/* tokens.css — общий язык интерфейса StickWorks для отдельных страниц (Диск и др.).
   Это ТА ЖЕ премиум-тема, что у основного сайта (см. «премиум-слой» в index.html):
   те же цвета, тонкие линии вместо рамок, стекло, красное свечение акцента, шрифт
   с засечками. Акцент и шрифт берутся из настроек внешнего вида сайта (sw_look_v1) —
   их выставляет скрипт в <head> страницы. Тема переключается атрибутом data-theme. */

:root {
  --red: #fa1e1e;
  --font: Georgia, 'Times New Roman', serif;
  --display: Georgia, 'Times New Roman', serif;
  --mono: ui-monospace, "JetBrains Mono", Consolas, monospace;

  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #f1ede6;
  --surface-3: #e7e1d7;
  --line: rgba(18, 16, 15, .09);
  --line-strong: rgba(18, 16, 15, .16);
  --text: #12100f;
  --muted: #57524b;
  --glass: rgba(246, 243, 238, .72);
  --hi: rgba(255, 255, 255, .85);

  --accent: var(--red);
  --accent-hover: color-mix(in srgb, var(--red) 86%, #000);
  --accent-soft: color-mix(in srgb, var(--red) 11%, transparent);
  --on-accent: #ffffff;
  --ok: #1f8a4c;
  --warn: #b26a00;

  --shadow: 0 1px 2px rgba(18, 16, 15, .05), 0 6px 18px -8px rgba(18, 16, 15, .14);
  --shadow-lg: 0 2px 6px rgba(18, 16, 15, .06), 0 22px 44px -18px rgba(18, 16, 15, .28);
  --glow: 0 10px 28px -10px color-mix(in srgb, var(--red) 70%, transparent);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --radius: 22px;
  --radius-sm: 12px;
}

[data-theme="dark"] {
  --bg: #0d0c0c;
  --surface: #161414;
  --surface-2: #1d1a1a;
  --surface-3: #262221;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .15);
  --text: #f0ece6;
  --muted: #b3aca3;
  --glass: rgba(13, 12, 12, .66);
  --hi: rgba(255, 255, 255, .18);
  --ok: #4cc287;
  --warn: #e6b04f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px -10px rgba(0, 0, 0, .6);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, .5), 0 26px 50px -18px rgba(0, 0, 0, .75);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background-color: var(--bg);
  /* как у сайта: мягкое тёплое свечение акцента сверху вместо тетрадной линовки */
  background-image:
    radial-gradient(1100px 520px at 12% -12%, color-mix(in srgb, var(--red) 10%, transparent), transparent 70%),
    radial-gradient(900px 480px at 100% 0%, color-mix(in srgb, var(--red) 5%, transparent), transparent 65%);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--display); }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.fill { fill: currentColor; stroke: none; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--red) 70%, transparent); outline-offset: 3px; border-radius: 8px; }
::selection { background: var(--accent-soft); }

/* кнопки — как в премиум-слое сайта: мягкий градиент, свечение, «подъём» при наведении */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 20px; border-radius: 12px; border: 1px solid transparent;
  background: linear-gradient(180deg, color-mix(in srgb, var(--red) 88%, #fff) 0%, var(--red) 100%);
  color: var(--on-accent); font-weight: 700; letter-spacing: -.005em; text-decoration: none;
  box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, .22);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s, filter .2s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.04); box-shadow: 0 14px 32px -12px color-mix(in srgb, var(--red) 75%, transparent), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.soft { background: var(--surface); color: var(--text); border-color: var(--line-strong); box-shadow: var(--shadow); }
.btn.soft:hover { box-shadow: var(--shadow-lg); filter: none; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: none; }
.btn.ghost:hover { background: color-mix(in srgb, var(--text) 7%, transparent); box-shadow: none; filter: none; transform: none; }
.btn.danger { background: transparent; color: var(--accent); border-color: var(--line-strong); box-shadow: none; }
.btn.danger:hover { background: var(--accent-soft); filter: none; box-shadow: none; }
.btn.sm { height: 34px; padding: 0 14px; font-size: 14px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 0; background: transparent; color: var(--muted); transition: background .2s, color .2s;
}
.icon-btn:hover { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); }
.icon-btn.on { color: var(--accent); }

.field {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .04); transition: border-color .2s, box-shadow .2s;
}
.field:focus { border-color: color-mix(in srgb, var(--red) 60%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 14%, transparent); }
select.field { padding-right: 8px; }

