/* Benzin Extra Bold — коммерческий шрифт, не из Google Fonts. Положи файл
   static/fonts/Benzin-ExtraBold.woff2 (и при желании .woff), и заголовки
   подхватят его. Без файла используется запасной шрифт. */
@font-face {
  font-family: "Benzin";
  src: url("/static/fonts/Benzin-ExtraBold.woff2") format("woff2"),
       url("/static/fonts/Benzin-ExtraBold.woff") format("woff");
  font-weight: 800;
  font-display: swap;
}

:root {
  --bg: #141414;
  --bg-soft: #1b1b1b;
  --panel: #1e1e1e;
  --panel-hover: #262626;
  --border: #2f2f2f;
  --grid-line: rgba(255, 255, 255, .045);
  --text: #e8e6e2;
  --muted: #8a8a8a;
  --accent: #f0a818;
  --accent-soft: #f7be4d;
  --danger: #e0664a;
  --btn-text: #16121c;
  --shadow: rgba(0, 0, 0, .85);
  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

[data-theme="light"] {
  --bg: #f1efea;
  --bg-soft: #e7e4dd;
  --panel: #fbfaf7;
  --panel-hover: #f0ede6;
  --border: #d9d4c9;
  --grid-line: rgba(0, 0, 0, .055);
  --text: #26241f;
  --muted: #848075;
  --accent: #df9606;
  --accent-soft: #c08105;
  --danger: #c44f31;
  --btn-text: #fffdf8;
  --shadow: rgba(60, 50, 30, .25);
}

body, .bg-grid, .btn, .cs-trigger, .cs-list, .avatar-menu,
.settings-card, .feature, .side-item, .sidebar {
  transition-property: background, background-color, border-color, color,
    box-shadow, transform, opacity;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Montserrat", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

/* --- background grid, fading toward the edges --- */

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(ellipse 70% 65% at 50% 45%,
      #000 0%, rgba(0,0,0,.55) 55%, transparent 100%);
  mask-image: radial-gradient(ellipse 70% 65% at 50% 45%,
      #000 0%, rgba(0,0,0,.55) 55%, transparent 100%);
}

h1, h2 {
  font-family: "Benzin", "Montserrat", system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: .5px;
}

/* --- layout --- */

.view {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 28px 72px;
}

/* --- buttons --- */

.btn {
  display: inline-block;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 28px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: var(--btn-text);
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: background .3s var(--ease), transform .3s var(--ease),
              box-shadow .3s var(--ease), color .3s var(--ease);
}

.btn:hover {
  background: var(--accent-soft);
  transform: translateY(-2px);
  box-shadow: 0 10px 34px -10px var(--accent);
}

.btn:active { transform: translateY(0); }

.btn-quiet {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
  box-shadow: none;
}

.btn-quiet:hover {
  background: var(--panel-hover);
  color: var(--text);
  box-shadow: none;
  transform: translateY(-2px);
}

.btn-lg { padding: 17px 44px; font-size: 17px; }

.btn-sm { padding: 9px 22px; font-size: 14px; }

/* fixed login / dashboard button, top-right of the landing page */
.corner {
  position: fixed;
  top: 22px;
  right: 28px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn:disabled { opacity: .45; cursor: default; box-shadow: none; transform: none; }

.back-link {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 22px;
  transition: color .25s var(--ease);
}

.back-link:hover { color: var(--accent); }

/* --- landing: screen 1 (hero) --- */

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 0;
  /* nudge the whole block down by ~the height of the lowercase "m" */
  transform: translateY(clamp(40px, 6.5vw, 70px));
}

.hero h1 {
  font-size: clamp(56px, 9vw, 96px);
  line-height: 1.02;
  margin-bottom: 26px;
}

.hero h1 .accent { color: var(--accent); }

.hero-lead {
  color: var(--muted);
  font-size: 19px;
  max-width: 640px;
  margin: 0 auto 40px;
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 26px;
  margin-bottom: 44px;
  line-height: 1;
}

.stat-badge .num {
  font-family: "Benzin", "Montserrat", sans-serif;
  font-weight: 800;
  font-size: 26px;
  color: var(--accent);
}

.stat-badge .lbl { color: var(--muted); font-size: 15px; }

.hero-note { color: var(--muted); font-size: 13px; margin-top: 16px; }

.scroll-hint {
  margin-top: 56px;
  color: var(--muted);
  font-size: 22px;
  text-decoration: none;
  animation: float 2.2s var(--ease) infinite;
  transition: color .25s var(--ease);
}

.scroll-hint:hover { color: var(--accent); }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

/* --- landing: screen 2 (features) --- */

.features-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 72px 0;
}

.features-screen > h2 {
  font-size: clamp(30px, 4.5vw, 44px);
  text-align: center;
  margin-bottom: 56px;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 26px;
}

.feature {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px 30px;
  transition: transform .45s var(--ease), border-color .45s var(--ease),
              background .45s var(--ease), box-shadow .45s var(--ease);
}

.feature:hover {
  transform: rotate(1deg) scale(1.12);
  border-color: var(--accent);
  background: var(--panel-hover);
  box-shadow: 0 18px 60px -18px rgba(240, 168, 24, .45);
  z-index: 2;
  position: relative;
}

.feature h2 {
  font-size: 19px;
  margin-bottom: 12px;
  color: var(--text);
  transition: color .45s var(--ease);
}

.feature:hover h2 { color: var(--accent); }

.feature p { color: var(--muted); font-size: 14px; }

/* --- dashboard (logged in) --- */

/* fixed at the top-left, directly above the sidebar */
.dash-top {
  position: fixed;
  top: 26px;
  left: 28px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0;
}

.dash-brand {
  font-family: "Benzin", "Montserrat", sans-serif;
  font-weight: 800;
  font-size: 24px;
  color: var(--accent);
  text-decoration: none;
}

/* avatar menu (fixed corner) */
.avatar-wrap { position: relative; }

.avatar-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-family: "Benzin", sans-serif;
  font-weight: 800;
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .25s var(--ease), transform .25s var(--ease);
}

.avatar-btn:hover { border-color: var(--accent); transform: scale(1.05); }

.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }

