:root {
  --bg: #f6f1e8;
  --paper: rgba(255, 252, 247, 0.9);
  --ink: #1f2a30;
  --muted: #637076;
  --brand: #0e7490;
  --brand-dark: #0b5569;
  --warm: #c76b2d;
  --warm-dark: #9a4f1f;
  --line: rgba(18, 47, 58, 0.12);
  --success: #1f8f62;
  --danger: #be4f37;
  --glow: radial-gradient(circle at top right, rgba(255, 187, 92, 0.32), transparent 30%),
    radial-gradient(circle at left bottom, rgba(14, 116, 144, 0.18), transparent 35%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(14, 116, 144, 0.08), rgba(199, 107, 45, 0.08)),
    var(--glow),
    var(--bg);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-shell,
.screen-shell {
  width: min(1200px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0 40px;
}

.topbar,
.screen-header,
.panel-head,
.group-top,
.action-row,
.mini-grid,
.stats-grid,
.screen-grid,
.admin-grid {
  display: flex;
  gap: 16px;
}

.topbar,
.screen-header,
.panel-head {
  justify-content: space-between;
  align-items: center;
}

.topbar {
  margin-bottom: 22px;
}

.brand {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
}

.hero,
.form-layout,
.admin-grid,
.screen-grid,
.game-grid {
  display: grid;
  gap: 20px;
}

.hero {
  grid-template-columns: 1.15fr 0.95fr;
  align-items: start;
  margin-bottom: 20px;
}

.hero-copy h1,
.intro-card h1,
.auth-card h1 {
  margin: 8px 0 14px;
  font-size: clamp(2rem, 5vw, 3.7rem);
  line-height: 0.95;
}

.hero-copy .lead {
  max-width: 58ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.eyebrow,
.section-tag {
  margin: 0;
  color: var(--brand-dark);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.8rem;
  font-weight: 700;
}

.panel,
.pane,
.user-card,
.screen-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 18px 60px rgba(44, 61, 69, 0.08);
  backdrop-filter: blur(8px);
}

.stats-grid,
.mini-grid {
  margin-top: 18px;
  flex-wrap: wrap;
}

.stat-card,
.mini-grid > div {
  flex: 1 1 150px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(18, 47, 58, 0.08);
}

.stat-card span,
.mini-grid span,
.timeline-item time,
.checkin-item time {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-card strong,
.mini-grid strong,
.group-top strong {
  font-size: 1.6rem;
}

.login-stack {
  display: grid;
  gap: 16px;
}

.qr-pane {
  width: 100%;
}

.qr-login-box {
  min-height: 440px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px dashed rgba(18, 47, 58, 0.18);
  margin-top: 14px;
  padding: 0;
  overflow: hidden;
}

.qr-login-box.disabled-box {
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.qr-loading {
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.qr-widget-root {
  width: 320px;
  height: 420px;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.qr-widget-root iframe {
  border: 0;
  width: 320px;
  height: 420px;
  overflow: hidden;
}

.poster-hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  align-items: center;
}

.poster-qr-wrap {
  display: grid;
  place-items: center;
}

.poster-qr-box {
  width: 320px;
  min-height: 320px;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(255, 255, 255, 0.86);
  border-radius: 24px;
  border: 1px solid rgba(18, 47, 58, 0.12);
}

.pane h2,
.panel h2,
.screen-panel h2 {
  margin: 6px 0 10px;
}

label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.95rem;
  font-weight: 700;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(18, 47, 58, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 800;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 10px 24px rgba(14, 116, 144, 0.24);
}

.btn.warm {
  background: var(--warm);
  color: #fff;
  box-shadow: 0 10px 24px rgba(199, 107, 45, 0.26);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.disabled {
  pointer-events: none;
  opacity: 0.5;
}

.flash-stack {
  margin-bottom: 18px;
}

.flash {
  padding: 12px 16px;
  border-radius: 16px;
  margin-bottom: 10px;
  font-weight: 700;
}

.flash.success {
  background: rgba(31, 143, 98, 0.12);
  color: var(--success);
}

.flash.error {
  background: rgba(190, 79, 55, 0.12);
  color: var(--danger);
}

.timeline,
.group-cards,
.checkin-list,
.leaderboard,
.roster-list,
.action-stack,
.template-actions,
.question-list {
  display: grid;
  gap: 12px;
}

.timeline-item,
.group-card,
.checkin-item,
.board-card,
.roster-item {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(18, 47, 58, 0.08);
}

.roster-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.score-badge {
  display: inline-flex;
  min-width: 56px;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  margin: 6px 0;
  font-weight: 800;
}

.score-badge.plus {
  background: rgba(31, 143, 98, 0.12);
  color: var(--success);
}

.score-badge.minus {
  background: rgba(190, 79, 55, 0.12);
  color: var(--danger);
}

.form-layout {
  grid-template-columns: 0.9fr 1.1fr;
}

.admin-grid {
  grid-template-columns: 1.2fr 0.8fr;
  margin-bottom: 20px;
}

.game-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-top: 20px;
}

.narrow {
  width: min(520px, 100%);
  margin: 0 auto;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(18, 47, 58, 0.08);
  text-align: left;
}

.group-card ul {
  padding-left: 18px;
  margin: 12px 0 0;
}

.panel-subsection {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(18, 47, 58, 0.08);
}

.rule-list {
  margin: 0;
  padding-left: 20px;
}

.rule-list li {
  margin-bottom: 10px;
}

.template-actions {
  margin-top: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.question-card {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(18, 47, 58, 0.08);
}

.question-card summary {
  cursor: pointer;
  font-weight: 700;
}

.game-card h2 {
  margin-bottom: 10px;
}

.compact {
  margin-top: 16px;
}

.muted {
  color: var(--muted);
}

.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
}

.status-pill.pending {
  background: rgba(199, 107, 45, 0.14);
  color: var(--warm-dark);
}

.status-pill.checked_in {
  background: rgba(31, 143, 98, 0.14);
  color: var(--success);
}

.status-pill.absent {
  background: rgba(190, 79, 55, 0.12);
  color: var(--danger);
}

.status-note {
  color: var(--success);
  font-weight: 700;
}

.screen-body {
  background:
    radial-gradient(circle at top left, rgba(255, 187, 92, 0.18), transparent 30%),
    linear-gradient(135deg, #10232f, #173948 60%, #1b4f5b);
  color: #f7f5f0;
}

.screen-shell {
  width: min(1380px, calc(100vw - 40px));
}

.screen-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  color: rgba(247, 245, 240, 0.8);
}

.screen-panel {
  background: rgba(8, 16, 22, 0.24);
  border-color: rgba(255, 255, 255, 0.08);
}

.screen-grid {
  grid-template-columns: 1.1fr 0.9fr;
}

.board-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
}

.board-rank {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  font-weight: 900;
  background: linear-gradient(135deg, #f6b84d, #c76b2d);
  color: #1e1f20;
}

.chip {
  display: inline-block;
  margin: 6px 6px 0 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.empty {
  color: var(--muted);
}

@media (max-width: 920px) {
  .hero,
  .form-layout,
  .admin-grid,
  .screen-grid,
  .game-grid,
  .poster-hero {
    grid-template-columns: 1fr;
  }

  .topbar,
  .screen-header,
  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
