@font-face {
  font-family: 'Roboto Slab';
  src: url('/fonts/roboto-slab.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --wood-1: #4a2410;
  --wood-2: #5a2d14;
  --wood-3: #3b1c0c;
  --paper: #f3e3cc;
  --paper-2: #e9d3b4;
  --paper-3: #dcc09a;
  --ink: #3a2a1c;
  --ink-soft: #6d5640;
  --red: #8c0f0f;
  --red-2: #6a0808;
  --red-hi: #b51d1d;
  --gold: #e9a531;
  --green: #2f6b2a;
  --line: #5c4630;
  --slab: 'Roboto Slab', 'Rockwell', Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --radius: 18px;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--wood-1);
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-text-size-adjust: 100%;
}
input, select, textarea { -webkit-user-select: text; user-select: text; font: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- surfaces ---------- */
.wood {
  background-color: var(--wood-2);
  background-image:
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(115deg, rgba(0, 0, 0, 0.08) 0 1px, transparent 1px 23px),
    radial-gradient(ellipse at 30% 20%, rgba(130, 70, 30, 0.45), transparent 60%),
    linear-gradient(160deg, var(--wood-2), var(--wood-3));
  background-attachment: fixed;
  min-height: 100%;
  color: #f6e8d4;
}
.paper {
  background-color: var(--paper);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .32 0 0 0 0 .18 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #f6e8d3, var(--paper));
}

/* ---------- buttons ---------- */
.btn {
  border: 0;
  border-radius: 999px;
  padding: 0.7em 1.6em;
  font-family: var(--slab);
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  background: linear-gradient(180deg, var(--red-hi), var(--red) 45%, var(--red-2));
  box-shadow: 0 4px 0 #3e0404, 0 8px 14px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
  transition: transform 0.06s, box-shadow 0.06s, opacity 0.2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #3e0404, 0 3px 6px rgba(0, 0, 0, 0.35); }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn.small { font-size: 0.9rem; padding: 0.5em 1.1em; }
.btn.ghost {
  background: linear-gradient(180deg, #fbf3e6, #e7d4b8);
  color: var(--ink);
  text-shadow: none;
  box-shadow: 0 3px 0 #a58a66, 0 6px 10px rgba(0, 0, 0, 0.2), inset 0 1px 0 #fff;
}
.btn.ghost:active { box-shadow: 0 1px 0 #a58a66; }
.icon-btn {
  width: 46px; height: 46px; border-radius: 50%;
  border: 2px solid currentColor; background: transparent;
  display: inline-grid; place-items: center; flex: none;
}
.icon-btn svg { width: 24px; height: 24px; }
.link-btn { border: 0; background: none; text-decoration: underline; padding: 0.3em; }

/* segmented control (like 3/4/5 Spieler) */
.seg {
  display: inline-flex;
  border-radius: 12px;
  border: 1px solid #8f7a5f;
  overflow: hidden;
  background: linear-gradient(180deg, #fff, #e6e1d8);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
}
.seg button {
  border: 0;
  border-right: 1px solid #b8ab97;
  background: none;
  padding: 0.65em 1.2em;
  font-family: var(--slab);
  font-weight: 700;
  color: #6a6156;
  font-size: 1.02rem;
  min-width: 5.5em;
}
.seg button:last-child { border-right: 0; }
.seg button.on {
  color: #fff;
  background: linear-gradient(180deg, #f2b648, #e08f1c);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}
.seg.red button.on { background: linear-gradient(180deg, var(--red-hi), var(--red-2)); }
.seg.green button.on { background: linear-gradient(180deg, #4b9a43, #2b6526); }

.toggle {
  border: 1px solid #9c8a72;
  border-radius: 12px;
  padding: 0.55em 0.9em;
  background: linear-gradient(180deg, #fff, #e8e1d6);
  font-family: var(--slab);
  font-weight: 700;
  color: #5c5247;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.15);
  min-height: 46px;
  line-height: 1.1;
}
.toggle.on { color: #fff; background: linear-gradient(180deg, #f2b648, #e08f1c); border-color: #b06a0c; }
.toggle.red.on { background: linear-gradient(180deg, var(--red-hi), var(--red-2)); border-color: #4e0505; }
.toggle:disabled { opacity: 0.35; }

/* switch */
.switch { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 6px 0; font-size: 1.05rem; }
.switch input { appearance: none; width: 64px; height: 36px; border-radius: 20px; background: #c9b79c; position: relative; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3); flex: none; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #666, #2c2c2c); transition: left 0.15s; }
.switch input:checked::after { left: 31px; background: radial-gradient(circle at 35% 30%, #ffb347, #e0670d); }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  padding-top: max(12px, env(safe-area-inset-top));
}
.topbar h1 { font-family: var(--slab); font-size: clamp(1.3rem, 3vw, 2.1rem); margin: 0; flex: 1; line-height: 1.1; }
.topbar .actions { display: flex; gap: 10px; align-items: center; }
.wood .topbar h1 { text-shadow: 0 2px 3px rgba(0, 0, 0, 0.5); }

/* ---------- home ---------- */
.home-title { font-family: var(--slab); font-weight: 700; }
.section-title {
  font-family: var(--slab);
  font-size: 1.2rem;
  margin: 18px 22px 4px;
  color: #f2dfc4;
  display: flex; align-items: baseline; gap: 12px;
}
.section-title small { font-family: var(--sans); font-weight: 400; opacity: 0.7; font-size: 0.85rem; }
.tables {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 22px 18px;
  padding: 12px 18px 22px;
}
.table-card {
  position: relative;
  padding: 8px 0 34px;
  cursor: pointer;
  border: 0;
  background: none;
  text-align: left;
  color: inherit;
}
.table-card .when { font-size: 1rem; padding: 0 22px 6px; display: flex; justify-content: space-between; align-items: center; color: #f6e8d4; }
.table-card .badge-done { font-family: var(--slab); font-size: 0.8rem; background: var(--red); padding: 2px 10px; border-radius: 10px; }
.table-card .badge-live { font-family: var(--slab); font-size: 0.8rem; background: var(--green); padding: 2px 10px; border-radius: 10px; }
.table-card .oval {
  position: absolute;
  left: 0; right: 0; bottom: 0; top: 46%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(255, 190, 120, 0.25), transparent 60%),
    repeating-linear-gradient(100deg, rgba(0, 0, 0, 0.06) 0 2px, transparent 2px 11px),
    linear-gradient(180deg, #b0612a, #7d3d14);
  box-shadow: 0 10px 0 #5a2a0d, 0 18px 24px rgba(0, 0, 0, 0.45), inset 0 2px 0 rgba(255, 220, 170, 0.35);
}
.table-card .chips { position: relative; display: grid; gap: 4px; padding: 0 22px; z-index: 1; }
.chip {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, #f3e2c8, #e1c9a5);
  color: var(--ink);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
  height: 56px;
}
.chip .avatar { width: 56px; height: 56px; border-radius: 0; }
.chip .name { flex: 1; font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .pts { font-family: var(--slab); font-weight: 700; font-size: 1.25rem; padding-right: 14px; }
.chip.loser { background: linear-gradient(180deg, #e8b3a7, #d38f80); }
.chip.loser .pts::after { content: ' 🍺'; }
.table-card .count { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; z-index: 1; font-size: 1.05rem; color: #fbe9cf; }
.new-card .oval { top: 30%; }
.new-card .center { position: relative; z-index: 1; display: grid; place-items: center; gap: 10px; padding-top: 18%; }
.home-empty { padding: 20px 26px; opacity: 0.75; }
.more { display: block; margin: 0 auto 30px; }
.footer { text-align: center; font-size: 0.8rem; opacity: 0.5; padding: 10px 0 24px; }

/* avatars */
.avatar {
  width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex: none;
  background: #8a6a4a; color: #fff; display: grid; place-items: center;
  font-family: var(--slab); font-weight: 700; font-size: 1.2rem; overflow: hidden;
}
img.avatar { display: block; }

/* ---------- list view ---------- */
.list-page { min-height: 100%; display: flex; flex-direction: column; }
.list-page .topbar { padding-bottom: 6px; }
.limit-pill {
  font-family: var(--slab);
  background: var(--wood-2);
  color: #fbe6c8;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 1rem;
  white-space: nowrap;
}
.scoreboard {
  display: grid;
  gap: 10px;
  padding: 4px 14px 10px;
}
.score {
  position: relative;
  background: linear-gradient(180deg, var(--red-hi) 0, var(--red) 40%, var(--red-2));
  color: #fff;
  border-radius: 16px;
  padding: 10px 12px 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 12px;
  align-items: center;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 0;
}
.score .avatar { width: 64px; height: 64px; grid-row: 1 / span 2; border-radius: 12px; border: 3px solid #f3e3cc; }
.score .name { font-family: var(--slab); font-weight: 700; font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score .role { font-size: 0.85rem; opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score .big {
  grid-column: 1 / -1;
  font-family: var(--slab);
  font-weight: 800;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1;
  text-align: center;
  padding: 6px 0 4px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}
.score .bar { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: rgba(0, 0, 0, 0.35); overflow: hidden; }
.score .bar i { display: block; height: 100%; background: linear-gradient(90deg, #f6c35a, #ff7a2f); border-radius: 4px; }
.score .rest { grid-column: 1 / -1; text-align: center; font-size: 0.8rem; opacity: 0.85; margin-top: 4px; }
.score.out { filter: saturate(0.25) brightness(0.85); }
.score.dealer::before {
  content: 'gibt';
  position: absolute; top: 8px; right: -26px;
  transform: rotate(35deg);
  background: var(--gold); color: #3a2205;
  font-family: var(--slab); font-weight: 700; font-size: 0.75rem;
  padding: 2px 30px;
}
.score.lost { background: linear-gradient(180deg, #3a3a3a, #1c1c1c); }
.score.lost .big::after { content: ' 🍺'; font-size: 0.6em; }

.statusbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.45);
  border-top: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  flex-wrap: wrap;
}
.statusbar .who { flex: 1; font-size: 1.15rem; min-width: 260px; }
.statusbar .who b { font-family: var(--slab); }
.statusbar .who .pos { display: inline-block; margin-right: 12px; white-space: nowrap; }
.statusbar .who .pos small { color: var(--ink-soft); margin-right: 4px; }
.phase {
  font-family: var(--slab);
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 1rem;
}
.phase.bock { background: #1f4f8f; color: #fff; }
.phase.ramsch { background: #6b3f9c; color: #fff; }
.phase.normal { background: #d9c3a1; }
.queue { font-size: 0.85rem; color: var(--ink-soft); }

.finished-banner {
  margin: 10px 14px;
  border-radius: 16px;
  padding: 16px 20px;
  background: linear-gradient(180deg, #3d2412, #26150a);
  color: #fbe6c8;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.finished-banner .txt { flex: 1; font-size: 1.15rem; min-width: 240px; }
.finished-banner .txt b { font-family: var(--slab); font-size: 1.5rem; display: block; }

/* game table */
.games { overflow-x: auto; flex: 1; padding-bottom: 120px; }
.games table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.games th {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--ink-soft);
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--line);
  position: sticky; top: 0; background: var(--paper-2);
  z-index: 1;
}
.games th.p { text-align: center; font-family: var(--slab); font-weight: 700; color: var(--ink); font-size: 0.95rem; }
.games td { padding: 9px 10px; border-bottom: 1px solid #c9ae8a; font-size: 1rem; vertical-align: middle; }
.games tr { cursor: pointer; }
.games tr:active td { background: rgba(255, 255, 255, 0.5); }
.games td.nr { color: var(--ink-soft); width: 3em; }
.games td.desc { min-width: 220px; }
.games td.desc .who { font-family: var(--slab); font-weight: 700; }
.games td.val { text-align: right; font-family: var(--slab); font-weight: 700; width: 4em; }
.games td.p { text-align: center; border-left: 1px dashed #c9ae8a; white-space: nowrap; }
.games td.p .t { font-family: var(--slab); font-weight: 700; font-size: 1.05rem; }
.games td.p .d { font-size: 0.78rem; color: var(--red); display: block; }
.games td.p.sit { background: rgba(0, 0, 0, 0.04); color: #a8957c; }
.games td.p.sit .t { font-weight: 400; }
.tag { display: inline-block; font-size: 0.72rem; font-family: var(--slab); font-weight: 700; padding: 1px 7px; border-radius: 8px; margin-left: 6px; vertical-align: 1px; }
.tag.bock { background: #1f4f8f; color: #fff; }
.tag.ramsch { background: #6b3f9c; color: #fff; }
.tag.trig { background: var(--gold); color: #3a2205; }
.tag.won { background: var(--green); color: #fff; }
.tag.lost { background: var(--red); color: #fff; }
.games .empty { padding: 30px; text-align: center; color: var(--ink-soft); }

.fab {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  font-size: 1.25rem;
  padding: 0.85em 2em;
  z-index: 20;
}

/* ---------- bottom sheet ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 40; animation: fade 0.15s; }
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-height: 94vh;
  overflow-y: auto;
  z-index: 41;
  border-top: 1px solid #a68b67;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
  border-radius: 18px 18px 0 0;
  animation: up 0.2s ease-out;
  padding-bottom: env(safe-area-inset-bottom);
}
@keyframes up { from { transform: translateY(40%); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid #c9ae8a;
  position: sticky; top: 0;
  background: inherit;
  z-index: 2;
}
.sheet-head h2 { flex: 1; text-align: center; margin: 0; font-weight: 400; font-size: 1.35rem; }
.sheet-body { padding: 16px 18px 20px; }

.entry-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px 18px;
  max-width: 1100px;
  margin: 0 auto;
}
.entry-main { display: grid; gap: 14px; min-width: 0; }
.entry-side { display: grid; gap: 10px; align-content: start; grid-template-columns: 1fr 1fr; width: 280px; }
.entry-side .full { grid-column: 1 / -1; }
.declarers { display: flex; width: 100%; }
.declarers button { flex: 1; min-width: 0; padding: 0.8em 0.4em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview {
  background: rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 1.05rem;
  min-height: 48px;
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px;
}
.preview b { font-family: var(--slab); font-size: 1.3rem; }
.preview .warn { color: var(--red); font-weight: 600; }
.result-row { display: flex; gap: 14px; justify-content: center; align-items: center; flex-wrap: wrap; }
.result-row .seg button { min-width: 8em; font-size: 1.2rem; }
.field { display: grid; gap: 4px; font-size: 0.85rem; color: var(--ink-soft); }
.field select, .field input {
  font-size: 1.1rem; padding: 0.55em 0.7em; border-radius: 10px; border: 1px solid #9c8a72;
  background: #fffaf2; color: var(--ink); min-height: 46px;
}
.bock-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bock-row .hint { font-size: 0.85rem; color: var(--ink-soft); }

/* wheel picker */
.wheels {
  position: relative;
  display: flex;
  border-radius: 12px;
  background: linear-gradient(180deg, #cfcac3, #fbfbfa 30%, #fbfbfa 70%, #cfcac3);
  border: 1px solid #8e8576;
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.25);
  height: 220px;
  overflow: hidden;
}
.wheels::before {
  content: '';
  position: absolute;
  left: 8px; right: 8px; top: 88px; height: 44px;
  background: rgba(225, 220, 212, 0.75);
  border-radius: 10px;
  pointer-events: none;
}
.wheel {
  position: relative;
  flex: 1;
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  padding: 88px 0;
  mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
}
.wheel::-webkit-scrollbar { display: none; }
.wheel div {
  height: 44px;
  line-height: 44px;
  scroll-snap-align: center;
  padding: 0 14px;
  font-size: 1.45rem;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.wheel div.sel { color: #111; }
.wheel div .s { display: inline-block; width: 1.2em; text-align: center; }
.wheel div .s.red { color: #c32237; }
.wheel.disabled { opacity: 0.35; pointer-events: none; }

/* ramsch input */
.chips-select { display: flex; gap: 10px; flex-wrap: wrap; }
.chips-select button { flex: 1; min-width: 120px; padding: 0.8em 0.6em; }
.augen { display: flex; align-items: center; gap: 10px; }
.augen input { width: 120px; text-align: center; font-family: var(--slab); font-size: 1.8rem; font-weight: 700; padding: 0.2em; border-radius: 12px; border: 1px solid #9c8a72; background: #fffaf2; }
.augen .step { width: 54px; height: 54px; border-radius: 50%; font-size: 1.6rem; padding: 0; }
.mode-row { display: flex; justify-content: center; }

/* ---------- dialogs / forms ---------- */
.dialog {
  position: fixed;
  z-index: 41;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, 94vw);
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: fade 0.15s;
}
.dialog.wide { width: min(1100px, 96vw); }
.dialog h2 {
  font-family: var(--slab);
  text-align: center;
  font-size: 2rem;
  margin: 26px 30px 0;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--ink);
}
.dialog .body { padding: 20px 30px 26px; display: grid; gap: 16px; }
.dialog .buttons { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; padding-top: 6px; }
.dialog .close { position: absolute; top: 18px; left: 18px; color: var(--ink); }
.center { text-align: center; }
.muted { color: var(--ink-soft); }
.err { color: var(--red); font-weight: 600; min-height: 1.3em; text-align: center; }

.seats { display: grid; gap: 10px; }
.seat-row { display: grid; grid-template-columns: 2.2em 52px 1fr auto; gap: 12px; align-items: center; }
.seat-row .num { font-family: var(--slab); font-weight: 700; font-size: 1.2rem; text-align: center; }
.seat-row select { font-size: 1.15rem; padding: 0.6em; border-radius: 10px; border: 1px solid #9c8a72; background: #fffaf2; min-height: 50px; }
.seat-row .deal { font-size: 0.9rem; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.seat-row .deal input { width: 22px; height: 22px; }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.person {
  display: flex; align-items: center; gap: 10px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.5);
  padding: 6px;
  text-align: left;
  min-height: 60px;
}
.person .avatar { width: 46px; height: 46px; }
.person span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.05rem; }
.person.on { border-color: #e08f1c; background: #fde6bf; box-shadow: 0 0 0 2px rgba(224, 143, 28, 0.3); }
.person.busy { opacity: 0.55; }

.draw-tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.draw-table { background: rgba(255, 255, 255, 0.5); border-radius: 16px; padding: 12px; }
.draw-table h3 { margin: 0 0 8px; font-family: var(--slab); font-size: 1.1rem; display: flex; justify-content: space-between; }
.draw-table ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.draw-table li { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; }
.draw-table li .avatar { width: 40px; height: 40px; }
.draw-table li small { margin-left: auto; color: var(--ink-soft); }

/* players page */
.page-paper { min-height: 100%; }
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; padding: 10px 18px 40px; }
.roster .card {
  display: flex; align-items: center; gap: 14px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 14px; padding: 10px; border: 0; text-align: left;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
.roster .card .avatar { width: 72px; height: 72px; }
.roster .card b { font-family: var(--slab); font-size: 1.2rem; display: block; }
.roster .card.archived { opacity: 0.5; }
.photo-edit { display: flex; gap: 18px; align-items: center; justify-content: center; flex-wrap: wrap; }
.photo-edit .avatar { width: 140px; height: 140px; border-radius: 18px; font-size: 3rem; }
.photo-edit .col { display: grid; gap: 10px; }
.text-input { font-size: 1.3rem; padding: 0.55em 0.8em; border-radius: 12px; border: 1px solid #9c8a72; background: #fffaf2; width: 100%; }

/* stats */
.stats-wrap { padding: 6px 18px 40px; display: grid; gap: 18px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: rgba(255, 255, 255, 0.55); border-radius: 14px; padding: 12px 16px; }
.kpi b { display: block; font-family: var(--slab); font-size: 2.1rem; color: var(--red); line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 0.9rem; color: var(--ink-soft); }
.stat-table { width: 100%; border-collapse: collapse; background: rgba(255, 255, 255, 0.45); border-radius: 14px; overflow: hidden; font-variant-numeric: tabular-nums; }
.stat-table th { text-align: right; font-size: 0.85rem; font-weight: 400; color: var(--ink-soft); padding: 10px; border-bottom: 2px solid var(--line); cursor: pointer; white-space: nowrap; }
.stat-table th:first-child, .stat-table td:first-child { text-align: left; }
.stat-table th.sorted { color: var(--ink); font-weight: 700; }
.stat-table td { padding: 8px 10px; border-bottom: 1px solid #d5bc98; text-align: right; font-size: 1.05rem; }
.stat-table td .pl { display: flex; align-items: center; gap: 10px; font-family: var(--slab); font-weight: 700; }
.stat-table td .pl .avatar { width: 40px; height: 40px; font-size: 1rem; }
.stat-table td.money { font-family: var(--slab); font-weight: 700; color: var(--red); }
.barcell { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.barcell i { display: inline-block; height: 10px; border-radius: 5px; background: linear-gradient(90deg, #f2b648, #c3521b); }
.stats-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stats-head select { font-size: 1.05rem; padding: 0.45em 0.7em; border-radius: 10px; border: 1px solid #9c8a72; background: #fffaf2; }

/* login */
.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login form { width: min(440px, 92vw); border-radius: 28px; box-shadow: var(--shadow); padding: 28px; display: grid; gap: 16px; text-align: center; }
.login h1 { font-family: var(--slab); margin: 0; font-size: 2.4rem; }

/* toast */
.toast {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translateX(-50%);
  background: #2b1a0e;
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  z-index: 100;
  box-shadow: var(--shadow);
  max-width: 90vw;
  animation: fade 0.2s;
}
.toast.error { background: var(--red); }

.offline {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  background: #b34a00; color: #fff; text-align: center; padding: 4px; font-size: 0.9rem;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .entry-side { width: 230px; gap: 8px; }
  .toggle { padding: 0.45em 0.6em; font-size: 0.92rem; min-height: 40px; }
  .sheet-body { padding: 10px 12px 14px; }
  .entry-main { gap: 10px; }
}
@media (max-width: 700px) {
  .entry-grid { grid-template-columns: 1fr; }
  .entry-side { width: auto; grid-template-columns: repeat(4, 1fr); }
  .entry-side .full { grid-column: span 2; }
}
@media (max-width: 600px) {
  .entry-side { grid-template-columns: 1fr 1fr; }
  .score .avatar { width: 44px; height: 44px; }
  .seg button { min-width: 0; padding: 0.6em 0.8em; }
  .games td.desc { min-width: 160px; }
  .dialog h2 { font-size: 1.5rem; }
  .dialog .body { padding: 16px; }
}
/* short landscape phones: keep the scoreboard compact */
@media (max-height: 520px) and (orientation: landscape) {
  .score { padding: 6px 10px 8px; }
  .score .avatar { width: 40px; height: 40px; }
  .score .big { font-size: 2.2rem; padding: 2px 0; }
  .score .rest { display: none; }
  .wheels { height: 176px; }
  .wheels::before { top: 66px; }
  .wheel { padding: 66px 0; }
}
.seg.green button[data-w="0"].on { background: linear-gradient(180deg, var(--red-hi), var(--red-2)); }
