:root {
  --bg-top: #1e2129;
  --bg-bottom: #090a10;
  --panel: linear-gradient(180deg, rgba(83, 111, 130, 0.88) 0%, rgba(44, 57, 72, 0.9) 100%);
  --panel-soft: linear-gradient(180deg, rgba(101, 130, 148, 0.72) 0%, rgba(54, 72, 88, 0.82) 100%);
  --line: rgba(223, 231, 236, 0.34);
  --line-strong: rgba(241, 171, 87, 0.72);
  --text: #f5f2ea;
  --muted: rgba(240, 239, 231, 0.78);
  --accent: #f2a53a;
  --accent-strong: #d98022;
  --danger: #6f7985;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 10%, rgba(235, 184, 94, 0.24), transparent 20%),
    radial-gradient(circle at 82% 88%, rgba(242, 165, 58, 0.12), transparent 16%),
    linear-gradient(180deg, var(--bg-top) 0%, #10131b 38%, var(--bg-bottom) 100%);
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black, transparent 85%);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 0.9rem 1.2rem;
  background: linear-gradient(180deg, rgba(61, 78, 93, 0.98), rgba(38, 47, 59, 0.98));
  color: var(--text);
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease, border-color 0.18s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

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

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

button.primary {
  background: linear-gradient(180deg, #f7b34f, #e08a2d);
  color: #1e1610;
  border-color: rgba(255, 212, 145, 0.58);
}

button.danger {
  background: linear-gradient(180deg, rgba(108, 120, 134, 0.98), rgba(70, 78, 89, 0.98));
  color: white;
}

button.ghost {
  background: linear-gradient(180deg, rgba(68, 82, 95, 0.88), rgba(41, 52, 63, 0.88));
}

input,
select {
  width: 100%;
  padding: 0.86rem 1rem;
  border: 1px solid rgba(232, 239, 244, 0.28);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(28, 38, 48, 0.98), rgba(17, 25, 33, 0.98));
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

select {
  color-scheme: dark;
}

select option,
select optgroup {
  color: #1d2430;
  background: #f3efe8;
}

input::placeholder {
  color: rgba(240, 239, 231, 0.38);
}

label span,
.hint,
.eyebrow {
  color: var(--muted);
  font-size: 0.9rem;
}

.eyebrow {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: #f4c174;
}

.page-shell {
  width: min(1120px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 24px 0 42px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}

.hero h1,
.entry-card h2,
.session-banner h2,
.panel-head h3 {
  margin: 0;
}

.hero h1,
.session-banner h2,
.entry-card h2 {
  font-family: "STZhongsong", "Noto Serif SC", serif;
  letter-spacing: 0.02em;
}

.hero h1 {
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  line-height: 0.98;
}

.subcopy {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 720px;
  line-height: 1.7;
}

.message {
  display: block;
  width: 100%;
  min-height: 56px;
  margin: 0 0 18px;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(79, 96, 110, 0.86), rgba(48, 58, 70, 0.86));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow);
}

.message:empty {
  display: none;
}

.message.error {
  border-color: rgba(231, 134, 96, 0.3);
  color: #ffd2c0;
}

.message.success {
  border-color: rgba(244, 193, 116, 0.3);
  color: #ffe6bc;
}

.card {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 28px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: rise-in 0.45s ease both;
}

.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.entry-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.9fr);
  gap: 20px;
}

.entry-card {
  padding: 28px;
}

.entry-intro {
  min-height: 280px;
}

.entry-form-card {
  align-self: start;
}

.feature-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.feature-pill,
.panel-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(247, 191, 111, 0.4);
  background: linear-gradient(180deg, rgba(244, 183, 94, 0.9), rgba(202, 124, 39, 0.88));
  color: #20140b;
  font-weight: 700;
}

.panel-badge-ghost,
.panel-badge-muted {
  background: linear-gradient(180deg, rgba(87, 103, 115, 0.88), rgba(62, 73, 84, 0.88));
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--text);
}

.grid.two-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0;
}

.entry-actions,
.controls-row,
.section-title-row,
.panel-head,
.panel-head-inline,
.panel-head-spread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head {
  margin-bottom: 16px;
}

.panel-head-inline {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.room-session {
  display: grid;
  gap: 18px;
}

.session-banner,
.roster-card,
.dice-card,
.action-card,
.state-card {
  padding: 18px 20px 20px;
}

.session-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 190px;
}

.session-banner h2 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1;
  margin-top: 10px;
}

.session-subcopy {
  margin: 14px 0 0;
  font-size: 1.02rem;
  color: var(--muted);
}

.room-chip-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.room-chip-value {
  display: inline-flex;
  min-width: 74px;
  justify-content: center;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(244, 183, 94, 0.9), rgba(202, 124, 39, 0.88));
  color: #22160c;
  border: 1px solid rgba(255, 239, 206, 0.35);
}

