:root {
  --bg: #f3efe5;
  --bg-alt: #e2d7c2;
  --panel: rgba(255, 250, 241, 0.92);
  --ink: #201814;
  --ink-soft: #6f6259;
  --line: rgba(32, 24, 20, 0.12);
  --accent: #9d4126;
  --accent-deep: #6e2410;
  --good: #2b6a4f;
  --evil: #8b1e2e;
  --shadow: 0 20px 40px rgba(79, 50, 25, 0.12);
  --radius: 22px;
  --font-body: "Segoe UI Variable", "Aptos", "Noto Sans SC", sans-serif;
  --font-display: "Georgia", "Times New Roman", "STSong", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(200, 148, 55, 0.25), transparent 40%),
    linear-gradient(180deg, var(--bg) 0%, #f7f2e9 55%, #efe3d0 100%);
  color: var(--ink);
  font-family: var(--font-body);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(157, 65, 38, 0.06), transparent 45%),
    repeating-linear-gradient(90deg, rgba(111, 98, 89, 0.02), rgba(111, 98, 89, 0.02) 1px, transparent 1px, transparent 24px);
}

a {
  color: inherit;
  text-decoration: none;
}

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

[hidden] {
  display: none !important;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1100px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.hero-header {
  align-items: stretch;
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--accent);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  margin: 0;
}

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

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.15rem;
}

p {
  line-height: 1.55;
}

.lead {
  max-width: 62ch;
  color: var(--ink-soft);
  margin: 14px 0 0;
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 14px;
  width: min(360px, 100%);
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  margin-bottom: 18px;
}

.panel.compact {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-height: 104px;
}

.label,
.muted {
  color: var(--ink-soft);
}

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

.room-layout > .panel:nth-child(1),
.room-layout > .panel:nth-child(4),
.room-layout > .panel:nth-child(5) {
  grid-column: 1 / -1;
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.section-head p,
.template-card p,
.metric,
.event-row,
.result-row,
.player-card p {
  margin: 0;
}

.form-stack,
.inline-form {
  display: grid;
  gap: 14px;
}

.inline-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

label {
  display: grid;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(157, 65, 38, 0.55);
  box-shadow: 0 0 0 4px rgba(157, 65, 38, 0.1);
  transform: translateY(-1px);
}

textarea {
  resize: vertical;
}

.button {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  background: #eadfca;
  color: var(--ink);
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(56, 31, 18, 0.14);
}

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

.button-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff7ef;
}

.button-ghost {
  background: rgba(255, 255, 255, 0.7);
}

.feedback,
.hint,
.empty-state {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink-soft);
}

.feedback {
  border: 1px solid rgba(139, 30, 46, 0.2);
  color: var(--evil);
}

.template-grid,
.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.template-card,
.player-card,
.saved-session,
.vote-summary-card {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  padding: 16px;
}

.player-card-top,
.vote-header,
.action-row,
.topnav,
.metric,
.event-row,
.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.saved-session-list,
.event-list,
.vote-results,
.vote-options {
  display: grid;
  gap: 10px;
}

.knowledge-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.knowledge-card {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  padding: 16px;
}

.knowledge-players {
  display: grid;
  gap: 10px;
}

.chip-list,
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.selection-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  cursor: pointer;
}

.selection-card input {
  width: auto;
  margin: 0;
}

.selection-card span {
  font-weight: 600;
}

.selection-card small {
  color: var(--ink-soft);
}

.button-card {
  text-align: left;
}

.saved-session {
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease;
}

.saved-session:hover {
  transform: translateY(-1px);
  border-color: rgba(157, 65, 38, 0.32);
}

.saved-session span {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
}

.topnav {
  flex-wrap: wrap;
}

.topnav a {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
}

.topnav a.is-active {
  background: rgba(157, 65, 38, 0.12);
  color: var(--accent-deep);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.status-online {
  color: var(--good);
}

.status-offline {
  color: var(--ink-soft);
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.metric {
  flex-direction: column;
  align-items: flex-start;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
}

.narrow {
  max-width: 520px;
}

.event-row,
.result-row {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

.vote-option {
  width: 100%;
  border: 1px solid rgba(157, 65, 38, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.vote-option.is-selected {
  border-color: rgba(157, 65, 38, 0.44);
  background: rgba(157, 65, 38, 0.08);
}

.identity-card {
  max-width: 720px;
  margin: 0 auto;
}

.role-card {
  border-radius: 22px;
  padding: 28px;
  background: linear-gradient(135deg, rgba(255, 251, 245, 0.95), rgba(234, 222, 203, 0.85));
  border: 1px solid rgba(157, 65, 38, 0.15);
}

.role-portrait-frame {
  position: relative;
  width: min(100%, 320px);
  aspect-ratio: 5 / 7;
  margin: 0 auto 18px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(157, 65, 38, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(32, 24, 20, 0.08)),
    linear-gradient(135deg, rgba(234, 222, 203, 0.95), rgba(214, 196, 164, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 14px 28px rgba(56, 31, 18, 0.12);
}

.role-portrait {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.role-card.role-good {
  border-color: rgba(43, 106, 79, 0.26);
  background: linear-gradient(135deg, rgba(246, 255, 251, 0.96), rgba(219, 241, 229, 0.9));
}

.role-card.role-evil {
  border-color: rgba(139, 30, 46, 0.28);
  background: linear-gradient(135deg, rgba(255, 246, 246, 0.96), rgba(245, 214, 220, 0.9));
}

.role-card.role-waiting {
  border-style: dashed;
}

@media (max-width: 860px) {
  .page-header,
  .two-column,
  .room-layout {
    grid-template-columns: 1fr;
    display: grid;
  }

  .hero-meta {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100vw - 16px, 100%);
    padding-top: 18px;
  }

  .panel {
    padding: 18px;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .action-row,
  .topnav {
    flex-direction: column;
    align-items: stretch;
  }

  .topnav a,
  .button {
    text-align: center;
  }
}
