:root {
  --sea: #16343c;
  --sea-2: #1d4652;
  --ink: #241c16;
  --paper: #f6f1e6;
  --clay: #b5523a;
  --line: rgba(36, 28, 22, 0.14);
  --wood: #6e4528;
  color: var(--ink);
  background: var(--sea);
  font-family: Outfit, "Avenir Next", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: radial-gradient(circle at 50% 0%, #245864, var(--sea) 46%); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }

#toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(440px, calc(100% - 24px));
  padding: 12px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

.screen { min-height: 100dvh; padding: calc(24px + env(safe-area-inset-top)) 20px calc(28px + env(safe-area-inset-bottom)); }
.narrow { width: min(460px, 100%); margin: 0 auto; }
h1, h2, .prompt { font-family: Fraunces, Georgia, serif; font-weight: 560; }
h1 { margin: 0 0 8px; color: var(--paper); font-size: 64px; letter-spacing: -0.04em; }
.lede, .fine { color: #d5e4e4; }
.fine { font-size: 13px; }
.card-panel, .panel {
  background: var(--paper);
  color: var(--ink);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}
label { display: block; margin: 12px 0 6px; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }
input {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 12px;
  padding: 14px 12px;
  font-size: 16px;
}
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.primary, .ghost, .chip, .card {
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
}
.primary { background: var(--clay); color: white; }
.ghost { background: transparent; color: var(--paper); border: 1px solid rgba(246, 241, 230, 0.35); }
.panel .ghost, .sheet .ghost { color: var(--ink); border-color: var(--line); background: transparent; }
.actions .ghost { color: var(--paper); border-color: rgba(246, 241, 230, 0.35); }
.stack { display: grid; gap: 10px; }

.shell { min-height: 100dvh; display: grid; grid-template-rows: auto auto 1fr; }
.top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 14px 8px;
  color: var(--paper);
}
.brand { font-family: Fraunces, Georgia, serif; font-size: 28px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: #86b34a; margin-right: 6px; }
.dot.off { background: #c47a3a; }
.prompt {
  margin: 0 14px 10px;
  color: var(--paper);
  font-size: 28px;
  line-height: 1.1;
}
.layout { display: grid; gap: 12px; padding: 0 12px 12px; align-items: start; width: 100%; }
.shell { width: 100%; overflow-x: hidden; }
.table {
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.08), transparent 46%), #1c4e59;
  border: 10px solid var(--wood);
  box-shadow: inset 0 0 0 3px #d7b48a, 0 16px 40px rgba(0, 0, 0, 0.25);
  border-radius: 28px;
  overflow: hidden;
  min-width: 0;
}
.table svg { width: 100%; height: auto; display: block; touch-action: manipulation; }
.table svg * { pointer-events: none; }
.table svg .hit { pointer-events: all; }
.hit { cursor: pointer; }
.aside { display: grid; gap: 10px; align-content: start; }
.players, .hand, .log, .actions, .bank { display: flex; gap: 8px; flex-wrap: wrap; }
.player {
  background: rgba(246, 241, 230, 0.94);
  border-radius: 16px;
  padding: 8px 10px;
  min-width: 128px;
  border: 2px solid transparent;
}
.player.on { border-color: var(--clay); }
.swatch { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0, 0, 0, 0.25); margin-right: 6px; }
.meta { color: #5e564c; font-size: 12px; }
.badge { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.hands {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.seat-hand {
  background: rgba(8, 24, 28, 0.28);
  border: 1px solid rgba(246, 241, 230, 0.16);
  border-radius: 16px;
  padding: 8px;
  min-width: 0;
}
.seat-hand.on { border-color: var(--clay); }
.seat-hand .who { color: var(--paper); font-size: 14px; margin-bottom: 6px; }
.seat-hand .badge { color: var(--paper); }
.fan { display: flex; gap: 6px; overflow-x: auto; min-height: 96px; align-items: stretch; }
.empty-hand { color: #d7e6e6; font-size: 13px; align-self: center; }
.playing {
  width: 64px;
  height: 92px;
  flex: 0 0 auto;
  border-radius: 8px;
  box-sizing: border-box;
}
.playing.face {
  background: linear-gradient(#fffdf8, #f3ecdf);
  color: var(--ink);
  border: 1px solid rgba(36, 28, 22, 0.18);
  border-bottom: 7px solid var(--c, #6e4528);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 6px;
  text-align: center;
}
.playing .art { width: 40px; height: 40px; }
.playing .art svg { width: 40px; height: 40px; display: block; }
.playing.face span, .playing.devcard span { font-size: 11px; letter-spacing: 0.02em; }
.playing.devcard {
  border-bottom-color: #6e4528;
  font: inherit;
  cursor: pointer;
}
.playing.devcard b { font-family: Fraunces, Georgia, serif; font-size: 13px; font-weight: 560; line-height: 1.1; }
.playing.devcard:disabled { opacity: 0.72; cursor: default; }
.playing.back {
  border: 3px solid #f3ead7;
  box-shadow: inset 0 0 0 3px #10241c, 0 6px 12px rgba(0, 0, 0, 0.22);
  background:
    radial-gradient(circle at 50% 46%, transparent 18%, #d7c4a2 19% 22%, transparent 23%),
    repeating-linear-gradient(30deg, #14382c 0 7px, #1c4a38 7px 14px);
}
.playing.back.dev {
  background:
    radial-gradient(circle at 50% 46%, transparent 18%, #e4d2ae 19% 22%, transparent 23%),
    repeating-linear-gradient(30deg, #4a2a24 0 7px, #5c342c 7px 14px);
  box-shadow: inset 0 0 0 3px #2a1614, 0 6px 12px rgba(0, 0, 0, 0.22);
}
.log {
  display: grid;
  max-height: 160px;
  overflow: auto;
  background: rgba(246, 241, 230, 0.92);
  border-radius: 16px;
  padding: 10px 12px;
  color: #3d342c;
  font-size: 14px;
}
.bank { color: #d7e6e6; font-size: 13px; padding: 0 4px; }
.sheet {
  background: var(--paper);
  border-radius: 18px;
  padding: 12px;
  display: grid;
  gap: 8px;
}
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.win {
  margin: 0 14px 10px;
  background: var(--paper);
  border-radius: 16px;
  padding: 12px 14px;
  font-family: Fraunces, Georgia, serif;
  font-size: 24px;
}

@media (min-width: 1100px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    grid-template-areas: "table aside" "hands hands";
    padding-bottom: 20px;
  }
  .table { grid-area: table; }
  .aside { grid-area: aside; }
  .hands { grid-area: hands; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .prompt { font-size: 34px; }
}