.overlay {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: rgba(10, 9, 9, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fade .2s ease-out;
}
.dialog {
  width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: 28px; box-shadow: var(--shadow-lg); animation: pop .26s var(--ease);
}
.dialog h2 { margin: 0 0 14px; font-size: 24px; letter-spacing: -.02em; font-weight: 800; }
.dialog .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.dialog p { margin: 0 0 10px; color: var(--muted); }
.dialog label { display: block; font-size: 13.5px; color: var(--muted); margin: 14px 0 6px; }

.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  background: var(--text); color: var(--bg); padding: 11px 20px; border-radius: 14px; font-size: 15px;
  box-shadow: var(--shadow-lg); animation: pop .22s var(--ease); max-width: 90vw;
}
.toast.err { background: var(--red); color: var(--on-accent); }

/* ── стеклянные переключатели (как в настройках Антона, только «жидкое стекло») ── */

/* выключатель: стеклянная дорожка и шарик; во включённом — акцентное свечение */
.gsw {
  position: relative; display: inline-flex; align-items: center; flex: none; width: 58px; height: 32px; padding: 0; border-radius: 999px;
  border: 1px solid var(--line-strong); cursor: pointer;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-3) 70%, transparent), color-mix(in srgb, var(--surface-2) 70%, transparent));
  -webkit-backdrop-filter: blur(10px) saturate(150%); backdrop-filter: blur(10px) saturate(150%);
  box-shadow: inset 0 1px 0 var(--hi), inset 0 -2px 4px rgba(0, 0, 0, .07), 0 1px 2px rgba(0, 0, 0, .06);
  transition: background .3s var(--ease), box-shadow .3s var(--ease), border-color .3s;
}
.gsw::after { /* шарик */
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(180deg, #fff, color-mix(in srgb, #fff 82%, var(--surface-3)));
  box-shadow: 0 2px 6px rgba(0, 0, 0, .28), inset 0 1px 0 #fff, inset 0 -1px 2px rgba(0, 0, 0, .12);
  transition: transform .32s var(--ease);
}
.gsw:active::after { width: 28px; }
.gsw.on, .gsw[aria-checked="true"] {
  background: linear-gradient(180deg, color-mix(in srgb, var(--red) 82%, #fff), var(--red));
  border-color: color-mix(in srgb, var(--red) 70%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -2px 4px rgba(0, 0, 0, .12), var(--glow);
}
.gsw.on::after, .gsw[aria-checked="true"]::after { transform: translateX(26px); }
.gsw.on:active::after, .gsw[aria-checked="true"]:active::after { transform: translateX(22px); }
.gsw svg { position: absolute; top: 8px; width: 16px; height: 16px; z-index: 1; pointer-events: none; transition: opacity .25s, color .25s; }
/* значок едет на шарике: солнце в светлой теме, луна в тёмной */
.gsw .gsw-l { left: 8px; color: #e49a00; }
.gsw .gsw-r { right: 8px; color: #4a4466; opacity: 0; }
[data-theme="dark"] .gsw .gsw-l { opacity: 0; } [data-theme="dark"] .gsw .gsw-r { opacity: 1; }

/* сегмент: стеклянная рамка, активная кнопка приподнята (как вкладки настроек Антона) */
.seg {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: 14px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 75%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .05);
}
.seg button {
  display: inline-grid; place-items: center; min-width: 38px; height: 34px; padding: 0 12px; border: 0; border-radius: 11px; background: transparent; color: var(--muted);
  transition: background .25s var(--ease), color .2s, box-shadow .25s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button.is-on { background: var(--surface); color: var(--red); box-shadow: var(--shadow), inset 0 1px 0 var(--hi); }

/* пилюля-выбор (срок ссылки и т.п.): стекло, активная — с красным тоном */
.gchips { display: flex; flex-wrap: wrap; gap: 8px; }
.gchip {
  height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); font-size: 14px; font-weight: 600;
  background: color-mix(in srgb, var(--surface-2) 70%, transparent); color: var(--muted);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: inset 0 1px 0 var(--hi);
  transition: background .2s, color .2s, border-color .2s, box-shadow .2s;
}
.gchip:hover { color: var(--text); border-color: var(--line-strong); }
.gchip.is-on { background: color-mix(in srgb, var(--red) 14%, var(--surface)); color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); box-shadow: inset 0 1px 0 var(--hi), 0 6px 16px -8px color-mix(in srgb, var(--red) 70%, transparent); }

/* строка настройки: подпись слева, переключатель справа */
.setrow { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.setrow > span { flex: 1; min-width: 0; }
.setrow b { display: block; font-weight: 700; }
.setrow small { color: var(--muted); font-size: 13.5px; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* без синей подсветки при нажатии; рамка только при переходе с клавиатуры */
a, button, [role="switch"] { -webkit-tap-highlight-color: transparent; }
a:focus:not(:focus-visible), button:focus:not(:focus-visible) { outline: none; }
a:focus-visible, button:focus-visible { outline: 2px solid color-mix(in srgb, var(--red) 70%, transparent); outline-offset: 3px; }
