/* Back-Up 3 web: the app's colours (ui/Theme.kt). */
:root {
  --table-dark: #0f1f1c;
  --table-light: #1f3b36;
  --panel: #162b27;
  --text: #f3efe6;
  --dim: rgba(243, 239, 230, 0.7);
  --accent: #ffc63d;
  --warn: #ff8a65;
  --wood: #7b5236;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--table-dark); color: var(--text); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
  -webkit-text-size-adjust: 100%;
}
input { -webkit-user-select: text; user-select: text; }
h1, h2, h3 { margin: 0.6em 0 0.4em; }
h2 { font-size: 20px; }
h3 { font-size: 15px; color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
p { margin: 0.5em 0; }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.bold { font-weight: 700; }
.accent { color: var(--accent); }
.center { text-align: center; justify-content: center; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; margin: 10px 0; }

.page {
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  min-height: 100%;
}
.narrow { max-width: 520px; margin: 0 auto; }
.logo { text-align: center; margin: 24px 0 8px; }
.logo h1 { font-size: 34px; margin: 8px 0 0; letter-spacing: 0.02em; }
.logo-marbles { display: flex; gap: 8px; justify-content: center; }
.lead { text-align: center; color: var(--dim); margin-bottom: 20px; }
.titlebar { display: flex; align-items: center; gap: 4px; }
.titlebar h2 { margin: 0; }

.dot { display: inline-block; border-radius: 50%; flex: none; box-shadow: inset -2px -2px 4px rgba(0,0,0,.35), inset 2px 2px 3px rgba(255,255,255,.25); }
.dot-space { display: inline-block; width: 8px; }

.btn {
  font: inherit; font-weight: 600; color: var(--text); background: var(--table-light);
  border: 0; border-radius: 999px; padding: 12px 18px; cursor: pointer; min-height: 44px;
}
.btn:active { filter: brightness(1.2); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn.primary { background: var(--accent); color: #1c1608; }
.btn.wide { display: block; width: 100%; margin: 10px 0; }
.btn.small { padding: 6px 12px; min-height: 32px; font-size: 14px; }
.back { font: inherit; font-size: 30px; line-height: 1; background: none; border: 0; color: var(--text); padding: 0 10px 4px; cursor: pointer; }
.field {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px; padding: 12px 14px; width: 100%; margin: 8px 0; min-height: 44px; font-size: 16px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 14px; font-weight: 600; color: var(--text); background: var(--panel);
  border: 1px solid rgba(255,255,255,.15); border-radius: 999px; padding: 8px 14px; cursor: pointer;
}
.chip.on { background: var(--accent); color: #1c1608; border-color: var(--accent); }
.tip { background: var(--panel); border-radius: 14px; padding: 12px 14px; margin: 18px 0; font-size: 14px; }

.games { display: flex; flex-direction: column; gap: 8px; }
.game-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  font: inherit; color: var(--text); background: var(--panel); border: 0; border-radius: 14px; padding: 14px; cursor: pointer;
}
.game-row .status { color: var(--dim); font-size: 14px; }
.game-row.your-turn { outline: 2px solid var(--accent); }
.game-row.your-turn .status { color: var(--accent); font-weight: 700; }
.settings { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.toggle { display: flex; gap: 10px; align-items: center; }
.toggle input { width: 20px; height: 20px; accent-color: var(--accent); }
.transfer { background: var(--panel); border-radius: 14px; padding: 12px; width: 100%; }

.invite { background: var(--panel); border-radius: 16px; padding: 16px; text-align: center; margin: 12px 0; }
.invite .code { font-size: 40px; font-weight: 800; letter-spacing: 0.15em; color: var(--accent); margin: 4px 0 12px; -webkit-user-select: text; user-select: text; }
.seats { display: flex; flex-direction: column; gap: 6px; }
.seat-row { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 12px; padding: 10px 12px; flex-wrap: wrap; }

/* The table: everything fits one screen, the board takes what's left. */
.table {
  display: flex; flex-direction: column; height: 100vh; height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  max-width: 900px; margin: 0 auto; overflow: hidden;
}
.topbar { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; padding: 6px 10px 2px; }
.roster { display: flex; flex: 1; gap: 10px; overflow-x: auto; align-items: center; scrollbar-width: none; }
.who { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--dim); white-space: nowrap; }
.who.current { color: var(--text); font-weight: 700; }
.topbar .status { width: 100%; font-weight: 700; padding: 0 10px; }
.topbar .status.mine { color: var(--accent); }
.aside { display: flex; align-items: center; gap: 4px; padding: 0 16px; min-height: 0; }
.aside:empty { display: none; }
.aside > span:first-child { margin-right: 6px; }
.board-box { position: relative; flex: 1; min-height: 160px; }
.board-wrap, .board { position: absolute; inset: 0; width: 100%; height: 100%; }
.board { display: block; touch-action: none; }
.board-overlay { position: absolute; left: 8px; right: 8px; top: 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
.board-overlay > * { pointer-events: auto; }
.banner { display: flex; align-items: center; gap: 8px; background: rgba(22,43,39,.92); border-radius: 999px; padding: 6px 14px; font-size: 13px; }
.log-panel { width: 100%; height: 260px; overflow-y: auto; background: rgba(22,43,39,.95); border-radius: 16px; padding: 12px; }
.log-line { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 1px 0; }
.last-moves { padding: 4px 16px; color: var(--dim); min-height: 44px; cursor: pointer; }
.actions .panel { margin: 4px 12px; background: var(--panel); border-radius: 16px; padding: 12px; }
.actions .row { margin: 10px 0 0; }
.warn { color: var(--warn); font-weight: 700; font-size: 14px; margin-top: 4px; }
.hand { position: relative; height: 150px; flex: none; perspective: 600px; margin-bottom: 8px; }
.hand-empty { padding-top: 50px; }

/* Cards are drawn in code, as in the app, so there are no images to license. */
.card {
  --w: 60px;
  position: relative; width: var(--w); height: calc(var(--w) * 1.45); flex: none;
  background: #fdfbf6; border: 1px solid rgba(0,0,0,.2); border-radius: calc(var(--w) * 0.1);
  color: #1c1c1e; font-weight: 700; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.card.red { color: #c62828; }
.card.joker { color: #6a3fb5; }
.card .corner { position: absolute; left: calc(var(--w) * 0.07); top: calc(var(--w) * 0.02); font-size: calc(var(--w) * 0.28); line-height: 1.2; }
.card .pip { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: calc(var(--w) * 0.5); font-weight: 400; }
.card .hint { position: absolute; left: 0; right: 0; bottom: calc(var(--w) * 0.05); text-align: center; font-size: calc(var(--w) * 0.16); opacity: 0.75; }
.aside .card .hint { display: none; }
.card.in-hand {
  position: absolute; left: 50%; bottom: 10px; transform-origin: 50% 100%;
  transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease; cursor: pointer;
}
.card.in-hand.selected { box-shadow: 0 10px 24px rgba(0,0,0,.5), 0 0 0 3px var(--accent); z-index: 2; }
.card.in-hand.dimmed { opacity: 0.45; cursor: default; }

.sheet-host:empty { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 24px; }
.sheet { background: var(--panel); border-radius: 20px; padding: 24px; width: 100%; max-width: 420px; text-align: center; max-height: 90vh; overflow-y: auto; }
.sheet .row { justify-content: center; }

#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 40px);
  background: #000c; color: var(--text); padding: 10px 16px; border-radius: 12px; font-size: 14px;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 20; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
