/* Hráč: hlavička, navigace, stav odeslání, výběr sektoru, rozhodnutí a kokpit (design manuál, kap. 6 až 8). */

.p-app { min-height: 100dvh; background: var(--bg); color: var(--text); }
.p-main { max-width: 1280px; margin-inline: auto; padding: 16px 16px 28px; }
.p-main[data-view="other"] { max-width: 880px; }
.p-app.has-nav .p-main { padding-bottom: calc(60px + 24px + env(safe-area-inset-bottom)); }
.p-app.has-nav.has-submit .p-main { padding-bottom: calc(60px + 64px + 28px + env(safe-area-inset-bottom)); }
.p-main > .panel, .p-main > .card { margin-bottom: 12px; }
.p-foot { text-align: center; font-size: var(--text-sm); color: var(--text-muted); margin: 12px 0 0; }
.page-head { margin: 4px 0 16px; }
.page-head h1 { font-size: var(--text-xl); margin: 0 0 4px; letter-spacing: -.02em; }
.page-head p { margin: 0; color: var(--text-muted); max-width: 70ch; }

/* ---------- hlavička ---------- */
.p-hud { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); }
.p-hud-in { max-width: 1280px; margin-inline: auto; padding-inline: 12px; height: 51px; display: flex; align-items: center; gap: 10px; }
.p-id { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 0; }
.p-id-text { min-width: 0; display: grid; }
.p-id b { font-family: var(--font-display); font-weight: 700; font-size: var(--text-base); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-id small { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-ico { flex: none; width: 34px; height: 34px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--sec-soft, var(--brand-soft)); color: var(--sec-text, var(--brand-text)); }
.p-nav-gap { display: none; }
.p-kpi { display: flex; align-items: center; gap: 12px; flex: none; }
.p-stat { display: flex; align-items: center; gap: 8px; }
.p-stat > .ico { color: var(--text-subtle); flex: none; display: none; }
.p-stat small { display: block; font-size: var(--text-xs); color: var(--text-muted); line-height: 1.2; white-space: nowrap; }
.p-stat b { display: block; font-family: var(--font-mono); font-weight: 700; font-size: var(--text-base); line-height: 1.25; white-space: nowrap; border-radius: 4px; }
.p-stat.bad b { color: var(--bad-text); }
.p-stat:nth-child(2) { display: none; }
.p-hud .timer { font-family: var(--font-mono); font-weight: 700; font-size: var(--text-lg); line-height: 1; min-width: 4.2ch; text-align: right; color: var(--text); }
.p-hud .timer.low { color: var(--bad-text); } .p-hud .timer.over { color: var(--bad-text); }
.p-out { min-height: 36px; padding-inline: 8px; }
.flash { animation: kpi-flash .9s ease-out; }
@keyframes kpi-flash { 0% { background: var(--brand-soft); box-shadow: 0 0 0 4px var(--brand-soft); } 100% { background: transparent; box-shadow: 0 0 0 4px transparent; } }

/* proužek času pod hlavičkou */
.p-time { position: absolute; left: 0; right: 0; bottom: -2px; height: 3px; background: var(--border); overflow: hidden; }
.p-time i { display: block; height: 100%; width: var(--from); background: var(--brand); animation: p-time var(--ms) linear forwards; }
.p-time.low i { background: var(--bad); }
.p-time.paused i { animation: none; background: var(--text-subtle); }
@keyframes p-time { to { width: 0; } }

/* ---------- navigace: na telefonu dole, na počítači v hlavičce ---------- */
.p-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 19; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.p-nav button { position: relative; min-width: 0; min-height: 60px; padding: 6px 2px; border: 0; border-radius: 0; background: none; box-shadow: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-muted); font-size: var(--text-xs); font-weight: 500; }
.p-nav button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-nav button .ico { width: 20px; height: 20px; flex: none; }
.p-nav button:hover { color: var(--text); background: var(--surface-2); }
.p-nav button.active { color: var(--brand-text); font-weight: 700; }
.p-nav button.active::before { content: ""; position: absolute; top: -1px; left: 22%; right: 22%; height: 2px; background: var(--brand); border-radius: 0 0 2px 2px; }
.p-nav .badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--radius-full); display: grid; place-items: center; font: 700 10px/1 var(--font-sans); font-style: normal; color: #fff; background: var(--brand); }
.p-nav .badge .ico { width: 10px; height: 10px; }
.p-nav .badge.todo { background: var(--bad); }
.p-nav .badge.sent { background: var(--ok); }
.p-nav .badge.dirty { background: var(--warn); color: #451A03; }
.p-nav .badge.count { background: var(--surface-3); color: var(--text); }

/* ---------- stavový pruh (výběr po řadě, čekání na další kolo) ---------- */
.status-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); font-size: var(--text-sm); }
.status-bar > .ico { flex: none; }
.status-bar > span { flex: 1; min-width: 0; }
.status-bar button { flex: none; }
.status-bar.todo { background: var(--warn-soft); border-color: var(--warn-border); } .status-bar.todo > .ico { color: var(--warn-text); }
.status-bar.sent { background: var(--ok-soft); border-color: var(--ok-border); } .status-bar.sent > .ico { color: var(--ok-text); }
.status-bar.wait { background: var(--surface-2); }
.turn-clock { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 12px; font-size: var(--text-sm); color: var(--text-muted); }
.turn-clock .timer { font-family: var(--font-mono); font-size: var(--text-lg); color: var(--text); }

