:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #17140f;
  color: #f5eddb;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% -10%, rgba(183, 125, 54, 0.2), transparent 34rem),
    radial-gradient(circle at 95% 15%, rgba(82, 101, 74, 0.2), transparent 28rem),
    #17140f;
}

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

button {
  cursor: pointer;
}

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

.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 48px) 56px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sigil {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(238, 196, 119, 0.45);
  border-radius: 50%;
  background: rgba(238, 196, 119, 0.08);
  color: #eec477;
  font-family: Georgia, serif;
  font-size: 24px;
}

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

h1,
h2,
h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

h1 {
  margin-bottom: 2px;
  font-size: clamp(24px, 4vw, 34px);
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(25px, 4vw, 38px);
}

h3 {
  margin-bottom: 12px;
  font-size: 20px;
}

.eyebrow {
  margin-bottom: 8px;
  color: #eec477;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.muted {
  color: #b9b09f;
}

.small {
  font-size: 13px;
}

.hero {
  max-width: 680px;
  margin: 36px 0 28px;
}

.hero p {
  max-width: 600px;
  color: #cfc5b1;
  font-size: 17px;
  line-height: 1.65;
}

.panel {
  border: 1px solid rgba(239, 224, 194, 0.13);
  border-radius: 18px;
  background: rgba(35, 31, 24, 0.88);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.22);
}

.panel-body {
  padding: clamp(18px, 4vw, 30px);
}

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

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

label,
.label {
  color: #d8cdb8;
  font-size: 13px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(239, 224, 194, 0.17);
  border-radius: 10px;
  outline: none;
  background: #18150f;
  color: #fff8e9;
  padding: 10px 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #dba856;
  box-shadow: 0 0 0 3px rgba(219, 168, 86, 0.16);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
}

.button {
  min-height: 44px;
  border: 1px solid rgba(239, 224, 194, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: #f5eddb;
  padding: 10px 16px;
  font-weight: 700;
}

.button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
}

.button.primary {
  border-color: #dba856;
  background: #dba856;
  color: #1b160e;
}

.button.primary:hover:not(:disabled) {
  background: #edbd70;
}

.button.danger {
  color: #f0aaa0;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 20px;
  align-items: start;
}

.session-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.code {
  color: #eec477;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 800;
  letter-spacing: 0.12em;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  background: rgba(238, 196, 119, 0.09);
  color: #eec477;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 700;
}

.status.started {
  background: rgba(100, 175, 118, 0.13);
  color: #92d39d;
}

.player-list,
.audio-list,
.character-list {
  display: grid;
  gap: 10px;
}

.player-card,
.audio-card,
.character-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(239, 224, 194, 0.11);
  border-radius: 12px;
  background: rgba(13, 12, 9, 0.25);
  padding: 12px;
}

.player-card.talking {
  border-color: #dba856;
  box-shadow: inset 0 0 0 1px rgba(219, 168, 86, 0.35);
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: #393126;
  color: #eec477;
  font-family: Georgia, serif;
  font-size: 19px;
}

.player-info {
  min-width: 0;
  flex: 1;
}

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

.player-info span {
  margin-top: 3px;
  color: #a9a08f;
  font-size: 13px;
}

.checks {
  display: flex;
  gap: 6px;
}

.check {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #827a6d;
  font-size: 12px;
}

.check.ok {
  background: rgba(100, 175, 118, 0.15);
  color: #92d39d;
}

