:root {
  --bg: #0d0b07;
  --panel: #16130c;
  --panel-2: #1d1910;
  --border: #2b2517;
  --text: #f2ead8;
  --muted: #9b8f74;
  --red: #ff3b3b;
  --green: #2fd575;
  --gold: #e8b34b;
  font-size: 15px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 1.15rem; font-weight: 900; letter-spacing: 1px; }
.brand h1 span { color: var(--red); }

.live-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--red);
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 59, 0.6); }
  50% { box-shadow: 0 0 0 7px rgba(255, 59, 59, 0); }
}

.redeem-value {
  margin-left: auto;
  text-align: right;
  cursor: help;
}
.redeem-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  justify-content: flex-end;
}
.redeem-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold);
}
.redeem-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 14px rgba(232, 179, 75, 0.4);
  transition: color 0.3s;
}
.redeem-vs {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  font-weight: 600;
}
.redeem-caption {
  font-size: 0.58rem;
  color: var(--muted);
  letter-spacing: 0.3px;
  margin-top: 1px;
}

.ticker {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: "JetBrains Mono", monospace;
}
.ticker-symbol { color: var(--gold); font-weight: 700; }
.ticker-price { font-size: 1.1rem; font-weight: 700; transition: color 0.3s; }
.ticker-change { font-size: 0.85rem; }

.online { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }

/* ---- layout ---- */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 12px;
  padding: 12px;
  min-height: 0;
}

/* ---- stream ---- */
.stream-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.stream-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.stream-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---- hero band: world cup + anthem in one cinematic strip ---- */
.hero-band {
  flex: 0 0 auto;
  display: flex;
  gap: 18px;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(100deg, rgba(13, 11, 7, 0.97) 25%, rgba(13, 11, 7, 0.88) 55%, rgba(16, 9, 9, 0.82) 100%),
    url("https://i.ytimg.com/vi/vrY1THC_NQE/maxresdefault.jpg") center 30% / cover no-repeat;
}
.hero-band::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232, 179, 75, 0.55), transparent);
}

.band-divider {
  flex: 0 0 1px;
  background: linear-gradient(180deg, transparent, var(--border) 25%, var(--border) 75%, transparent);
}

.hero-left { flex: 0.8; min-width: 0; display: flex; flex-direction: column; gap: 8px; justify-content: center; }

/* dynamic match stage in the middle of the hero band */
.hero-stage {
  flex: 1.1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  position: relative;
}
.hero-stage::before {
  content: "";
  position: absolute;
  inset: -20px;
  background: radial-gradient(50% 65% at 50% 50%, rgba(232, 179, 75, 0.12), transparent 70%);
  pointer-events: none;
}
.hero-stage.live::before {
  background: radial-gradient(50% 65% at 50% 50%, rgba(255, 59, 59, 0.2), transparent 70%);
}
.stage-row { display: flex; align-items: center; gap: 18px; }
.stage-team { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stage-flag {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  padding: 3px;
  box-shadow: 0 0 0 1px rgba(232, 179, 75, 0.35), 0 6px 18px rgba(0, 0, 0, 0.6);
}
.hero-stage.live .stage-flag { box-shadow: 0 0 0 1px rgba(255, 59, 59, 0.6), 0 0 18px rgba(255, 59, 59, 0.35); }
.stage-abbr { font-size: 0.72rem; font-weight: 900; letter-spacing: 1px; }
.stage-mid {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--muted);
  padding-bottom: 16px;
}
.hero-stage.live .stage-mid {
  font-size: 1.7rem;
  color: var(--text);
  text-shadow: 0 0 18px rgba(255, 59, 59, 0.6);
}
.stage-clock {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--red);
  animation: pulse-text 1.4s infinite;
}

.hero-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wc-badge {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--gold);
  border: 1px solid rgba(232, 179, 75, 0.6);
  border-radius: 99px;
  padding: 2px 9px;
  background: rgba(13, 11, 7, 0.6);
}
.hero-head h2 {
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 1px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}
.hero-tour {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.5;
}
.hero-cd-label {
  font-size: 0.62rem;
  color: var(--gold);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cd-chips { display: flex; gap: 8px; }
.cd-chip {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 0 4px;
  width: 58px;
  text-align: center;
  backdrop-filter: blur(4px);
}
.cd-chip b {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  text-shadow: 0 0 14px rgba(232, 179, 75, 0.35);
}
.cd-chip span {
  font-size: 0.55rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}
.wc-live-now {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--red);
  letter-spacing: 1px;
  animation: pulse-text 1.2s infinite;
  text-shadow: 0 0 18px rgba(255, 59, 59, 0.5);
}
@keyframes pulse-text {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.hero-right { flex: 1; min-width: 0; display: flex; gap: 14px; align-items: center; }

/* ---- broadcast ticker ribbons: odds + matches ---- */
.ticker-stack {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #100d08, #0a0805);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.ticker-row {
  display: flex;
  align-items: stretch;
  height: 44px;
}
.ticker-row + .ticker-row { border-top: 1px solid rgba(255, 255, 255, 0.05); }

.ticker-tag {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--gold);
  background: rgba(255, 255, 255, 0.03);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  text-decoration: none;
  white-space: nowrap;
}
a.ticker-tag:hover { color: #fff; }

.ticker-viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}
.ticker-track {
  display: flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
  animation: ticker-left var(--dur, 40s) linear infinite;
}
.ticker-track.reverse { animation-name: ticker-right; }
.ticker-viewport:hover .ticker-track { animation-play-state: paused; }
@keyframes ticker-left {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@keyframes ticker-right {
  from { transform: translateX(-50%); }
  to { transform: translateX(0); }
}

.tk-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 22px;
  font-size: 0.8rem;
  color: var(--text);
  text-decoration: none;
}
a.tk-item:hover .tk-name { color: var(--gold); }
.tk-sep {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(232, 179, 75, 0.5);
  flex: 0 0 auto;
}
.tk-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--muted);
  text-transform: uppercase;
}
.tk-name { font-weight: 700; }
.tk-pct {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  color: var(--green);
  text-shadow: 0 0 10px rgba(47, 213, 117, 0.45);
}
.tk-strip {
  display: inline-flex;
  width: 56px;
  height: 5px;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}
