:root {
  color-scheme: dark;
  --bg: #03070d;
  --panel: rgba(9, 25, 43, 0.86);
  --panel-strong: rgba(12, 35, 61, 0.94);
  --line: rgba(123, 188, 255, 0.22);
  --line-strong: rgba(135, 207, 255, 0.56);
  --text: #edf6ff;
  --muted: #91a8c2;
  --blue: #2778ff;
  --cyan: #48d5ff;
  --green: #45d483;
  --amber: #ffd166;
  --red: #ff6b6b;
  --violet: #a78bfa;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(25, 75, 132, 0.18) 0 1px, transparent 1px 58px),
    linear-gradient(225deg, rgba(39, 120, 255, 0.16) 0 1px, transparent 1px 66px),
    linear-gradient(180deg, #02050b 0%, #07111f 48%, #020608 100%);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  cursor: pointer;
}

input {
  width: 100%;
  border: 1px solid rgba(128, 179, 237, 0.22);
  border-radius: var(--radius);
  background: rgba(2, 10, 20, 0.65);
  color: var(--text);
  min-height: 48px;
  padding: 0 14px;
  outline: none;
}

input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(72, 213, 255, 0.14);
}

.app-shell {
  width: min(100%, 460px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 12px max(18px, env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(5, 14, 28, 0.36), rgba(1, 5, 10, 0.82)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.024) 0 1px, transparent 1px 28px);
}

.hero-screen {
  min-height: calc(100svh - 30px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

.hero-art {
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.hero-art img {
  width: min(250px, 68vw);
  filter: drop-shadow(0 22px 35px rgba(36, 135, 255, 0.34));
}

.hero-copy {
  text-align: center;
}

.eyebrow,
.section-label {
  margin: 0 0 8px;
  color: #8fdcff;
  font-size: 13px;
  letter-spacing: 0;
}

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

.hero-copy h1 {
  margin: 0;
  font-size: clamp(42px, 13vw, 64px);
  line-height: 1.05;
  letter-spacing: 0;
  text-shadow: 0 10px 32px rgba(74, 156, 255, 0.38);
}

.entry-card,
.room-panel,
.identity-board,
.market-card,
.action-card,
.vote-panel,
.review-card,
.poster-card,
.ranking-card,
.player-panel,
.tamper-box,
.role-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
}

.entry-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

label span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.split-actions,
.host-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary,
.secondary,
.hold-button {
  min-height: 54px;
  border-radius: var(--radius);
  font-weight: 800;
}

.primary {
  background: linear-gradient(180deg, #2f85ff, #1858df);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 14px 30px rgba(23, 96, 232, 0.26);
}

.secondary {
  border: 1px solid rgba(142, 190, 255, 0.24);
  background: rgba(14, 31, 52, 0.82);
}

.hold-button {
  width: 100%;
  margin-top: 12px;
  border: 1px solid rgba(145, 168, 194, 0.28);
  background: rgba(8, 20, 34, 0.86);
}

.rule-dock {
  color: var(--muted);
  font-size: 14px;
  padding: 0 6px;
}

.rule-dock summary {
  text-align: center;
  color: #b9d7ff;
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 42px 1fr 64px;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  margin: -12px -12px 12px;
  padding: max(10px, env(safe-area-inset-top)) 12px 8px;
  background: rgba(2, 7, 14, 0.86);
  border-bottom: 1px solid rgba(116, 188, 255, 0.14);
  backdrop-filter: blur(18px);
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  font-size: 26px;
  line-height: 1;
}

.topbar-title {
  min-width: 0;
  text-align: center;
}

.topbar-title strong,
.topbar-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-title span {
  color: var(--muted);
  font-size: 12px;
}

.timer-pill {
  min-width: 56px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(39, 120, 255, 0.18);
  color: #b9d7ff;
  text-align: center;
  font-weight: 800;
}

.timer-pill.urgent {
  color: #fff;
  background: rgba(255, 107, 107, 0.28);
}

.room-panel,
.identity-board,
.market-card,
.action-card,
.vote-panel,
.review-card,
.poster-card,
.ranking-card,
.player-panel,
.role-card,
.tamper-box {
  padding: 14px;
  margin-bottom: 12px;
}

.room-code {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(39, 120, 255, 0.14);
  border: 1px solid rgba(72, 150, 255, 0.22);
}

.room-code span,
.meta-line,
.quiet-tip,
.waiting-copy {
  color: var(--muted);
}

.room-code strong {
  font-size: 30px;
  letter-spacing: 0;
}

.mini-copy {
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius);
  background: rgba(72, 213, 255, 0.18);
  color: #c9efff;
}

.meta-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 2px;
  font-size: 13px;
}

.player-stack {
  display: grid;
  gap: 8px;
}

.player-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 7px;
  border: 1px solid rgba(137, 180, 230, 0.12);
  border-radius: var(--radius);
  background: rgba(5, 16, 28, 0.7);
}

