/* =============================================================
   NASTAVENÍ VZHLEDU VŠECH PRVKŮ
   Mobilní přepnutí: @media (max-width: 700px) na konci souboru.
   ============================================================= */
:root {
  --page-bg: #ffffff;
  --text: #182336;
  --font: "Segoe UI", Arial, sans-serif;
  --font-size: 17px;
  --line-height: 1.65;
  --app-width: 960px;
  --outer-gap: 24px;
  --section-gap: 24px;
  --header-bg: #d4e3ff;
  --header-padding: 12px 20px;
  --title-size: 25px;
  --title-weight: 500;
  --home-size: 14px;
  --panel-bg: #f2f2f2;
  --panel-padding: 22px;
  --panel-min-height: 430px;
  --scene-title-size: 23px;
  --scene-title-weight: 600;
  --scene-title-gap: 16px;
  --scene-title-display: block;
  --image-width: 33.333%;
  --image-max-height: 370px;
  --image-gap: 22px;
  --image-fit: contain;
  --button-bg: #d5f6ff;
  --button-hover: #b7ebfb;
  --button-text: #182336;
  --button-border: #b9dbf5;
  --button-padding-y: 12px;
  --button-padding-x: 20px;
  --button-min-height: 54px;
  --button-min-width: 150px;
  --button-font-size: 17px;
  --button-gap: 24px;
  --radius: 2px;
  --shadow: 0 0 11px 3px #78a9f2aa;
  --focus: #135cb3;
  --error: #9c2424;
  --save-text: #526175;
  --save-font-size: 13px;
  --mobile-outer-gap: 14px;
  --mobile-panel-padding: 18px;
  --mobile-title-size: 22px;
  --mobile-image-max-height: 240px;
  --mobile-image-width: 100%;
  --mobile-button-gap: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page-bg); color: var(--text); font: var(--font-size)/var(--line-height) var(--font); }
button { font: inherit; }
.app { width: min(var(--app-width), calc(100% - 2 * var(--outer-gap))); margin: var(--outer-gap) auto; }
.header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: var(--header-padding); background: var(--header-bg); box-shadow: var(--shadow); border-radius: var(--radius); margin-bottom: var(--section-gap); }
h1 { margin: 0; font-size: var(--title-size); font-weight: var(--title-weight); line-height: 1.3; overflow-wrap: anywhere; }
.home { flex-shrink: 0; background: transparent; color: var(--text); border: 0; padding: 8px 0 8px 8px; cursor: pointer; font-size: var(--home-size); text-decoration: underline; text-underline-offset: 3px; }
.home:disabled { opacity: .5; cursor: not-allowed; }
.paragraph { display: flow-root; min-height: var(--panel-min-height); padding: var(--panel-padding); background: var(--panel-bg); box-shadow: var(--shadow); border-radius: var(--radius); }
.scene-title { display: var(--scene-title-display); margin: 0 0 var(--scene-title-gap); font-size: var(--scene-title-size); font-weight: var(--scene-title-weight); line-height: 1.3; overflow-wrap: anywhere; }
.scene-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.scene-image { width: var(--image-width); max-width: 33.333%; max-height: var(--image-max-height); object-fit: var(--image-fit); height: auto; }
.scene-image.right { float: right; margin: 0 0 16px var(--image-gap); }
.scene-image.left { float: left; margin: 0 var(--image-gap) 16px 0; }
.choices { display: flex; flex-wrap: wrap; justify-content: center; align-items: stretch; gap: var(--button-gap); margin-top: var(--section-gap); }
.choice { flex: 0 0 auto; width: min(var(--choice-width, var(--button-min-width)), 100%); max-width: 100%; min-height: var(--button-min-height); padding: var(--button-padding-y) var(--button-padding-x); background: var(--button-bg); color: var(--button-text); border: 1px solid var(--button-border); border-radius: var(--radius); box-shadow: var(--shadow); font-size: var(--button-font-size); cursor: pointer; overflow-wrap: anywhere; transition: background .15s; }
.choice:hover { background: var(--button-hover); }
button:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
#scene:focus { outline: none; }
.ending { text-align: center; }
.status { padding: 16px; }
.status.error { color: var(--error); border: 1px solid currentColor; white-space: pre-wrap; }
.save-status { color: var(--save-text); font-size: var(--save-font-size); margin: 20px 0 0; overflow-wrap: anywhere; }
.save-status:empty { display: none; }
.save-status.error { color: var(--error); }
/* Skrytý dočasný klon slouží k měření přirozených rozměrů. */
.choices.measuring { position: absolute; visibility: hidden; pointer-events: none; width: max-content; max-width: none; left: 0; top: 0; margin: 0; }
.choices.measuring .choice { width: max-content; max-width: none; white-space: nowrap; }
@media (max-width: 700px) {
  .app { width: calc(100% - 2 * var(--mobile-outer-gap)); margin: var(--mobile-outer-gap) auto; }
  .header { flex-wrap: wrap; gap: 4px 12px; }
  h1 { font-size: var(--mobile-title-size); }
  .home { margin-left: auto; }
  .paragraph { min-height: 0; padding: var(--mobile-panel-padding); display: flex; flex-direction: column; }
  .scene-title { order: 0; }
  .scene-image.left, .scene-image.right { order: 1; float: none; width: var(--mobile-image-width); max-width: 100%; max-height: var(--mobile-image-max-height); margin: 0 auto var(--image-gap); }
  .scene-text { order: 2; }
  .choices { gap: var(--mobile-button-gap); }
  .choice { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .choice { transition: none; } }