.tk-strip i { height: 100%; }
.tk-strip i:nth-child(1) { background: var(--green); box-shadow: 0 0 6px rgba(47,213,117,0.6); }
.tk-strip i:nth-child(2) { background: var(--gold); }
.tk-strip i:nth-child(3) { background: rgba(255, 255, 255, 0.25); }

.tk-flag {
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  padding: 1.5px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.tk-vs { font-size: 0.62rem; color: var(--muted); font-weight: 700; }
.tk-score {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 0.88rem;
}
.tk-time { font-size: 0.68rem; color: var(--muted); font-family: "JetBrains Mono", monospace; }
.tk-item.live .tk-time,
.tk-item.live .tk-score { color: var(--red); text-shadow: 0 0 10px rgba(255, 59, 59, 0.5); }
.tk-item.live .tk-time { font-weight: 700; animation: pulse-text 1.4s infinite; }

/* anthem (inside hero band) */
.anthem-player {
  position: relative;
  flex: 0 0 178px;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}
.anthem-player img { width: 100%; height: 100%; object-fit: cover; display: block; }
.anthem-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.anthem-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 59, 59, 0.92);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s;
}
.anthem-play:hover { transform: scale(1.12); }

.anthem-info { flex: 1; min-width: 0; }
.anthem-label { font-size: 0.66rem; color: var(--gold); letter-spacing: 0.4px; margin-bottom: 2px; }
.anthem-title { font-weight: 900; font-size: 1.1rem; margin-bottom: 8px; }
.anthem-views { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.anthem-info { text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85); }
.anthem-views-num {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(1.2rem, 1.7vw, 1.8rem);
  font-weight: 700;
  line-height: 1;
  color: var(--green);
  text-shadow: 0 0 18px rgba(47, 213, 117, 0.45);
}
.anthem-views-label { font-size: 0.72rem; color: var(--muted); }
.anthem-delta {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold);
  margin-top: 5px;
  min-height: 1.1em;
  opacity: 0;
  transition: opacity 0.4s;
}
.anthem-delta.show { opacity: 1; }
.live-tag {
  background: var(--red);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  border-radius: 4px;
  padding: 1px 5px;
  letter-spacing: 0.8px;
  animation: pulse-text 1.4s infinite;
}
.anthem-likes { font-size: 0.72rem; color: var(--muted); margin-top: 2px; font-family: "JetBrains Mono", monospace; }

/* ---- side ---- */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.price-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  gap: 14px;
}

.card-visual { flex: 0 0 110px; text-align: center; }
.card-visual img {
  width: 110px;
  border-radius: 8px;
  border: 1px solid var(--gold);
  box-shadow: 0 4px 18px rgba(232, 179, 75, 0.18);
  transition: transform 0.25s;
  transform-origin: top left;
  position: relative;
}
.card-visual img:hover {
  transform: scale(2.4);
  z-index: 50;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
}
.card-caption {
  margin-top: 6px;
  font-size: 0.58rem;
  color: var(--gold);
  letter-spacing: 0.4px;
  line-height: 1.5;
}

.price-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.price-row { display: flex; align-items: baseline; gap: 10px; }
.price-big {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.7rem;
  font-weight: 700;
  transition: color 0.3s;
}
.price-change { font-size: 0.9rem; font-weight: 600; }

.up { color: var(--green); }
.down { color: var(--red); }

#sparkline { width: 100%; height: 64px; }

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}
.stat label { display: block; font-size: 0.62rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat span { font-family: "JetBrains Mono", monospace; font-size: 0.82rem; }

.grail-link {
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
}
.grail-link:hover { text-decoration: underline; }

/* ---- chat ---- */
.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 0;
  overflow: hidden;
}

.chat-header {
  padding: 10px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.85rem;
  line-height: 1.45;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.msg .u { font-weight: 700; margin-right: 6px; }
.msg .t { color: var(--text); overflow-wrap: anywhere; }

.chat-input {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
}
.chat-input input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 10px;
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}
.chat-input input:focus { border-color: var(--gold); }
#nameInput { width: 84px; }
#msgInput { flex: 1; min-width: 0; }

.chat-input button {
  background: var(--red);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.chat-input button:hover { filter: brightness(1.1); }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .redeem-caption { display: none; }
  .ticker-change { display: none; }
}
@media (max-width: 900px) {
  body { overflow: auto; height: auto; }
  .layout { grid-template-columns: 1fr; }
  .stream-wrap { aspect-ratio: 16 / 9; height: auto; flex: none; }
  .hero-band { flex-direction: column; gap: 14px; }
  .hero-band {
    background:
      linear-gradient(180deg, rgba(13, 11, 7, 0.93), rgba(13, 11, 7, 0.88)),
      url("https://i.ytimg.com/vi/vrY1THC_NQE/maxresdefault.jpg") center 30% / cover no-repeat;
  }
  .band-divider { display: none; }
  .hero-right { width: 100%; flex-direction: column; align-items: flex-start; }
  .anthem-player { flex: none; width: 100%; max-width: 340px; }
  .card-visual img:hover { transform: none; }
  .chat-panel { min-height: 320px; }
}
