:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #191b20;
  --panel-2: #22252b;
  --line: #343842;
  --text: #f1f2f5;
  --muted: #a9afbd;
  --red: #d85a58;
  --gold: #d3a64d;
  --green: #65b487;
  --blue: #6e9bdc;
  --ink: #111216;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 78% 8%, rgba(211, 166, 77, .2), transparent 26rem),
    linear-gradient(140deg, #101114, #151820 48%, #171411);
  color: var(--text);
}

button {
  border: 0;
  border-radius: 8px;
  padding: .85rem 1rem;
  color: var(--text);
  background: var(--panel-2);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.app {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: .8rem;
  font-weight: 800;
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 8vw, 4rem);
  line-height: 1;
}

h2 {
  font-size: 1rem;
}

.icon-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 1.4rem;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background:
    linear-gradient(110deg, rgba(16,17,20,.96), rgba(31,34,42,.78)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='360' viewBox='0 0 900 360'%3E%3Crect width='900' height='360' fill='%2313151b'/%3E%3Cpath d='M0 286 C130 225 210 266 326 212 C444 157 552 238 661 176 C755 122 822 133 900 87 L900 360 L0 360 Z' fill='%2322262e'/%3E%3Cpath d='M0 322 C158 277 272 315 420 255 C552 202 664 274 900 193 L900 360 L0 360 Z' fill='%231b1d23'/%3E%3Cpath d='M110 232 l22 -70 l22 70 Z M610 194 l29 -94 l30 94 Z M722 171 l23 -75 l23 75 Z' fill='%232d3139'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
}

.moon {
  position: absolute;
  right: 24px;
  top: 22px;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: #edd98a;
  box-shadow: 0 0 34px rgba(237, 217, 138, .35);
}

.status {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.status span, .panel-title span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  background: rgba(16,17,20,.8);
  font-size: .78rem;
  font-weight: 800;
}

#hostLine {
  position: relative;
  width: min(690px, calc(100% - 76px));
  min-height: 58px;
  color: #f7f0dc;
  font-size: clamp(1.3rem, 5vw, 2.4rem);
  font-weight: 900;
  line-height: 1.2;
}

.actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.primary {
  background: var(--gold);
  color: var(--ink);
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
}

.layout {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 14px;
  margin-top: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 27, 32, .94);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  gap: 10px;
}

.identity-panel, .table-panel, .speech-panel {
  overflow: hidden;
}

.role-card {
  margin: 14px;
  border-radius: 8px;
  padding: 22px 16px;
  background: linear-gradient(150deg, #252932, #15171d);
  min-height: 156px;
}

.role-card strong {
  display: block;
  margin-bottom: 12px;
  font-size: 2.1rem;
}

.role-card p, .skill-box, .log, .round-info {
  color: var(--muted);
  line-height: 1.55;
}

.skill-box {
  padding: 0 14px 14px;
  font-size: .92rem;
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.player {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #15171c;
}

.player.dead {
  opacity: .46;
}

.player.you {
  border-color: var(--gold);
}

.player .seat {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: .78rem;
}

.player strong {
  display: block;
  margin: 10px 0 4px;
  font-size: 1.05rem;
}

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

.speech-panel {
  margin-top: 14px;
}

.insight-panel {
  margin-top: 14px;
  overflow: hidden;
}

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

.insight-item {
  min-height: 92px;
  border: 1px solid rgba(52, 56, 66, .8);
  border-radius: 8px;
  padding: 12px;
  background: #15171c;
}

.insight-item b {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: .92rem;
}

.insight-item span {
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.5;
}

.round-info {
  border-bottom: 1px solid rgba(52, 56, 66, .65);
  padding: 10px 14px;
  font-size: .88rem;
  background: rgba(34, 37, 43, .55);
}

.log {
  height: min(44vh, 460px);
  overflow: auto;
  padding: 14px;
}

.entry {
  border-bottom: 1px solid rgba(52, 56, 66, .65);
  padding: 10px 0;
}

.entry:first-child {
  padding-top: 0;
}

.entry b {
  color: var(--text);
}

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

.entry.death b {
  color: var(--red);
}

.entry.info b {
  color: var(--blue);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: end center;
  padding: 16px;
  background: rgba(0, 0, 0, .58);
}

.modal.hidden, .hidden {
  display: none;
}

.modal-card {
  width: min(560px, 100%);
  max-height: 82vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #191b20;
}

.modal-card p {
  margin: 8px 0 12px;
  color: var(--muted);
}

.choice-list, .preset-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.choice-list button, .preset-list button {
  min-height: 54px;
  text-align: left;
}

.preset-list {
  grid-template-columns: 1fr;
  margin-bottom: 10px;
}

.preset-list button {
  color: var(--muted);
  font-weight: 650;
  line-height: 1.45;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 2px 0 10px;
  color: var(--text);
  background: #111319;
  font: inherit;
  line-height: 1.5;
  outline: none;
}

textarea:focus {
  border-color: var(--gold);
}

#submitSpeechBtn {
  width: 100%;
}

#skipBtn {
  width: 100%;
  margin-top: 10px;
}

.wolf {
  color: var(--red);
}

.good {
  color: var(--green);
}

@media (max-width: 760px) {
  .app {
    padding: 12px;
  }

  .hero {
    min-height: 230px;
    padding: 18px;
  }

  .moon {
    width: 52px;
    height: 52px;
  }

  #hostLine {
    width: 100%;
    padding-right: 58px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .players-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .insight-grid {
    grid-template-columns: 1fr;
  }

  .choice-list {
    grid-template-columns: 1fr;
  }
}
