:root {
  --ink: #130d12;
  --paper: #f7ead2;
  --acid: #c8ff3d;
  --pink: #ff3d7f;
  --cyan: #27d7ff;
  --gold: #f7c645;
  --team: #2b68ff;
  --team2: #ff3d3d;
  --panel: rgba(255, 243, 218, 0.88);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Serif SC", serif;
  background:
    radial-gradient(circle at 12% 10%, color-mix(in srgb, var(--team) 38%, transparent), transparent 30%),
    radial-gradient(circle at 86% 12%, rgba(255, 61, 127, 0.28), transparent 28%),
    radial-gradient(circle at 50% 92%, rgba(39, 215, 255, 0.25), transparent 34%),
    linear-gradient(135deg, #160b18 0%, #2a1530 35%, #f3d9a4 36%, #e8c87e 100%);
  overflow-x: hidden;
}

button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  opacity: 0.16;
  background: repeating-linear-gradient(0deg, transparent 0 7px, rgba(255,255,255,.35) 8px, transparent 9px);
  mix-blend-mode: overlay;
}

.shell {
  width: min(1560px, calc(100vw - 28px));
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-columns: .9fr 1.55fr .82fr;
  grid-template-rows: auto 1fr;
  gap: 18px;
  padding: 20px 0;
}

.intro-panel, .selection-panel, .broadcast-panel, .support-panel, .result-panel {
  background: var(--panel);
  border: 2px solid rgba(19, 13, 18, .35);
  box-shadow: 10px 10px 0 rgba(0,0,0,.22);
  backdrop-filter: blur(16px);
}

.intro-panel {
  padding: 26px;
  border-radius: 34px 10px 34px 10px;
  overflow: hidden;
  position: relative;
}

.intro-panel::after {
  content: "2026";
  position: absolute;
  right: -20px;
  bottom: -36px;
  font-family: "Bebas Neue", sans-serif;
  font-size: 170px;
  color: rgba(19, 13, 18, .07);
}

.eyebrow {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--acid);
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: .13em;
  font-size: 18px;
}

h1 {
  margin: 34px 0 18px;
  font-family: "ZCOOL KuaiLe", sans-serif;
  font-size: clamp(52px, 5.7vw, 92px);
  line-height: .88;
  letter-spacing: -.04em;
}

h1 span {
  color: var(--pink);
  text-shadow: 4px 4px 0 var(--acid), 8px 8px 0 rgba(39, 215, 255, .35);
}

.intro-panel p {
  position: relative;
  font-size: 17px;
  line-height: 1.85;
}

.world-facts {
  margin: 24px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.world-facts span {
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(19,13,18,.16);
  background: rgba(255,255,255,.48);
  font-size: 13px;
}

.harness-strip {
  position: relative;
  display: grid;
  gap: 4px;
  margin: 18px 0;
  padding: 12px 14px;
  border: 2px dashed rgba(19,13,18,.42);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(200,255,61,.55), rgba(39,215,255,.22));
}
.harness-strip span { font-family: "Bebas Neue"; letter-spacing: .12em; font-size: 16px; }
.harness-strip b { font-size: 13px; line-height: 1.45; }