/* ---------- stav odeslání ---------- */
.submit-box { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--brand-border); border-radius: var(--radius-md); background: var(--brand-soft); transition: background-color .2s, border-color .2s; }
.submit-dot { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--brand); display: grid; place-items: center; color: #fff; transition: background-color .2s, border-color .2s; }
.submit-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.submit-text b { font-size: var(--text-base); line-height: 1.3; }
.submit-text small { font-size: var(--text-sm); color: var(--text-muted); line-height: 1.35; }
.submit-text small.neg { color: var(--bad-text); font-weight: 600; }
.submit-box button { flex: none; }
.submit-box.sent { background: var(--ok-soft); border-color: var(--ok-border); }
.submit-box.sent .submit-dot { background: var(--ok); border-color: var(--ok); }
.submit-box.dirty { background: var(--warn-soft); border-color: var(--warn-border); }
.submit-box.dirty .submit-dot { background: var(--warn); border-color: var(--warn); }
.submit-box button.warn { background: var(--warn); border-color: var(--warn); color: #451A03; font-weight: 700; }
.submit-box button.warn:hover { filter: brightness(.96); }
.submit-box.dock { position: fixed; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom)); z-index: 18; border-radius: 0; border-width: 1px 0 0; padding: 10px 12px; min-height: 64px; box-shadow: 0 -4px 12px rgb(15 23 42 / .06); }
.submit-box.dock .submit-text b { font-size: var(--text-sm); }
.submit-box.side { display: none; flex-wrap: wrap; }
.submit-box.side button { flex: 1 1 100%; min-height: 44px; }

/* ---------- výběr sektoru ---------- */
.sector-layout { display: grid; gap: 14px; margin-bottom: 14px; }
.sector-side { min-width: 0; }
.sector-side .panel { margin: 0; }
.sector-side table { font-size: var(--text-sm); }
.sector-grid { display: grid; gap: 14px; align-items: start; }
.sector-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; cursor: pointer; box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s; display: grid; gap: 10px; }
.sector-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.sector-card.selected { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); cursor: default; }
.sector-card.chosen { border-color: var(--ok); }
.sector-card.full { opacity: .6; }
.sector-card header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sector-card h2 { font-size: var(--text-md); margin: 0; flex: 1; min-width: 0; }
.sector-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.sector-desc { margin: 0; color: var(--text-muted); font-size: var(--text-sm); line-height: 1.5; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fact { background: var(--surface-2); border-radius: var(--radius-md); padding: 8px 10px; min-width: 0; }
.fact small { display: flex; align-items: center; gap: 5px; font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fact small .ico { flex: none; }
.fact b { font-family: var(--font-mono); font-size: var(--text-md); }
.fact b.lvl-word { font-family: inherit; display: inline-flex; align-items: center; gap: 6px; }
.lvl { display: inline-flex; gap: 3px; }
.lvl i { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.lvl i.on { background: var(--brand); }
.sector-traits { margin: 0; font-size: var(--text-xs); color: var(--text-subtle); }
.sector-more { font-size: var(--text-sm); font-weight: 600; color: var(--brand-text); }
.product-list { display: grid; gap: 8px; }
.product-hint { display: flex; align-items: center; gap: 6px; margin: 10px 0 8px; padding: 8px 10px; border-radius: var(--radius-md); background: var(--warn-soft); color: var(--warn-text); font-weight: 600; font-size: 14px; }
.product-hint.done { background: var(--ok-soft); color: var(--ok-text); }
.product { display: grid; gap: 3px; text-align: left; height: auto; min-height: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); box-shadow: none; white-space: normal; font-weight: 400; }
.product b { font-size: var(--text-base); } .product span { font-size: var(--text-sm); color: var(--text-muted); } .product small { font-size: var(--text-xs); color: var(--text-subtle); line-height: 1.45; }
.product.selected { border-color: var(--brand); background: var(--brand-soft); }

/* ---------- rozhodnutí: formulář a kokpit ---------- */
.decide-grid { display: grid; gap: 16px; }
.decide-form { min-width: 0; display: grid; gap: 12px; align-content: start; }
.decide-form > * { margin: 0; }
.decide-form > .sent-banner:empty { display: none; }
.panel.decide h2 { font-size: var(--text-lg); margin: 0 0 12px; }
.panel.decide .field { margin: 0; min-width: 0; }
.field-grid { display: grid; gap: 14px 16px; margin-top: 14px; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; margin-bottom: 4px; }
.field-head label { margin: 0; font-size: var(--text-sm); font-weight: 600; color: var(--text); display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.field-head .by-mark { font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; margin: 0; }
.price-row { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 12px; align-items: center; }
.amount { display: flex; align-items: center; gap: 8px; min-width: 0; }
.amount input { flex: 1; min-width: 0; }
.amount .unit { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-muted); flex: none; }
.amount-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: center; }
.amount-row .seg { margin: 0; }
.amount-row .seg button { padding: 0 10px; min-height: 40px; font-size: var(--text-sm); white-space: nowrap; }
.panel.decide input[type="number"] { font-family: var(--font-mono); font-weight: 500; text-align: right; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { min-height: 26px; padding: 0 10px; border-radius: var(--radius-full); border: 1px solid var(--border); background: var(--surface-2); box-shadow: none; font-size: var(--text-xs); font-weight: 500; color: var(--text-muted); }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.on { background: var(--brand-soft); border-color: var(--brand-border); color: var(--brand-text); font-weight: 700; }
#decideForm .hint, #decideForm .hint.cost { background: none; border: 0; border-radius: 0; padding: 0; margin: 6px 0 0; font-size: var(--text-xs); line-height: 1.4; color: var(--text-muted); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }

/* posuvník ceny s barevnými zónami: pod nákladem ztráta, uprostřed běžné pásmo, vpravo vysoká cena */
input[type="range"].zoned { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; padding: 0; border: 0; background: none; box-shadow: none; min-height: 0; }
input[type="range"].zoned::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: linear-gradient(to right, var(--bad-border) 0 var(--cost), var(--ok-border) var(--cost) var(--high), var(--warn-border) var(--high) 100%); }
input[type="range"].zoned::-moz-range-track { height: 8px; border-radius: 4px; background: linear-gradient(to right, var(--bad-border) 0 var(--cost), var(--ok-border) var(--cost) var(--high), var(--warn-border) var(--high) 100%); }
input[type="range"].zoned::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -7px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); box-shadow: var(--shadow-md); cursor: grab; }
input[type="range"].zoned::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); box-shadow: var(--shadow-md); cursor: grab; }
input[type="range"].zoned:focus-visible { outline: none; }
input[type="range"].zoned:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--brand-glow); }

