/* Dark parchment-and-gilt, echoing the game's own chrome without imitating it. */
:root {
  --bg: #14100c;
  --bg-panel: #1e1811;
  --bg-input: #120e09;
  --border: #3d3226;
  --gold: #c9a227;
  --gold-bright: #e8c44a;
  --text: #e8dfd0;
  --text-dim: #9b8f7d;
  --danger: #b3402f;
  --ok: #5c8a3c;
  --radius: 6px;
  --font: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* The `hidden` attribute is only `display: none` in the user-agent
   stylesheet, so any author rule that sets `display` silently defeats it --
   and several below do (.screen is grid, #screen-play is flex, label is
   block). Everything this page hides uses the attribute, so enforce it once
   here rather than remembering the interaction at every call site. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
}

body {
  background-image:
    radial-gradient(ellipse at 50% -20%, rgba(201, 162, 39, 0.10), transparent 60%),
    radial-gradient(ellipse at 50% 120%, rgba(90, 60, 20, 0.14), transparent 55%);
}

.screen { min-height: 100%; }
.screen.center { display: grid; place-items: center; padding: 24px; }

.panel {
  width: min(420px, 100%);
  padding: 32px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(232, 196, 74, 0.08);
}
.panel.wide { width: min(720px, 100%); }

h1 {
  margin: 0 0 4px;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--gold-bright);
}
.numeral { color: var(--text); }

h2 {
  margin: 28px 0 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.subtitle { margin: 0 0 20px; color: var(--text-dim); font-size: 14px; }
.hint { margin: 12px 0 0; font-size: 13px; line-height: 1.55; color: var(--text-dim); }
.hint em { color: var(--gold); font-style: normal; }

.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-head .subtitle { margin-bottom: 8px; }

/* --- tabs --- */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 9px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.tab.active { color: var(--gold-bright); border-bottom-color: var(--gold); }

/* --- forms --- */
label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--text-dim); }

input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.14); }

button { font: inherit; cursor: pointer; border-radius: var(--radius); transition: background 120ms, border-color 120ms; }
button:disabled { opacity: 0.5; cursor: default; }

.primary {
  width: 100%;
  padding: 11px 18px;
  border: 1px solid var(--gold);
  background: linear-gradient(180deg, #a8861d, #7d6415);
  color: #fdf6e0;
  font-size: 15px;
  font-weight: 600;
}
.primary:hover:not(:disabled) { background: linear-gradient(180deg, #c19b23, #8f7218); }
.primary.big { padding: 15px; font-size: 17px; margin-top: 8px; }

.ghost {
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
}
.ghost:hover { border-color: var(--gold); color: var(--gold-bright); }

.danger {
  padding: 8px 14px;
  border: 1px solid var(--danger);
  background: transparent;
  color: #e0917f;
  font-size: 14px;
}
.danger:hover { background: var(--danger); color: #fff; }

.notice {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  background: rgba(201, 162, 39, 0.07);
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.5;
}

.error {
  margin: 16px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  background: rgba(179, 64, 47, 0.12);
  color: #e8a497;
  font-size: 14px;
}

/* --- player table --- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
}
td { padding: 9px 8px; border-bottom: 1px solid rgba(61, 50, 38, 0.5); }
tr.you td { color: var(--gold-bright); }

code {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--gold);
  font-family: var(--mono);
  font-size: 12.5px;
  cursor: pointer;
}
code.copied { border-color: var(--ok); color: #a8d080; }

.empty { color: var(--text-dim); font-size: 14px; font-style: italic; }
.capacity { float: right; color: var(--text-dim); letter-spacing: 0; text-transform: none; }

details { margin-top: 28px; border-top: 1px solid var(--border); padding-top: 16px; }
summary { color: var(--text-dim); font-size: 13px; cursor: pointer; }
#invite-list { padding-left: 0; list-style: none; }
#invite-list li { margin: 8px 0; }

/* --- booting --- */
.spinner {
  width: 34px;
  height: 34px;
  margin: 22px auto;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.logs {
  max-height: 220px;
  margin-top: 18px;
  padding: 12px;
  overflow: auto;
  background: #0c0906;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* --- playing --- */
#screen-play { display: flex; flex-direction: column; height: 100vh; }

.game-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding: 8px 14px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}
.game-bar .brand { color: var(--gold); font-size: 14px; letter-spacing: 0.04em; }
.game-bar .spacer { flex: 1; }
.game-bar .addr { color: var(--text-dim); font-family: var(--mono); font-size: 12px; }

#game-frame { flex: 1 1 auto; width: 100%; border: 0; background: #000; }

@media (max-width: 560px) {
  .panel { padding: 22px; }
  .game-bar .addr { display: none; }
}
