:root {
  --paper: #f4efe3;
  --paper-deep: #e9dfcb;
  --paper-light: #fbf8f0;
  --ink: #182522;
  --ink-muted: #59645f;
  --wine: #741f31;
  --wine-deep: #4d111f;
  --wine-soft: #a85866;
  --gold: #a78543;
  --gold-light: #d2bd83;
  --line: rgba(44, 48, 42, 0.18);
  --success: #2f6e57;
  --danger: #9b2f32;
  --shadow: 0 20px 60px rgba(48, 37, 24, 0.14);
  --radius: 4px;
  --font-serif: "Noto Serif SC", "Songti SC", SimSun, serif;
  --font-sans: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  font-family: var(--font-sans);
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 255, 255, 0.82), transparent 30rem),
    linear-gradient(180deg, #f7f3e9 0%, var(--paper) 54%, #ede5d5 100%);
}

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

button,
select {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(167, 133, 67, 0.42);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.paper-noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.26;
  background-image:
    repeating-linear-gradient(91deg, rgba(79, 63, 42, 0.018) 0, rgba(79, 63, 42, 0.018) 1px, transparent 1px, transparent 4px),
    repeating-linear-gradient(2deg, transparent 0, transparent 5px, rgba(255, 255, 255, 0.09) 5px, rgba(255, 255, 255, 0.09) 6px);
}

.site-header {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--wine);
  color: var(--wine);
  font-family: var(--font-serif);
  font-size: 22px;
  transform: rotate(45deg);
}

.brand-mark::first-line {
  transform: rotate(-45deg);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: var(--font-serif);
  font-size: 18px;
  letter-spacing: 0.16em;
}

.brand small {
  margin-top: 2px;
  color: var(--gold);
  font-size: 9px;
  letter-spacing: 0.34em;
}

.connection-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  color: var(--ink-muted);
  font-size: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-muted);
}

.connection-badge.is-online .status-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(47, 110, 87, 0.12);
}

.connection-badge.is-syncing .status-dot {
  background: var(--gold);
  animation: pulse 1s ease infinite;
}

.connection-badge.is-offline .status-dot {
  background: var(--danger);
}

@keyframes pulse {
  50% { opacity: 0.3; }
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 calc(64px + env(safe-area-inset-bottom));
}

.home-view {
  display: grid;
  gap: 34px;
}

.hero-copy {
  padding: 18px 2px 4px;
}

.eyebrow,
.overline {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.hero-copy h1 {
  max-width: 720px;
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(42px, 10vw, 88px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.hero-copy h1 em {
  color: var(--wine);
  font-style: normal;
}

.hero-lead {
  max-width: 650px;
  margin: 24px 0 0;
  color: var(--ink-muted);
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.95;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 30px;
}

.duration-hint {
  color: var(--ink-muted);
  font-size: 12px;
}

.entry-card,
.lobby-panel,
.phase-card,
.message-panel,
.asset-card,
.players-card {
  border: 1px solid var(--line);
  background: rgba(251, 248, 240, 0.88);
  box-shadow: var(--shadow);
}

.entry-card {
  position: relative;
  padding: 26px;
}

.entry-card::before,
.lobby-panel::before,
.phase-card::before {
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(167, 133, 67, 0.28);
  content: "";
  pointer-events: none;
}

.card-heading,
.panel-title-row,
.section-heading,
.room-header,
.game-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.card-heading {
  position: relative;
  justify-content: flex-start;
  margin-bottom: 28px;
}

.card-index {
  color: rgba(116, 31, 49, 0.19);
  font-family: Georgia, serif;
  font-size: 52px;
  line-height: 1;
}

h1,
h2,
h3,
h4,
p {
  overflow-wrap: break-word;
}

.card-heading h2,
.panel-title-row h2,
.section-heading h3,
.dialog-topbar h2,
.game-status-bar h2 {
  margin: 0;
  font-family: var(--font-serif);
}

.card-heading h2,
.panel-title-row h2 {
  font-size: 28px;
}

.field-label {
  display: block;
  margin: 18px 0 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.input-wrap {
  position: relative;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(35, 42, 36, 0.26);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--ink);
  padding: 12px 14px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 0 0 3px rgba(167, 133, 67, 0.12);
  outline: 0;
}

.input-count {
  position: absolute;
  top: 50%;
  right: 13px;
  color: var(--ink-muted);
  font-size: 11px;
  transform: translateY(-50%);
}

#nickname {
  padding-right: 58px;
}

.field-help,
.action-hint,
.form-error,
.muted-copy {
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.6;
}

.field-help {
  margin: 7px 0 20px;
}

.form-error {
  min-height: 19px;
  margin: 9px 0 0;
  color: var(--danger);
}

.button {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 2px;
  padding: 11px 17px;
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: transform 0.16s, background 0.16s, border-color 0.16s, box-shadow 0.16s;
}

.button:not(:disabled):active {
  transform: translateY(1px);
}

.button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--wine);
  color: #fffaf0;
  box-shadow: 0 10px 24px rgba(116, 31, 49, 0.18);
}

