:root {
  --paper: #f5f1e8;
  --card: #fffdf8;
  --ink: #1b221f;
  --ink-soft: #55605b;
  --line: #e1dacb;
  --moss: #2b5a4c;
  --moss-dark: #1f4338;
  --moss-tint: #e3ede7;
  --gold: #b88c2c;
  --gold-soft: #e2bf62;
  --gold-tint: #f7edd4;
  --red: #a23a2e;
  --red-tint: #f9e3de;
  --night: #121a1b;
  --radius: 18px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --dock-h: 0px;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.5 var(--sans);
  min-height: 100vh;
  overscroll-behavior-y: none;
}
h1, h2 { font-family: var(--serif); font-weight: 600; line-height: 1.18; margin: 0 0 .35em; letter-spacing: -0.005em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.2rem; }
p { margin: 0 0 .7em; }
a { color: var(--moss); }
.muted { color: var(--ink-soft); }
.boot { padding: 40vh 24px 0; text-align: center; color: var(--ink-soft); font-family: var(--serif); font-style: italic; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.page {
  max-width: 620px;
  margin: 0 auto;
  padding: 8px max(18px, env(safe-area-inset-left)) calc(40px + var(--dock-h) + env(safe-area-inset-bottom));
}

/* ---------- Tlačítka */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 20px;
  border-radius: 14px; border: 1.5px solid #cfc6b2; background: #fff;
  font-weight: 650; font-size: 1.02rem; color: var(--ink); text-decoration: none;
  cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--moss); border-color: var(--moss); color: #fff; }
