:root {
  --bg: #0f0e13;
  --panel: #17151f;
  --tile: #1a1822;
  --line: #2e2a3a;
  --text: #ece9f3;
  --muted: #a39db3;
  --accent: #e8b04a;
  --chosen: #6ab04c;
  --face: #f3eee4;
  --ink: #1d1a22;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
#bar { height: 36px; display: flex; align-items: center; gap: 14px; padding: 0 14px; border-bottom: 1px solid var(--line); }
#bar a { color: var(--text); text-decoration: none; }
#bar #home { font-weight: 700; }
#bar #where { color: var(--muted); }
#bar .right { margin-left: auto; color: var(--muted); font-size: 14px; }
#screen { position: absolute; top: 36px; left: 0; right: 0; bottom: 0; overflow: auto; }
body.playing #screen { overflow: hidden; }
.status { color: var(--muted); padding: 24px 16px; text-align: center; }
.page { max-width: 880px; margin: 0 auto; padding: 8px 16px 32px; }
h1 { font-size: 26px; margin: 18px 0 4px; }
.lead, .muted { color: var(--muted); }
.games { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.games a { display: block; height: 100%; background: var(--tile); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; color: inherit; text-decoration: none; }
.games a:hover { border-color: #4a4460; }
.games h2 { font-size: 19px; margin: 0 0 4px; }
.games p { margin: 0; color: var(--muted); }
.setup { display: grid; gap: 14px; margin-top: 18px; max-width: 560px; }
.setup label { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
select, input { background: #221f2c; color: var(--text); border: 1px solid #3d3750; border-radius: 8px; padding: 5px 8px; font: inherit; }
input[type=number] { width: 110px; }
.buttons, .options { display: flex; flex-wrap: wrap; gap: 6px; }
button, a.button { background: #2a2636; color: var(--text); border: 1px solid #3d3750; border-radius: 8px; padding: 5px 11px; font: inherit; cursor: pointer; text-decoration: none; }
button:hover, a.button:hover { border-color: var(--accent); }
button:disabled { opacity: 0.4; cursor: default; border-color: #3d3750; }
button.chosen { background: #2b4428; border-color: var(--chosen); }

/* the table */
.stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.table { position: relative; overflow: hidden; }
.seat-area { position: absolute; border-top: 1px solid rgba(255, 255, 255, 0.05); }
.seat-area.mine { background: rgba(232, 176, 74, 0.035); }
.box { position: absolute; border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 8px; background: rgba(255, 255, 255, 0.02); }
.box .title { position: absolute; left: 6px; top: 1px; color: var(--muted); font-size: 0.8em; white-space: nowrap; }
.card { position: absolute; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55); transition: transform 0.12s; }
.card.face { background: var(--face); color: var(--ink); border: 1px solid #c9bfae; padding: 4px 5px; }
.card.back { background: repeating-linear-gradient(45deg, #2c3f7c 0 6px, #24346a 6px 12px); border: 2px solid #c9d2f0; color: #fff; padding: 4px; }
.card.under { box-shadow: none; }
.card.face { display: flex; flex-direction: column; gap: 2px; }
.card .name { font-weight: 700; line-height: 1.12; overflow-wrap: anywhere; }
.card .big { font-weight: 800; line-height: 1; text-align: center; margin: 2px 0; -webkit-text-stroke: 1px rgba(0, 0, 0, 0.35); }
.card .big.only { margin: auto 0; }
.card .picture { flex: none; border-radius: 4px; background: #000 center / cover no-repeat; border: 1px solid rgba(0, 0, 0, 0.25); }
.card.pictured { background-size: cover; background-position: center; color: #fff; justify-content: flex-end; text-shadow: 0 1px 2px #000; }
.card .props { margin-top: 3px; line-height: 1.15; opacity: 0.85; overflow-wrap: anywhere; }
.card.back .props { background: rgba(0, 0, 0, 0.55); border-radius: 4px; padding: 2px 3px; opacity: 1; }
.card .props .changed { color: #8a4b00; }
.card.back .props .changed { color: #ffd27a; }
.card .props .boosted { color: #a3261b; font-weight: 700; }
.card .props s { font-weight: 400; opacity: 0.7; }
.card .seen { position: absolute; left: 4px; right: 4px; bottom: 3px; font-size: 9px; font-style: italic; opacity: 0.85; }
.card .order { position: absolute; right: 3px; bottom: 3px; background: var(--chosen); color: #000; border-radius: 999px; padding: 0 6px; font-weight: 700; }
.card.face-down { opacity: 0.72; outline: 2px dashed #2c3f7c; outline-offset: -4px; }
.card.turned { transform: rotate(90deg); }
.option { cursor: pointer; box-shadow: 0 0 0 2px var(--accent), 0 0 12px rgba(232, 176, 74, 0.7) !important; }
.card.option:hover { margin-top: -4px; }
.chosen { box-shadow: 0 0 0 3px var(--chosen), 0 0 14px rgba(106, 176, 76, 0.8) !important; }
.veil { position: absolute; inset: 0; z-index: 90; }
.menu { position: absolute; z-index: 91; background: var(--panel); border: 1px solid var(--accent); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6); font-size: 14px; }
.menu .label { color: var(--muted); font-size: 12px; padding: 0 4px; }
.menu button { text-align: left; }
.slot { position: absolute; border: 1px dashed rgba(255, 255, 255, 0.18); border-radius: 6px; }
.count { position: absolute; z-index: 60; background: var(--accent); color: #000; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 6px; }
.cell { position: absolute; border: 1px dashed rgba(255, 255, 255, 0.14); border-radius: 6px; display: flex; align-items: center; justify-content: center; text-align: center; }
.cell span { color: rgba(255, 255, 255, 0.25); font-size: 0.75em; padding: 2px; }
.object { position: absolute; border-radius: 6px; background: rgba(255, 255, 255, 0.035); border: 1px solid rgba(255, 255, 255, 0.07); padding: 2px 5px; color: var(--muted); font-size: 0.85em; overflow: hidden; }
.object .label, .info .label { color: var(--text); font-weight: 600; }
.info { position: absolute; border-radius: 8px; padding: 4px 8px; background: rgba(255, 255, 255, 0.03); overflow: hidden; color: var(--muted); }
.info.me .label { color: var(--accent); }
.info.turn { background: rgba(232, 176, 74, 0.08); }
.info .status { color: var(--accent); margin-top: 2px; }
.panel { position: absolute; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; padding: 10px; font-size: 14px; }
.panel .who { color: var(--muted); font-size: 13px; }
.panel .prompt { font-weight: 700; margin-bottom: 6px; }
.panel .hint, .panel .waiting, .panel .drawer { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.panel .options { max-height: 38vh; overflow: auto; }
.panel .done { margin-top: 8px; }
.panel .number { display: flex; gap: 6px; align-items: center; }
.panel .number input[type=range] { flex: 1; }
.panel .error { color: #ff8f7a; white-space: pre-wrap; font-size: 12px; }
.panel .log { flex: 1; min-height: 60px; overflow: auto; margin: 0; font: 11px/1.35 ui-monospace, "SFMono-Regular", Menlo, monospace; color: var(--muted); white-space: pre-wrap; border-top: 1px solid var(--line); padding-top: 6px; }
.panel .places { margin: 4px 0 10px; padding-left: 20px; }
.panel .who a { color: var(--muted); }
.panel.upright { border-left: 0; border-top: 1px solid var(--line); }

/* the layout editor */
.stage.editing { margin: 0 auto; }
.edit-outline { position: absolute; z-index: 80; border: 1px dashed rgba(122, 196, 255, 0.55); border-radius: 6px; cursor: move; touch-action: none; }
.edit-outline:hover { border-color: #7ac4ff; background: rgba(122, 196, 255, 0.06); }
.edit-outline.area { z-index: 79; pointer-events: none; border-color: rgba(255, 255, 255, 0.18); }
.edit-outline.selected { border: 2px solid #7ac4ff; background: rgba(122, 196, 255, 0.08); }
.edit-outline .edit-label { position: absolute; left: 0; top: 0; transform: translateY(-100%); background: #1f3b52; color: #d6ecff; font-size: 11px; padding: 0 6px; border-radius: 4px 4px 0 0; white-space: nowrap; pointer-events: auto; cursor: pointer; }
.edit-outline.area .edit-label { top: auto; bottom: 0; transform: none; background: #2a2636; color: var(--muted); border-radius: 0 4px 0 0; }
.edit-outline.box .edit-label { transform: none; border-radius: 0 0 4px 0; }
.edit-handle { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border-radius: 3px; background: #7ac4ff; cursor: nwse-resize; pointer-events: auto; touch-action: none; }
.box.missing { border-color: #ff8f7a; }
.box.missing .title { color: #ff8f7a; }
.editor-panel { display: flex; flex-direction: column; gap: 8px; overflow: auto; height: 100%; }
.editor-panel .section { border-top: 1px solid var(--line); padding-top: 6px; display: flex; flex-direction: column; gap: 5px; }
.editor-panel .section-title { font-weight: 700; }
.editor-panel .field { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.editor-panel .field > span { color: var(--muted); }
.editor-panel .field select, .editor-panel .field input[type=text] { max-width: 60%; }
.editor-panel .field input[type=number] { width: 80px; }
.editor-panel .xywh { display: flex; gap: 4px; }
.editor-panel .xywh input { width: 58px !important; }
.editor-panel .hint { color: var(--muted); font-size: 13px; margin: 0; }

/* small screens: the table gets the whole screen while playing, and the panel gets denser */
@media (max-height: 520px), (max-width: 520px) {
  body.playing #bar { display: none; }
  body.playing #screen { top: 0; }
  .panel { font-size: 13px; padding: 6px; gap: 5px; }
  .panel .log { font-size: 10px; }
  .panel .options { max-height: none; }
  button, a.button { padding: 4px 8px; }
}
