:root {
  --bg: #0b0b0f;
  --bg-2: #14141a;
  --paper: #17171e;
  --ink: #f3f1ea;
  --muted: #8b8a93;
  --line: rgba(243, 241, 234, 0.12);
  --lime: #c8ff2e;
  --lime-ink: #0b0b0f;
  --pink: #ff3ea5;
  --violet: #8b6cff;
  --warn: #ff5a5a;
  --good: #c8ff2e;
  --radius: 16px;
  --display: "Unbounded", "Arial Black", sans-serif;
  --sans: "Onest", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(60vw 40vw at 85% -10%, rgba(139, 108, 255, 0.22), transparent 60%),
    radial-gradient(50vw 35vw at -10% 110%, rgba(255, 62, 165, 0.14), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: var(--pink); color: #fff; }
.mono { font-family: var(--mono); letter-spacing: -0.01em; }
.small { font-size: 12px; line-height: 1.5; }
.muted { color: var(--muted); }
mark { background: var(--lime); color: var(--lime-ink); padding: 0 3px; }

/* --- бегущая строка --- */
.marquee {
  overflow: hidden;
  background: var(--lime);
  color: var(--lime-ink);
  font-family: var(--display);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border-bottom: 2px solid var(--bg);
}
.marquee-track { display: inline-flex; gap: 18px; padding: 8px 0; animation: marquee 28s linear infinite; }
.marquee i { font-style: normal; color: var(--pink); }
@keyframes marquee { to { transform: translateX(-50%); } }

.page {
  max-width: 1280px;
  margin: 0 auto;
  min-height: calc(100vh - 34px);
  min-height: calc(100dvh - 34px);
  display: flex;
  flex-direction: column;
  padding: 22px clamp(16px, 4vw, 48px) 20px;
}
main { flex: 1; display: flex; flex-direction: column; }

/* --- шапка --- */
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.logo {
  text-decoration: none;
  font-family: var(--display);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.logo-dot { color: var(--lime); }
.nav { display: flex; gap: clamp(16px, 4vw, 40px); }
.nav button {
  background: none; border: 0; padding: 4px 0; cursor: pointer;
  font-size: 12px; text-transform: uppercase; color: var(--muted);
}
.nav button:hover { color: var(--ink); }

/* --- слово --- */
.stage {
  position: relative;
  margin: clamp(28px, 7vh, 72px) 0 clamp(20px, 4vh, 40px);
  min-height: 1em;
}
.word {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.04em;
  white-space: nowrap;
  font-size: 200px; /* JS подгоняет под ширину */
  text-transform: uppercase;
  color: var(--ink);
}
.word span {
  display: inline-block; padding-right: 0.04em;
  background: linear-gradient(180deg, #ffffff 0%, #ffffff 55%, #c9c4de 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.word.swap span { animation: swap 0.7s cubic-bezier(.2,.9,.2,1); }
@keyframes swap {
  0% { opacity: 0; transform: translateY(25%) skewY(6deg); filter: blur(10px); }
  60% { filter: blur(0); }
  100% { opacity: 1; transform: none; }
}
.sticker {
  position: absolute;
  right: 0;
  top: -6%;
  background: var(--pink);
  color: #fff;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(10px, 1.2vw, 13px);
  line-height: 1.05;
  text-transform: uppercase;
  text-align: center;
  padding: 9px 12px;
  border-radius: 999px;
  transform: rotate(12deg);
  box-shadow: 0 6px 24px -6px rgba(255, 62, 165, .7);
  pointer-events: none;
  animation: wobble 3.5s ease-in-out infinite;
}
@keyframes wobble { 50% { transform: rotate(4deg) scale(1.06); } }

/* --- действие --- */
.action {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 24px; flex-wrap: wrap;
  margin-bottom: clamp(24px, 5vh, 48px);
}
.owner { margin: 0; font-size: 13px; line-height: 1.6; color: var(--muted); }
.owner b { font-weight: 600; color: var(--ink); }
.mine {
  margin-left: 8px; background: var(--violet); color: #fff;
  padding: 1px 8px; border-radius: 999px; font-weight: 600; font-size: 11px;
}
.held { display: block; }
.cta-wrap { display: flex; flex-direction: column; gap: 10px; min-width: min(360px, 100%); max-width: 420px; }
.cta-wrap .small { margin: 0 0 0 4px; }

.cta {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 40px;
  background: var(--lime); color: var(--lime-ink);
  border: 0; border-radius: 14px;
  padding: 16px 20px;
  font-family: var(--display); font-weight: 800; font-size: 17px; letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .2s ease, opacity .12s;
  box-shadow: 0 0 0 0 rgba(200, 255, 46, 0), 0 10px 30px -12px rgba(200, 255, 46, .6);
}
.cta:hover:not(:disabled) { transform: translateY(-2px) rotate(-0.6deg); box-shadow: 0 0 0 4px rgba(200, 255, 46, .18), 0 16px 40px -12px rgba(200, 255, 46, .8); }
.cta:active:not(:disabled) { transform: translateY(0) scale(.98); }
.cta:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }
.cta:focus-visible { outline: 2px solid var(--pink); outline-offset: 3px; }
.cta .arrow { font-family: var(--sans); font-weight: 700; font-size: 22px; transition: transform .15s; }
.cta:hover:not(:disabled) .arrow { transform: translateX(4px); }
.cta-full { width: 100%; }

/* --- статистика --- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px;
  min-width: 0;
}
.stat b {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(18px, 2.2vw, 26px); letter-spacing: -0.03em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.stat:nth-child(2) b { color: var(--lime); }
.stat span { font-size: 11px; color: var(--muted); }

/* --- лента --- */
.ticker {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 0;
  min-width: 0;
}
.ticker-link {
  background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap;
  font-size: 11px; text-transform: uppercase; font-weight: 600; color: var(--muted);
}
.ticker-link:hover { color: var(--ink); }
.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  mask-image: linear-gradient(90deg, #000 85%, transparent);
  min-width: 0;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 10px;
  white-space: nowrap;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-family: var(--mono); font-size: 11px;
}
.chip b { font-family: var(--display); font-weight: 800; font-size: 12px; letter-spacing: -0.01em; }
.chip .now { background: var(--lime); color: var(--lime-ink); padding: 1px 8px; border-radius: 999px; font-weight: 600; }
.chip.removed b { color: var(--muted); font-weight: 600; text-decoration: line-through; }

/* --- подвал --- */
.foot {
  display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: center;
  padding-top: 16px; border-top: 1px solid var(--line);
}
.foot a { text-underline-offset: 3px; }
.foot .age { border: 1px solid var(--muted); border-radius: 6px; padding: 0 5px; }

/* --- диалоги --- */
.dlg {
  border: 1px solid var(--line); padding: 0; border-radius: 22px;
  background: var(--bg-2); color: var(--ink);
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.8), 0 0 0 1px rgba(139,108,255,.15);
}
.dlg-wide { width: min(760px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(5, 5, 8, .7); backdrop-filter: blur(6px); }
.dlg[open] { animation: pop .25s cubic-bezier(.2,.9,.2,1); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.dlg-body { padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 14px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; }
.dlg h2 { margin: 0; font-family: var(--display); font-weight: 900; font-size: 24px; letter-spacing: -0.03em; text-transform: uppercase; }
.x { background: none; border: 0; font-size: 28px; line-height: 1; cursor: pointer; padding: 0 4px; color: var(--muted); }
.x:hover { color: var(--ink); }

.word-input {
  width: 100%;
  font-family: var(--display); font-weight: 900; font-size: clamp(26px, 7vw, 40px);
  letter-spacing: -0.03em; text-transform: uppercase;
  background: var(--bg); color: var(--ink);
  border: 2px solid var(--line); border-radius: 14px;
  padding: 12px 16px;
  outline: none;
  transition: border-color .15s;
}
.word-input::placeholder { color: #3a3a44; }
.word-input:focus { border-color: var(--violet); }
.word-input.bad { border-color: var(--warn); }
.word-input.good { border-color: var(--lime); }
.hint { margin: -6px 0 0 2px; color: var(--muted); min-height: 1.5em; }
.hint.bad { color: var(--warn); }
.hint.good { color: var(--good); }
.warn { color: var(--warn); margin: -6px 0 0; }

.pay-row { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); padding-top: 12px; }
.pay-row b { font-family: var(--display); font-size: 28px; font-weight: 900; letter-spacing: -0.03em; color: var(--lime); }

.agree { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.45; cursor: pointer; color: #cfcdd6; }
.agree input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--lime); flex-shrink: 0; }
.fine { margin: 0; }

.rules { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.5; color: #dddbe3; }
.rules li::marker { color: var(--lime); font-family: var(--mono); }

.table-wrap { overflow: auto; max-height: 60vh; }
.hist { width: 100%; border-collapse: collapse; font-size: 14px; }
.hist th { text-align: left; font-weight: 400; padding: 6px 8px; position: sticky; top: 0; background: var(--bg-2); }
.hist td { padding: 9px 8px; border-top: 1px solid var(--line); white-space: nowrap; }
.hist td:nth-child(2) { font-family: var(--display); font-weight: 800; letter-spacing: -0.01em; white-space: normal; }
.hist td.removed { color: var(--muted); font-family: var(--sans); font-weight: 400; font-style: italic; }
.hist .num { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* --- уведомление --- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line);
  padding: 14px 18px; border-radius: 14px;
  font-size: 14px; line-height: 1.4;
  max-width: calc(100vw - 32px); width: max-content;
  box-shadow: 0 20px 50px -15px rgba(0,0,0,.8);
  z-index: 10;
  animation: pop .25s ease;
}
.toast.ok { background: var(--lime); color: var(--lime-ink); border-color: transparent; font-weight: 500; }

/* --- мобильные --- */
@media (max-width: 720px) {
  .page { padding-top: 16px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .action { flex-direction: column; align-items: stretch; }
  .cta-wrap { max-width: none; }
  .cta { width: 100%; }
  .ticker { flex-direction: column; align-items: flex-start; gap: 10px; }
  .chips { width: 100%; }
  .sticker { top: -22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