.button-primary:not(:disabled):hover {
  background: var(--wine-deep);
}

.button-secondary {
  border-color: var(--wine);
  background: transparent;
  color: var(--wine);
}

.button-secondary:not(:disabled):hover,
.button-ghost:not(:disabled):hover {
  background: rgba(116, 31, 49, 0.06);
}

.button-ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

.button-block {
  width: 100%;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 6px;
  color: var(--ink-muted);
  font-size: 11px;
}

.divider::before,
.divider::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.join-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.code-input {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.resume-box,
.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 17px;
  color: var(--ink-muted);
  font-size: 12px;
}

.text-button {
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--wine);
  padding: 2px 0;
  font-weight: 700;
}

.mood-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  color: rgba(24, 37, 34, 0.33);
  font: 9px/1 Georgia, serif;
  letter-spacing: 0.18em;
  white-space: nowrap;
}

.mood-strip i {
  width: 4px;
  height: 4px;
  flex: 0 0 4px;
  border: 1px solid var(--gold);
  transform: rotate(45deg);
}

.room-view {
  position: relative;
}

.room-header {
  align-items: flex-end;
  margin-bottom: 24px;
}

.room-header h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(32px, 7vw, 56px);
  font-weight: 500;
}

.room-code-box {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 2px 10px;
  border-left: 1px solid var(--gold-light);
  padding-left: 18px;
}

.room-code-box > span {
  color: var(--ink-muted);
  font-size: 10px;
  letter-spacing: 0.16em;
}

.room-code-box strong {
  grid-column: 1;
  color: var(--wine);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 22px;
  letter-spacing: 0.13em;
}

.icon-button,
.dialog-close {
  display: grid;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  place-items: center;
}

.icon-button {
  width: 34px;
  height: 34px;
  grid-column: 2;
  grid-row: 1 / span 2;
}

.notice {
  margin: 0 0 16px;
  border: 1px solid rgba(167, 133, 67, 0.35);
  background: rgba(210, 189, 131, 0.14);
  padding: 12px 14px;
}

.notice button {
  border: 0;
  background: transparent;
  color: var(--wine);
  font-weight: 700;
}

.lobby-panel {
  position: relative;
  padding: 26px;
}

.panel-intro {
  max-width: 680px;
  margin: 11px 0 24px;
  color: var(--ink-muted);
  font-family: var(--font-serif);
  line-height: 1.8;
}

.seat-counter {
  color: var(--wine);
  font: 600 28px/1 Georgia, serif;
}

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

.seat {
  position: relative;
  min-height: 92px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.28);
  padding: 13px;
}

.seat.is-filled {
  border-color: rgba(116, 31, 49, 0.24);
  background: rgba(255, 255, 255, 0.56);
}

.seat.is-me {
  box-shadow: inset 3px 0 var(--wine);
}

.seat-number {
  display: block;
  margin-bottom: 12px;
  color: var(--gold);
  font: 11px/1 Georgia, serif;
}

.seat-name {
  display: block;
  overflow: hidden;
  font-family: var(--font-serif);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  color: var(--ink-muted);
  font-size: 10px;
}

.seat .tiny-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
}

.seat.is-empty {
  display: grid;
  color: rgba(89, 100, 95, 0.46);
  place-items: center;
}

.lobby-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.lobby-actions .button {
  flex: 1;
}

.action-hint {
  margin: 10px 0 0;
  text-align: center;
}

.phase-rail {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  margin: 0 0 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  scrollbar-width: thin;
}

.round-stamp {
  display: grid;
  min-width: 70px;
  grid-template-columns: auto auto;
  align-content: center;
  border-right: 1px solid var(--line);
  padding-right: 16px;
}

.round-stamp span {
  grid-column: 1 / -1;
  color: var(--gold);
  font-size: 8px;
  letter-spacing: 0.22em;
}

.round-stamp strong {
  color: var(--wine);
  font: 34px/1 Georgia, serif;
}

.round-stamp small {
  align-self: end;
  color: var(--ink-muted);
}