.avatar-wrap.open .avatar-btn { border-color: var(--accent); }

.avatar-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 170px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  box-shadow: 0 20px 56px -22px var(--shadow);
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}

.avatar-wrap.open .avatar-menu { opacity: 1; transform: translateY(0); pointer-events: auto; }

.avatar-menu-name {
  padding: 8px 14px 10px;
  color: var(--muted);
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-menu-item {
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  padding: 11px 14px;
  border: none;
  background: none;
  border-radius: 9px;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s var(--ease), color .15s var(--ease);
}

.avatar-menu-item:hover { background: var(--panel-hover); color: var(--accent); }

.avatar-menu-item.danger { color: var(--danger); }

.avatar-menu-item.danger:hover {
  background: rgba(224, 102, 74, .12);
  color: var(--danger);
}

.page-title { font-size: 34px; margin-bottom: 8px; }

.subtitle { color: var(--muted); margin-bottom: 32px; font-size: 15px; }

/* --- guild list --- */

.guild-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guild-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  text-decoration: none;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background .3s var(--ease), border-color .3s var(--ease),
              transform .3s var(--ease);
}

.guild-row:hover {
  background: var(--panel-hover);
  border-color: var(--accent);
  transform: translateX(6px);
}

.guild-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: "Benzin", sans-serif;
  font-weight: 800;
  font-size: 18px;
}

.guild-icon img { width: 100%; height: 100%; object-fit: cover; }

.guild-name {
  flex: 1;
  font-size: 17px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guild-status {
  font-size: 13px;
  padding: 7px 16px;
  border-radius: 999px;
}

.guild-status.on { color: var(--accent); background: rgba(240, 168, 24, .12); }

.guild-status.off { color: var(--muted); background: var(--bg-soft); }

/* --- settings form --- */

.guild-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 10px;
}

.guild-header .guild-icon { width: 56px; height: 56px; }

.guild-header .page-title { margin-bottom: 0; }

.settings-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px;
  margin-top: 10px;
}

.field { margin-bottom: 28px; }

.field:last-of-type { margin-bottom: 0; }

.field label {
  display: block;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 10px;
}

.field .hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}

input[type="number"] {
  font-family: inherit;
  font-size: 15px;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .3s var(--ease);
}

input[type="number"]:focus { border-color: var(--accent); }

/* --- custom dropdown --- */

.cs { position: relative; }

.cs-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: inherit;
  font-size: 15px;
  padding: 14px 16px;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: border-color .25s var(--ease), background .25s var(--ease);
}

.cs-trigger:hover { border-color: var(--accent); }

.cs.open .cs-trigger { border-color: var(--accent); background: var(--panel); }

.cs-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cs-arrow {
  color: var(--muted);
  font-size: 12px;
  flex-shrink: 0;
  transition: transform .25s var(--ease), color .25s var(--ease);
}

.cs.open .cs-arrow { transform: rotate(180deg); color: var(--accent); }

.cs-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px;
  max-height: 280px;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  box-shadow: 0 20px 56px -22px var(--shadow);
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}

