:root {
  color-scheme: light;
  --bg: #f4fbf6;
  --paper: #ffffff;
  --paper-soft: #fbfffc;
  --ink: #1f3028;
  --muted: #60756a;
  --line: #d8eadf;
  --green: #3f9b72;
  --green-deep: #1f6f51;
  --mint: #dff4e8;
  --gold: #d69d38;
  --danger: #c85656;
  --shadow: 0 18px 50px rgba(31, 111, 81, 0.10);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 0%, rgba(124, 206, 161, 0.22), transparent 32rem),
    linear-gradient(180deg, #f7fff9 0%, var(--bg) 48%, #ffffff 100%);
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, -apple-system, sans-serif;
}

button, input { font: inherit; }
a { color: inherit; }

.shell {
  width: min(1160px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.topbar, .panel, .status-grid > div {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 22px;
  padding: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green-deep);
  font-weight: 800;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 10px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.04;
  letter-spacing: 0;
}

h2 { margin-bottom: 8px; font-size: clamp(24px, 3vw, 34px); }
h3 { margin-bottom: 10px; }

.subtitle, .section-head p, .hint, .empty {
  color: var(--muted);
  line-height: 1.7;
}

.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.primary { background: var(--green); color: #fff; }
.ghost { background: #fff; color: var(--green-deep); border: 1px solid var(--line); }
.danger { background: #fff3f3; color: var(--danger); border: 1px solid #f0c9c9; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.status-grid > div { padding: 16px; min-width: 0; }
.status-grid span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.status-grid strong { display: block; overflow-wrap: anywhere; }

.panel { padding: 24px; margin-bottom: 16px; }
.arena { min-height: 420px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.duel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.top10-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.option-card {
  min-height: 150px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  text-align: left;
  padding: 15px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.option-card:hover {
  transform: translateY(-2px);
  border-color: #8bcfa8;
  box-shadow: 0 12px 24px rgba(31, 111, 81, .12);
}

.option-card.selected {
  background: var(--mint);
  border-color: var(--green);
}

.option-card.eliminated {
  background: #fff5f5;
  border-color: #e1a7a7;
  opacity: .82;
}

.option-name {
  display: block;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.25;
  margin-bottom: 8px;
}

.option-intro {
  display: block;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 12px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef8f1;
  color: var(--green-deep);
  font-size: 12px;
  border: 1px solid #d6eadf;
}

.next-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.submit-row {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.winner-hero {
  text-align: center;
  padding: 24px 10px 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.winner-name {
  font-size: clamp(46px, 8vw, 92px);
  font-weight: 950;
  color: var(--green-deep);
  line-height: 1;
  margin: 12px 0;
}

.easter {
  display: inline-block;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff9e9;
  border: 1px solid #efd9a7;
  color: #76531a;
  font-weight: 800;
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: 18px;
  align-items: start;
}

.result-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--paper-soft);
  min-width: 0;
  max-width: 100%;
}

.list-line { line-height: 1.8; color: var(--muted); }
.list-line strong { color: var(--ink); }

.rose-wrap {
  display: grid;
  place-items: center;
  overflow: hidden;
}

#roseCanvas {
  display: block;
  width: min(100%, 360px);
  max-width: 100%;
  height: auto;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.rose-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}

.summary-list {
  padding-left: 18px;
  color: var(--ink);
  line-height: 1.75;
}

.bracket {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}

.round {
  flex: 0 0 180px;
  min-width: 0;
}
.round h3 { color: var(--green-deep); }

.match {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  background: #fff;
}

.match .win { color: var(--green-deep); font-weight: 900; }
.match .lose { color: var(--muted); text-decoration: line-through; margin-top: 4px; }

.qr-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
}

#qrBox canvas, #qrBox img {
  width: 132px !important;
  height: 132px !important;
}

.qr-fallback {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.small { font-size: 13px; color: var(--muted); line-height: 1.6; }

.stats-box {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

@media (max-width: 860px) {
  .shell {
    width: calc(100% - 20px);
    padding: 14px 0 32px;
  }
  .topbar { display: block; }
  .top-actions { justify-content: flex-start; margin-top: 18px; }
  .status-grid, .card-grid, .duel-grid, .top10-grid, .result-grid, .qr-row { grid-template-columns: 1fr; }
  .panel, .topbar { padding: 16px; }
  .option-card { min-height: 0; }
  h1 { font-size: 34px; }
  .winner-name { font-size: clamp(44px, 14vw, 64px); }
  #roseCanvas { width: min(100%, 310px); }
  .section-head { display: block; }
  .result-box { padding: 14px; }
}
