@import url("https://fonts.googleapis.com/css2?family=Amatic+SC:wght@400;700&family=Open+Sans:wght@400;600;700&display=swap");

:root {
  color-scheme: only light;
  --ink: #173228;
  --cream: #fffaf0;
  --moss: #2d6a4f;
  --moss-dark: #173f2d;
  --leaf: #72a85a;
  --sun: #f4c95d;
  --rust: #ba5536;
  --error: #a4372a;
  --shadow: 0 18px 55px rgba(14, 48, 34, .2);
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--ink);
  background: #d8e8cd;
}

button, input { font: inherit; }
button { touch-action: manipulation; }
[hidden] { display: none !important; }

.app-shell, .screen { min-height: 100vh; min-height: 100svh; }
.screen { position: relative; overflow: hidden; }

.setup-screen, .result-screen {
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 48px);
  background:
    linear-gradient(rgba(224, 239, 213, .5), rgba(74, 105, 65, .43)),
    url("images/mech.jpg") center center / cover no-repeat;
}

.setup-screen::before, .result-screen::before {
  content: "";
  position: absolute;
  inset: auto -5% 0;
  height: 23%;
  background: #234a30;
  border-radius: 50% 50% 0 0 / 30% 30% 0 0;
  opacity: .25;
}

.setup-card, .result-card {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  padding: clamp(24px, 5vw, 48px);
  border: 2px solid rgba(255,255,255,.7);
  border-radius: 32px;
  background: rgba(255, 250, 240, .94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--rust);
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1, h2 { margin: 0; color: var(--moss-dark); line-height: 1.05; }
h1 { font-size: clamp(2.35rem, 8vw, 4.8rem); }
h2 { font-size: clamp(2rem, 6vw, 3.4rem); }
.intro { max-width: 56ch; margin: 14px 0 28px; font-size: clamp(1rem, 2.5vw, 1.2rem); line-height: 1.55; }

fieldset { margin: 0 0 24px; padding: 0; border: 0; }
legend { margin-bottom: 12px; font-size: 1.12rem; font-weight: 800; }
.choice-grid { display: grid; gap: 10px; }
.operations { grid-template-columns: repeat(4, 1fr); }
.ranges, .durations { grid-template-columns: repeat(4, 1fr); }
.choice { cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px;
  border: 2px solid #cbd8bd;
  border-radius: 15px;
  background: #fff;
  font-weight: 750;
  transition: transform .16s, border-color .16s, background .16s;
}
.choice b { font-size: 1.6rem; }
.choice input:checked + span { border-color: var(--moss); background: #e2f0d7; box-shadow: inset 0 0 0 2px rgba(45,106,79,.12); }
.choice input:focus-visible + span { outline: 3px solid var(--sun); outline-offset: 2px; }
.choice:hover span { transform: translateY(-2px); }
.form-error { margin: 8px 0 0; color: var(--error); font-weight: 700; }

.primary-button, .secondary-button, .text-button, .sound-button, .icon-button {
  border: 0;
  cursor: pointer;
  font-weight: 800;
}
.primary-button {
  width: 100%;
  padding: 16px 24px;
  border-radius: 16px;
  color: #fff;
  background: var(--moss);
  box-shadow: 0 7px 0 #194832;
  font-size: 1.15rem;
}
.primary-button:active { transform: translateY(4px); box-shadow: 0 3px 0 #194832; }
.sound-button { margin: 20px auto 0; display: block; color: var(--ink); background: transparent; }

.game-screen {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  background:
    linear-gradient(to bottom, rgba(12, 36, 25, .12), rgba(12, 32, 21, .24)),
    url("images/mech.jpg") center center / cover no-repeat;
}

.game-header { position: relative; z-index: 2; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 10px; padding: max(14px, env(safe-area-inset-top)) clamp(14px, 4vw, 42px) 8px; }
.status-pill, .score-panel { display: inline-flex; align-items: baseline; gap: 8px; width: max-content; padding: 8px 14px; border-radius: 16px; color: #fff; background: rgba(23,63,45,.88); box-shadow: 0 7px 20px rgba(0,0,0,.16); }
.status-pill span, .score-panel span { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.status-pill strong, .score-panel strong { font-size: clamp(1.5rem, 4vw, 2.2rem); }
.score-panel { justify-self: center; background: rgba(255,250,240,.94); color: var(--ink); }
.icon-button { justify-self: end; width: 48px; height: 48px; border-radius: 50%; background: rgba(255,250,240,.94); font-size: 1.3rem; }
.timer-track { position: relative; z-index: 2; height: 8px; margin: 0 clamp(14px, 4vw, 42px); border-radius: 10px; overflow: hidden; background: rgba(255,255,255,.4); }
.timer-track span { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--sun); transform-origin: left; }
.problem-wrap { position: relative; z-index: 2; justify-self: center; margin-top: clamp(8px, 2vh, 22px); padding: 8px 28px 12px; border-radius: 24px; text-align: center; background: rgba(255,250,240,.93); box-shadow: var(--shadow); }
.problem-label { margin: 0; font-size: clamp(.68rem, 1.8vw, .92rem); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #607567; }
.problem { min-width: 5ch; font-size: clamp(2.5rem, 8vw, 5.5rem); line-height: 1.05; font-weight: 900; }
.mushroom-field { position: relative; z-index: 2; min-height: 360px; width: min(100%, 980px); height: 100%; justify-self: center; }

.mushroom {
  --grow-delay: 0ms;
  position: absolute;
  width: clamp(108px, 17vw, 170px);
  height: clamp(118px, 19vw, 185px);
  border: 0;
  padding: 0;
  cursor: pointer;
  background: transparent;
  filter: drop-shadow(0 10px 7px rgba(12,28,17,.4));
  transform: translate(-50%, -50%);
  transform-origin: 50% 100%;
  transition: opacity .28s, transform .28s, filter .18s;
  animation: mushroom-grow .58s cubic-bezier(.2, .82, .28, 1.16) var(--grow-delay) both;
}
.mushroom:hover { filter: drop-shadow(0 13px 8px rgba(20,38,23,.32)); transform: translate(-50%, -54%) scale(1.04); }
.mushroom:focus-visible { outline: 4px solid var(--sun); outline-offset: 3px; border-radius: 50%; }
.mushroom-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.mushroom-number {
  position: absolute;
  left: 50%;
  top: 45%;
  display: grid;
  min-width: clamp(48px, 7vw, 66px);
  min-height: clamp(48px, 7vw, 66px);
  place-items: center;
  padding: 6px 9px;
  border: 3px solid rgba(56, 58, 35, .58);
  border-radius: 50%;
  background: rgba(255, 250, 231, .94);
  box-shadow: 0 4px 12px rgba(26, 35, 21, .36);
  transform: translate(-50%, -50%);
  font-size: clamp(1.55rem, 4vw, 2.55rem);
  font-weight: 900;
  color: #20372a;
  line-height: 1;
  text-shadow: 0 1px #fff;
  pointer-events: none;
}
.mushroom.wrong { animation: none; }
.mushroom.wrong .mushroom-photo { transform-origin: 50% 88%; animation: mushroom-sway .36s ease-in-out; }
.mushroom.wrong .mushroom-number { animation: number-sway .36s ease-in-out; }
.mushroom.vanish { opacity: 0; transform: translate(-50%, -35%) scale(.5) rotate(8deg); pointer-events: none; }
.mushroom.correct { pointer-events: none; animation: correct-lift .52s cubic-bezier(.38, .02, .64, 1) forwards; }
@keyframes mushroom-grow {
  0% { opacity: 0; transform: translate(-50%, -24%) scale(.2, .04); filter: drop-shadow(0 1px 1px rgba(12,28,17,0)); }
  48% { opacity: 1; transform: translate(-50%, -50%) scale(.78, 1.1); }
  72% { transform: translate(-50%, -50%) scale(1.06, .94); }
  88% { transform: translate(-50%, -50%) scale(.98, 1.02); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); filter: drop-shadow(0 10px 7px rgba(12,28,17,.4)); }
}
@keyframes mushroom-sway {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-7deg); }
  55% { transform: rotate(6deg); }
  78% { transform: rotate(-3deg); }
}
@keyframes number-sway {
  0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
  25% { transform: translate(-50%, -50%) rotate(-5deg); }
  55% { transform: translate(-50%, -50%) rotate(4deg); }
  78% { transform: translate(-50%, -50%) rotate(-2deg); }
}
@keyframes correct-lift {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  18% { transform: translate(-50%, -46%) scale(.98, 1.04); }
  100% { opacity: 0; transform: translate(-50%, -112%) scale(.9); }
}

.game-message { position: absolute; z-index: 4; left: 50%; bottom: 14px; margin: 0; transform: translateX(-50%); padding: 8px 16px; border-radius: 20px; background: rgba(255,250,240,.9); font-weight: 800; opacity: 0; transition: opacity .2s; }
.game-message.show { opacity: 1; }
.countdown { position: absolute; z-index: 10; inset: 0; display: grid; place-items: center; background: rgba(15,52,37,.73); backdrop-filter: blur(3px); }
.countdown span { color: #fff9df; font-size: clamp(6rem, 30vw, 14rem); font-weight: 900; text-shadow: 0 9px 0 #173f2d; animation: countdown-pop .72s ease; }
@keyframes countdown-pop { from { opacity: 0; transform: scale(.35); } 45% { opacity: 1; transform: scale(1.1); } }

.result-card { width: min(760px, 100%); }
.final-score { margin: 24px 0 16px; padding: 18px; border-radius: 20px; text-align: center; color: #fff; background: var(--moss); }
.final-score span { display: block; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.final-score strong { display: block; font-size: clamp(3rem, 10vw, 5.8rem); line-height: 1; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 24px; }
.stats div { padding: 13px 8px; border-radius: 14px; text-align: center; background: #edf2e5; }
.stats dt { font-size: .78rem; font-weight: 750; }
.stats dd { margin: 5px 0 0; font-size: 1.55rem; font-weight: 900; }
.score-form label { display: block; margin-bottom: 7px; font-weight: 800; }
.name-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.name-row input { min-width: 0; padding: 13px 14px; border: 2px solid #bdcdb3; border-radius: 13px; background: #fff; }
.name-row input:focus { outline: 3px solid rgba(244,201,93,.7); border-color: var(--moss); }
.secondary-button { padding: 10px 15px; border-radius: 13px; color: #fff; background: var(--rust); }
.leaderboard { margin-top: 24px; padding-top: 18px; border-top: 2px dashed #cdd7c2; }
.leaderboard-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.leaderboard h3 { margin: 0; font-size: 1.25rem; }
.leaderboard-heading span { color: #617064; font-size: .84rem; font-weight: 700; }
.leaderboard ol { margin: 12px 0 0; padding: 0; list-style: none; counter-reset: place; }
.leaderboard li { counter-increment: place; display: grid; grid-template-columns: 32px 1fr auto auto; gap: 9px; align-items: center; padding: 9px 6px; border-bottom: 1px solid #e0e4d8; }
.leaderboard li::before { content: counter(place) "."; font-weight: 900; color: var(--rust); }
.leaderboard .points { font-weight: 900; }
.leaderboard .errors { color: #6e776f; font-size: .82rem; }
#empty-leaderboard { color: #687469; font-style: italic; }
.result-actions { display: grid; gap: 10px; margin-top: 24px; }
.text-button { padding: 10px; color: var(--moss); background: transparent; }

.preview-notice {
  margin: 2px 0 12px;
  padding: 10px 14px;
  border-left: 5px solid #657e23;
  border-radius: 8px;
  color: #343b25;
  background: #f1f4e8;
  line-height: 1.35;
}

.preview-notice strong {
  display: block;
  font-family: "Amatic SC", "Segoe Print", cursive;
  font-size: 1.65rem;
  line-height: 1;
  text-transform: uppercase;
}

.preview-notice span { display: block; margin-top: 3px; font-size: .9rem; }
.preview-notice a {
  display: inline-block;
  margin-top: 7px;
  color: #4e6418;
  font-size: .88rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.preview-notice a:hover { color: #2f3f0d; }
.preview-locked { position: relative; }
.preview-locked legend::after {
  content: "  V PLNÉ VERZI";
  color: #737a63;
  font-family: "Open Sans", Arial, sans-serif;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .04em;
}
.preview-locked .choice input:not(:checked) + span,
.preview-locked .setting-slider { opacity: .52; }
.preview-locked .choice span,
.preview-locked .setting-slider input,
.preview-locked .slider-labels button { cursor: default; }

.product-page-link {
  display: block;
  padding: 12px 18px;
  border: 2px solid #4e6418;
  border-radius: 10px;
  color: #fff;
  background: #657e23;
  font-family: "Amatic SC", "Segoe Print", cursive;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
}
.product-page-link:hover { color: #fff; background: #4e6418; }

@media (max-width: 640px) {
  .setup-card, .result-card { padding: 22px 18px; border-radius: 24px; }
  .operations { grid-template-columns: repeat(2, 1fr); }
  .choice span { min-height: 52px; }
  .game-header { grid-template-columns: auto 1fr auto; }
  .status-pill span, .score-panel span { display: none; }
  .mushroom-field { min-height: 430px; }
  .mushroom { width: 94px; height: 128px; }
  .mushroom-number { min-width: 46px; min-height: 46px; }
  .stats { gap: 6px; }
  .stats dt { min-height: 2.2em; }
  .name-row { grid-template-columns: 1fr; }
  .leaderboard-heading { display: block; }
}

/* Svěží zelený akcent a měkčí tvary. */
:root { --accent: #657e23; --accent-dark: #4e6418; }

.setup-card,
.result-card { border-radius: 20px; }

.choice span,
.name-row input { border-radius: 9px; }

.choice input:checked + span {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.sound-choice input { accent-color: var(--accent); }

.primary-button,
.secondary-button {
  border-color: var(--accent-dark);
  border-radius: 10px;
  color: #fff;
  background: var(--accent);
}

.primary-button:hover,
.secondary-button:hover { color: #fff; background: var(--accent-dark); }

.timer-track,
.timer-track span { border-radius: 5px; }
.timer-track span { background: var(--accent); }

.setup-characters {
  height: 170px;
  margin: 4px auto 8px;
  object-position: center 64%;
}

.intro { margin: 4px 0 24px; }

.countdown span {
  color: var(--accent-dark);
  transform: rotate(var(--countdown-rotation, 0deg));
  transform-origin: 50% 58%;
}

@keyframes countdown-pop {
  from { opacity: 0; transform: scale(.35) rotate(var(--countdown-rotation, 0deg)); }
  45% { opacity: 1; transform: scale(1.1) rotate(var(--countdown-rotation, 0deg)); }
  to { transform: scale(1) rotate(var(--countdown-rotation, 0deg)); }
}

.result-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 24px;
  align-items: stretch;
}

.result-character {
  float: none;
  align-self: end;
  width: 100%;
  max-height: 440px;
  height: 100%;
  margin: 0;
  object-fit: contain;
  object-position: center bottom;
}

@media (max-width: 640px) {
  .setup-card, .result-card { border-radius: 14px; }
  .setup-characters { height: 130px; margin-bottom: 5px; }
  .result-top { grid-template-columns: minmax(0, 1fr) 105px; gap: 8px; }
  .result-character { width: 100%; max-height: 360px; height: 100%; margin: 0; }
  .name-row { grid-template-columns: 1fr; }
}

.game-message:not(.bonus) {
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  color: #fff !important;
  box-shadow: 0 7px 20px rgba(20, 25, 12, .25);
}

.game-message.positive { background: #657e23; }
.game-message.negative { background: #c96d24; }

/* Amatic SC v této hře vždy používáme jako verzálkový titulkářský font. */
.eyebrow,
h1,
h2,
.leaderboard h3,
legend,
.problem-label,
.choice b,
.primary-button,
.status-pill span,
.status-pill strong,
.score-panel span,
.score-panel strong,
.problem,
.game-message,
.countdown span,
.final-score span,
.final-score strong {
  text-transform: uppercase;
}

@media (max-height: 650px) and (orientation: landscape) {
  .game-screen { grid-template-rows: auto auto auto 1fr; }
  .game-header { padding-top: 8px; }
  .problem-wrap { position: absolute; top: 75px; left: 50%; transform: translateX(-50%); margin: 0; }
  .problem { font-size: 3.3rem; }
  .mushroom-field { min-height: 250px; }
  .mushroom { width: 105px; height: 112px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* Vizuální styl navazující na dubanci.cz: fotografie, bílá plocha, kreslené písmo a tenké linky. */
body {
  color: #353535;
  background: #fff;
  font-family: "Open Sans", Arial, sans-serif;
}

.setup-screen,
.result-screen {
  background:
    linear-gradient(rgba(255, 255, 255, .14), rgba(255, 255, 255, .14)),
    url("images/mech.jpg") center center / cover no-repeat;
}

.setup-screen::before,
.result-screen::before { display: none; }

.setup-card,
.result-card {
  border: 1px solid rgba(40, 40, 40, .46);
  border-radius: 0;
  background: rgba(255, 255, 255, .95);
  box-shadow: 10px 10px 0 rgba(35, 35, 35, .12);
  backdrop-filter: none;
}

.eyebrow {
  margin-bottom: 0;
  color: #656565;
  font-family: "Amatic SC", "Segoe Print", cursive;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: .06em;
}

h1, h2, .leaderboard h3, legend, .problem-label {
  color: #333;
  font-family: "Amatic SC", "Segoe Print", cursive;
}

h1 { font-size: clamp(3.8rem, 10vw, 6.6rem); font-weight: 700; letter-spacing: .015em; }
h2 { font-size: clamp(3.4rem, 8vw, 5.4rem); font-weight: 700; }
.intro { margin-top: 7px; color: #555; font-size: 1rem; }
legend { font-size: 2rem; font-weight: 700; }

.choice span {
  min-height: 52px;
  border: 1px solid #777;
  border-radius: 0;
  color: #3d3d3d;
  background: #fff;
  box-shadow: none;
  font-weight: 600;
}

.choice b {
  color: #6e4c2f;
  font-family: "Amatic SC", "Segoe Print", cursive;
  font-size: 2rem;
}

.choice input:checked + span {
  border-color: #2f2f2f;
  color: #fff;
  background: #3b3b3b;
  box-shadow: none;
}

.choice input:checked + span b { color: #fff; }
.choice:hover span { transform: none; border-color: #222; }

.primary-button {
  border: 2px solid #3b3b3b;
  border-radius: 0;
  color: #3b3b3b;
  background: #fff;
  box-shadow: none;
  font-family: "Amatic SC", "Segoe Print", cursive;
  font-size: 2rem;
  letter-spacing: .04em;
}

.primary-button:hover { color: #fff; background: #3b3b3b; }
.primary-button:active { transform: translateY(1px); box-shadow: none; }
.sound-button { color: #555; font-size: .86rem; font-weight: 600; }

.game-screen {
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, .04), rgba(0, 0, 0, .1)),
    url("images/mech.jpg") center center / cover no-repeat;
}

.status-pill,
.score-panel {
  gap: 7px;
  padding: 5px 12px;
  border: 1px solid rgba(35, 35, 35, .8);
  border-radius: 0;
  color: #333;
  background: rgba(255, 255, 255, .94);
  box-shadow: none;
}

.status-pill span,
.score-panel span {
  font-family: "Amatic SC", "Segoe Print", cursive;
  font-size: 1.35rem;
  letter-spacing: .04em;
}

.status-pill strong,
.score-panel strong { font-family: "Amatic SC", "Segoe Print", cursive; font-size: clamp(2rem, 5vw, 2.8rem); }

.icon-button {
  border: 1px solid rgba(35, 35, 35, .8);
  border-radius: 0;
  background: rgba(255, 255, 255, .94);
}

.timer-track {
  height: 5px;
  border-radius: 0;
  background: rgba(255,255,255,.58);
}

.timer-track span { border-radius: 0; background: #4d4d4d; }

.problem-wrap {
  padding: 5px 30px 8px;
  border: 1px solid rgba(35, 35, 35, .82);
  border-radius: 0;
  background: rgba(255, 255, 255, .96);
  box-shadow: 6px 6px 0 rgba(35, 35, 35, .12);
}

.problem-label { color: #555; font-size: 1.35rem; letter-spacing: .04em; }
.problem { color: #2f2f2f; font-family: "Amatic SC", "Segoe Print", cursive; font-size: clamp(4rem, 11vw, 7.2rem); line-height: .9; }

.mushroom-number {
  top: 61%;
  min-width: clamp(52px, 7vw, 68px);
  min-height: clamp(44px, 6vw, 56px);
  border: 0;
  border-radius: 0;
  color: #292929;
  background: transparent;
  box-shadow: none;
  font-family: Arial, sans-serif;
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  font-weight: 700;
  line-height: 1;
  text-shadow:
    0 0 3px rgba(255, 255, 255, 1),
    0 0 7px rgba(255, 255, 255, 1),
    0 2px 10px rgba(255, 255, 255, .96);
}

.game-message {
  border: 1px solid #444;
  border-radius: 0;
  color: #333 !important;
  background: rgba(255,255,255,.96);
  font-family: "Amatic SC", "Segoe Print", cursive;
  font-size: 1.65rem;
}

.countdown { background: rgba(255,255,255,.74); backdrop-filter: none; }
.countdown span { color: #333; font-family: "Amatic SC", "Segoe Print", cursive; text-shadow: none; }

.final-score {
  border-top: 1px solid #555;
  border-bottom: 1px solid #555;
  border-radius: 0;
  color: #333;
  background: transparent;
}

.final-score span { font-family: "Amatic SC", "Segoe Print", cursive; font-size: 1.7rem; }
.final-score strong { font-family: "Amatic SC", "Segoe Print", cursive; }
.stats { gap: 0; border-bottom: 1px solid #bbb; }
.stats div { border-right: 1px solid #bbb; border-radius: 0; background: transparent; }
.stats div:last-child { border-right: 0; }
.score-form label { font-size: .9rem; }
.name-row input { border: 1px solid #777; border-radius: 0; }
.secondary-button { border: 1px solid #3b3b3b; border-radius: 0; color: #3b3b3b; background: #fff; }
.secondary-button:hover { color: #fff; background: #3b3b3b; }
.leaderboard { border-top: 1px solid #999; }
.leaderboard h3 { font-size: 2rem; }
.leaderboard li { border-bottom-color: #ccc; }
.leaderboard li::before { color: #765439; }
.text-button { color: #444; text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 640px) {
  .setup-card, .result-card { border-radius: 0; }
  h1 { font-size: clamp(3.6rem, 18vw, 5.4rem); }
  .problem-label { font-size: 1.1rem; }
  .mushroom-number { min-width: 48px; min-height: 40px; }
}

.sound-choice {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: -5px 0 24px;
  color: #444;
  cursor: pointer;
  font-size: .94rem;
  font-weight: 600;
}

.sound-choice input {
  width: 19px;
  height: 19px;
  margin: 0;
  accent-color: #3b3b3b;
}

.game-screen { grid-template-rows: auto 1fr; }

.game-header {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(70px, 1fr) auto minmax(70px, 1fr);
  grid-template-rows: auto 5px;
  align-items: center;
  gap: 5px clamp(8px, 2.5vw, 24px);
  width: 100%;
  padding: max(8px, env(safe-area-inset-top)) clamp(14px, 4vw, 42px) 0;
  background: rgba(255, 255, 255, .84);
  backdrop-filter: blur(4px);
}

.game-header .status-pill,
.game-header .score-panel {
  padding: 0;
  border: 0;
  color: #333;
  background: transparent;
}

.game-header .status-pill { justify-self: start; }
.game-header .score-panel { justify-self: end; }

.game-header .problem-wrap {
  position: static;
  margin: 0;
  padding: 0 12px 5px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.game-header .problem-label { font-size: 1.15rem; }
.game-header .problem { font-size: clamp(3.8rem, 8vw, 6rem); }

.game-header .timer-track {
  grid-column: 1 / -1;
  width: auto;
  margin: 0 calc(clamp(14px, 4vw, 42px) * -1);
  background: rgba(70, 70, 70, .18);
}

@media (max-width: 640px) {
  .game-header {
    grid-template-columns: 52px 1fr 52px;
    gap: 4px;
    padding-inline: 10px;
  }

  .game-header .status-pill,
  .game-header .score-panel {
    display: block;
    text-align: center;
  }

  .game-header .status-pill span,
  .game-header .score-panel span {
    display: block;
    font-size: 1rem;
    line-height: .8;
  }

  .game-header .status-pill strong,
  .game-header .score-panel strong { font-size: 2.35rem; line-height: 1; }
  .game-header .problem-wrap { padding-inline: 2px; }
  .game-header .problem-label { font-size: .9rem; white-space: nowrap; }
  .game-header .problem { font-size: clamp(3.2rem, 16vw, 4.4rem); }
  .game-header .timer-track { margin-inline: -10px; }
}

.setup-screen { overflow-y: auto; }

.setup-characters {
  display: block;
  width: min(430px, 82%);
  height: 150px;
  margin: -8px auto 18px;
  object-fit: cover;
  object-position: center 68%;
}

.result-character {
  position: relative;
  z-index: 1;
  float: right;
  width: clamp(110px, 18vw, 165px);
  max-height: 230px;
  margin: -12px 0 12px 24px;
  object-fit: contain;
}

.time-bonus { animation: time-bonus-pop .7s ease-out; }

@keyframes time-bonus-pop {
  0% { color: #333; transform: scale(1); }
  35% { color: #a94b32; transform: scale(1.55) rotate(-3deg); }
  70% { transform: scale(.94) rotate(1deg); }
  100% { color: #333; transform: scale(1); }
}

@media (max-width: 640px) {
  .setup-characters {
    width: 92%;
    height: 115px;
    margin-top: -4px;
    object-position: center 70%;
  }

  .result-character {
    width: 105px;
    max-height: 160px;
    margin-left: 10px;
  }
}

/* Nový obrázek obsahuje také hlavní nadpis. */
.setup-characters {
  width: min(620px, 100%);
  margin: 0 auto 10px;
}

@media (max-width: 640px) {
  .setup-characters { width: 100%; margin-top: 0; }
}

/* Finální vzhledové přepisy musí zůstat za původním motivem. */
:root { --accent: #657e23; --accent-dark: #4e6418; }

.setup-card,
.result-card { border-radius: 20px; }
.choice span,
.name-row input { border-radius: 9px; }
.choice input:checked + span { border-color: var(--accent); color: #fff; background: var(--accent); }
.sound-choice input { accent-color: var(--accent); }
.primary-button,
.secondary-button { border-color: var(--accent-dark); border-radius: 10px; color: #fff; background: var(--accent); }
.primary-button:hover,
.secondary-button:hover { color: #fff; background: var(--accent-dark); }
.timer-track,
.timer-track span { border-radius: 5px; }

.setup-characters { height: 170px; margin: 30px auto 8px; object-position: center 64%; }
.intro { margin: 4px 0 24px; }

.game-message.bonus {
  top: clamp(150px, 24vh, 220px);
  bottom: auto;
  min-width: min(410px, calc(100% - 32px));
  padding: 14px 22px;
  border: 0;
  border-radius: 12px;
  color: #fff !important;
  background: var(--accent);
  box-shadow: 0 10px 30px rgba(20, 35, 8, .32);
  font-family: "Amatic SC", "Segoe Print", cursive;
  font-size: clamp(2rem, 6vw, 3.2rem);
  text-align: center;
  animation: bonus-notice .55s ease-out;
}

@keyframes bonus-notice {
  from { opacity: 0; transform: translateX(-50%) scale(.55) rotate(-4deg); }
  65% { transform: translateX(-50%) scale(1.08) rotate(1deg); }
  to { opacity: 1; transform: translateX(-50%) scale(1); }
}

.countdown span {
  color: var(--accent-dark);
  transform: rotate(var(--countdown-rotation, 0deg));
  transform-origin: 50% 58%;
}

@keyframes countdown-pop {
  from { opacity: 0; transform: scale(.35) rotate(var(--countdown-rotation, 0deg)); }
  45% { opacity: 1; transform: scale(1.1) rotate(var(--countdown-rotation, 0deg)); }
  to { transform: scale(1) rotate(var(--countdown-rotation, 0deg)); }
}

.result-top { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 24px; align-items: stretch; }
.result-character {
  float: none;
  align-self: end;
  width: 100%;
  max-height: 440px;
  height: 100%;
  margin: 0;
  object-fit: contain;
  object-position: center bottom;
}

@media (max-width: 640px) {
  .setup-card, .result-card { border-radius: 14px; }
  .setup-characters { width: 92%; height: 130px; margin: 24px auto 5px; object-position: center 67%; }
  .result-top { grid-template-columns: minmax(0, 1fr) 105px; gap: 8px; }
  .result-character { width: 100%; max-height: 360px; height: 100%; margin: 0; }
  .name-row { grid-template-columns: 1fr; }
}

/* Fotografie houbařů se zobrazuje celá, bez výřezu. */
.setup-characters {
  width: min(440px, 92%);
  height: auto;
  max-height: none;
  margin: 24px auto 8px;
  object-fit: contain;
  object-position: center;
}

@media (max-width: 640px) {
  .setup-characters {
    width: min(400px, 96%);
    height: auto;
    margin-top: 20px;
    object-fit: contain;
    object-position: center;
  }
}

.intro {
  width: 100%;
  max-width: none;
}

.choice b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1em;
  font-family: "Open Sans", Arial, sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  transform: translateY(-1px);
}

.mushroom {
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.mushroom:focus:not(:focus-visible) { outline: none; }
.mushroom:disabled { color: inherit; cursor: default; opacity: 1; }

.game-header .problem {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  letter-spacing: -.03em;
}

.countdown span { color: #111; }

.leaderboard-tools {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.clear-leaderboard {
  padding: 4px 8px;
  border: 1px solid #a9a9a9;
  border-radius: 6px;
  color: #666;
  background: transparent;
  cursor: pointer;
  font-size: .72rem;
  font-weight: 700;
}

.clear-leaderboard:hover:not(:disabled) { color: #fff; background: #c96d24; border-color: #c96d24; }
.clear-leaderboard:disabled { cursor: default; opacity: .35; }

@media (max-width: 640px) {
  .leaderboard-tools { width: 100%; justify-content: space-between; margin-top: 4px; }
}

.setting-slider {
  --slider-position: 33.333%;
  padding: 2px 5px 0;
}

.setting-slider input[type="range"] {
  width: 100%;
  height: 30px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}

.setting-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 5px;
  background: linear-gradient(to right, #657e23 0 var(--slider-position), #d5d8cf var(--slider-position) 100%);
}

.setting-slider input[type="range"]::-moz-range-track { height: 8px; border-radius: 5px; background: #d5d8cf; }
.setting-slider input[type="range"]::-moz-range-progress { height: 8px; border-radius: 5px; background: #657e23; }

.setting-slider input[type="range"]::-webkit-slider-thumb {
  width: 26px;
  height: 26px;
  margin-top: -9px;
  border: 3px solid #fff;
  border-radius: 50%;
  appearance: none;
  -webkit-appearance: none;
  background: #657e23;
  box-shadow: 0 2px 7px rgba(35, 45, 18, .35);
}

.setting-slider input[type="range"]::-moz-range-thumb {
  width: 21px;
  height: 21px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #657e23;
  box-shadow: 0 2px 7px rgba(35, 45, 18, .35);
}

.setting-slider input[type="range"]:focus-visible { outline: 3px solid rgba(101, 126, 35, .35); outline-offset: 3px; border-radius: 8px; }

.slider-labels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 1px;
}

.slider-labels button {
  padding: 3px 0;
  border: 0;
  color: #777;
  background: transparent;
  cursor: pointer;
  font-size: .86rem;
  font-weight: 700;
}

.slider-labels button:first-child { text-align: left; }
.slider-labels button:last-child { text-align: right; }
.slider-labels button.active { color: #657e23; font-weight: 800; }

/* Kompaktnější rozložení úvodního nastavení. */
.setup-screen { padding: clamp(10px, 2.5vw, 24px); }
.setup-card { padding: 14px 38px 24px; }
.setup-characters { width: min(500px, 100%); margin: 0 auto 2px; }
.setup-card .intro { margin: 0 0 14px; line-height: 1.4; }
.setup-card fieldset { margin-bottom: 14px; }
.setup-card legend { margin-bottom: 4px; font-size: 1.72rem; line-height: 1; }
.setup-card .choice span { min-height: 46px; padding-block: 6px; }
.setup-card .sound-choice { margin: 0 0 12px; }

.setup-card .setting-slider { padding-top: 0; }
.setup-card .setting-slider input[type="range"] { height: 22px; }
.setup-card .slider-labels { margin-top: -1px; }
.setup-card .slider-labels button { padding-block: 1px; line-height: 1.15; }

@media (max-width: 640px) {
  .setup-card { padding: 12px 18px 18px; }
  .setup-characters { width: min(390px, 100%); }
  .setup-card .intro { margin-bottom: 12px; font-size: .94rem; }
  .setup-card fieldset { margin-bottom: 12px; }
  .setup-card legend { font-size: 1.55rem; }
}