.crystal-ball-entry {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 3px;
  margin: 14px 0;
  padding: 13px 15px;
  border: 2px solid var(--ink);
  border-radius: 20px;
  background: linear-gradient(135deg, #fff8e4, rgba(39, 215, 255, .34));
  box-shadow: 5px 5px 0 rgba(19,13,18,.18);
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
}
.crystal-ball-entry span { font-size: 13px; color: rgba(19,13,18,.68); font-weight: 500; }
.crystal-ball-hint { margin: 8px 0 0; max-width: 58ch; line-height: 1.65; color: rgba(19,13,18,.72); }

.primary-btn, .ghost-btn {
  min-height: 46px;
  padding: 0 18px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 4px 4px 0 rgba(19,13,18,.22);
  transition: transform .16s ease, box-shadow .16s ease;
}
.primary-btn { background: var(--ink); color: #fff8e4; }
.ghost-btn { background: #fff8e4; color: var(--ink); }
button:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 rgba(19,13,18,.2); }

.selection-panel, .broadcast-panel {
  grid-row: span 2;
  padding: 18px;
  border-radius: 12px 40px 12px 40px;
}

.panel-head {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 340px);
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
}
.panel-head span, .support-card span, .odds-card span, .chem-card span, .collection-card span, .bracket-card span, .poster-top { color: rgba(19,13,18,.62); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.panel-head h2 { margin: 3px 0 0; font-family: "Bebas Neue", sans-serif; font-size: 42px; letter-spacing: .04em; }
input[type="text"] { width: 100%; border: 2px solid rgba(19,13,18,.3); border-radius: 16px; padding: 12px 14px; background: #fff9e9; color: var(--ink); }

.team-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  max-height: calc(100vh - 130px);
  overflow: auto;
  padding: 2px 4px 12px 0;
}

.team-card {
  position: relative;
  min-height: 150px;
  padding: 13px;
  border: 2px solid rgba(19,13,18,.28);
  border-radius: 20px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c1) 22%, white), white 58%, color-mix(in srgb, var(--c2) 24%, white));
  overflow: hidden;
}
.team-card::before { content: ""; position: absolute; width: 120px; height: 120px; border-radius: 50%; right: -38px; bottom: -42px; background: var(--c1); opacity: .18; }
.team-card.crystal-highlight { border-color: var(--acid); box-shadow: 0 0 0 4px rgba(200,255,61,.32), 6px 6px 0 rgba(19,13,18,.18); }
.team-card.crystal-highlight::after { content: "水晶球前瞻"; position: absolute; left: 10px; top: 10px; padding: 4px 8px; border-radius: 999px; background: var(--ink); color: #fff8e4; font-size: 11px; }
.team-card strong { display: block; font-family: "Bebas Neue", sans-serif; font-size: 30px; letter-spacing: .05em; }
.team-card em { font-style: normal; color: rgba(19,13,18,.62); font-size: 13px; }
.team-card p { margin: 10px 0 0; line-height: 1.55; font-size: 13px; }
.team-card .power { position: absolute; right: 10px; top: 10px; padding: 5px 8px; border-radius: 999px; background: var(--ink); color: #fff8e4; font-family: "Bebas Neue"; }

.support-panel {
  padding: 16px;
  border-radius: 10px 34px 10px 34px;
}
.support-card, .odds-card, .chem-card, .collection-card, .bracket-card {
  padding: 16px;
  border-radius: 22px;
  background: rgba(255,249,233,.76);
  border: 1px solid rgba(19,13,18,.18);
  margin-bottom: 14px;
}
.support-card strong, .odds-card strong, .chem-card strong { display: block; margin: 5px 0; font-family: "Bebas Neue"; font-size: 36px; letter-spacing: .05em; }
.support-card p { line-height: 1.65; margin: 8px 0 0; }
.odds-bar { height: 12px; border: 1px solid var(--ink); border-radius: 999px; background: #fff; overflow: hidden; }
.odds-bar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--team), var(--acid)); transition: width .5s ease; }
.chem-track { height: 12px; border: 1px solid var(--ink); border-radius: 999px; background: #fff; overflow: hidden; }
.chem-track i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--pink), var(--cyan)); transition: width .5s ease; }
.chem-card p { margin: 8px 0 0; line-height: 1.5; font-size: 13px; }
.card-ledger { display: grid; gap: 7px; margin-top: 10px; }
.card-ledger em { display: block; padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,.58); border-left: 5px solid var(--team); font-style: normal; font-size: 12px; line-height: 1.35; }
.bracket-card ol { margin: 10px 0 0; padding-left: 22px; display: grid; gap: 8px; }
.bracket-card li { line-height: 1.45; font-size: 13px; }

