/* Grimoár – styly. Konzervativní CSS pro starší iOS Safari (bez gap, aspect-ratio, inset). */

@font-face {
  font-family: 'PiratesBay';
  src: url('../assets/fonts/piratesbay.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Papyrus';
  src: url('../assets/fonts/papyrus.woff2') format('woff2'), url('../assets/fonts/papyrus.woff') format('woff');
  font-display: swap;
}

:root {
  --bg: #0f1a1c;
  --bg2: #16262a;
  --panel: rgba(18, 30, 34, 0.92);
  --panel-border: rgba(232, 217, 181, 0.18);
  --parch: #e9dbb8;
  --parch-dark: #cdb98a;
  --ink: #2b1d12;
  --text: #ece4d0;
  --muted: #a89f8a;
  --accent: #d8a640;
  --danger: #b3261e;
  --townsfolk: #2b6bd6;
  --outsider: #3aa7c9;
  --minion: #e07a1f;
  --demon: #c11f1f;
  --traveller: #a23cd6;
  --fabled: #d9b52b;
  --token: 100px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', serif;
  font-size: 16px;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
input, textarea { -webkit-user-select: text; user-select: text; }
/* Zákaz označování textu jen tam, kde není textové pole (iOS blokuje klávesnici u polí uvnitř user-select:none) */
.btn, .token, .seat, .reminder, .grim-top, .topbar, .role-card, .role-grid, .bag-token, .bag-progress, .bag-title, .bag-sub,
.show-screen, .cover-screen, .team-title, h1, h2, h3, .night-row, .corner-panel, .zoom-controls, .picker-tabs, .sheet-head,
.action-grid, .pick-item, .stat-card, .script-card, .setup-head, .counts, .stepper, .resume-banner, .home-grid, .update-banner, img, svg {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
button { font-family: inherit; }
img { -webkit-user-drag: none; }

.app { position: fixed; top: 0; left: 0; right: 0; bottom: 0; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

h1, h2, h3, .title-font { font-family: 'PiratesBay', Georgia, serif; font-weight: normal; letter-spacing: 0.5px; }
h1 { font-size: 34px; margin: 0 0 8px; color: var(--parch); text-shadow: 0 2px 6px rgba(0,0,0,0.6); }
h2 { font-size: 24px; margin: 0 0 8px; color: var(--parch); }
h3 { font-size: 18px; margin: 0 0 6px; color: var(--parch); }

/* ---------- Tlačítka ---------- */
.btn {
  display: inline-block; cursor: pointer; border: 1px solid var(--panel-border);
  background: linear-gradient(#2a3d42, #1a292d); color: var(--text);
  padding: 10px 16px; border-radius: 8px; font-size: 16px; line-height: 1.2;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 0;
}
.btn:active { transform: translateY(1px); filter: brightness(1.15); }
.btn.primary { background: linear-gradient(#e0b04a, #b9832a); color: #2b1d12; border-color: #f0d080; font-weight: bold; }
.btn.danger { background: linear-gradient(#a03030, #6f1c1c); border-color: #d06060; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.small { padding: 6px 10px; font-size: 14px; }
.btn.big { padding: 14px 24px; font-size: 18px; }
.btn.icon { padding: 8px 10px; font-size: 20px; line-height: 1; min-width: 44px; text-align: center; }
.btn.active { background: linear-gradient(#5a4a22, #3c3016); border-color: var(--accent); color: #ffe9b0; }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn-row > .btn { margin-right: 8px; margin-bottom: 8px; }
.btn-row > .btn:last-child { margin-right: 0; }

input[type=text], input[type=number], textarea, select {
  background: rgba(0,0,0,0.35); color: var(--text); border: 1px solid var(--panel-border);
  border-radius: 6px; padding: 10px 12px; font-size: 16px; font-family: inherit; width: 100%;
}
textarea { min-height: 120px; resize: vertical; }

/* ---------- Obrazovky ---------- */
.screen { position: absolute; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden; display: flex; flex-direction: column; }
.screen.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.screen-bg {
  background: url('../assets/img/background.jpg') center/cover no-repeat, var(--bg);
}
.screen-bg::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, rgba(10,18,20,0.55), rgba(8,14,16,0.92));
  pointer-events: none;
}
.screen > * { position: relative; }

.topbar {
  display: flex; align-items: center; padding: 8px 12px; padding-top: calc(8px + var(--safe-top));
  background: var(--panel); border-bottom: 1px solid var(--panel-border); flex-shrink: 0; min-height: 56px; z-index: 5;
}
.topbar h2 { margin: 0; font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.topbar .btn { white-space: nowrap; flex-shrink: 0; }
.topbar .spacer { flex: 1; }
.topbar > * { margin-right: 8px; }
.topbar > *:last-child { margin-right: 0; }

.content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px; }
.content.center { display: flex; flex-direction: column; align-items: center; }

/* ---------- Domů ---------- */
.home-grid { display: flex; flex-wrap: wrap; justify-content: center; max-width: 960px; margin: 0 auto; }
.script-card {
  width: 260px; margin: 10px; padding: 14px; border-radius: 12px; cursor: pointer; text-align: center;
  background: var(--panel); border: 1px solid var(--panel-border); box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  position: relative;
}
.script-card:active { filter: brightness(1.2); }
.script-card img.logo { width: 150px; height: 150px; object-fit: contain; display: block; margin: 0 auto 8px; }
.script-card .logo-placeholder { width: 150px; height: 150px; margin: 0 auto 8px; display: flex; align-items: center; justify-content: center; font-family: 'PiratesBay', serif; font-size: 40px; color: var(--accent); }
.script-card .name { font-family: 'PiratesBay', serif; font-size: 22px; color: var(--parch); }
.script-card .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.script-card .del { position: absolute; top: 6px; right: 6px; }
.home-actions { text-align: center; margin: 16px; }
.home-actions .btn { margin: 6px; }
.resume-banner {
  max-width: 640px; margin: 12px auto; padding: 14px 18px; background: rgba(216,166,64,0.15); border: 1px solid var(--accent);
  border-radius: 10px; display: flex; align-items: center; justify-content: space-between;
}

/* ---------- Příprava ---------- */
.setup-head { display: flex; align-items: center; flex-wrap: wrap; padding: 10px 16px; background: rgba(0,0,0,0.3); border-bottom: 1px solid var(--panel-border); }
.setup-head > * { margin-right: 18px; }
.stepper { display: inline-flex; align-items: center; }
.stepper .btn { min-width: 44px; }
.stepper .val { min-width: 44px; text-align: center; font-size: 24px; font-family: 'PiratesBay', serif; }
.stepper label { margin-right: 8px; color: var(--muted); }
.counts { display: flex; }
.counts .count { text-align: center; margin-right: 14px; padding: 4px 10px; border-radius: 8px; border: 1px solid transparent; }
.counts .count .n { font-size: 22px; font-family: 'PiratesBay', serif; }
.counts .count .l { font-size: 12px; color: var(--muted); }
.counts .count.ok { border-color: rgba(120, 200, 120, 0.6); }
.counts .count.bad { border-color: rgba(230, 120, 60, 0.8); background: rgba(230,120,60,0.12); }
.team-section { margin-bottom: 14px; }
.team-title { display: flex; align-items: center; padding: 4px 0; border-bottom: 2px solid; margin-bottom: 8px; font-family: 'PiratesBay', serif; font-size: 20px; }
.team-title.townsfolk { border-color: var(--townsfolk); color: #8fb4ff; }
.team-title.outsider { border-color: var(--outsider); color: #8fdcf0; }
.team-title.minion { border-color: var(--minion); color: #ffb070; }
.team-title.demon { border-color: var(--demon); color: #ff8080; }
.team-title.traveller { border-color: var(--traveller); color: #d9a0ff; }
.team-title.fabled { border-color: var(--fabled); color: #ffe080; }
.role-grid { display: flex; flex-wrap: wrap; }
.role-card {
  width: 118px; margin: 0 8px 10px 0; text-align: center; cursor: pointer; padding: 6px 4px; border-radius: 10px;
  border: 2px solid transparent; position: relative;
}
.role-card .token { margin: 0 auto; }
.role-card .rc-name { font-size: 12px; margin-top: 4px; color: var(--text); line-height: 1.15; min-height: 28px; }
.role-card.selected { border-color: var(--accent); background: rgba(216,166,64,0.14); }
.role-card.dimmed { opacity: 0.45; }
.role-card.compact { width: 74px; margin: 0 4px 4px 0; padding: 3px 2px; }
.role-grid.flow { align-items: flex-start; }
.setup-row5 { display: flex; flex-wrap: nowrap; justify-content: center; align-items: flex-start; }
.team-chip.blank { visibility: hidden; }
.team-chip {
  width: 26px; margin: 0 6px 4px 0; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  -webkit-writing-mode: vertical-rl; writing-mode: vertical-rl; transform: rotate(180deg);
  font-family: 'PiratesBay', serif; font-size: 15px; letter-spacing: 1px; border-left: 3px solid; padding: 4px 0; background: rgba(0,0,0,0.3);
}
.team-chip.townsfolk { border-color: var(--townsfolk); color: #8fb4ff; }
.team-chip.outsider { border-color: var(--outsider); color: #8fdcf0; }
.team-chip.minion { border-color: var(--minion); color: #ffb070; }
.team-chip.demon { border-color: var(--demon); color: #ff8080; }
.role-card.compact.big { width: 100px; margin: 0 6px 6px 0; }
.role-grid.compact-grid .role-card .token { margin: 0 auto; }
.setup-row { display: flex; flex-wrap: wrap; }
.setup-row .team-section { margin-right: 24px; }
.setup-content .team-section { margin-bottom: 8px; }
.setup-content .team-title { font-size: 18px; padding: 2px 0; margin-bottom: 6px; }
.role-card .rc-ability { font-size: 11px; color: var(--muted); line-height: 1.2; margin-top: 2px; display: none; }
.role-grid.with-ability .role-card { width: 160px; }
.role-grid.with-ability .role-card .rc-ability { display: block; }

/* ---------- Žeton ---------- */
.token {
  position: relative; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(circle at 50% 40%, #f3e7c8 0%, #e6d6b0 55%, #cfba8c 100%);
  box-shadow: 0 3px 6px rgba(0,0,0,0.55), inset 0 0 0 2px rgba(120, 90, 40, 0.35), inset 0 0 18px rgba(120,90,40,0.35);
  overflow: hidden;
}
.token::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: 50%;
  background: url('../assets/img/token.png') center/cover; opacity: 0.16; mix-blend-mode: multiply;
}
.token .token-icon { position: absolute; left: 12%; top: 5%; width: 76%; height: 76%; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.35)); }
.token .token-name { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.token .token-name text { fill: var(--ink); font-family: 'PiratesBay', Georgia, serif; font-weight: bold; letter-spacing: 0.5px; }
.token.empty { background: radial-gradient(circle, rgba(60,70,72,0.7), rgba(30,38,40,0.9)); box-shadow: inset 0 0 0 2px rgba(232,217,181,0.25); }
.token .token-empty { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; color: var(--muted); font-size: 12px; }
.token .token-setup { position: absolute; top: 6%; right: 8%; color: #6b3b1a; font-size: 14px; z-index: 2; }
.token.align-evil { box-shadow: 0 3px 6px rgba(0,0,0,0.55), inset 0 0 0 4px var(--demon); }
.token.align-good { box-shadow: 0 3px 6px rgba(0,0,0,0.55), inset 0 0 0 4px var(--townsfolk); }
.token .token-badge { position: absolute; top: 4px; left: 4px; background: var(--accent); color: var(--ink); border-radius: 10px; padding: 1px 6px; font-size: 12px; font-weight: bold; }

.reminder { position: relative; cursor: pointer; }
.reminder .reminder-face {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0; border-radius: 50%; overflow: hidden;
  background: url('../assets/img/reminder.png') center/cover, #d9c8a0; box-shadow: 0 2px 4px rgba(0,0,0,0.55);
}
.reminder .reminder-face img { position: absolute; left: 16%; top: 3%; width: 68%; height: 68%; object-fit: contain; }
.reminder .reminder-glyph { position: absolute; left: 0; right: 0; top: 14%; text-align: center; font-size: 45%; color: var(--ink); line-height: 1; }
.reminder.note .reminder-face { background: radial-gradient(circle at 50% 40%, #f6ecd2 0%, #e9dbb8 60%, #d3bf92 100%); box-shadow: 0 2px 4px rgba(0,0,0,0.55), inset 0 0 0 2px rgba(120,90,40,0.35); }
.reminder.note .reminder-glyph { top: 30%; font-size: 60%; opacity: 0.35; }
/* text přes spodní část žetonu – kontrastní pruh, může přesahovat do stran, max. 2 řádky */
.reminder .reminder-label {
  position: absolute; left: -20%; right: -20%; bottom: -3%; z-index: 7;
  background: rgba(8, 14, 16, 0.9); color: #f3e9cf; border: 1px solid rgba(232,217,181,0.35); border-radius: 6px;
  padding: 1px 3px; font-size: 11px; line-height: 1.12; text-align: center; white-space: normal; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  pointer-events: none; text-shadow: 0 1px 2px #000; font-weight: bold;
}
/* poznámka: text přes celý žeton, až 4 řádky */
.reminder.note .reminder-label { top: 4%; bottom: auto; left: -25%; right: -25%; -webkit-line-clamp: 4; font-weight: normal; min-height: 92%; }
.pick-list .reminder .reminder-label { display: none; }

/* ---------- Grimoár ---------- */
.board {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden; touch-action: none;
  background: url('../assets/img/background.jpg') center/cover no-repeat, var(--bg);
}
.board::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(6, 12, 14, 0.72); pointer-events: none; }
.world { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-origin: 0 0; }
.seat { position: absolute; width: 0; height: 0; }
.seat-inner { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); text-align: center; }
.seat .token { margin: 0 auto; cursor: pointer; }
.seat .seat-name {
  position: absolute; z-index: 6; left: 50%; top: 100%; transform: translateX(-50%); margin-top: -4px;
  font-size: 14px; color: var(--parch); text-shadow: 0 1px 3px #000; white-space: nowrap;
  background: rgba(8,14,16,0.85); border: 1px solid rgba(232,217,181,0.45); border-radius: 8px; padding: 1px 8px;
  display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis;
}
.seat.traveller .seat-name { color: #d9a0ff; }
.seat .shroud {
  position: absolute; left: 50%; top: -12%; width: 45%; height: 90%; transform: translateX(-50%);
  background: url('../assets/img/shroud.png') center/contain no-repeat; pointer-events: none; z-index: 3;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.7));
}
.seat.dead .token { filter: brightness(0.55) saturate(0.6); }
.seat .ghost-vote {
  position: absolute; right: -10%; top: 45%; width: 32%; height: 32%; z-index: 4;
  background: url('../assets/img/vote.png') center/contain no-repeat; pointer-events: none;
}
.seat .token-wrap { position: relative; display: inline-block; }
.seat .night-badge {
  position: absolute; top: 4%; width: 30%; height: 30%; border-radius: 50%; z-index: 5;
  display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 14px;
  color: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.6); border: 2px solid rgba(255,255,255,0.7);
}
.seat .night-badge.left { left: -8%; background: #23477a; }
.seat .night-badge.right { right: -8%; background: #7a2323; }
.seat .night-badge.active { box-shadow: 0 0 0 4px var(--accent), 0 2px 4px rgba(0,0,0,0.6); }
.seat .night-badge.done { opacity: 0.45; }
.seat .believes {
  position: absolute; left: -12%; bottom: 8%; width: 36%; height: 36%; border-radius: 50%; z-index: 4;
  background: radial-gradient(circle, #f3e7c8, #cfba8c); box-shadow: 0 2px 4px rgba(0,0,0,0.6); border: 2px dashed #6b3b1a;
}
.seat .believes img { width: 100%; height: 100%; object-fit: contain; }
.seat .reminders { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.seat .reminders .reminder { position: absolute; transform: translate(-50%, -50%); z-index: 4; }

.seat.highlight .token { box-shadow: 0 0 0 5px var(--accent), 0 0 30px rgba(216,166,64,0.9); }
.seat.dragging { z-index: 20; }
.seat .seat-note-dot { position: absolute; top: 0; right: -6px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); z-index: 5; }

.grim-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 30; display: flex; align-items: center; flex-wrap: wrap;
  padding: 6px 10px; padding-top: calc(6px + var(--safe-top)); background: linear-gradient(rgba(8,14,16,0.92), rgba(8,14,16,0.75));
  border-bottom: 1px solid var(--panel-border);
}
.grim-top > * { margin-right: 6px; margin-top: 2px; margin-bottom: 2px; }
.grim-top .phase { font-family: 'PiratesBay', serif; font-size: 20px; color: var(--parch); margin-right: 10px; white-space: nowrap; line-height: 1.1; }
.grim-top .script-title { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.grim-top .spacer { flex: 1; }
.grim-top .btn { white-space: nowrap; padding: 8px 10px; font-size: 15px; }
.grim-top .btn.icon { padding: 7px 9px; min-width: 38px; }

.corner-panel {
  position: absolute; z-index: 25; background: rgba(8,14,16,0.75); border: 1px solid var(--panel-border); border-radius: 10px; padding: 6px 8px;
}
.corner-panel .cp-title { font-size: 12px; color: var(--muted); margin-bottom: 4px; text-align: center; }
.corner-panel .cp-tokens { display: flex; }
.corner-panel .cp-tokens .token { margin-right: 6px; cursor: pointer; }
.corner-panel .cp-tokens .token:last-child { margin-right: 0; }
.bluffs-panel { left: 10px; bottom: calc(10px + var(--safe-bottom)); }
.fabled-panel { right: 10px; bottom: calc(10px + var(--safe-bottom)); }

.zoom-controls { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); z-index: 25; display: flex; flex-direction: column; }
.zoom-controls .btn { margin-bottom: 6px; }

/* Drawer (postranní panel) */
.drawer {
  position: absolute; top: 0; bottom: 0; right: 0; width: 340px; max-width: 90%; z-index: 28; background: var(--panel);
  border-left: 1px solid var(--panel-border); box-shadow: -8px 0 30px rgba(0,0,0,0.6); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.2s ease-out;
}
.drawer.open { transform: translateX(0); }
.drawer .drawer-head { display: flex; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--panel-border); }
.drawer .drawer-head h3 { flex: 1; margin: 0; }
.drawer .drawer-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px 12px; }
.drawer textarea { min-height: 60vh; font-size: 17px; line-height: 1.4; }

.night-list .night-row {
  display: flex; align-items: center; padding: 8px 6px; border-bottom: 1px solid rgba(255,255,255,0.06); cursor: pointer; border-radius: 6px;
}
.night-row .num { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 13px; margin-right: 8px; flex-shrink: 0; color: #fff; }
.night-row.first .num { background: #23477a; }
.night-row.other .num { background: #7a2323; }
.night-row .num.marker { background: #3b3b3b; font-size: 11px; }
.night-row .token { margin-right: 10px; }
.night-row .nr-text { flex: 1; min-width: 0; }
.night-row .nr-role { font-weight: bold; color: var(--parch); }
.night-row .nr-players { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.night-row .nr-check { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--muted); margin-left: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.night-row.done .nr-check { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.night-row.done { opacity: 0.6; }
.night-row.dead .nr-role { text-decoration: line-through; opacity: 0.7; }
.night-row.active { background: rgba(216,166,64,0.18); }
.night-row .nr-reminder { font-size: 14px; color: var(--text); margin-top: 4px; line-height: 1.35; white-space: normal; }
.night-row .nr-actions { margin-top: 6px; }
.night-row .nr-actions .btn { margin-right: 6px; margin-bottom: 4px; }

/* ---------- Modal / bottom sheet ---------- */
.modal-backdrop { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  width: 560px; max-width: 94%; max-height: 90%; display: flex; flex-direction: column; overflow: hidden;
}
.modal.wide { width: 900px; }
.modal .modal-head { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--panel-border); }
.modal .modal-head h3 { flex: 1; margin: 0; font-size: 20px; }
.modal .modal-body { padding: 14px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal .modal-foot { padding: 10px 16px; border-top: 1px solid var(--panel-border); text-align: right; }
.modal .modal-foot .btn { margin-left: 8px; }
.sheet-head { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--panel-border); }
.sheet-head .token { margin-right: 14px; }
.sheet-head .sh-name { font-family: 'PiratesBay', serif; font-size: 22px; color: var(--parch); }
.sheet-head .sh-role { color: var(--muted); font-size: 14px; }
.sheet-head .sh-ability { font-size: 13px; color: var(--text); margin-top: 4px; line-height: 1.3; }
.action-grid { display: flex; flex-wrap: wrap; padding: 10px; }
.action-grid .btn { width: calc(33.33% - 8px); margin: 4px; padding: 12px 6px; text-align: center; font-size: 15px; }
.action-grid .btn .ic { display: block; font-size: 22px; margin-bottom: 4px; }
.picker-tabs { display: flex; margin-bottom: 8px; }
.picker-tabs .btn { margin-right: 6px; }
.picker-search { margin-bottom: 8px; }
.pick-list .pick-item { display: flex; align-items: center; padding: 8px; border-radius: 8px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.06); }
.pick-list .pick-item:active { background: rgba(255,255,255,0.08); }
.pick-list .pick-item .token, .pick-list .pick-item .reminder { margin-right: 12px; }
.pick-list .pick-item .pi-text { flex: 1; }
.pick-list .pick-item .pi-sub { color: var(--muted); font-size: 13px; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.hint { color: var(--muted); font-size: 13px; }

/* ---------- Pytlík ---------- */
.bag-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.bag-title { font-family: 'PiratesBay', serif; font-size: 36px; color: var(--parch); text-shadow: 0 2px 8px #000; margin-bottom: 6px; text-align: center; }
.bag-sub { color: var(--muted); font-size: 18px; margin-bottom: 20px; }
.bag-tokens { display: flex; flex-wrap: wrap; justify-content: center; max-width: 900px; }
.bag-token {
  width: 110px; height: 110px; margin: 10px; border-radius: 50%; cursor: pointer;
  background: radial-gradient(circle at 50% 35%, #4a3a2a, #1e160f 75%); box-shadow: 0 6px 14px rgba(0,0,0,0.7), inset 0 0 0 3px rgba(232,217,181,0.25);
  display: flex; align-items: center; justify-content: center; transition: transform 0.15s;
}
.bag-token::after { content: '?'; font-family: 'PiratesBay', serif; font-size: 44px; color: rgba(232,217,181,0.35); }
.bag-token:active { transform: scale(1.08); }
.bag-token.taken { opacity: 0; pointer-events: none; }
.bag-progress { display: flex; flex-wrap: wrap; justify-content: center; margin-top: 16px; max-width: 900px; }
.bag-progress .bp { padding: 6px 10px; margin: 4px; border-radius: 14px; background: rgba(0,0,0,0.4); border: 1px solid var(--panel-border); font-size: 14px; color: var(--muted); cursor: pointer; }
.bag-progress .bp.done { color: var(--parch); border-color: rgba(120,200,120,0.6); }
.bag-progress .bp.current { border-color: var(--accent); color: var(--accent); }

/* ---------- Ukázat hráči (fullscreen) ---------- */
.show-screen {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 200; background: radial-gradient(ellipse at center, #1b2a2e, #05090a 80%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px;
}
.show-screen.flipped .show-inner { transform: rotate(180deg); }
.show-inner { display: flex; flex-direction: column; align-items: center; justify-content: center; max-width: 100%; }
.show-label { font-family: 'PiratesBay', serif; font-size: 42px; color: var(--parch); letter-spacing: 2px; text-shadow: 0 3px 10px #000; margin-bottom: 20px; }
.show-role-name { font-family: 'PiratesBay', serif; font-size: 48px; color: var(--parch); margin-top: 16px; }
.show-ability { font-size: 24px; line-height: 1.4; max-width: 760px; margin-top: 12px; color: var(--text); }
.show-text { font-size: 120px; line-height: 1.15; font-family: 'PiratesBay', serif; color: var(--parch); max-width: 94vw; text-shadow: 0 3px 10px #000; word-wrap: break-word; }
.show-number { font-size: 260px; line-height: 1; font-family: 'PiratesBay', serif; color: var(--parch); text-shadow: 0 6px 20px #000; }
.show-tokens { display: flex; flex-wrap: wrap; justify-content: center; }
.show-tokens .token { margin: 12px; }
.show-close, .show-screen .show-close.hold-btn { position: absolute; top: calc(10px + var(--safe-top)); right: 12px; z-index: 2; }
.show-flip { position: absolute; top: calc(10px + var(--safe-top)); left: 12px; z-index: 2; }
.show-tip { position: absolute; bottom: calc(12px + var(--safe-bottom)); left: 0; right: 0; text-align: center; color: var(--muted); font-size: 14px; }
.info-token {
  width: 440px; height: 440px; border-radius: 50%; display: flex; align-items: center; justify-content: center; text-align: center; padding: 40px;
  background: radial-gradient(circle at 50% 40%, #f3e7c8 0%, #e6d6b0 55%, #cfba8c 100%); color: var(--ink); font-family: 'PiratesBay', serif; font-size: 50px; line-height: 1.1;
  box-shadow: 0 10px 30px rgba(0,0,0,0.7), inset 0 0 0 6px rgba(120,90,40,0.35);
}
.info-token.good { box-shadow: 0 10px 30px rgba(0,0,0,0.7), inset 0 0 0 10px var(--townsfolk); }
.info-token.evil { box-shadow: 0 10px 30px rgba(0,0,0,0.7), inset 0 0 0 10px var(--demon); }

/* ---------- Krycí obrazovka (den) ---------- */
.cover-screen {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 150; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: url('../assets/img/background.jpg') center/cover no-repeat, var(--bg);
}
.cover-screen::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(6,12,14,0.75); }
.cover-screen > * { position: relative; }
.cover-day { font-family: 'PiratesBay', serif; font-size: 72px; color: var(--parch); text-shadow: 0 4px 16px #000; }
.cover-logo { width: 220px; height: 220px; object-fit: contain; margin-bottom: 10px; filter: drop-shadow(0 6px 16px rgba(0,0,0,0.8)); }
.cover-timer { font-size: 96px; font-family: 'PiratesBay', serif; color: var(--parch); margin: 10px 0; }
.cover-timer.warn { color: #ff8a70; }
.cover-timer.finished, .grim-top .timer-display.finished { color: #ff5040; animation: igrim-blink 0.5s steps(2, start) infinite; }
.grim-top .timer-display.warn { color: #ff8a70; border-color: #ff8a70; }
.cover-timer { cursor: pointer; min-height: 40px; }
@keyframes igrim-blink { to { visibility: hidden; } }
.cover-actions { margin-top: 18px; }
.cover-actions .btn { margin: 4px; }

/* ---------- Statistiky ---------- */
.stat-cards { display: flex; flex-wrap: wrap; }
.stat-card { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px; padding: 12px 18px; margin: 0 10px 10px 0; min-width: 140px; text-align: center; }
.stat-card .n { font-size: 32px; font-family: 'PiratesBay', serif; color: var(--parch); }
.stat-card .l { font-size: 13px; color: var(--muted); }
.game-rec { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
.game-rec .gr-head { display: flex; align-items: center; }
.game-rec .gr-head .gr-title { flex: 1; font-family: 'PiratesBay', serif; font-size: 20px; color: var(--parch); }
.game-rec .gr-sub { color: var(--muted); font-size: 13px; }
.game-rec .gr-players { display: flex; flex-wrap: wrap; margin-top: 8px; }
.game-rec .gr-player { display: flex; align-items: center; margin: 0 12px 6px 0; font-size: 14px; }
.game-rec .gr-player .token { margin-right: 6px; }
.game-rec .gr-player.dead { opacity: 0.6; text-decoration: line-through; }
.win-good { color: #8fb4ff; } .win-evil { color: #ff8080; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: calc(24px + var(--safe-bottom)); left: 0; right: 0; text-align: center; z-index: 300; pointer-events: none; }
.toast { display: inline-block; background: rgba(20,30,34,0.95); color: var(--parch); border: 1px solid var(--accent); padding: 10px 18px; border-radius: 20px; font-size: 15px; box-shadow: 0 4px 16px rgba(0,0,0,0.6); }

.text-center { text-align: center; }
.mt { margin-top: 12px; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; }
.row > * { margin-right: 8px; }
.row > *:last-child { margin-right: 0; }
.flex1 { flex: 1; }

@media (max-width: 700px) {
  .action-grid .btn { width: calc(50% - 8px); }
  .drawer { width: 100%; max-width: 100%; }
  .show-text { font-size: 60px; }
  .show-number { font-size: 180px; }
  .info-token { width: 260px; height: 260px; font-size: 30px; }
}

.bag-progress .bp .bp-edit { opacity: 0.6; margin-left: 2px; }
.bag-progress .bp .bp-edit:hover { opacity: 1; }
.bag-title .btn { vertical-align: middle; font-size: 18px; }

/* ---------- Podržet tlačítko / předání vypravěči ---------- */
.hold-btn { position: relative; overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.hold-btn .hold-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255,255,255,0.35); transition-property: width; transition-timing-function: linear; transition-duration: 0ms; }
.hold-btn.holding .hold-fill { width: 100%; }
.hold-btn .hold-label { position: relative; }
.show-screen.handback { background: #05090a; }
.show-screen.handback .show-inner .mt { margin-top: 28px; }

.update-banner {
  position: fixed; top: calc(8px + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 400;
  background: rgba(20,30,34,0.97); color: var(--parch); border: 1px solid var(--accent); border-radius: 12px;
  padding: 8px 12px; display: flex; align-items: center; box-shadow: 0 6px 20px rgba(0,0,0,0.6); font-size: 15px;
}
.update-banner > * { margin-right: 10px; }
.update-banner > *:last-child { margin-right: 0; }

.token .token-split { position: absolute; left: 0; top: 0; right: 0; bottom: 0; }
.token .token-half { position: absolute; top: 0; bottom: 0; width: 50%; overflow: hidden; }
.token .token-half.left { left: 0; }
.token .token-half.right { left: 50%; }
.token .token-half img { filter: drop-shadow(0 2px 2px rgba(0,0,0,0.35)); }
.token .token-split-line { position: absolute; left: 50%; top: 8%; bottom: 22%; width: 2px; margin-left: -1px; background: rgba(90,60,25,0.45); }

/* ---------- botcscripts.com ---------- */
.bs-list .pick-item { align-items: flex-start; }
.bs-icons { display: flex; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.bs-icons .token { margin: 0 3px 3px 0; }
.bs-icons .hint { margin-left: 4px; }

/* ---------- Ukázat hráči: grimoár, sekvence ---------- */
.show-grim { position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden; touch-action: none; background: rgba(6,12,14,0.6); }
.show-grim .seat, .show-grim .token, .show-grim .reminder { cursor: default; }
.show-next { position: absolute; bottom: calc(44px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); z-index: 2; }
.pick-list h3 { margin: 10px 0 4px; }

/* ---------- Offline stav ---------- */
.offline-box { background: rgba(0,0,0,0.3); border: 1px solid var(--panel-border); border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; }
.offline-line { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.offline-line.ok b { color: #9fd89f; }
.offline-line.missing b { color: #ffb070; }