.phase-steps {
  display: flex;
  min-width: max-content;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.phase-step {
  display: flex;
  align-items: center;
  color: rgba(89, 100, 95, 0.64);
  font-size: 11px;
}

.phase-step::after {
  width: 22px;
  height: 1px;
  margin: 0 7px;
  background: var(--line);
  content: "";
}

.phase-step:last-child::after {
  display: none;
}

.phase-step span {
  display: grid;
  width: 24px;
  height: 24px;
  margin-right: 6px;
  border: 1px solid var(--line);
  border-radius: 50%;
  place-items: center;
  font: 11px/1 Georgia, serif;
}

.phase-step.is-done {
  color: var(--success);
}

.phase-step.is-done span {
  border-color: var(--success);
  background: var(--success);
  color: white;
}

.phase-step.is-current {
  color: var(--wine);
  font-weight: 700;
}

.phase-step.is-current span {
  border-color: var(--wine);
  box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 12px var(--wine);
}

.game-status-bar {
  align-items: flex-end;
  margin-bottom: 18px;
}

.game-status-bar h2 {
  font-size: 32px;
}

.game-status-bar p:last-child {
  margin: 7px 0 0;
  color: var(--ink-muted);
  font-size: 13px;
}

.progress-medallion {
  display: grid;
  min-width: 80px;
  height: 80px;
  border: 1px solid var(--gold-light);
  border-radius: 50%;
  text-align: center;
  place-content: center;
}

.progress-medallion strong {
  color: var(--wine);
  font: 700 20px/1.1 Georgia, serif;
}

.progress-medallion span {
  margin-top: 4px;
  color: var(--ink-muted);
  font-size: 9px;
}

.game-layout {
  display: grid;
  gap: 14px;
}

.private-column,
.main-column {
  display: grid;
  align-content: start;
  gap: 14px;
}

.identity-card {
  position: relative;
  overflow: hidden;
  min-height: 186px;
  border: 1px solid var(--wine-deep);
  background:
    radial-gradient(circle at 100% 0%, rgba(210, 189, 131, 0.19), transparent 40%),
    linear-gradient(145deg, var(--wine-deep), #26181a);
  color: #fff8e9;
  padding: 23px;
  box-shadow: 0 18px 48px rgba(77, 17, 31, 0.22);
}

.identity-card::after {
  position: absolute;
  right: -20px;
  bottom: -33px;
  width: 120px;
  height: 120px;
  border: 1px solid rgba(210, 189, 131, 0.25);
  border-radius: 50%;
  content: "";
}

.identity-card .overline {
  color: var(--gold-light);
}

.identity-role {
  margin: 12px 0 3px;
  font-family: var(--font-serif);
  font-size: 29px;
}

.identity-preference {
  margin: 0;
  color: rgba(255, 248, 233, 0.76);
  font-size: 13px;
}

.identity-note {
  position: absolute;
  bottom: 18px;
  left: 23px;
  color: rgba(255, 248, 233, 0.52);
  font-size: 10px;
}

.asset-card,
.players-card,
.message-panel {
  padding: 19px;
}

.section-heading.compact {
  align-items: flex-start;
  margin-bottom: 15px;
}

.section-heading h3 {
  font-size: 18px;
}

.coin-pill {
  display: flex;
  min-width: 64px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--gold-light);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--gold);
}

.coin-pill strong {
  color: var(--ink);
  font-family: Georgia, serif;
}

.asset-ledger {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.asset-item {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 9px;
  text-align: center;
}

.asset-item span {
  display: block;
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-item strong {
  display: block;
  margin-top: 3px;
  font: 700 18px/1.2 Georgia, serif;
}

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

.player-row {
  display: grid;
  min-width: 0;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 2px 7px;
  align-items: center;
  border-bottom: 1px solid rgba(44, 48, 42, 0.09);
  padding: 7px 2px;
  font-size: 11px;
}

.player-row .presence {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-muted);
}

.player-row.is-connected .presence { background: var(--success); }
.player-row.is-ready .presence { box-shadow: 0 0 0 3px rgba(47, 110, 87, 0.15); }
.player-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-row small { grid-column: 2; color: var(--ink-muted); }

.phase-card {
  position: relative;
  padding: 26px;
}

.phase-card > * {
  position: relative;
}

.phase-section + .phase-section {
  margin-top: 25px;
  border-top: 1px solid var(--line);
  padding-top: 23px;
}

.phase-section h3,
.phase-section h4 {
  margin: 0;
  font-family: var(--font-serif);
}

.phase-section h3 { font-size: 22px; }
.phase-section h4 { font-size: 17px; }
.phase-section > p { color: var(--ink-muted); font-size: 13px; line-height: 1.75; }

.form-grid {
  display: grid;
  gap: 13px;
  margin-top: 16px;
}

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

.form-grid.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-field label,
.mini-field label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
}