.cockpit { min-width: 0; display: grid; gap: 12px; align-content: start; }
.cockpit > * { margin: 0; }
.panel.money h3 { font-size: var(--text-md); margin: 0 0 8px; }
table.ba.compact { width: 100%; font-size: var(--text-sm); }
table.ba.compact td { font-size: var(--text-sm); padding: 5px 0; border-bottom: 1px solid var(--border); }
table.ba.compact td.num { font-family: var(--font-mono); text-align: right; white-space: nowrap; }
table.ba.compact tr.sub td { color: var(--text-muted); font-size: var(--text-xs); padding: 3px 0 3px 12px; border-bottom: 0; }
table.ba.compact tr.total td { border-top: 2px solid var(--border-strong); border-bottom: 0; padding-top: 8px; font-size: var(--text-base); }
table.ba.compact tr.total.neg b, table.ba.compact td.neg { color: var(--bad-text); }
table.ba.compact tr.total b { border-radius: 4px; }
button.link { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }
button.link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 2px; }
.be { margin-top: 14px; }
.be-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: var(--text-sm); font-weight: 600; }
.be-head span { display: inline-flex; align-items: center; gap: 6px; }
.be-head b { font-family: var(--font-mono); }
.be-track { position: relative; height: 10px; margin: 8px 0 6px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.be-track i { display: block; height: 100%; border-radius: 5px; background: var(--ok); transition: width .3s ease, background-color .3s ease; }
.be-track em { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--surface); }
.be.warn .be-track i { background: var(--warn); } .be.bad .be-track i { background: var(--bad); }
.be.bad .be-head b { color: var(--bad-text); } .be.warn .be-head b { color: var(--warn-text); }
.be small { display: block; font-size: var(--text-xs); color: var(--text-muted); line-height: 1.4; }
.mwf { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); display: grid; gap: 5px; }
.mwf h4 { margin: 0 0 4px; font-size: var(--text-sm); font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; }
.mwf-row { display: grid; grid-template-columns: 116px minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: var(--text-xs); }
.mwf-row span { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mwf-row b { font-family: var(--font-mono); font-weight: 500; min-width: 9ch; text-align: right; white-space: nowrap; }
.mwf-track { position: relative; height: 12px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.mwf-track i { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--brand); transition: left .3s ease, width .3s ease; }
.mwf-row.neg .mwf-track i { background: var(--text-subtle); }
.mwf-row.total { font-size: var(--text-sm); } .mwf-row.total span { color: var(--text); font-weight: 600; } .mwf-row.total b { font-weight: 700; }
.mwf-row.total.pos .mwf-track i { background: var(--ok); } .mwf-row.total.neg .mwf-track i { background: var(--bad); }
.mwf-row.total.neg b { color: var(--bad-text); } .mwf-row.total.pos b { color: var(--ok-text); }
.mwf small { font-size: var(--text-xs); color: var(--text-subtle); margin-top: 2px; }


/* ---------- od 640 px ---------- */
@media (min-width: 640px) {
  .p-hud-in { padding-inline: 16px; }
  .p-stat:nth-child(2) { display: flex; }
  .sector-grid { grid-template-columns: 1fr 1fr; }
  .field-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- od 1024 px: jednořádková hlavička se záložkami, kokpit vpravo ---------- */
@media (min-width: 1024px) {
  .p-hud-in { height: calc(var(--hud-h) - 1px); padding-inline: 24px; gap: 16px; }
  .p-main { padding: 20px 24px 32px; }
  .p-app.has-nav .p-main, .p-app.has-nav.has-submit .p-main { padding-bottom: 32px; }
  .p-id { flex: 0 1 220px; }
  .p-nav-gap { display: block; flex: 1; }
  .p-nav { position: static; flex: 1 1 auto; min-width: 0; display: flex; justify-content: center; gap: 2px; border: 0; padding: 0; background: none; overflow-x: auto; scrollbar-width: none; }
  .p-nav::-webkit-scrollbar { display: none; }
  .p-nav button { flex: none; min-height: 40px; flex-direction: row; gap: 7px; padding: 0 12px; border-radius: var(--radius-md); font-size: var(--text-sm); }
  .p-nav button .ico { width: 16px; height: 16px; display: none; }
  .p-nav button.active { background: var(--brand-soft); }
  .p-nav button.active::before { display: none; }
  .p-nav .badge { position: static; }
  .p-stat small { display: none; }
  .p-stat > .ico { display: block; }
  .p-hud .timer { font-size: var(--text-xl); }
  .submit-box.dock { display: none; }
  .submit-box.side { display: flex; }
  .sector-layout.with-order { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
  .sector-layout.with-order .sector-side { order: 0; position: sticky; top: calc(var(--hud-h) + 16px); }
  .decide-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
  .cockpit { position: sticky; top: calc(var(--hud-h) + 16px); max-height: calc(100dvh - var(--hud-h) - 32px); overflow-y: auto; scrollbar-width: thin; }
  #decideForm .hint, #decideForm .hint.cost { background: none; border: 0; border-radius: 0; padding: 0; -webkit-line-clamp: 1; line-clamp: 1; }
}
@media (min-width: 1180px) {
  .p-nav button .ico { display: block; }
  .p-stat small { display: block; }
  .p-stat > .ico { display: none; }
}
@media (min-width: 1360px) {
  .sector-grid { grid-template-columns: repeat(3, 1fr); }
  .sector-layout.with-order .sector-grid { grid-template-columns: 1fr 1fr; }
}
@media print { .p-hud, .p-nav, .submit-box.dock { display: none !important; } }

/* ---------- událost a krize v rozhodnutí ---------- */
.p-main .event-panel { border: 1px solid var(--warn-border); background: var(--warn-soft); }
.p-main .event-panel h2 { font-size: var(--text-lg); margin: 0; }
.p-main .event-panel > p { font-size: var(--text-sm); line-height: 1.5; }
.p-main .event-panel .field > label { font-size: var(--text-sm); font-weight: 600; }
.p-main .event-panel label.row { font-size: var(--text-sm); gap: 8px; }
.p-main .event-panel label.row b { font-family: var(--font-sans); font-size: var(--text-base); }
.p-main .event-kicker { font-size: var(--text-xs); font-weight: 600; color: var(--warn-text); text-transform: uppercase; letter-spacing: .04em; }
.p-main .panel.crisis { border: 1px solid var(--bad-border); background: var(--bad-soft); }
.p-main .panel.crisis h2 { font-size: var(--text-lg); margin: 0; }

/* ================= karty Firma, Investice, Trh, Historie, Studovna a Výsledek ================= */
.p-main .panel h3 { font-size: var(--text-md); }
.p-main p.muted, .p-main .panel > p.muted { font-size: var(--text-sm); }
.kpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.kpi-row .tile { padding: 14px 16px; }
.kpi-row .tile .value { font-size: var(--text-xl); border-radius: 4px; }
.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile .value { border-radius: 4px; }
.sec-ico.big { width: 44px; height: 44px; border-radius: var(--radius-lg); }

/* Firma */
.firm-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 14px; }
.firm-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.firm-title h1 { font-size: var(--text-xl); margin: 0; letter-spacing: -.02em; }
.firm-title p { margin: 0; color: var(--text-muted); font-size: var(--text-sm); }
.firm-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.firm-grid, .invest-grid, .market-grid, .result-grid, .study-grid { display: grid; gap: 12px; align-items: start; }
.firm-main, .firm-side, .invest-main, .invest-side, .market-main, .market-side, .result-main, .result-side { min-width: 0; display: grid; gap: 12px; align-content: start; }
.firm-main > *, .firm-side > *, .invest-main > *, .invest-side > *, .market-main > *, .market-side > *, .result-main > *, .result-side > * { margin: 0; }
.p-main .waterfall h3 { font-size: var(--text-md); }
.p-main .wf-row { font-size: var(--text-sm); grid-template-columns: minmax(110px, 32%) 1fr auto; padding: 4px 0; }
.p-main .wf-row b { font-family: var(--font-mono); font-weight: 500; font-size: var(--text-sm); min-width: 96px; }
.p-main .wf-track { height: 14px; background: var(--surface-2); border-radius: 3px; }
.p-main .wf-track i { border-radius: 3px; background: var(--text-subtle); transition: left .35s ease, width .35s ease; }
.p-main .wf-row.in .wf-track i { background: var(--brand); }
.p-main .wf-row.sum { border-top: 2px solid var(--border-strong); }
.p-main .wf-row.sum .wf-track i { background: var(--ok); } .p-main .wf-row.sum.neg .wf-track i { background: var(--bad); }
.p-main .wf-row.sum b { font-weight: 700; font-size: var(--text-base); }
.p-main .report .line { font-size: var(--text-sm); padding: 9px 0; }
.p-main .report .line b { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.p-main .report .line.summary { font-size: var(--text-base); border-left: 3px solid var(--brand); background: var(--brand-soft); padding: 10px 12px; border-radius: 0 var(--radius-md) var(--radius-md) 0; border-bottom: 0; }
.p-main .short-glossary { font-size: var(--text-sm); }

/* Investice: čtyři stavy karty (k dispozici, v rozhodnutí, koupeno, zamčeno) */
.p-main .inv-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
.p-main .inv-card { position: relative; min-height: 104px; height: auto; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-xs); white-space: normal; transition: border-color .15s, box-shadow .15s, background-color .15s; }
.p-main .inv-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.p-main .inv-card .ico { color: var(--brand); }
.p-main .inv-card .name { font-size: var(--text-sm); font-weight: 600; }
.p-main .inv-card .cost { top: 10px; right: 10px; font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 700; background: var(--surface-2); color: var(--text); padding: 2px 7px; border-radius: var(--radius-full); }
.p-main .inv-card .tag { font-size: var(--text-xs); font-weight: 600; padding: 1px 8px; border-radius: var(--radius-full); }
.p-main .inv-card .tag.ok { background: var(--ok-soft); color: var(--ok-text); }
.p-main .inv-card .tag.sel { background: var(--brand-soft); color: var(--brand-text); }
.p-main .inv-card .tag.warn { background: var(--warn-soft); color: var(--warn-text); }
.p-main .inv-card.chosen { border-color: var(--brand); background: var(--brand-soft); }
.p-main .inv-card.owned { border-color: var(--ok-border); background: var(--ok-soft); opacity: 1; }
.p-main .inv-card.owned .cost { background: var(--ok); color: #fff; } .p-main .inv-card.owned .ico { color: var(--ok-text); }
.p-main .inv-card.locked { border-style: dashed; background: var(--surface-2); box-shadow: none; opacity: 1; color: var(--text-subtle); }
.p-main .inv-card.locked .ico { color: var(--text-subtle); } .p-main .inv-card.locked .cost { background: var(--surface-3); color: var(--text-muted); }
.p-main .inv-card.active { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.p-main .inv-detail { border-color: var(--brand-border); }
.p-main .inv-money > div { background: var(--surface-2); border-radius: var(--radius-md); }
.p-main .inv-money b { font-family: var(--font-mono); font-size: var(--text-md); }
.empty-side { text-align: center; color: var(--text-muted); padding: 28px 20px; border-style: dashed; box-shadow: none; }
.empty-side .ico { color: var(--text-subtle); } .empty-side p { margin: 8px 0 0; font-size: var(--text-sm); }

/* Trh */
.p-main .board-stamp { background: var(--brand-soft); border: 1px solid var(--brand-border); border-radius: var(--radius-md); font-size: var(--text-sm); margin-bottom: 12px; }
.p-main .board-stamp .ico { color: var(--brand); }
.p-main table tr.mine td { background: var(--brand-soft); font-weight: 600; }
.p-main .news { font-size: var(--text-sm); }

/* Historie a společný vzhled sloupcových grafů */
.p-main .pchart-y span, .p-main .pchart-x span { font: 500 var(--text-xs) var(--font-mono); color: var(--chart-axis); }
.p-main .pchart-plot > i { border-top: 1px solid var(--chart-grid); } .p-main .pchart-plot > i.zero { border-top-color: var(--chart-axis); }
.p-main .pchart-bars b { background: var(--brand); border-radius: 4px 4px 0 0; left: 22%; right: 22%; max-width: 56px; margin-inline: auto; }
.p-main .pchart-bars b.neg { background: var(--bad); border-radius: 0 0 4px 4px; }
.pchart.anim .pchart-bars b { animation: bar-grow .5s ease-out both; transform-origin: bottom; }
.pchart.anim .pchart-bars b.neg { transform-origin: top; }
@keyframes bar-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.p-main[data-view="history"] table { font-size: var(--text-sm); } .p-main[data-view="history"] td.num { font-family: var(--font-mono); white-space: nowrap; }

/* Studovna: seznam a detail */
.study-list { display: grid; gap: 6px; align-content: start; min-width: 0; }
.study-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; height: auto; min-height: 56px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); box-shadow: none; white-space: normal; font-weight: 400; }
.study-item > .ico { color: var(--text-subtle); }
.study-item b { display: block; font-size: var(--text-sm); font-weight: 600; } .study-item small { font-size: var(--text-xs); color: var(--text-muted); }
.study-item.active { border-color: var(--brand); background: var(--brand-soft); } .study-item.active > .ico { color: var(--brand); }
.study-item.locked { background: var(--surface-2); color: var(--text-subtle); }
.study-detail header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.study-detail h2 { font-size: var(--text-lg); margin: 0; }
.study-body { white-space: pre-wrap; line-height: 1.6; max-width: 72ch; }
.study-benefit { margin: 12px 0 0; }
.gloss-list { margin-top: 10px; display: grid; gap: 8px; }
.gloss-list .help-box { margin: 0; }
.pill.brand { background: var(--brand-soft); color: var(--brand-text); border-color: var(--brand-border); }

/* Výsledek hry */
.result-hero { text-align: center; padding: 24px 20px; }
.result-hero h1 { font-size: var(--text-xl); margin: 4px 0 0; }
.rank-big { font-family: var(--font-display); font-weight: 800; font-size: 4rem; line-height: 1; color: var(--brand); letter-spacing: -.04em; }
.kpi-row.three { grid-template-columns: repeat(3, 1fr); }
.insights { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.insights li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--ok-soft); border: 1px solid var(--ok-border); }
.insights li > .ico { color: var(--ok-text); margin-top: 2px; }
.insights li.bad { background: var(--warn-soft); border-color: var(--warn-border); } .insights li.bad > .ico { color: var(--warn-text); }
.insights b { font-size: var(--text-sm); } .insights small { font-size: var(--text-xs); color: var(--text-muted); }
.insights p { margin: 3px 0 0; font-size: var(--text-sm); line-height: 1.45; }
.code-box { text-align: center; display: grid; gap: 6px; justify-items: center; }
.code-box small { font-size: var(--text-xs); color: var(--text-muted); }
.code-copy { height: auto; padding: 10px 16px; gap: 10px; border: 1px dashed var(--brand-border); background: var(--brand-soft); box-shadow: none; }
.code-copy .code { font-family: var(--font-mono); font-size: var(--text-lg); font-weight: 700; letter-spacing: .08em; color: var(--brand-text); }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; } .result-actions > * { flex: 1; } .result-actions a button { width: 100%; }

