:root {
  --bg: #090a0d;
  --panel: rgba(17, 18, 22, 0.94);
  --panel-2: rgba(25, 26, 31, 0.92);
  --line: rgba(214, 182, 105, 0.25);
  --gold: #d7b66d;
  --gold-2: #8f7140;
  --red: #9d2028;
  --red-2: #4b1015;
  --blue: #8aa6be;
  --text: #f2eee4;
  --muted: #a9a197;
  --dead: #56565d;
  --good: #78a6c8;
  --evil: #c55a5f;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 30%, rgba(130, 18, 24, 0.16), transparent 30%),
    linear-gradient(135deg, #06070a 0%, #111016 45%, #07080b 100%);
  overflow: hidden;
}

button,
select,
textarea {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid rgba(215, 182, 109, 0.34);
  color: var(--text);
  background: linear-gradient(180deg, rgba(59, 45, 30, 0.92), rgba(26, 20, 18, 0.96));
  border-radius: 6px;
  padding: 0 12px;
  cursor: pointer;
}

button:hover {
  border-color: rgba(215, 182, 109, 0.75);
  box-shadow: 0 0 0 2px rgba(215, 182, 109, 0.08);
}

button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

select,
textarea {
  width: 100%;
  border: 1px solid rgba(215, 182, 109, 0.22);
  border-radius: 6px;
  color: var(--text);
  background: rgba(9, 10, 13, 0.76);
  padding: 9px 10px;
}

textarea {
  resize: none;
  line-height: 1.45;
}

.shell {
  display: grid;
  grid-template-columns: 300px minmax(560px, 1fr) 340px;
  gap: 14px;
  height: 100vh;
  padding: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
  overflow: hidden;
}

.left-panel,
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  min-height: 0;
}

.left-panel {
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(215, 182, 109, 0.18);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(215, 182, 109, 0.55);
  border-radius: 50%;
  color: var(--gold);
  background: rgba(93, 24, 28, 0.36);
  font-weight: 700;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.control-group {
  display: grid;
  gap: 8px;
}

.level-info,
.data-summary {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(215, 182, 109, 0.14);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  padding: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.level-info strong {
  color: var(--gold);
}

.control-group label,
.section-title {
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
}

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

.inline-row {
  display: grid;
  grid-template-columns: 1fr 76px;
  gap: 8px;
}

.primary-btn {
  background: linear-gradient(180deg, #95242b, #481015);
  border-color: rgba(225, 115, 98, 0.5);
}

.ghost-btn {
  min-height: 30px;
  padding: 0 9px;
  background: rgba(255, 255, 255, 0.04);
}

.badge {
  border: 1px solid rgba(215, 182, 109, 0.24);
  border-radius: 999px;
  color: var(--muted);
  padding: 3px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.identity-box {
  display: grid;
  gap: 8px;
}

.player-card {
  width: 100%;
  height: clamp(220px, 34vh, 360px);
  object-fit: cover;
  border: 1px solid rgba(215, 182, 109, 0.3);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
}

.identity-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.identity-meta strong {
  color: var(--text);
}

.vote-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.vote-chip {
  min-height: 34px;
  padding: 0;
}

.vote-chip.selected {
  background: linear-gradient(180deg, #9d2028, #4b1015);
  border-color: rgba(255, 154, 124, 0.7);
}

.game-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 9, 12, 0.9);
  overflow: hidden;
}

.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(215, 182, 109, 0.16);
  background: rgba(8, 9, 12, 0.78);
}

.phase-label {
  color: var(--gold);
  font-weight: 800;
  font-size: 18px;
}

.day-label {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.table-wrap {
  position: absolute;
  inset: 72px 0 0;
  overflow: hidden;
}

.table-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.86) contrast(1.06) brightness(0.74);
}

.table-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 48%, transparent 0 34%, rgba(3, 4, 6, 0.2) 48%, rgba(3, 4, 6, 0.82) 82%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.5));
}

.seats-layer {
  position: absolute;
  inset: 0;
}

.seat {
  position: absolute;
  width: 122px;
  min-height: 164px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(215, 182, 109, 0.28);
  border-radius: 8px;
  background: rgba(10, 11, 14, 0.82);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.38);
  overflow: hidden;
}

.seat.player {
  border-color: rgba(215, 182, 109, 0.78);
  box-shadow: 0 0 0 2px rgba(215, 182, 109, 0.14), 0 14px 28px rgba(0, 0, 0, 0.38);
}

.seat.dead {
  filter: grayscale(1) brightness(0.58);
}

.seat-avatar {
  width: 100%;
  height: 104px;
  object-fit: cover;
  display: block;
}

.seat-info {
  padding: 8px;
  display: grid;
  gap: 4px;
}

.seat-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 12px;
}

.seat-title strong {
  font-size: 13px;
}

.seat-role {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-status {
  color: var(--blue);
  font-size: 12px;
}

.seat.dead .seat-status {
  color: var(--dead);
}

.center-status {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: min(280px, 34vw);
  aspect-ratio: 1;
  border: 1px solid rgba(215, 182, 109, 0.28);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(64, 16, 20, 0.5), rgba(4, 5, 7, 0.28) 64%, transparent 70%);
  text-align: center;
  color: var(--muted);
}

.center-status strong {
  color: var(--text);
  font-size: 18px;
}

.log-list,
.status-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  min-height: 0;
}

.right-panel section:first-child {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.log-item,
.status-item {
  border: 1px solid rgba(215, 182, 109, 0.14);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  padding: 9px;
}

.log-item {
  color: #d9d2c4;
  font-size: 13px;
  line-height: 1.45;
}

.log-item strong {
  color: var(--gold);
}

.status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.status-item.alive b {
  color: var(--good);
}

.status-item.dead b {
  color: var(--dead);
}

.data-panel {
  flex: none;
}

.metric {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.metric b {
  color: var(--gold);
}

.review-dialog {
  width: min(900px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  border: 1px solid rgba(215, 182, 109, 0.38);
  border-radius: 8px;
  color: var(--text);
  background: #101116;
  padding: 0;
}

.review-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.review-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(215, 182, 109, 0.18);
}

.review-head h2 {
  margin: 0;
  font-size: 18px;
}

.review-content {
  padding: 16px;
  overflow: auto;
  max-height: calc(min(720px, 100vh - 32px) - 68px);
  display: grid;
  gap: 12px;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  min-width: 240px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid rgba(215, 182, 109, 0.4);
  border-radius: 999px;
  color: var(--text);
  background: rgba(19, 15, 14, 0.94);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.44);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.toast.show {
  opacity: 1;
}

.ai-model-note {
  position: fixed;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  z-index: 4;
  color: rgba(242, 238, 228, 0.5);
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0;
  pointer-events: none;
  white-space: nowrap;
  text-align: center;
}

@media (max-width: 1120px) {
  body {
    overflow: auto;
  }

  .shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  .game-stage {
    min-height: 720px;
  }

  .table-wrap {
    min-height: 648px;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 8px;
    gap: 8px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-wrap {
    top: 120px;
  }

  .seat {
    width: 96px;
    min-height: 138px;
  }

  .seat-avatar {
    height: 80px;
  }
}