.scorebug {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}
.scorebug span { color: rgba(19,13,18,.62); font-size: 12px; }
.scorebug strong { display: block; font-family: "Bebas Neue"; font-size: 32px; letter-spacing: .05em; }
.scoreline { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 2px solid var(--ink); border-radius: 16px; background: #fff8e4; }
.scoreline b { font-family: "Bebas Neue"; font-size: 28px; }
.scoreline strong { color: var(--pink); }

.stage-wrap {
  position: relative;
  border-radius: 28px;
  overflow: hidden;
  border: 2px solid rgba(19,13,18,.26);
  background: #10351d;
}
#matchCanvas { display: block; width: 100%; height: auto; background: #0f5c31; }
.goal-flash {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: "Bebas Neue";
  font-size: clamp(88px, 14vw, 190px);
  color: var(--acid);
  text-shadow: 7px 7px 0 var(--pink), 12px 12px 0 rgba(0,0,0,.35);
  animation: smash .8s ease both;
}
.star-cutin {
  position: absolute;
  left: 20px;
  bottom: 20px;
  width: min(330px, calc(100% - 40px));
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 2px solid var(--ink);
  border-radius: 22px;
  background: rgba(255,248,228,.92);
  box-shadow: 8px 8px 0 rgba(0,0,0,.2);
}
.toon-head { grid-row: span 2; width: 72px; height: 72px; border-radius: 44% 44% 50% 50%; border: 3px solid var(--ink); background: linear-gradient(145deg, #ffd9ad, #c77b48); position: relative; }
.toon-head span { position: absolute; left: 8px; right: 8px; top: -6px; height: 26px; border-radius: 50%; background: var(--team); }
.star-cutin strong { font-family: "Bebas Neue"; font-size: 30px; }
.star-cutin p { margin: 0; font-size: 13px; }

.card-draft {
  margin: 10px 0 14px;
  padding: 12px;
  border: 2px solid rgba(19,13,18,.24);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255,248,228,.9), rgba(255,255,255,.46));
}
.card-draft-head {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}
.card-draft-head span { color: rgba(19,13,18,.62); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.card-draft-head strong { font-family: "Bebas Neue"; font-size: 25px; letter-spacing: .04em; }
.card-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.boost-card {
  position: relative;
  min-height: 146px;
  padding: 12px;
  border: 2px solid var(--ink);
  border-radius: 20px;
  background:
    radial-gradient(circle at 82% 12%, color-mix(in srgb, var(--team) 34%, transparent), transparent 28%),
    linear-gradient(145deg, #fff9e9, color-mix(in srgb, var(--team2) 17%, #fff9e9));
  box-shadow: 5px 5px 0 rgba(19,13,18,.18);
  text-align: left;
}
.boost-card.selected { background: linear-gradient(145deg, var(--acid), #fff9e9 64%); transform: translate(-2px, -2px); }
.boost-card b { display: block; font-family: "Bebas Neue"; font-size: 26px; letter-spacing: .04em; }
.boost-card small { display: inline-block; margin: 4px 0 8px; padding: 4px 8px; border-radius: 999px; background: var(--ink); color: #fff8e4; font-family: "Bebas Neue"; letter-spacing: .08em; }
.boost-card p { margin: 0; font-size: 13px; line-height: 1.45; }
.boost-card i { position: absolute; right: 10px; bottom: 8px; font-style: normal; font-family: "Bebas Neue"; font-size: 40px; color: rgba(19,13,18,.11); }

.win-rate-preview {
  margin-top: 12px;
  padding: 14px;
  border: 2px solid rgba(19,13,18,.3);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(19,13,18,.88), rgba(42,21,48,.82)),
    radial-gradient(circle at 80% 10%, color-mix(in srgb, var(--team) 42%, transparent), transparent 36%);
  color: #fff8e4;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 6px 6px 0 rgba(19,13,18,.2);
}
.win-rate-preview h3 { margin: 0 0 10px; font-family: "Bebas Neue"; font-size: 30px; letter-spacing: .05em; }
.win-rate-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 10px; }
.win-rate-grid div { padding: 10px; border-radius: 14px; background: rgba(255,248,228,.12); border: 1px solid rgba(255,248,228,.18); }
.win-rate-grid span { display: block; color: rgba(255,248,228,.7); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.win-rate-grid strong { display: block; margin-top: 2px; font-family: "Bebas Neue"; font-size: 36px; color: var(--acid); }
.win-rate-effects { margin: 0; padding-left: 18px; display: grid; gap: 5px; }
.win-rate-effects li { line-height: 1.45; }

.match-effect-toast {
  position: absolute;
  left: 50%;
  top: 18%;
  z-index: 6;
  width: min(390px, calc(100% - 32px));
  padding: 14px 16px;
  border: 2px solid var(--ink);
  border-radius: 20px;
  background: linear-gradient(135deg, var(--acid), #fff8e4 70%);
  box-shadow: 8px 8px 0 rgba(0,0,0,.28);
  transform: translateX(-50%) translateY(-8px) scale(.98);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.match-effect-toast.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
.match-effect-title { font-family: "Bebas Neue"; font-size: 30px; letter-spacing: .04em; }
.match-effect-desc { margin-top: 3px; font-size: 13px; line-height: 1.45; }

.match-breakdown-panel {
  margin: 14px 0;
  padding: 16px;
  border: 2px solid rgba(19,13,18,.34);
  border-radius: 24px;
  background:
    radial-gradient(circle at 92% 0%, color-mix(in srgb, var(--team) 32%, transparent), transparent 28%),
    rgba(255,249,233,.82);
  box-shadow: 7px 7px 0 rgba(19,13,18,.16);
}
.final-breakdown { min-width: 260px; max-width: 360px; margin: 0; align-self: stretch; }
.breakdown-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.breakdown-header h3 { margin: 0; font-family: "Bebas Neue"; font-size: 32px; letter-spacing: .05em; }
.final-rate { padding: 7px 10px; border-radius: 999px; background: var(--ink); color: #fff8e4; font-family: "Bebas Neue"; white-space: nowrap; }
.breakdown-factors { display: grid; gap: 8px; }
.breakdown-row { display: grid; grid-template-columns: 86px 1fr 52px; gap: 10px; align-items: center; }
.breakdown-label { font-size: 13px; color: rgba(19,13,18,.72); }
.breakdown-meter { height: 12px; border: 1px solid rgba(19,13,18,.32); border-radius: 999px; background: rgba(255,255,255,.58); overflow: hidden; }
.breakdown-meter-fill { height: 100%; border-radius: 999px; background: rgba(19,13,18,.24); }
.breakdown-row.positive .breakdown-meter-fill { background: linear-gradient(90deg, var(--team), var(--acid)); }
.breakdown-row.negative .breakdown-meter-fill { background: linear-gradient(90deg, var(--pink), #7d172f); }
.breakdown-row.neutral { opacity: .52; }
.breakdown-value { font-family: "Bebas Neue"; font-size: 20px; text-align: right; }
.breakdown-row.positive .breakdown-value { color: #167a34; }
.breakdown-row.negative .breakdown-value { color: var(--pink); }
.breakdown-result {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.48);
  font-family: "Bebas Neue";
  font-size: 22px;
  letter-spacing: .03em;
}
.trigger-list h4 { margin: 10px 0 8px; font-family: "Bebas Neue"; font-size: 24px; letter-spacing: .04em; }
.trigger-row { display: grid; grid-template-columns: 42px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid rgba(19,13,18,.14); }
.trigger-minute { font-family: "Bebas Neue"; font-size: 22px; color: var(--pink); }
.trigger-row strong { display: block; font-family: "Bebas Neue"; font-size: 22px; letter-spacing: .03em; }
.trigger-row p { margin: 2px 0 0; line-height: 1.45; font-size: 13px; }
.empty-trigger { padding: 10px; border-radius: 12px; background: rgba(255,255,255,.42); color: rgba(19,13,18,.62); }


.match-controls { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }

.progress-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 12px; }
.round-pill { padding: 9px; border-radius: 14px; text-align: center; border: 1px solid rgba(19,13,18,.22); background: rgba(255,255,255,.45); font-size: 12px; }
.round-pill.done { background: var(--acid); }
.round-pill.active { background: var(--ink); color: #fff8e4; }
.narration { max-height: 180px; overflow: auto; display: grid; gap: 8px; }
.narration p { margin: 0; padding: 10px 12px; border-left: 5px solid var(--team); background: rgba(255,249,233,.75); border-radius: 12px; line-height: 1.55; }

.result-panel {
  grid-column: 1 / -1;
  padding: 18px;
  border-radius: 30px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
}
.poster {
  min-height: 360px;
  padding: 26px;
  border-radius: 28px;
  border: 2px solid var(--ink);
  background:
    radial-gradient(circle at 78% 10%, color-mix(in srgb, var(--team) 35%, transparent), transparent 28%),
    linear-gradient(135deg, #fff7dd, color-mix(in srgb, var(--team2) 20%, #fff7dd));
  position: relative;
  overflow: hidden;
}
.poster h2 { margin: 12px 0; font-family: "ZCOOL KuaiLe"; font-size: clamp(42px, 6vw, 84px); line-height: .95; }
.poster p { max-width: 62ch; line-height: 1.8; }
.poster-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 22px; }
.poster-metrics div { padding: 14px; border-radius: 18px; border: 1px solid rgba(19,13,18,.18); background: rgba(255,255,255,.55); }
.poster-metrics span { display: block; font-size: 12px; color: rgba(19,13,18,.62); }
.poster-metrics strong { display: block; margin-top: 4px; font-family: "Bebas Neue"; font-size: 30px; }
.poster-team { position: absolute; right: -12px; bottom: -20px; font-family: "Bebas Neue"; font-size: 120px; color: rgba(19,13,18,.07); }
.share-actions { display: grid; gap: 10px; min-width: 210px; }
.qr-box { display: none; text-align: center; }
.qr-box.visible { display: block; }
.poster-preview { display: none; grid-column: 1 / -1; padding: 14px; border: 2px solid var(--ink); border-radius: 24px; background: rgba(255,248,228,.72); box-shadow: 7px 7px 0 rgba(0,0,0,.18); }
.poster-preview.visible { display: grid; gap: 12px; }
.poster-preview-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.poster-preview-head strong { font-family: "Noto Serif SC"; font-size: 18px; }
.poster-preview-head span { color: rgba(19,13,18,.66); font-size: 13px; }
.poster-preview img { width: min(100%, 420px); border: 2px solid var(--ink); border-radius: 22px; background: #fff; justify-self: center; box-shadow: 10px 10px 0 rgba(0,0,0,.2); }
#qrCanvas { padding: 10px; background: #fff; border: 2px solid var(--ink); border-radius: 18px; }
.qr-box p { margin: 8px 0 0; font-size: 13px; }
.qr-share-url { word-break: break-all; max-width: 260px; color: rgba(19,13,18,.68); }


@keyframes smash { 0% { transform: scale(.3) rotate(-8deg); opacity: 0; } 38% { transform: scale(1.16) rotate(2deg); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }

@media (max-width: 1180px) {
  .shell { grid-template-columns: 1fr 1fr; }
  .intro-panel { grid-column: 1 / -1; }
  .support-panel { grid-column: 1 / -1; }
  .team-grid { grid-template-columns: repeat(3, minmax(140px, 1fr)); max-height: none; }
  .card-choices { grid-template-columns: 1fr; }
  .poster-metrics { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .shell { width: min(100vw - 18px, 680px); grid-template-columns: 1fr; padding: 9px 0; }
  .selection-panel, .broadcast-panel { grid-row: auto; }
  .panel-head, .scorebug, .result-panel, .poster-metrics { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .progress-strip { grid-template-columns: repeat(2, 1fr); }
  .share-actions { min-width: 0; }
  .win-rate-grid, .breakdown-header { grid-template-columns: 1fr; display: grid; }
  .breakdown-row { grid-template-columns: 76px 1fr 46px; gap: 7px; }
  .final-breakdown { max-width: none; }
}