/* oznámení události a okna */
.p-app .overlay { background: var(--overlay); backdrop-filter: blur(3px); }
.p-app .overlay-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.p-app .overlay-card.event { border-top: 4px solid var(--warn); }
.p-app .overlay-card h1 { font-size: var(--text-xl); }
.p-app .overlay-card p { font-size: var(--text-base); }
.p-app .overlay-ico { background: var(--warn-soft); color: var(--warn-text); }
.p-app .overlay-card.modal-card { border-color: var(--border); }

@media (min-width: 640px) {
  .kpi-row { grid-template-columns: repeat(4, 1fr); }
  .kpi-row.two { grid-template-columns: 1fr 1fr; }
  .tile-grid { grid-template-columns: repeat(3, 1fr); }
  .p-main .inv-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
  .firm-grid { grid-template-columns: minmax(0, 11fr) minmax(0, 9fr); gap: 20px; }
  .invest-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; }
  .market-grid { grid-template-columns: minmax(0, 13fr) minmax(0, 7fr); gap: 20px; }
  .result-grid { grid-template-columns: 1fr 1fr; gap: 20px; }
  .study-grid { grid-template-columns: 340px minmax(0, 1fr); gap: 20px; }
  .invest-side, .study-list { position: sticky; top: calc(var(--hud-h) + 16px); }
  .invest-side { max-height: calc(100dvh - var(--hud-h) - 32px); overflow-y: auto; scrollbar-width: thin; }
}