.cs.open .cs-list { opacity: 1; transform: translateY(0); pointer-events: auto; }

.cs-option {
  padding: 11px 14px;
  border-radius: 9px;
  cursor: pointer;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background .15s var(--ease), color .15s var(--ease);
}

.cs-option:hover { background: var(--panel-hover); }

.cs-option.selected { color: var(--accent); background: rgba(240, 168, 24, .1); }

/* scrollbar inside the dropdown */
.cs-list::-webkit-scrollbar { width: 8px; }
.cs-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

/* fixed save bar, bottom-left of the viewport */
.save-bar {
  position: fixed;
  left: 28px;
  bottom: 28px;
  z-index: 30;
  display: flex;
  flex-direction: row;
  align-items: center; /* button fixed; note sits to its right */
  gap: 16px;
}

.save-bar .btn { transition: box-shadow .3s var(--ease), transform .3s var(--ease), background .3s var(--ease); }

/* button "lights up" while there are unsaved changes — glow centred under it */
.save-bar.dirty .btn {
  animation: savepulse 1.7s var(--ease) infinite;
}

@keyframes savepulse {
  0%, 100% { box-shadow: 0 0 22px 0 rgba(240, 168, 24, .45); }
  50% { box-shadow: 0 0 40px 4px rgba(240, 168, 24, .65); }
}

.save-note {
  font-family: "Montserrat", system-ui, sans-serif;
  font-size: 13px;
  white-space: nowrap;
  /* opacity is driven by the .show class so text can crossfade between
     states (unsaved -> saved) instead of swapping abruptly */
  opacity: 0;
  transform: translateX(10px);
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}

.save-note.show {
  opacity: 1;
  transform: translateX(0);
}

/* white hint (dark text in light theme so it stays readable) */
.save-note.unsaved { color: #ffffff; font-weight: 400; }

[data-theme="light"] .save-note.unsaved { color: var(--text); }

.save-note.ok { color: var(--accent); }

.save-note.error { color: var(--danger); }

/* --- misc --- */

.notice {
  color: var(--muted);
  padding: 60px 0;
  text-align: center;
}

.notice.error { color: var(--danger); }

/* --- theme toggle --- */

.theme-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .25s var(--ease), color .25s var(--ease),
              transform .25s var(--ease);
}

.theme-btn:hover { border-color: var(--accent); color: var(--accent); transform: scale(1.05); }

/* --- dashboard layout with sidebar --- */

.dash-layout {
  display: block;
  padding-top: 88px; /* room for the fixed top bar */
}

/* fixed panel on the left; doesn't move with the page scroll */
.sidebar {
  position: fixed;
  top: 92px;
  left: 28px;
  z-index: 9;
  width: 270px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  transition: opacity .35s var(--ease), transform .35s var(--ease),
              border-color .35s var(--ease);
}

.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

.dash-layout.collapsed .sidebar {
  opacity: 0;
  transform: translateX(-24px);
  pointer-events: none;
}

.side-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 4px 12px 12px;
  white-space: nowrap;
}

.side-list { display: flex; flex-direction: column; gap: 5px; }

.side-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  border: 1px solid transparent;
  transition: background .25s var(--ease), border-color .25s var(--ease);
  min-width: 0;
}

.side-item:hover { background: var(--panel-hover); }

.side-item.active {
  border-color: var(--accent);
  background: rgba(240, 168, 24, .1);
}

.side-item.active .side-name { color: var(--accent); }

.side-icon { width: 38px; height: 38px; font-size: 15px; }

.side-meta { display: flex; flex-direction: column; min-width: 0; }

.side-name {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color .25s var(--ease);
}

.side-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.side-sub.on { color: var(--accent); }

.side-empty { color: var(--muted); font-size: 13px; padding: 8px 12px; }

.side-toggle {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 17px;
  cursor: pointer;
  transition: border-color .25s var(--ease), color .25s var(--ease);
}

.side-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* centered settings column; the sidebar floats over the left edge */
.dash-main {
  min-width: 0;
  max-width: 640px;
  margin: 0 auto;
}

/* --- settings extras --- */

.settings-card + .settings-card { margin-top: 18px; }

.card-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
  margin-bottom: 22px;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.field-row label { margin-bottom: 6px; }

.field-row .hint { margin-top: 0; }

/* on/off switch */
.switch {
  width: 54px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  cursor: pointer;
  position: relative;
  transition: background .3s var(--ease), border-color .3s var(--ease);
}

.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .3s var(--ease), background .3s var(--ease);
}

.switch.on { background: rgba(240, 168, 24, .18); border-color: var(--accent); }

.switch.on .switch-knob { transform: translateX(24px); background: var(--accent); }
