/* Vikshoes live — black & metallic gold, sporty italic headings.
   Mobile-first; two columns on wide screens. #app follows the *visual*
   viewport so the input and newest messages stay visible with the keyboard open. */

@font-face {
  font-family: "Exo 2"; font-style: italic; font-weight: 700 900; font-display: swap;
  src: url(/static/fonts/exo2-italic-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Exo 2"; font-style: italic; font-weight: 700 900; font-display: swap;
  src: url(/static/fonts/exo2-italic-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Exo 2"; font-style: normal; font-weight: 500 800; font-display: swap;
  src: url(/static/fonts/exo2-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Exo 2"; font-style: normal; font-weight: 500 800; font-display: swap;
  src: url(/static/fonts/exo2-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #050505;
  --surface: #111111;
  --surface-2: #1a1a1a;
  --line: #262626;
  --text: #f5f5f4;
  --muted: #a8a29e;
  --gold: #e5ae32;
  --gold-hi: #fdd564;
  --gold-lo: #b9800e;
  --gold-ink: #1a1204;
  --gold-grad: linear-gradient(135deg, #fde58a 0%, #fdd564 18%, #e5ae32 52%, #b9800e 100%);
  --live: #ef4444;
  --ok: #22c55e;
  --radius: 16px;
  --display: "Exo 2", system-ui, sans-serif;
}

body.live-page { background: var(--bg); color: var(--text); overflow: hidden; }
.live-page :focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }

.app {
  position: fixed; left: 0; right: 0; top: 0;
  height: var(--vvh, 100dvh);
  transform: translateY(var(--vvtop, 0px));
  display: flex; flex-direction: column;
}

/* ------------------------------------------------------------ top bar */
.topbar {
  display: flex; align-items: center; gap: 0.5rem; flex: none;
  padding: calc(0.45rem + env(safe-area-inset-top)) 0.75rem 0.45rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0b0b0b, var(--bg));
}
.brand { display: flex; align-items: center; gap: 0.4rem; text-decoration: none; }
.brand-mark { height: 34px; width: auto; }
.brand-word { height: 20px; width: auto; }
.spacer { flex: 1; }
.icon-btn {
  min-height: 38px; min-width: 38px; padding: 0; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--gold-hi); font: 800 1rem var(--display);
}
.icon-btn:hover { border-color: var(--gold-lo); }
.conn-bar {
  flex: none; text-align: center; font-size: 0.85rem; padding: 0.3rem;
  background: #451a03; color: #fde68a;
}

/* ------------------------------------------------------------ layout */
.layout { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.stage-col { flex: none; display: flex; flex-direction: column; }
.chat-col { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

@media (min-width: 960px) {
  .layout {
    display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 1rem;
    padding: 1rem; max-width: 1440px; width: 100%; margin: 0 auto;
  }
  .stage-col { min-height: 0; overflow-y: auto; gap: 0.75rem; }
  .chat-col {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  }
  .stage { border-radius: var(--radius); max-height: none !important; }
  .pair { border-radius: var(--radius); border: 1px solid var(--line); }
}

/* ------------------------------------------------------------ video stage */
.stage {
  position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 44vh;
  background: #000; overflow: hidden; flex: none; transition: max-height 0.2s ease;
}
@media (min-width: 960px) { .stage { aspect-ratio: 16 / 9; } }
video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.stage-top { position: absolute; top: 0.6rem; left: 0.6rem; display: flex; gap: 0.4rem; z-index: 2; }
.live-pill, .viewers-pill {
  font: 800 0.78rem/1 var(--display); letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.38rem 0.6rem; border-radius: 6px; background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.live-pill.on { background: var(--live); color: #fff; }
.live-pill.on::before {
  content: ""; display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%;
  background: #fff; margin-right: 0.4rem; vertical-align: 0.05rem; animation: blink 1.4s infinite;
}
.viewers-pill { font-weight: 700; text-transform: none; }
.overlay {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem;
  padding: 1rem; text-align: center;
  background: radial-gradient(ellipse at center, #1a1406 0%, #050505 70%);
}
.overlay-logo { width: min(46%, 240px); height: auto; filter: drop-shadow(0 6px 24px rgba(229, 174, 50, 0.25)); }
.overlay-text { margin: 0; font: italic 800 clamp(0.95rem, 3.6vw, 1.25rem) var(--display); color: var(--text); }
.overlay.thin { background: rgba(0, 0, 0, 0.55); }
.overlay.thin .overlay-logo { display: none; }
.unmute {
  position: absolute; z-index: 3; right: 0.6rem; bottom: 0.6rem;
  display: inline-flex; align-items: center; gap: 0.45rem;
  min-height: 40px; padding: 0.45rem 1rem; border-radius: 999px;
  background: var(--gold-grad); color: var(--gold-ink); font: 800 0.95rem var(--display);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}
.unmute.on {
  padding: 0; min-width: 40px; justify-content: center;
  background: rgba(0, 0, 0, 0.6); color: #fff;
}
.unmute.on .unmute-label { display: none; }

/* ------------------------------------------------------------ current pair */
.pair {
  flex: none; background: var(--surface); padding: 0.7rem 0.9rem 0.75rem;
  border-bottom: 1px solid var(--line); position: relative;
}
.pair[data-phase="idle"] { display: none; }
.pair-id { display: flex; align-items: baseline; gap: 0.6rem; min-width: 0; }
.pair-kicker { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.pair-no {
  font: italic 900 1.5rem/1.1 var(--display);
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pair-desc { margin: 0.2rem 0 0; color: #e7e5e4; font-size: 0.95rem; }
.pair-desc:empty { display: none; }
.hint { margin: 0.45rem 0 0; font-size: 0.88rem; color: var(--muted); }
.hint:empty { display: none; }
.phase-banner {
  margin-top: 0.55rem; text-align: center;
  font: 800 0.95rem/1.25 var(--display); padding: 0.55rem 0.8rem; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.pair[data-phase="open"] { box-shadow: inset 0 0 0 2px var(--gold); }
.pair[data-phase="open"] .phase-banner {
  background: var(--gold-grad); color: var(--gold-ink); border: 0; animation: pulse 1.2s ease-in-out infinite;
}
.pair[data-phase="open"] .hint { color: var(--gold-hi); font-weight: 600; }
.pair[data-phase="paused"] .phase-banner { background: #431407; border-color: #9a3412; color: #fed7aa; }
.pair[data-phase="won"] .phase-banner, .pair[data-phase="mine"] .phase-banner {
  background: #1c1404; border-color: var(--gold-lo); color: var(--gold-hi);
}
.pair[data-phase="mine"] { box-shadow: inset 0 0 0 2px var(--gold-hi); }

.claim-chip {
  margin: 0.5rem 0.75rem 0; flex: none; min-height: 46px; border-radius: 12px;
  background: var(--gold-grad); color: var(--gold-ink); font: italic 900 1rem var(--display);
  box-shadow: 0 6px 24px rgba(229, 174, 50, 0.25);
}
.claim-chip.void { background: var(--surface-2); color: var(--muted); box-shadow: none; font-style: normal; font-weight: 700; }
@media (min-width: 960px) { .claim-chip { margin: 0; } }

/* ------------------------------------------------------------ how-to */
.howto {
  flex: none; margin: 0.5rem 0.75rem 0; padding: 0.55rem 0.7rem 0.65rem;
  border: 1px solid #3a2c0c; border-radius: 14px;
  background: linear-gradient(160deg, #17120a, #0d0d0d);
}
.howto-head { display: flex; align-items: center; justify-content: space-between; }
.howto-head strong { font: italic 800 1rem var(--display); color: var(--gold-hi); }
.link-btn { background: none; min-height: 32px; padding: 0 0.3rem; color: var(--muted); font-size: 0.85rem; text-decoration: underline; }
.steps {
  list-style: none; margin: 0.45rem 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; font-size: 0.78rem; line-height: 1.25;
}
.steps li { display: flex; flex-direction: column; gap: 0.3rem; align-items: flex-start; color: #e7e5e4; }
.step-n {
  flex: none; width: 1.4rem; height: 1.4rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold-grad); color: var(--gold-ink); font: 900 0.78rem var(--display);
}

/* ------------------------------------------------------------ chat */
.chat-wrap { position: relative; flex: 1 1 auto; min-height: 0; display: flex; }
.chat {
  list-style: none; margin: 0; padding: 0.6rem 0.75rem; flex: 1; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 0.45rem;
}
.chat li { display: flex; gap: 0.55rem; align-items: flex-start; overflow-wrap: anywhere; animation: rise 0.18s ease-out; }
.chat .av {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font: 800 0.75rem var(--display); color: #0a0a0a;
}
.chat .bubble { min-width: 0; line-height: 1.35; }
.chat .who { font-weight: 700; font-size: 0.82rem; margin-right: 0.35em; }
.chat .txt { color: #ecebea; }
.chat li.mine .who { color: var(--gold-hi); }
.chat li.mine .txt { color: #fff; }
.chat li.pending { opacity: 0.5; }
.chat li.failed .txt { color: var(--live); text-decoration: line-through; }
.chat li.system {
  align-self: center; justify-content: center; text-align: center;
  font-size: 0.76rem; color: #78716c; padding: 0.1rem 0.6rem; max-width: 92%;
}
.chat li.system.open {
  color: var(--gold-hi); font-weight: 700; font-size: 0.82rem;
  padding: 0.25rem 0.8rem; border-radius: 999px; border: 1px solid var(--gold-lo); background: #1a1405;
}
.chat li.system.win {
  background: var(--gold-grad); color: var(--gold-ink); border: 0;
  font: italic 900 0.92rem var(--display); padding: 0.4rem 0.9rem; border-radius: 999px;
}
.jump {
  position: absolute; left: 50%; bottom: 0.5rem; transform: translateX(-50%);
  min-height: 34px; padding: 0.3rem 0.9rem; border-radius: 999px; font-size: 0.82rem; font-weight: 700;
  background: var(--gold-grad); color: var(--gold-ink); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

/* ------------------------------------------------------------ composer */
.composer {
  flex: none; display: flex; align-items: center; gap: 0.45rem;
  padding: 0.55rem 0.75rem calc(0.55rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--bg);
}
@media (min-width: 960px) { .composer { background: var(--surface); } }
.composer input {
  font-size: 16px; /* avoids iOS zoom-on-focus */
  border-radius: 999px; padding: 0.6em 1em; background: var(--surface-2); border: 1px solid var(--line);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.composer input:focus { outline: none; border-color: var(--gold-lo); }
.app.answering .composer input { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(229, 174, 50, 0.22); }
.send {
  flex: none; width: 46px; min-height: 46px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; background: var(--gold-grad); color: var(--gold-ink);
}
.me-chip {
  flex: none; max-width: 30%; min-height: 36px; padding: 0 0.7rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: 0.8rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ------------------------------------------------------------ keyboard open (phones) */
.app.kb .topbar, .app.kb .howto, .app.kb .hint, .app.kb .pair-desc, .app.kb .claim-chip, .app.kb .unmute, .app.kb .stage-top { display: none; }
.app.kb .stage { max-height: 22vh; }
.app.kb .overlay-logo { display: none; }
.app.kb .pair { padding: 0.4rem 0.75rem; }
.app.kb .pair-kicker { display: none; }
.app.kb .phase-banner { margin-top: 0.3rem; padding: 0.3rem 0.6rem; font-size: 0.85rem; }
.app.kb .pair-no { font-size: 1.1rem; }
.app.kb .me-chip { display: none; }

/* ------------------------------------------------------------ dialogs */
dialog {
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: 20px; width: min(92vw, 420px); padding: 1.25rem;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(3px); }
.sheet { text-align: center; }
.sheet h2 { margin: 0.4rem 0 0.2rem; font: italic 900 1.4rem var(--display); }
.sheet .muted { margin: 0 0 0.9rem; font-size: 0.9rem; }
.sheet input { text-align: center; font-size: 1.05rem; border-radius: 12px; }
.sheet .row { display: flex; gap: 0.5rem; margin-top: 0.9rem; }
.sheet .row > * { flex: 1; }
.sheet-logo { height: 44px; width: auto; }
.btn-gold { background: var(--gold-grad); color: var(--gold-ink); font: 800 1rem var(--display); border-radius: 12px; }
.btn-ghost { background: transparent; border: 1px solid var(--line); border-radius: 12px; color: var(--text); }
.btn-ghost.wide { width: 100%; margin-top: 0.6rem; }

/* Winner card: designed to look good in a screenshot sent over Viber. */
.claim-dialog { padding: 0.75rem; background: transparent; border: 0; width: min(94vw, 400px); }
.claim-card {
  position: relative; overflow: hidden; text-align: center; color: var(--text);
  border-radius: 22px; padding: 1.3rem 1.1rem 1.2rem;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(253, 213, 100, 0.25), transparent 60%),
    linear-gradient(180deg, #141008, #070707);
  border: 2px solid transparent;
  background-clip: padding-box;
  box-shadow: 0 0 0 2px var(--gold), 0 20px 60px rgba(0, 0, 0, 0.6);
}
.claim-card .cc-logo { width: 150px; height: auto; margin: 0 auto 0.2rem; display: block; }
.claim-card .cc-title {
  font: italic 900 2.1rem/1 var(--display); letter-spacing: 0.02em; margin: 0.2rem 0 0.6rem;
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.claim-card .cc-pair { font: italic 800 1.25rem var(--display); }
.claim-card .cc-desc { color: #d6d3d1; font-size: 0.92rem; margin-top: 0.15rem; }
.claim-card .cc-price { font: italic 900 2rem var(--display); color: var(--gold-hi); margin: 0.4rem 0 0.2rem; }
.claim-card .cc-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; margin-top: 0.5rem; }
.claim-card .code {
  font: 800 2.3rem/1 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: 0.18em;
  margin: 0.35rem auto 0.6rem; padding: 0.55rem 0.4rem 0.55rem 0.6rem; border-radius: 12px;
  background: var(--gold-grad); color: var(--gold-ink); width: fit-content; min-width: 70%;
}
.claim-card .cc-meta { font-size: 0.85rem; color: #d6d3d1; }
.claim-card .cc-steps {
  margin: 0.8rem 0 0; padding: 0.6rem 0.7rem; border-radius: 12px; background: rgba(255, 255, 255, 0.05);
  font-size: 0.88rem; text-align: left; display: grid; gap: 0.25rem;
}
.claim-card.void { box-shadow: 0 0 0 2px #3f3f46, 0 20px 60px rgba(0, 0, 0, 0.6); background: #111; }
.claim-card.void .cc-title { background: none; color: var(--muted); font-size: 1.5rem; }

/* ------------------------------------------------------------ toast + confetti */
.toast {
  background: #1c1404; border: 1px solid var(--gold-lo); color: var(--text);
  border-radius: 14px; bottom: calc(5rem + env(safe-area-inset-bottom)); z-index: 50; font-size: 0.92rem;
}
.toast.error { background: #2a0a0a; border-color: var(--live); }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

@keyframes blink { 50% { opacity: 0.25; } }
@keyframes pulse { 50% { box-shadow: 0 0 22px rgba(229, 174, 50, 0.55); filter: brightness(1.08); } }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