.player-row.self {
  border-color: rgba(72, 213, 255, 0.42);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  color: #fff;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #1b3659;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.gold { background: linear-gradient(135deg, #704b19, #d9a441); }
.avatar.blue { background: linear-gradient(135deg, #173774, #3b82f6); }
.avatar.cyan { background: linear-gradient(135deg, #075667, #22d3ee); }
.avatar.green { background: linear-gradient(135deg, #0d5f3b, #34d399); }
.avatar.violet { background: linear-gradient(135deg, #37226e, #a78bfa); }
.avatar.red { background: linear-gradient(135deg, #6f1d1b, #ff6b6b); }
.avatar.steel { background: linear-gradient(135deg, #263543, #94a3b8); }
.avatar.lime { background: linear-gradient(135deg, #365314, #84cc16); }
.avatar.amber { background: linear-gradient(135deg, #78350f, #f59e0b); }
.avatar.rose { background: linear-gradient(135deg, #831843, #fb7185); }
.avatar.mint { background: linear-gradient(135deg, #115e59, #5eead4); }
.avatar.indigo { background: linear-gradient(135deg, #312e81, #818cf8); }

.player-main {
  min-width: 0;
}

.player-main strong,
.player-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-tag {
  color: #b7cef0;
  font-size: 12px;
}

.role-tag.muted {
  color: #6f8299;
}

.player-status {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.player-status.done {
  color: var(--green);
}

.host-actions {
  margin-top: 14px;
}

.identity-board h2,
.player-panel h2,
.ranking-card h2,
.tamper-box h2 {
  margin-bottom: 12px;
  font-size: 18px;
}

.role-list {
  display: grid;
  gap: 8px;
}

.role-mini {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(124, 205, 255, 0.16);
  background: rgba(3, 14, 27, 0.72);
}

.role-mini img {
  width: 52px;
  height: 52px;
}

.role-mini strong {
  display: block;
  margin-bottom: 4px;
}

.role-mini small {
  color: var(--muted);
  font-size: 12px;
}

.role-mini p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.role-card.large {
  min-height: calc(100svh - 88px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-color: var(--line-strong);
}

.role-card.danger {
  border-color: rgba(255, 107, 107, 0.56);
}

.role-portrait {
  width: 140px;
  height: 140px;
  margin-bottom: 10px;
  filter: drop-shadow(0 16px 30px rgba(36, 135, 255, 0.28));
}

.role-card h1 {
  margin-bottom: 8px;
  font-size: 31px;
}

.camp-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(72, 213, 255, 0.12);
  color: #c9efff;
  font-weight: 700;
}

.role-copy {
  width: 100%;
  margin-top: 18px;
  text-align: left;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(4, 15, 28, 0.72);
}

.role-copy h2 {
  margin: 0 0 6px;
  font-size: 16px;
  color: #9fd8ff;
}

.role-copy p,
.teammates,
.review-card p {
  color: var(--muted);
  line-height: 1.6;
}

.teammates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.teammates span,
.teammates strong {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 107, 107, 0.14);
}

.market-card {
  background: linear-gradient(180deg, rgba(13, 35, 61, 0.92), rgba(5, 16, 29, 0.9));
}

.card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.card-title span {
  color: #9fd8ff;
  font-weight: 800;
}

.card-title strong.up {
  color: var(--amber);
}

.card-title strong.down {
  color: var(--green);
}

.bulletin {
  margin-bottom: 12px;
  color: #d7e9ff;
  line-height: 1.55;
}

.market-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.market-grid div {
  min-height: 66px;
  padding: 10px;
  border: 1px solid rgba(133, 186, 245, 0.12);
  border-radius: var(--radius);
  background: rgba(1, 9, 18, 0.5);
}

.market-grid span,
.market-grid strong {
  display: block;
}

.market-grid span {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.market-grid strong {
  font-size: 14px;
}

.split-market {
  display: grid;
  gap: 12px;
}

.choice-list {
  display: grid;
  gap: 9px;
}

.choice,
.suspect-button {
  width: 100%;
  min-height: 62px;
  padding: 11px;
  border: 1px solid rgba(128, 179, 237, 0.18);
  border-radius: var(--radius);
  background: rgba(5, 17, 30, 0.78);
  text-align: left;
}

.choice.danger {
  border-color: rgba(255, 107, 107, 0.22);
}

.choice span,
.choice small {
  display: block;
}

.choice span {
  font-weight: 800;
}

.choice small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.trade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.trade-button {
  min-height: 86px;
  padding: 10px 6px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 27, 45, 0.92);
}

.trade-button strong,
.trade-button span {
  display: block;
}

.trade-button strong {
  font-size: 15px;
}

.trade-button span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.trade-button.buy {
  border-color: rgba(255, 209, 102, 0.28);
}

.trade-button.sell {
  border-color: rgba(69, 212, 131, 0.28);
}

.trade-button.selected {
  outline: 2px solid var(--cyan);
}

.vote-panel h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.vote-panel p {
  color: var(--muted);
}

.suspect-button {
  display: grid;
  grid-template-columns: 44px 1fr auto 24px;
  align-items: center;
  gap: 10px;
}

.suspect-button strong,
.suspect-button small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suspect-button small {
  color: var(--muted);
}

.suspect-button i {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(172, 205, 244, 0.44);
  border-radius: 50%;
}

.review-card {
  text-align: center;
}

.review-card h1 {
  margin-bottom: 10px;
  font-size: 32px;
}

.review-card.hit {
  border-color: rgba(69, 212, 131, 0.42);
}

.review-card.miss {
  border-color: rgba(255, 209, 102, 0.34);
}

.score-flash {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(72, 213, 255, 0.12);
  font-size: 22px;
  font-weight: 900;
}

.danger-text {
  color: #ffb4b4;
}

.end-hero {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 12px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(24, 78, 138, 0.26), rgba(9, 24, 42, 0.84)),
    url("/assets/logo.svg") center/170px no-repeat;
}

.end-hero h1 {
  margin: 0 0 8px;
  font-size: 36px;
  color: #ffe8a3;
}

.poster-card canvas {
  display: block;
  width: 100%;
  aspect-ratio: 45 / 64;
  border-radius: var(--radius);
  border: 1px solid rgba(124, 205, 255, 0.2);
  background: #07111f;
}

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

.rank-row {
  display: grid;
  grid-template-columns: 30px 42px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(128, 179, 237, 0.12);
}

.rank-row.self {
  color: #dff6ff;
}

.rank-row span {
  color: var(--muted);
  font-weight: 900;
}

.rank-row strong,
.rank-row small {
  display: block;
}

.rank-row small {
  color: var(--muted);
  font-size: 12px;
}

.rank-row b {
  color: var(--green);
  white-space: nowrap;
}

.full {
  width: 100%;
  margin-top: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 20;
  transform: translate(-50%, 20px);
  max-width: min(360px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(7, 16, 27, 0.96);
  border: 1px solid rgba(128, 179, 237, 0.24);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast[data-type="error"] {
  border-color: rgba(255, 107, 107, 0.38);
}

@media (min-width: 820px) {
  .app-shell {
    margin-top: 24px;
    margin-bottom: 24px;
    min-height: calc(100svh - 48px);
    border: 1px solid rgba(137, 180, 230, 0.18);
    border-radius: 24px;
    overflow: hidden;
  }
}