/* ================= čitelnost a důraz ================= */
/* závěr reportu na Firmě: jedna věta a tlačítka, celý report je na kartě Historie */
.verdict { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px 14px; align-items: center; padding: 16px 18px; margin-bottom: 12px; background: var(--brand-soft); border: 1px solid var(--brand-border); border-left: 5px solid var(--brand); border-radius: var(--radius-lg); }
.verdict > .ico { color: var(--brand); }
.verdict small { display: block; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-text); }
.verdict p { margin: 2px 0 0; font-size: var(--text-md); line-height: 1.45; font-weight: 500; color: var(--text); }
.verdict.empty { background: var(--surface); border-color: var(--border); border-left-color: var(--border-strong); } .verdict.empty > .ico { color: var(--text-subtle); } .verdict.empty small { color: var(--text-muted); }
.verdict-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; } .verdict-actions button { flex: 1 1 auto; }
.firm-numbers h3 { margin: 0 0 12px; }
.firm-numbers .tile-grid { grid-template-columns: 1fr 1fr; }
.firm-numbers .tile { box-shadow: none; background: var(--surface-2); border-color: transparent; }
.firm-foot { display: grid; gap: 12px; margin-top: 12px; } .firm-foot > * { margin: 0; }
.history-grid { display: grid; gap: 12px; align-items: start; }
.history-main, .history-side { min-width: 0; display: grid; gap: 12px; align-content: start; } .history-main > *, .history-side > * { margin: 0; }
.history-side h2 { font-size: var(--text-lg); }