.field-suffix {
  position: relative;
}

.field-suffix input {
  padding-right: 36px;
}

.field-suffix span {
  position: absolute;
  top: 50%;
  right: 11px;
  color: var(--ink-muted);
  font-size: 10px;
  transform: translateY(-50%);
}

.inline-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-chip {
  position: relative;
}

.choice-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-chip label {
  display: block;
  margin: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.3);
  padding: 9px 12px;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.choice-chip input:checked + label {
  border-color: var(--wine);
  background: var(--wine);
  color: white;
}

.choice-chip input:focus-visible + label {
  outline: 3px solid rgba(167, 133, 67, 0.42);
  outline-offset: 2px;
}

.submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 19px;
}

.submit-row .muted-copy {
  margin: 0;
}

.submitted-banner,
.empty-state,
.settlement-panel,
.final-card {
  border: 1px solid rgba(167, 133, 67, 0.34);
  background: rgba(210, 189, 131, 0.12);
  padding: 17px;
}

.submitted-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.submitted-banner strong { color: var(--success); }
.submitted-banner p { margin: 4px 0 0; color: var(--ink-muted); font-size: 12px; }

.ready-panel {
  display: grid;
  gap: 16px;
  text-align: center;
  justify-items: center;
  padding: 10px 0;
}

.ready-seal {
  display: grid;
  width: 92px;
  aspect-ratio: 1;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--wine);
  font-family: var(--font-serif);
  font-size: 30px;
  place-items: center;
}

.ready-panel p { max-width: 500px; margin: 0; color: var(--ink-muted); line-height: 1.75; }

.trade-layout {
  display: grid;
  gap: 18px;
}

.trade-ticket {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.35);
  padding: 14px;
}

.trade-ticket + .trade-ticket { margin-top: 9px; }
.trade-ticket header { display: flex; justify-content: space-between; gap: 10px; }
.trade-ticket h4 { margin: 0; font-family: var(--font-serif); }
.trade-ticket time { color: var(--ink-muted); font-size: 10px; }
.trade-summary { margin: 10px 0; color: var(--ink-muted); font-size: 12px; line-height: 1.65; }
.trade-actions { display: flex; gap: 7px; }
.trade-actions .button { min-height: 36px; padding: 7px 12px; font-size: 11px; }

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

.mini-field input { min-height: 42px; }

.message-panel {
  box-shadow: none;
}

.private-note {
  color: var(--ink-muted);
  font-size: 10px;
}

.message-list {
  display: grid;
  max-height: 260px;
  gap: 10px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 14px 2px;
}

.message-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 4px 9px;
  align-items: baseline;
}

.message-item strong { color: var(--wine); font-size: 11px; }
.message-item p { grid-column: 2 / -1; margin: 0; font-size: 13px; line-height: 1.6; }
.message-item time { color: var(--ink-muted); font-size: 9px; }
.message-empty { color: var(--ink-muted); font-family: var(--font-serif); font-size: 12px; text-align: center; }

.message-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 12px;
}

.message-form input,
.message-form .button {
  min-height: 42px;
}

.settlement-grid,
.ranking-list,
.reveal-grid {
  display: grid;
  gap: 8px;
  margin-top: 15px;
}

.settlement-item,
.ranking-row,
.reveal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 10px 2px;
}

.settlement-item span,
.ranking-row span,
.reveal-item span { color: var(--ink-muted); font-size: 12px; }
.settlement-item strong,
.ranking-row strong { font-family: Georgia, serif; }
.settlement-item strong { text-align: right; }
.settlement-item strong small {
  display: block;
  margin-top: 3px;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
}
.ranking-row strong { text-align: right; }
.ranking-row strong small {
  display: block;
  margin-top: 3px;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
}

.data-json {
  overflow: auto;
  max-height: 260px;
  margin: 13px 0 0;
  border: 1px solid var(--line);
  background: rgba(24, 37, 34, 0.04);
  padding: 12px;
  color: var(--ink-muted);
  font: 11px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
}

.host-dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.host-dock > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--ink-muted);
  font-size: 10px;
}

.room-exit {
  display: block;
  margin: 24px auto 0;
}