.room-chip-label {
  color: var(--text);
}

.session-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) 320px;
  gap: 14px;
  align-items: start;
}

.side-stack {
  display: grid;
  gap: 14px;
}

.state-card {
  grid-column: 1 / -1;
  margin-top: -2px;
}

.roster-card {
  min-height: 280px;
}

.player-list {
  margin: 0;
}

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

.player-card {
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 194, 112, 0.7);
  background: linear-gradient(180deg, rgba(96, 131, 155, 0.18), rgba(46, 56, 68, 0.3));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.player-card.is-active {
  border-color: rgba(255, 187, 98, 0.98);
  box-shadow: 0 0 0 1px rgba(255, 187, 98, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.player-card.is-eliminated {
  opacity: 0.62;
}

.player-card strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.player-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  color: #ffd989;
  font-size: 0.88rem;
}

.player-note,
.player-bid-line,
.player-dice-line,
.action-help,
.round-summary,
.mode-description {
  color: var(--text);
  line-height: 1.55;
}

.player-note {
  margin-bottom: 6px;
  color: #ffea9f;
  font-weight: 600;
}

.player-bid-line {
  margin-bottom: 6px;
  color: #ffd38b;
  font-weight: 700;
}

.player-dice-line {
  color: rgba(245, 242, 234, 0.88);
}

.player-card-actions {
  margin-top: 12px;
}

.player-card-kick {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 14px;
}

.team-board {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: start;
}

.team-column {
  display: grid;
  gap: 14px;
}

.team-title {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 18px;
  border: 1px solid rgba(255, 194, 112, 0.65);
  background: linear-gradient(180deg, rgba(113, 93, 98, 0.72), rgba(98, 84, 88, 0.72));
  font-weight: 700;
  color: #ffdc92;
}

.team-stack {
  display: grid;
  gap: 14px;
}

.versus-mark {
  align-self: center;
  font-size: 2rem;
  font-weight: 800;
  color: #ffdd9b;
}

.history-panel {
  min-height: 252px;
  max-height: 252px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  padding: 8px;
  background: linear-gradient(180deg, rgba(67, 84, 98, 0.64), rgba(31, 40, 50, 0.66));
}

.history-item {
  padding: 0.44rem 0.68rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(86, 107, 124, 0.34), rgba(47, 58, 70, 0.44));
  line-height: 1.28;
}

.history-item + .history-item {
  margin-top: 6px;
}

.history-item-latest {
  border-color: rgba(255, 194, 112, 0.75);
  background: linear-gradient(180deg, rgba(132, 97, 77, 0.52), rgba(100, 70, 53, 0.44));
}

.dice-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 0;
  min-height: 62px;
}

.die {
  aspect-ratio: 1;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(65, 88, 104, 0.98), rgba(41, 52, 63, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09);
}

.dice-empty {
  grid-column: 1 / -1;
  min-height: 56px;
  display: flex;
  align-items: center;
  color: var(--muted);
  line-height: 1.6;
}

.reveal-panel {
  margin: 12px 0;
  border: 1px solid rgba(244, 183, 94, 0.28);
  background: linear-gradient(180deg, rgba(111, 86, 68, 0.6), rgba(73, 55, 42, 0.5));
  border-radius: 18px;
  padding: 16px;
}

.reveal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.reveal-card {
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.mode-card {
  padding: 12px 14px;
  border-radius: 20px;
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.bid-row {
  align-items: end;
}

.compact-row {
  gap: 10px;
}

.compact-divider {
  height: 1px;
  margin: 10px 0 12px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
}

.action-card-merged .panel-head {
  margin-bottom: 10px;
}

.action-card-merged .controls-row {
  margin-top: 10px;
}

.owner-badge {
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  background: rgba(244, 183, 94, 0.16);
  color: #ffd98c;
  border: 1px solid rgba(244, 183, 94, 0.25);
}

.session-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.round-summary,
.mode-description,
.action-help {
  margin: 10px 0 0;
  font-size: 0.94rem;
}

.section-title-row {
  margin: 10px 0 6px;
}

.section-title-row h3,
.panel-head h3 {
  margin: 0;
}

.status-sr-only {
  display: none;
}

.hidden {
  display: none !important;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .hero,
  .entry-layout,
  .session-banner,
  .session-grid,
  .team-board,
  .grid.two-cols,
  .controls-row,
  .section-title-row,
  .panel-head,
  .panel-head-spread {
    flex-direction: column;
    align-items: stretch;
  }

  .session-grid,
  .entry-layout,
  .team-board,
  .grid.two-cols,
  .player-grid {
    grid-template-columns: 1fr;
  }

  .versus-mark {
    justify-self: center;
  }

  .dice-grid {
    grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  }

  .page-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 18px;
  }
}