/* hlavní čísla: větší hodnota, barevný proužek podle stavu */
.kpi-row .tile { border-top: 4px solid var(--brand); padding: 16px 18px; gap: 4px; }
.kpi-row .tile.ok { border-top-color: var(--ok); } .kpi-row .tile.warn { border-top-color: var(--warn); } .kpi-row .tile.bad { border-top-color: var(--bad); }
.kpi-row .tile .value { font-size: 1.75rem; line-height: 1.15; color: var(--text); }
.kpi-row .tile.bad .value { color: var(--bad-text); } .kpi-row .tile.ok .value { color: var(--ok-text); }
.p-main .tile .label { font-size: var(--text-xs); color: var(--text-muted); }
.p-main .tile .sub { font-size: var(--text-sm); }
.p-main .panel > h2, .p-main .panel > h3, .p-main section.panel h3 { font-family: var(--font-display); font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.p-main th { font-size: var(--text-xs); color: var(--text-muted); }
.p-main td { font-size: var(--text-base); }
.p-main .pill { font-size: var(--text-xs); }
.p-main .report .line { font-size: var(--text-base); line-height: 1.55; }
.p-main .help-box { font-size: var(--text-sm); line-height: 1.55; }
.p-main .news, .p-main .short-glossary { font-size: var(--text-base); }
.p-main p.muted[style] { font-size: var(--text-sm) !important; }

@media (min-width: 1024px) {
  .verdict { grid-template-columns: auto minmax(0, 1fr) auto; padding: 18px 22px; }
  .verdict-actions { grid-column: auto; flex-wrap: nowrap; } .verdict-actions button { white-space: nowrap; }
  .kpi-row { gap: 16px; margin-bottom: 16px; }
  .kpi-row .tile .value { font-size: 2.125rem; }
  .firm-foot { grid-template-columns: 1fr 1fr; align-items: start; }
  .history-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; }
  .p-main .panel { padding: 20px 22px; }
  .p-main .wf-row, .p-main .wf-row b { font-size: var(--text-base); } .p-main .wf-row { padding: 6px 0; } .p-main .wf-track { height: 18px; }
  .p-main .wf-row.sum b { font-size: var(--text-md); }
  .p-stat b { font-size: var(--text-md); } .p-id b { font-size: var(--text-md); }
  .p-nav button { font-size: var(--text-sm); font-weight: 600; }
  .field-head label { font-size: var(--text-base); }
  .panel.decide input[type="number"] { font-size: var(--text-md); font-weight: 700; min-height: 46px; }
  .chip { font-size: var(--text-xs); min-height: 30px; }
  #decideForm .hint, #decideForm .hint.cost { font-size: var(--text-sm); }
  table.ba.compact td { font-size: var(--text-base); padding: 7px 0; } table.ba.compact tr.total td { font-size: var(--text-md); }
  .be-head { font-size: var(--text-base); } .be small, .mwf small { font-size: var(--text-sm); } .be-track { height: 12px; }
  .mwf-row { font-size: var(--text-sm); grid-template-columns: 150px minmax(0, 1fr) auto; } .mwf-row.total { font-size: var(--text-base); } .mwf h4 { font-size: var(--text-base); }
  .submit-text b { font-size: var(--text-md); }
  /* odeslání zůstává na očích, i když je kokpit vyšší než okno */
  .cockpit .submit-box.side { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 -6px 14px rgb(15 23 42 / .08); }
  .sector-desc, .product span { font-size: var(--text-base); } .sector-traits, .product small { font-size: var(--text-sm); } .fact small { font-size: var(--text-sm); } .fact b { font-size: var(--text-lg); }
  .p-main .inv-card .name { font-size: var(--text-base); } .p-main .inv-card { min-height: 120px; }
  .study-item b { font-size: var(--text-base); } .study-body { font-size: var(--text-md); }
  .insights b, .insights p { font-size: var(--text-base); }
}

