:root {
  color-scheme: dark;
  --bg: #0c0f15;
  --surface: #131821;
  --raised: #1a212c;
  --border: #2b3441;
  --ink: #f0f3f8;
  --muted: #a6b0c1;
  --accent: #a8c4ff;
  --action: #2856ce;
  --blue: #a2caff;
  --red: #ffb0a6;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", "Malgun Gothic", "Yu Gothic", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--bg); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.shell { width: min(1200px, calc(100% - 48px)); margin-inline: auto; }

.masthead { border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 750; letter-spacing: -.04em; white-space: nowrap; }
.logo-tile { display: grid; place-items: center; width: 28px; height: 28px; color: var(--accent); }
.logo { width: 23px; height: 23px; }
.language {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 35px;
  padding: 5px 9px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}
.language-icon { flex: none; width: 16px; height: 16px; color: var(--accent); }
.language select { color: var(--ink); background: var(--surface); border: 0; font-weight: 650; font-size: inherit; }

.intro { padding: 25px 0 21px; }
h1 { margin: 0; font-size: clamp(35px, 5.2vw, 62px); line-height: 1.05; font-weight: 760; letter-spacing: -.06em; }
.intro-subtitle { margin: 5px 0 0; color: var(--muted); font-size: clamp(14px, 2vw, 18px); font-weight: 500; letter-spacing: -.01em; }
.main-grid { display: grid; grid-template-columns: minmax(0, 2.45fr) minmax(265px, 1fr); gap: 14px; }
.panel { min-width: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.scoreboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  min-height: 70px;
  border-bottom: 1px solid var(--border);
}
.messi { --team: var(--blue); --team-fill: #1e324d; }
.ronaldo { --team: var(--red); --team-fill: #3b262d; }
.score-team { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 8px 13px; font-size: 15px; }
.score-team > b { overflow-wrap: anywhere; }
.score-team.ronaldo { flex-direction: row-reverse; text-align: right; }
.crest {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--team-fill);
  color: var(--team);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}
.score-center { display: grid; gap: 3px; padding: 6px 13px; text-align: center; }
.score-center > span { color: var(--muted); font-size: 10px; font-weight: 650; }
.score-center div { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.score-center strong { color: var(--ink); font-size: clamp(25px, 4vw, 36px); line-height: 1; font-weight: 760; font-variant-numeric: tabular-nums; }
.score-divider { color: var(--muted); font-size: 19px; }

.stage { position: relative; overflow: hidden; aspect-ratio: 2.4; min-height: 170px; background: #172d28 url('/assets/night-match.jpg') center / 100% 100% no-repeat; }
.legends { height: clamp(105px, 17vw, 180px); display: grid; grid-template-columns: 1fr 1fr 1fr; position: relative; overflow: hidden; margin: 0 0 14px; background: linear-gradient(100deg,#102b3b,#11141c 48%,#3a1921); border: 1px solid var(--border); border-radius: 10px; }
.legend-portrait { position: relative; min-width: 0; overflow: hidden; }
.legend-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center 29%; opacity: .82; }
.legend-portrait::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg,transparent,#10141bd9); }
.ronaldo-photo::after { background: linear-gradient(270deg,transparent,#10141bd9); }
.legend-portrait span { position: absolute; z-index: 1; bottom: 12px; left: 14px; color: white; font-size: clamp(12px,2vw,19px); font-weight: 800; letter-spacing: .08em; text-shadow: 0 2px 7px #000; }
.ronaldo-photo span { left: auto; right: 14px; }
.legend-portrait b { opacity: .7; }
.legend-center { align-self: center; text-align: center; color: #c0c9d6; font-size: clamp(9px,1.3vw,12px); letter-spacing: .18em; font-weight: 700; }
.legend-center strong { display: block; color: #fff; margin-top: 7px; font-size: clamp(12px,2.2vw,21px); letter-spacing: .05em; }
.photo-credits { color: var(--muted); font-size: 10px; line-height: 1.5; padding-bottom: 16px; }
.photo-credits a { color: inherit; }
.stage-info, .timer { position: absolute; top: 10px; z-index: 2; padding: 5px 9px; background: #0c111be8; border: 1px solid #596579; border-radius: 6px; }
.stage-info { left: 10px; max-width: 72%; color: #edf1f8; font-size: 12px; overflow-wrap: anywhere; }
.stage-info b { font-weight: 650; }
.timer { right: 10px; display: flex; align-items: baseline; gap: 4px; color: var(--accent); font-size: 11px; font-weight: 700; }
.timer b { font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.timer.urgent { color: var(--red); border-color: #aa6662; }
.striker, .keeper, .ball { position: absolute; overflow: visible; filter: drop-shadow(1px 2px 1px #08110d9c); pointer-events: none; }
.keeper { left: 45%; top: 36%; width: 10%; height: 29%; }
.striker { top: 51%; width: 16%; height: 46%; transform-origin: 55% 90%; display: none; }
.striker-messi { left: 50%; }
.striker-ronaldo { left: 34%; }
.stage[data-team="messi"] .striker-messi, .stage[data-team="ronaldo"] .striker-ronaldo { display: block; }
.ball { left: 48.55%; top: 82%; width: 2.9%; min-width: 13px; z-index: 1; }
.stage.shot .striker { animation: step .62s both ease-out; }
.stage.shot .striker-messi { animation-name: step-right; }
.stage.shot .ball { animation: kick .72s .17s both cubic-bezier(.19,.81,.39,1); }
.stage.shot .keeper { animation: dive .6s .22s both cubic-bezier(.22,.7,.35,1); }
.stage.shot[data-shot="left"] { --ball-x: -510%; }
.stage.shot[data-shot="center"] { --ball-x: 0%; }
.stage.shot[data-shot="right"] { --ball-x: 510%; }
.stage.shot[data-save="left"] { --keep-x: -118%; --keep-a: -65deg; }
.stage.shot[data-save="center"] { --keep-x: 0%; --keep-a: 0deg; }
.stage.shot[data-save="right"] { --keep-x: 118%; --keep-a: 65deg; }
@keyframes step { 42% { transform: translate(33%,-5%) rotate(11deg) scale(.95); } 100% { transform: translate(39%,-9%) rotate(-10deg) scale(.92); } }
@keyframes step-right { 42% { transform: translate(-34%,-5%) rotate(-11deg) scale(.95); } 100% { transform: translate(-39%,-9%) rotate(10deg) scale(.92); } }
@keyframes kick { 10% { transform: translate(0,-20%) scale(.95); } 100% { left: 50%; top: 49%; transform: translate(calc(var(--ball-x) - 50%),-50%) scale(.52) rotate(260deg); } }
@keyframes dive { 100% { transform: translate(var(--keep-x),-7%) rotate(var(--keep-a)); } }
.result {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 26%;
  max-width: 88%;
  transform: translate(-50%, -50%);
  padding: 5px 16px;
  border: 1px solid #779ec2;
  border-radius: 8px;
  background: #101a29ee;
  color: #c7e7ff;
  text-align: center;
  text-transform: uppercase;
  font-size: clamp(23px, 4.5vw, 39px);
  font-weight: 800;
  animation: result .24s ease-out;
}
.result.saved { color: var(--red); border-color: #a25d62; }
@keyframes result { from { opacity: 0; transform: translate(-50%, -32%) scale(.86); } }

.controls { display: grid; gap: 10px; padding: 11px 13px 13px; border-top: 1px solid var(--border); }
.play-state { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 42px; }
.play-state > div { min-width: 0; }
.play-state strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.play-state small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.profile-actions { display: none; flex-wrap: wrap; gap: 16px; }
.profile-actions:has(> button:not([hidden])) { display: flex; }
.profile-actions .link { min-height: 36px; }
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  gap: 9px;
  min-height: 38px;
  padding: 7px 12px;
  color: #fff;
  background: var(--action);
  border: 1px solid #557fe6;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 750;
}
.primary:hover:not(:disabled) { background: #3264e0; }
.primary:disabled { color: var(--muted); background: var(--raised); border-color: var(--border); }
.taking-kick #primary { display: none; }
.taking-kick .play-state strong { color: var(--accent); }
.directions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.directions button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 5px;
  color: var(--ink);
  background: #25354e;
  border: 1px solid #576e9a;
  border-radius: 7px;
  font-size: 12px;
}
.directions button:not(:disabled):hover { background: #344a6e; }
.directions button:disabled { color: var(--muted); background: var(--raised); border-color: var(--border); }
.directions button span { font-size: 17px; line-height: 1; }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 47px; padding: 0 13px; border-bottom: 1px solid var(--border); }
.panel-head h2 { margin: 0; font-size: 14px; font-weight: 730; }
.panel-meta { color: var(--muted); font-size: 11px; }
.chat-panel { position: relative; display: flex; flex-direction: column; min-height: 285px; }
.messages { position: absolute; inset: 47px 0 61px; display: flex; flex-direction: column; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 2px 12px; }
.messages .empty { margin: auto 0; text-align: center; }
.message { flex: none; padding: 10px 1px; border-bottom: 1px solid var(--border); }
.message:last-child { border-bottom: 0; }
.message-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 7px; }
.message-meta b { font-size: 12px; }
.message time { margin-inline-start: auto; color: var(--muted); font-size: 10px; white-space: nowrap; }
.message p { margin: 4px 0 0; color: #e2e8f1; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.chat-form { display: flex; gap: 6px; margin-top: auto; padding: 10px 11px; border-top: 1px solid var(--border); }
.chat-form input, .field input { min-width: 0; width: 100%; padding: 8px 9px; color: var(--ink); background: var(--raised); border: 1px solid var(--border); border-radius: 7px; font-size: 12px; }
.chat-form input::placeholder, .field input::placeholder { color: var(--muted); }
.chat-form button { display: grid; flex: none; place-items: center; width: 38px; height: 38px; color: var(--ink); background: var(--action); border: 1px solid #557fe6; border-radius: 7px; }
.chat-form button:disabled { color: var(--muted); background: var(--raised); border-color: var(--border); }

.activity { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 14px; }
.activity > section { min-width: 0; }
.activity > section + section { border-inline-start: 1px solid var(--border); }
.list { margin: 0; padding: 3px 13px; min-height: 55px; max-height: 222px; overflow: auto; list-style: none; }
.empty { margin: 0; padding: 11px 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.list-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.list-row:last-child { border-bottom: 0; }
.list-row .rank { flex: none; min-width: 19px; color: var(--muted); }
.entry-name { min-width: 0; overflow-wrap: anywhere; }
.list-row em { margin-inline-start: auto; color: var(--accent); font-size: 10px; font-style: normal; font-weight: 700; white-space: nowrap; }
.scored { color: #a9dfc3; }
.saved { color: var(--red); }
.team-badge { display: inline-flex; flex: none; align-items: center; gap: 4px; padding: 2px 5px; color: var(--team); background: var(--team-fill); border-radius: 5px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.team-number { font-weight: 850; font-variant-numeric: tabular-nums; }

.ad-space, .affiliate { margin-top: 14px; padding: 11px 13px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.ad-space { display: grid; justify-items: center; gap: 4px; }
.ad-space:not(:has(a, .adsbygoogle)), .ad-space:has(.adsbygoogle[data-ad-status="unfilled"]) { display: none; }
.ad-space span, .affiliate span { color: var(--muted); font-size: 10px; }
.ad-space .adsbygoogle { display: block; width: 100%; }
.affiliate { display: grid; gap: 6px; justify-items: start; }
.affiliate a, .ad-space a { color: var(--accent); font-size: 14px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.affiliate p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.coupang-banner { justify-items: center; }
.coupang-banner iframe { border: 0; max-width: 100%; }
.coupang-banner .coupang-mobile { display: none; }
@media (max-width: 740px) {
  .coupang-banner .coupang-desktop { display: none; }
  .coupang-banner .coupang-mobile { display: block; }
}
.footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 0 20px; color: var(--muted); font-size: 11px; }
.footer b { margin-right: 7px; color: var(--ink); font-weight: 750; }
.footer small { font-size: inherit; }
.footer > div { display: flex; flex-wrap: wrap; gap: 10px; }
.link { padding: 3px 0; color: var(--muted); background: none; border: 0; font-size: 12px; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--ink); }

.policy-page { max-width: 760px; padding-block: 28px; }
.policy-page h1 { margin-top: 12px; }
.policy-page details { padding: 15px; margin-block: 12px; }
.policy-page summary { cursor: pointer; font-weight: 730; }
.policy-page p { color: var(--muted); line-height: 1.65; }
.policy-page .link { font-size: inherit; }
.guide-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 14px; padding: 8px 13px; }
.guide-links a, .guide-nav a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.guide-links a, .guide-nav a { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; font-size: 14px; }
.guide { max-width: 760px; padding-block: 24px; }
.guide-nav { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 14px; }
.guide h1 { font-size: clamp(29px, 6vw, 43px); letter-spacing: -.045em; }
.guide-lead { color: var(--ink); font-size: 16px; line-height: 1.65; }
.guide-sections { display: grid; gap: 10px; margin-block: 16px; }
.guide-sections h2 { margin: 0 0 5px; font-size: 18px; }
.guide-sections p { margin: 0; color: var(--muted); line-height: 1.65; }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 700; }
dialog { width: min(425px, calc(100% - 28px)); padding: 18px; color: var(--ink); background: var(--surface); border: 1px solid #455165; border-radius: 12px; box-shadow: 0 15px 52px #0009; }
dialog::backdrop { background: #05080eb8; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; }
.close { display: grid; place-items: center; width: 33px; height: 33px; padding: 0; color: var(--ink); background: var(--raised); border: 1px solid var(--border); border-radius: 6px; font-size: 21px; line-height: 1; }
.close:hover { background: #2a3546; }
dialog h2 { margin: 12px 0 7px; font-size: 22px; letter-spacing: -.035em; }
dialog p { margin: 0 0 13px; color: var(--muted); font-size: 13px; line-height: 1.6; white-space: pre-line; }
.field { display: grid; gap: 6px; font-size: 12px; font-weight: 730; }
.field input { height: 40px; font-size: 16px; }
.full { width: 100%; margin-top: 12px; }
.team-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.team-option { display: grid; align-content: center; justify-items: center; gap: 6px; min-height: 104px; padding: 10px 5px; color: var(--team); background: var(--raised); border: 1px solid var(--border); border-radius: 8px; }
.team-option:hover:not(:disabled) { border-color: var(--team); }
.team-option > span:last-child { color: var(--muted); font-size: 10px; }
.form-error { margin: 8px 0; color: var(--red); }
.toast { position: fixed; z-index: 3; left: 50%; bottom: 16px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 26px); padding: 8px 11px; color: var(--ink); background: var(--raised); border: 1px solid #556988; border-radius: 7px; font-size: 13px; }

@media (max-width: 800px) {
  .shell { width: calc(100% - 28px); }
  .main-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .intro { padding: 19px 0 15px; }
}
@media (max-width: 490px) {
  .shell { width: calc(100% - 20px); }
  .header-inner { min-height: 51px; }
  .brand { font-size: 15px; }
  .language { gap: 5px; min-height: 32px; padding: 4px 6px; font-size: 11px; }
  .language-icon { width: 14px; height: 14px; }
  .scoreboard { min-height: 56px; }
  .score-team { gap: 5px; padding: 6px; font-size: 11px; }
  .score-center { padding: 4px 7px; }
  .crest { width: 28px; height: 28px; font-size: 16px; }
  .stage-info, .timer { top: 6px; }
  .stage-info { left: 6px; font-size: 10px; }
  .timer { right: 6px; }
  .controls { gap: 8px; padding: 8px 9px 10px; }
  .play-state small { font-size: 11px; }
  .primary { gap: 6px; padding: 6px 8px; font-size: 12px; }
  .activity { grid-template-columns: minmax(0, 1fr); }
  .activity > section + section { border-inline-start: 0; border-top: 1px solid var(--border); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01s !important; animation-delay: 0s !important; }
}