.btn-primary:active { background: var(--moss-dark); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-danger { color: var(--red); border-color: #e2b3aa; }
.btn-dark { background: var(--night); border-color: var(--night); color: #f1e9d2; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-soft); }
.btn-big { min-height: 60px; font-size: 1.12rem; width: 100%; }
.btn-small { min-height: 42px; font-size: .95rem; padding: 0 14px; }
.btn-wide { flex: 1; }
.link { background: none; border: 0; padding: 8px 0; color: var(--moss); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: .98rem; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-size: 1.3rem; display: inline-grid; place-items: center; cursor: pointer; flex: none; }

/* ---------- Náhled */
.preview-banner { background: var(--gold-tint); border-bottom: 1px solid #e8d49f; padding: 10px 18px; font-size: .9rem; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.preview-banner a { font-weight: 650; }

/* ---------- Seznam */
.top { max-width: 620px; margin: 0 auto; padding: calc(18px + env(safe-area-inset-top)) 18px 10px; }
.brand { display: flex; gap: 14px; align-items: center; }
.brand img { border-radius: 11px; box-shadow: 0 2px 10px rgba(22, 38, 42, .25); }
.brand h1 { font-size: 1.65rem; margin: 0; }
.brand p { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.quests { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 14px; }
.qcard { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(40, 35, 20, .05); }
.qcard-link { display: block; padding: 18px 18px 16px; color: inherit; text-decoration: none; }
.qcard h2 { font-size: 1.4rem; margin-bottom: 4px; }
.qcard-meta { color: var(--ink-soft); font-size: .95rem; margin-bottom: 10px; }
.qcard-rec { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-tint), 0 6px 22px rgba(184, 140, 44, .14); }
.rec-label { display: inline-block; color: #8a6514; font-weight: 700; font-size: .85rem; letter-spacing: .02em; margin-bottom: 4px; }
.qcard-cta { display: inline-block; margin-top: 10px; font-weight: 700; color: var(--moss); }
.chips { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 0 0 4px; }
.chip { display: inline-block; font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #ece7da; color: #4f4a3d; }
.chip-playing { background: var(--gold-tint); color: #7a5a12; }
.chip-done { background: var(--moss-tint); color: var(--moss-dark); }
.chip-ready { background: var(--moss-tint); color: var(--moss-dark); }
.chip-warn { background: var(--red-tint); color: var(--red); }
.chip-dl { background: #e5ecf3; color: #2c4d6b; }
.chip-muted { background: transparent; border: 1px solid var(--line); color: var(--ink-soft); font-weight: 600; }
.chip-text { font-size: .88rem; color: var(--ink-soft); }
.empty { text-align: center; padding: 40px 10px; color: var(--ink-soft); }
.foot { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); font-size: .92rem; color: var(--ink-soft); }
.foot-links { display: flex; gap: 20px; flex-wrap: wrap; }
.flash { background: var(--moss-tint); border: 1px solid #c7dbcf; color: var(--moss-dark); padding: 14px 16px; border-radius: 14px; margin: 6px 0 12px; }
.notice { background: #fbf6ea; border: 1px solid #ecdcae; padding: 12px 16px; border-radius: 14px; margin: 6px 0 14px; font-size: .95rem; }
.notice p:last-child { margin: 0; }
.notice-warn { background: var(--red-tint); border-color: #eec2b9; }

/* ---------- Příprava */
.bar { max-width: 620px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top)) 12px 4px; display: flex; align-items: center; gap: 10px; min-height: 56px; }
.back { font-weight: 650; text-decoration: none; padding: 10px 6px; font-size: 1.02rem; }
.prep h1 { margin-top: 4px; }
.summary { font-family: var(--serif); font-size: 1.15rem; line-height: 1.5; margin: 12px 0 16px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 18px; }
.facts div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.facts dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); font-weight: 700; }
.facts dd { margin: 2px 0 0; font-weight: 650; line-height: 1.3; }
.block { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 12px; margin: 0 0 14px; }
.block h2 { font-size: 1.12rem; }
.items { margin: 0 0 6px; padding-left: 1.2em; }
.items li { margin-bottom: 4px; }
.treasure { background: linear-gradient(180deg, #fffaf0, var(--card)); border-color: #ecdcae; }
.beta { background: transparent; }
.dl .progress { height: 10px; background: #ece6d8; border-radius: 99px; overflow: hidden; margin: 6px 0 8px; }
.dl .progress div { height: 100%; background: var(--moss); transition: width .25s; }
.ok-line { color: var(--moss-dark); font-weight: 750; font-size: 1.05rem; }
.warn-line { color: var(--red); font-weight: 700; }
.missing { margin: 0 0 12px; padding-left: 1.2em; font-size: .95rem; }
.prep-actions { display: grid; gap: 6px; margin-top: 18px; }

/* ---------- Hra */
.bar-play { position: sticky; top: 0; z-index: 4; background: rgba(245, 241, 232, .94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); max-width: none; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
.bar-play .back { font-size: 1.4rem; padding: 6px 10px; }
.bar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.bar-title strong { font-family: var(--serif); font-size: 1.08rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-title span { font-size: .82rem; color: var(--ink-soft); }
.wake { display: block; width: 100%; border: 0; border-bottom: 1px solid #eec2b9; background: var(--red-tint); color: var(--red); padding: 9px 16px; font-size: .88rem; font-weight: 650; cursor: pointer; text-align: center; position: sticky; top: 57px; z-index: 3; }
.wake[hidden] { display: none; }

.stops { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.stop { background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.stop-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 14px; background: none; border: 0; text-align: left; cursor: pointer; min-height: 60px; }
.stop-num { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 750; border: 1.5px solid #cfc6b2; color: var(--ink-soft); background: #fff; }
.stop-title { flex: 1; font-weight: 650; font-size: 1.05rem; line-height: 1.3; }
.stop-played { font-size: .78rem; font-weight: 750; color: var(--moss-dark); background: var(--moss-tint); padding: 3px 9px; border-radius: 99px; }
.stop-body { display: none; padding: 0 16px 14px 62px; }
.stop.selected { border-color: var(--moss); box-shadow: 0 0 0 3px rgba(43, 90, 76, .14); }
.stop.selected .stop-body { display: block; }
.stop.selected .stop-num { background: var(--moss); border-color: var(--moss); color: #fff; }
.stop.played .stop-num { background: var(--moss-tint); border-color: var(--moss-tint); color: var(--moss-dark); }
.stop.played .stop-title { color: var(--ink-soft); }
.stop.played.selected .stop-num { background: var(--moss); color: #fff; }
.stop.active { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-tint); }
.note { margin: 0 0 8px; }
.note-label { font-weight: 750; color: var(--moss-dark); }
.tip { background: var(--gold-tint); border-radius: 12px; padding: 0 12px; }
.tip summary { cursor: pointer; padding: 10px 0; font-weight: 700; color: #7a5a12; list-style-position: inside; min-height: 44px; display: flex; align-items: center; gap: 6px; }
.tip summary::-webkit-details-marker { display: none; }
.tip summary::before { content: '✦'; }
.tip p { margin: 0 0 10px; }
.finish { background: var(--gold-tint); border: 1.5px solid #ead79d; border-radius: var(--radius); padding: 18px; margin: 18px 0 0; text-align: center; }

/* ---------- Ovládací panel */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--card); border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(40, 35, 20, .1);
  border-radius: 22px 22px 0 0;
  padding: 14px max(16px, env(safe-area-inset-left)) calc(14px + env(safe-area-inset-bottom));
}
.dock > * { max-width: 620px; margin-left: auto; margin-right: auto; }
.dock-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-bottom: 10px; }
.dock-head strong { font-family: var(--serif); font-size: 1.15rem; flex: 1 1 60%; min-width: 0; }
.dock-kicker { width: 100%; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 750; color: var(--ink-soft); }
.dock-kicker.warn { color: var(--red); }
.dock-dur { font-size: .9rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.delays { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-delay { min-height: 58px; font-size: 1.08rem; }
.dock-row { display: flex; gap: 10px; flex-wrap: wrap; }
.dock-row .btn { min-height: 56px; }
.dock-sub { color: var(--ink-soft); font-size: .93rem; margin: 0 0 12px; }
.dock-error { color: var(--red); font-weight: 650; margin: 0 0 12px; }
.countdown { font-family: var(--serif); font-size: 4rem; line-height: 1; text-align: center; font-variant-numeric: tabular-nums; margin: 2px 0 8px; color: var(--moss-dark); }
.countdown-chime { color: #8a6514; animation: shimmer 1.6s ease-in-out infinite; }
@keyframes shimmer { 50% { opacity: .55; } }
.playbar { height: 8px; background: #ece6d8; border-radius: 99px; overflow: hidden; }
.playbar-fill { height: 100%; width: 0; background: var(--moss); transition: width .25s linear; }
.playtime { font-size: .85rem; color: var(--ink-soft); text-align: right; margin: 4px 0 10px; font-variant-numeric: tabular-nums; min-height: 1.2em; }

/* ---------- Dialogy */
.sheet-wrap { position: fixed; inset: 0; z-index: 30; background: rgba(18, 26, 27, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet { background: var(--paper); width: 100%; max-width: 620px; max-height: 92vh; overflow-y: auto; border-radius: 24px 24px 0 0; padding: 22px 20px calc(18px + env(safe-area-inset-bottom)); animation: up .2s ease; }
@keyframes up { from { transform: translateY(30px); } }
.sheet h2 { font-size: 1.45rem; }
.sheet-actions { display: flex; gap: 10px; margin-top: 14px; }
.sheet-actions .btn { flex: 1; }
.intro-quote { font-family: var(--serif); font-size: 1.2rem; line-height: 1.5; font-style: italic; background: var(--card); border-left: 3px solid var(--gold-soft); padding: 12px 14px; border-radius: 0 12px 12px 0; }
.steps { padding-left: 1.3em; }
.steps li { margin-bottom: 6px; }
.menu { display: grid; gap: 10px; }

/* Volič minut */
.sheet-wheel { text-align: center; }
.sheet-wheel .btn-big { margin-top: 14px; }
.wheel-box { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 6px 0 0; }
.wheel-step { width: 56px; height: 56px; font-size: 1.6rem; border-radius: 50%; }
.wheel { position: relative; height: 260px; width: 170px; overflow-y: scroll; scroll-snap-type: y mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); overscroll-behavior: contain; touch-action: pan-y; }
.wheel::-webkit-scrollbar { display: none; }
.wheel-list { list-style: none; margin: 0; padding: 104px 0; }
.wheel-item { height: 52px; line-height: 52px; scroll-snap-align: center; font-size: 1.35rem; font-variant-numeric: tabular-nums; color: var(--ink-soft); cursor: pointer; }
.wheel-item.on { color: var(--ink); font-weight: 750; font-size: 1.7rem; }
.wheel-lens { position: sticky; bottom: 104px; height: 52px; margin-top: -52px; border-top: 1.5px solid var(--line); border-bottom: 1.5px solid var(--line); pointer-events: none; }

/* ---------- Režim do kapsy */
.pocket { position: fixed; inset: 0; z-index: 60; background: #000; color: #8d8a7f; display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: calc(40px + env(safe-area-inset-top)) 24px calc(30px + env(safe-area-inset-bottom)); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pocket-status { margin-top: 18vh; text-align: center; }
.pocket-big { font-family: var(--serif); font-size: 3.6rem; color: #b5ad95; font-variant-numeric: tabular-nums; }
.pocket-label { font-size: 1.1rem; margin-top: 6px; color: #9a9483; }
.pocket-sub { font-size: .9rem; margin-top: 4px; }
.pocket-foot { text-align: center; font-size: .82rem; max-width: 300px; }
.hold { position: relative; width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; border: 2px solid #3a3933; color: #b5ad95; font-weight: 650; cursor: pointer; touch-action: none; }
.hold-ring { position: absolute; inset: -2px; border-radius: 50%; border: 3px solid transparent; }
.hold.holding .hold-ring { border-color: #b5ad95; clip-path: inset(0 0 0 0); animation: holdfill 1.5s linear forwards; }
@keyframes holdfill { from { opacity: .2; transform: scale(.85); } to { opacity: 1; transform: scale(1.08); } }
html.pocket-on, html.pocket-on body { overflow: hidden; }

/* ---------- Oznámení */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); top: calc(12px + env(safe-area-inset-top)); z-index: 70; display: grid; gap: 8px; width: min(560px, calc(100% - 24px)); }
.toast { background: var(--ink); color: #fff; padding: 13px 16px; border-radius: 14px; box-shadow: 0 8px 26px rgba(0, 0, 0, .2); font-size: .97rem; }
.toast-ok { background: var(--moss-dark); }
.toast-error { background: var(--red); }

@media (max-width: 360px) {
  h1 { font-size: 1.7rem; }
  .facts { grid-template-columns: 1fr 1fr; }
  .countdown { font-size: 3.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Tři volby v panelu: hlavní na celou šířku, zbylé dvě vedle sebe */
.dock-row .btn:first-child:nth-last-child(3) { flex-basis: 100%; }
.dock-row .btn { flex: 1 1 0; }