/* ================= uvítání a klikací průvodce ================= */
.welcome-card { max-width: 560px; border: 1px solid var(--border); border-top: 5px solid var(--brand); text-align: left; padding: 28px; }
.welcome-card h1 { font-size: var(--text-xl); margin: 0 0 8px; }
.welcome-card > p { color: var(--text-muted); margin: 0 0 18px; }
.welcome-choices { display: grid; gap: 10px; }
.welcome-choice { display: grid; gap: 3px; justify-items: start; width: 100%; text-align: left; height: auto; padding: 14px 16px; white-space: normal; border: 1px solid var(--border); background: var(--surface); box-shadow: none; }
.welcome-choice b { font-size: var(--text-md); } .welcome-choice span { font-size: var(--text-sm); font-weight: 400; color: var(--text-muted); }
.welcome-choice.main { border-color: var(--brand); background: var(--brand-soft); } .welcome-choice.main b { color: var(--brand-text); }
.welcome-choice:hover { border-color: var(--brand); }
.welcome-skip { width: 100%; margin-top: 10px; }
.welcome-card .welcome-note { font-size: var(--text-xs); color: var(--text-subtle); text-align: center; margin: 10px 0 0; }
.tour-layer { position: fixed; inset: 0; z-index: 28; pointer-events: none; }
.tour-hole { position: fixed; border-radius: 12px; box-shadow: 0 0 0 3px var(--brand), 0 0 0 9999px rgb(15 23 42 / .45); transition: top .25s ease, left .25s ease, width .25s ease, height .25s ease; }
/* bublina je tmavá, aby se neztratila na bílých kartách ani uvnitř velkého výřezu */
.tour-tip { position: fixed; pointer-events: auto; background: var(--text); color: var(--on-dark); border: 1px solid var(--text); border-radius: var(--radius-lg); box-shadow: 0 0 0 3px rgb(255 255 255 / .9), 0 18px 44px rgb(15 23 42 / .45); padding: 16px 18px; max-width: calc(100vw - 24px); transition: top .25s ease, left .25s ease; }
.tour-tip small { font: 500 var(--text-xs) var(--font-mono); color: var(--on-dark-accent); }
.tour-tip h3 { font-family: var(--font-display); font-size: var(--text-md); margin: 4px 0 6px; color: var(--on-dark); }
.tour-tip p { margin: 0; font-size: var(--text-sm); line-height: 1.5; color: var(--on-dark-muted); }
.tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.tour-tip button.ghost { color: var(--on-dark-muted); border-color: transparent; background: none; } .tour-tip button.ghost:hover { color: var(--on-dark); background: rgb(255 255 255 / .1); }
.tour-tip button.primary { background: var(--on-dark); color: var(--brand-text); border-color: var(--on-dark); }
.tour-wait { font-size: var(--text-sm); font-weight: 700; color: var(--on-dark-accent); }
html.tour-lock { overflow: hidden; } /* jen na kořeni: s body by přestala držet přilepená hlavička */
@media (prefers-reduced-motion: reduce) { .tour-hole, .tour-tip { transition: none; } }