.rules-dialog {
  width: min(820px, calc(100% - 24px));
  max-height: min(88vh, 940px);
  border: 1px solid var(--gold);
  background: var(--paper-light);
  color: var(--ink);
  padding: 0;
  box-shadow: 0 28px 100px rgba(24, 13, 12, 0.42);
}

.rules-dialog::backdrop {
  background: rgba(24, 21, 18, 0.7);
  backdrop-filter: blur(3px);
}

.dialog-topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 248, 240, 0.96);
  padding: 20px 22px;
}

.dialog-topbar h2 { font-size: 22px; }
.dialog-close { width: 38px; height: 38px; font-size: 24px; }

.rules-body {
  padding: 24px 22px 8px;
}

.rules-body section {
  position: relative;
  padding-left: 42px;
}

.rules-body section + section {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 25px;
}

.rule-number {
  position: absolute;
  top: 0;
  left: 0;
  color: var(--wine);
  font: 700 14px/1 var(--font-serif);
}

.rules-body h3,
.rules-body h4 {
  font-family: var(--font-serif);
}

.rules-body h3 { margin: 0 0 11px; font-size: 20px; }
.rules-body h4 { margin: 18px 0 5px; font-size: 15px; }
.rules-body p { margin: 7px 0; color: var(--ink-muted); font-size: 13px; line-height: 1.9; }

.rules-table-wrap {
  overflow-x: auto;
  margin-top: 14px;
}

.rules-body table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 11px;
}

.rules-body th,
.rules-body td {
  border: 1px solid var(--line);
  padding: 9px;
  text-align: left;
  vertical-align: top;
}

.rules-body th { background: rgba(116, 31, 49, 0.07); color: var(--wine); }

.dialog-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  background: rgba(251, 248, 240, 0.96);
  padding: 14px 22px;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 14px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  display: grid;
  width: min(360px, calc(100% - 28px));
  gap: 8px;
}

.toast {
  border: 1px solid rgba(210, 189, 131, 0.42);
  background: #211a18;
  color: #fff8e9;
  padding: 13px 15px;
  box-shadow: 0 16px 40px rgba(20, 10, 10, 0.26);
  font-size: 12px;
  line-height: 1.55;
  animation: toast-in 0.22s ease both;
}

.toast.is-error { border-color: var(--wine-soft); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  background: var(--paper);
  color: var(--wine);
  place-items: center;
}

@media (min-width: 640px) {
  .site-header,
  .app-shell {
    width: min(1180px, calc(100% - 56px));
  }

  .entry-card,
  .lobby-panel,
  .phase-card {
    padding: 34px;
  }

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

  .asset-input-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .trade-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  }

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

@media (min-width: 880px) {
  .app-shell {
    padding-top: 54px;
  }

  .home-view {
    min-height: calc(100vh - 180px);
    grid-template-columns: minmax(0, 1.5fr) minmax(340px, 0.72fr);
    grid-template-rows: 1fr auto;
    align-items: center;
    gap: 52px;
  }

  .entry-card {
    padding: 34px;
  }

  .mood-strip {
    grid-column: 1 / -1;
  }

  .game-layout {
    grid-template-columns: 315px minmax(0, 1fr);
  }

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

  .asset-ledger {
    grid-template-columns: repeat(5, 1fr);
  }

  .message-panel {
    padding: 22px 26px;
  }
}

@media (max-width: 520px) {
  .site-header,
  .app-shell {
    width: min(100% - 24px, 1180px);
  }

  .site-header {
    padding-top: 15px;
  }

  .connection-badge span:last-child {
    display: none;
  }

  .connection-badge {
    padding: 10px;
  }

  .app-shell {
    padding-top: 24px;
  }

  .hero-copy h1 {
    font-size: 41px;
  }

  .hero-actions,
  .lobby-actions,
  .submit-row,
  .host-dock {
    align-items: stretch;
    flex-direction: column;
  }

  .entry-card,
  .lobby-panel,
  .phase-card {
    padding: 22px 18px;
  }

  .join-row {
    grid-template-columns: 1fr;
  }

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

  .room-code-box {
    width: 100%;
    border-top: 1px solid var(--gold-light);
    border-left: 0;
    padding-top: 12px;
    padding-left: 0;
  }

  .game-status-bar {
    align-items: flex-start;
  }

  .progress-medallion {
    min-width: 68px;
    height: 68px;
  }

  .form-grid.two-columns,
  .form-grid.three-columns {
    grid-template-columns: 1fr;
  }

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

  .rules-body {
    padding-right: 17px;
    padding-left: 17px;
  }

  .rules-body section {
    padding-left: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