.qr-wrap {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.qr-wrap img {
  width: min(280px, 100%);
  border-radius: 14px;
  background: white;
  padding: 10px;
}

.join-link {
  width: 100%;
  overflow-wrap: anywhere;
  color: #b9b09f;
  font-size: 12px;
}

.notice,
.error {
  margin: 14px 0 0;
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 14px;
  line-height: 1.5;
}

.notice {
  background: rgba(100, 175, 118, 0.1);
  color: #b8dfbf;
}

.error {
  background: rgba(189, 75, 65, 0.12);
  color: #f0aaa0;
}

.empty {
  border: 1px dashed rgba(239, 224, 194, 0.14);
  border-radius: 12px;
  color: #918879;
  padding: 22px;
  text-align: center;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.character-option {
  position: relative;
}

.character-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.character-option label {
  display: grid;
  min-height: 104px;
  align-content: center;
  border: 1px solid rgba(239, 224, 194, 0.13);
  border-radius: 12px;
  background: rgba(13, 12, 9, 0.25);
  padding: 14px;
  cursor: pointer;
}

.character-option label strong {
  color: #f5eddb;
  font-family: Georgia, serif;
  font-size: 18px;
}

.character-option label span {
  margin-top: 4px;
  color: #a9a08f;
  font-size: 13px;
}

.character-option input:checked + label {
  border-color: #dba856;
  background: rgba(219, 168, 86, 0.09);
  box-shadow: inset 0 0 0 1px rgba(219, 168, 86, 0.3);
}

.character-option input:disabled + label {
  cursor: not-allowed;
  opacity: 0.38;
}

.mobile-shell {
  width: min(580px, 100%);
  margin: 0 auto;
  padding: 18px 14px max(34px, env(safe-area-inset-bottom));
}

.mobile-shell .brand {
  margin-bottom: 22px;
}

.player-hero {
  padding: 20px;
}

.player-hero .avatar {
  width: 58px;
  height: 58px;
  font-size: 25px;
}

.mic-block {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.mic-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.mic-meter span {
  display: block;
  width: var(--level, 0%);
  height: 100%;
  background: #dba856;
  transition: width 80ms linear;
}

.push-to-talk {
  display: grid;
  width: min(230px, 70vw);
  height: min(230px, 70vw);
  margin: 24px auto 12px;
  place-items: center;
  border: 2px solid rgba(238, 196, 119, 0.52);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #e9bd6c, #b87f36);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.34), inset 0 1px rgba(255, 255, 255, 0.35);
  color: #1a140c;
  padding: 34px;
  text-align: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.push-to-talk strong,
.push-to-talk span {
  display: block;
}

.push-to-talk strong {
  font-size: 19px;
}

.push-to-talk span {
  margin-top: 7px;
  font-size: 12px;
  opacity: 0.72;
}

.push-to-talk.recording {
  transform: scale(0.97);
  border-color: #f3d093;
  background: radial-gradient(circle at 40% 30%, #f4d394, #d48e38);
  box-shadow: 0 0 0 9px rgba(219, 168, 86, 0.12), 0 18px 50px rgba(0, 0, 0, 0.34);
}

.center {
  text-align: center;
}

.audio-card .button {
  min-height: 36px;
  padding: 6px 12px;
}

.game-panel,
.mobile-timeline {
  margin-top: 20px;
}

.timeline-heading,
.timeline-meta,
.narration-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.timeline-heading h3,
.timeline-heading .eyebrow {
  margin-bottom: 0;
}

.narrative-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #b9b09f;
  font-size: 12px;
  font-weight: 700;
}

.narrative-status > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #73917b;
}

.narrative-status.busy {
  color: #eec477;
}

.narrative-status.busy > span {
  background: #eec477;
  box-shadow: 0 0 0 5px rgba(238, 196, 119, 0.09);
  animation: pulse 1.3s ease-in-out infinite;
}

.timeline {
  display: grid;
  max-height: 520px;
  gap: 12px;
  margin-top: 20px;
  overflow-y: auto;
  padding-right: 4px;
}

.timeline-entry {
  max-width: 86%;
  border: 1px solid rgba(239, 224, 194, 0.1);
  border-radius: 14px;
  background: rgba(12, 11, 8, 0.3);
  padding: 14px 16px;
}

.timeline-entry.player-action {
  justify-self: end;
  border-color: rgba(219, 168, 86, 0.25);
  background: rgba(219, 168, 86, 0.08);
}

.timeline-meta {
  margin-bottom: 7px;
  color: #eec477;
  font-size: 12px;
}

.timeline-meta span {
  color: #8f8779;
  font-weight: 600;
}

.timeline-entry p {
  margin-bottom: 0;
  color: #ded4c1;
  line-height: 1.55;
  white-space: pre-wrap;
}

.narration-controls,
.narration-disclosure {
  margin-top: 18px;
}

.text-action {
  margin-top: 20px;
}

.text-action .panel-body {
  display: grid;
  gap: 12px;
}

.text-action textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
}

.text-action .button {
  justify-self: start;
}

.text-action p {
  margin-bottom: 0;
}

@keyframes pulse {
  50% {
    opacity: 0.5;
    transform: scale(0.82);
  }
}

@media (max-width: 760px) {
  .shell {
    padding-top: 18px;
  }

  .grid,
  .split {
    grid-template-columns: 1fr;
  }

  .field.full {
    grid-column: auto;
  }

  .hero {
    margin-top: 22px;
  }

  .timeline-heading,
  .narration-controls {
    align-items: flex-start;
    flex-direction: column;
  }

  .timeline {
    max-height: 440px;
  }

  .timeline-entry {
    max-width: 95%;
  }
}