/* vyhodnocené kolo: hlavní krok hráče, proto v barvě značky a přilepené pod hlavičkou */
.status-bar.next { position: sticky; top: calc(52px + 8px); z-index: 6; background: var(--brand); border-color: var(--brand); color: var(--on-dark); padding: 14px 18px; font-size: var(--text-base); box-shadow: 0 8px 22px var(--brand-glow); }
.status-bar.next > .ico { width: 24px; height: 24px; color: var(--on-dark); }
.status-bar.next b { display: block; font-family: var(--font-display); font-size: var(--text-md); }
.status-bar.next button { background: var(--on-dark); color: var(--brand-text); border-color: var(--on-dark); font-weight: 700; min-height: 44px; padding-inline: 22px; }
.status-bar.next button:hover { background: var(--brand-soft); }
@media (min-width: 1024px) { .status-bar.next { top: calc(var(--hud-h) + 10px); padding: 16px 22px; } .status-bar.next b { display: inline; } }
.ba tr.sub-head td { padding-top: 10px; font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; border-bottom: 0; }
.panel.warn-panel { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn-text); }
.lic-line { font-size: var(--text-sm); margin: 6px 0; padding: 8px 10px; border-radius: var(--radius-md); background: var(--surface-2, transparent); border: 1px solid var(--border-strong); }
.lic-line.warn, .lic-line.bad { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn-text); }
.lic-form { display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: 10px; align-items: end; min-width: 340px; padding: 10px 0; }
.lic-form label { display: grid; gap: 4px; font-size: var(--text-sm); }
.lic-form label:nth-of-type(5) { grid-column: 1 / -1; }
