/* =========================================================================
   Pastierska cesta — vzhľad. Hrubé okraje, teplé farby, guľaté rohy.
   ========================================================================= */

:root {
  --cream: #fdf6e6;
  --cream-2: #f5e9cf;
  --ink: #3d2d1f;
  --ink-soft: #6b543f;
  --grass: #6cbe4a;
  --grass-dark: #3f8a34;
  --sky: #4fa3e3;
  --sun: #ffc93c;
  --red: #e0574a;
  --red-dark: #b13c34;
  --purple: #8a6fd0;
  --shadow: 0 6px 0 rgba(61, 45, 31, .28), 0 12px 28px rgba(30, 20, 12, .3);
  --panel-border: 4px solid var(--ink);
  --font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #16202c;
  font-family: var(--font);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#app { position: fixed; inset: 0; }

#scene { display: block; width: 100%; height: 100%; touch-action: none; }

.hidden { display: none !important; }

/* ---------------------------------------------------------------- buttons */

.btn {
  font-family: var(--font);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: .01em;
  color: var(--ink);
  background: linear-gradient(180deg, #ffe9a8, #ffd15c);
  border: var(--panel-border);
  border-radius: 16px;
  padding: 12px 26px;
  cursor: pointer;
  box-shadow: 0 5px 0 #b8862c, 0 9px 14px rgba(0, 0, 0, .28);
  transition: transform .07s, box-shadow .07s, filter .12s;
  position: relative;
  user-select: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #b8862c, 0 3px 8px rgba(0, 0, 0, .3);
}
.btn.big { font-size: 22px; padding: 16px 42px; border-radius: 20px; }
.btn.tiny { font-size: 13px; padding: 8px 14px; border-radius: 12px; }
.btn.ghost {
  background: linear-gradient(180deg, #fffaf0, #eadfc8);
  box-shadow: 0 5px 0 #a2917a, 0 9px 14px rgba(0, 0, 0, .22);
}
.btn.ghost:active { box-shadow: 0 1px 0 #a2917a; }
.btn.toggle.on { background: linear-gradient(180deg, #b9f09a, #6cbe4a); box-shadow: 0 5px 0 #3f8a34, 0 9px 14px rgba(0,0,0,.25); }
.btn:disabled { opacity: .5; cursor: default; }

kbd {
  display: inline-block;
  background: var(--cream);
  border: 2px solid var(--ink);
  border-bottom-width: 3px;
  border-radius: 6px;
  padding: 1px 7px;
  font-size: .86em;
  font-family: var(--font);
  font-weight: 800;
}

/* ---------------------------------------------------------------- overlay */

#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(12, 24, 34, .30), rgba(8, 16, 24, .74));
  backdrop-filter: blur(2.5px);
  z-index: 20;
  padding: 20px;
  overflow-y: auto;
}

.screen { display: none; width: 100%; max-width: 520px; }
.screen.active { display: block; animation: pop .28s cubic-bezier(.2, 1.3, .5, 1); }
.screen.wide { max-width: 1000px; }

@keyframes pop {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to { opacity: 1; transform: none; }
}

.screen h2 {
  margin: 0 0 6px;
  font-size: 34px;
  color: var(--cream);
  text-shadow: 0 3px 0 rgba(0, 0, 0, .38);
  text-align: center;
}
.screen .sub { text-align: center; color: #e8dcc4; margin: 0 0 20px; font-weight: 700; }
.screen .sub b { color: var(--sun); }

.row-end {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 22px;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ title */

#screen-title { text-align: center; }
.title-block { margin-bottom: 30px; }
.eyebrow {
  color: var(--sun);
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-size: 12px;
  margin: 0 0 10px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .4);
}
.game-title {
  margin: 0;
  font-size: clamp(52px, 12vw, 92px);
  line-height: .92;
  letter-spacing: -.02em;
  color: var(--cream);
  text-shadow:
    0 4px 0 var(--grass-dark),
    0 8px 0 rgba(0, 0, 0, .28),
    0 18px 34px rgba(0, 0, 0, .5);
}
.game-title span { color: var(--sun); }
.tagline {
  color: #efe4cd;
  font-weight: 700;
  font-size: 17px;
  margin: 18px 0 0;
  line-height: 1.5;
  text-shadow: 0 2px 4px rgba(0, 0, 0, .5);
}
.menu-buttons { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.opt-row { display: flex; gap: 10px; margin-top: 4px; }
.credit { margin-top: 26px; color: #bfb096; font-size: 13px; font-weight: 700; }

/* ------------------------------------------------------------------- help */

.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(268px, 1fr));
  gap: 14px;
}
.help-card {
  background: var(--cream);
  border: var(--panel-border);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.help-card h3 { margin: 0 0 8px; font-size: 17px; color: var(--grass-dark); }
.help-card p { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--ink-soft); }
.help-card b { color: var(--ink); }

/* ------------------------------------------------------------------ dogs */

.breed-layout { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.preview-box {
  background: linear-gradient(180deg, #bfe4f5, #dff0d0);
  border: var(--panel-border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
  aspect-ratio: 1 / 1;
  position: sticky;
  top: 0;
}
#breed-preview { width: 100%; height: 100%; display: block; }

.breed-list { display: grid; gap: 12px; }
.breed-card {
  text-align: left;
  font-family: var(--font);
  background: var(--cream);
  border: var(--panel-border);
  border-radius: 18px;
  padding: 14px 18px;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(61, 45, 31, .3);
  transition: transform .1s, box-shadow .1s, background .15s;
  color: var(--ink);
}
.breed-card:hover { transform: translateY(-2px); }
.breed-card.selected {
  background: linear-gradient(180deg, #e6f8d4, #cdefb2);
  box-shadow: 0 5px 0 var(--grass-dark), 0 0 0 4px rgba(108, 190, 74, .45);
}
.breed-head { display: flex; align-items: center; gap: 10px; }
.breed-card h3 { margin: 0; font-size: 19px; }
.tag {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  background: var(--ink);
  color: var(--cream);
  padding: 3px 9px;
  border-radius: 20px;
}
.blurb { margin: 7px 0 10px; font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); }
.hint-line { margin: 8px 0 0; font-size: 12px; font-weight: 700; color: var(--grass-dark); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 14px; }
.stat { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 800; }
.stat span { width: 62px; color: var(--ink-soft); }
.stat .bar { flex: 1; height: 8px; background: #e0d2b6; border-radius: 6px; overflow: hidden; border: 2px solid var(--ink); }
.stat .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--grass), var(--sun)); }

/* ----------------------------------------------------------------- levels */

.level-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 13px; }
.level-card {
  display: flex;
  align-items: center;
  gap: 13px;
  text-align: left;
  font-family: var(--font);
  background: var(--cream);
  border: var(--panel-border);
  border-radius: 18px;
  padding: 13px 15px;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(61, 45, 31, .3);
  transition: transform .1s;
  color: var(--ink);
  position: relative;
}
.level-card:hover:not(.locked) { transform: translateY(-3px); }
.level-card.locked { opacity: .55; cursor: default; filter: grayscale(.6); }
.lv-num {
  flex: 0 0 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--grass);
  border: 3px solid var(--ink);
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .3);
}
.lv-body h3 { margin: 0; font-size: 16px; }
.lv-place { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.lv-stars { margin-top: 3px; font-size: 15px; color: #cbbb9c; letter-spacing: 2px; }
.lv-stars .on { color: var(--sun); text-shadow: 0 1px 0 #b8862c; }
.lock { position: absolute; right: 12px; font-size: 18px; }

/* ------------------------------------------------------------------ brief */

.brief-card, .pause-card, .result-card {
  background: var(--cream);
  border: var(--panel-border);
  border-radius: 24px;
  padding: 26px 28px;
  box-shadow: var(--shadow);
  text-align: center;
}
.brief-num {
  display: inline-block;
  background: var(--ink);
  color: var(--sun);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
}
.brief-card h2 { color: var(--ink); text-shadow: none; margin: 12px 0 2px; font-size: 30px; }
.brief-place { margin: 0 0 14px; color: var(--ink-soft); font-weight: 700; font-size: 13px; }
.brief-text { margin: 0 0 18px; line-height: 1.6; color: var(--ink-soft); font-size: 15px; }
.brief-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  text-align: left;
  background: var(--cream-2);
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
}
.brief-stats div { display: flex; justify-content: space-between; font-size: 13.5px; }
.brief-stats span { color: var(--ink-soft); font-weight: 700; }
.brief-stats b { color: var(--ink); }

/* ------------------------------------------------------------------ pause */

.pause-card { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.pause-card h2 { color: var(--ink); text-shadow: none; margin-bottom: 8px; }

/* ----------------------------------------------------------------- result */

.result-card h2 { text-shadow: none; margin: 0 0 4px; font-size: 30px; }
.result-card h2.win { color: var(--grass-dark); }
.result-card h2.lose { color: var(--red-dark); }
.result-card > p { margin: 0 0 14px; color: var(--ink-soft); font-weight: 700; font-size: 14px; }
.stars { font-size: 46px; letter-spacing: 8px; color: #d8c9ab; margin: 6px 0 16px; }
.stars .star.on { color: var(--sun); text-shadow: 0 3px 0 #b8862c; animation: starpop .45s cubic-bezier(.2, 1.6, .4, 1) backwards; }
.stars .star.on:nth-child(2) { animation-delay: .18s; }
.stars .star.on:nth-child(3) { animation-delay: .36s; }
@keyframes starpop { from { transform: scale(0) rotate(-40deg); opacity: 0; } }

.result-lines {
  background: var(--cream-2);
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 12px 16px;
  text-align: left;
}
.result-lines div { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; padding: 3px 0; }
.result-lines span { color: var(--ink-soft); font-weight: 700; }
.result-lines em { color: var(--ink-soft); font-size: 12px; font-style: normal; }

/* -------------------------------------------------------------------- HUD */

#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }

.panel {
  background: rgba(253, 246, 230, .93);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(61, 45, 31, .3);
  padding: 7px 14px;
  font-weight: 800;
}

.hud-top {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}
.counter { font-size: 19px; display: flex; align-items: center; gap: 5px; }
.counter .ico { font-size: 17px; }
.counter b { font-size: 23px; color: var(--grass-dark); }
.counter .slash { color: var(--ink-soft); }
.counter .lost { font-size: 12px; color: var(--red-dark); font-weight: 700; margin-left: 6px; }
.counter .lost b { font-size: 14px; color: var(--red-dark); }
.level-name { font-size: 13px; color: var(--ink-soft); }
.timer { font-size: 18px; display: flex; align-items: center; gap: 6px; }
.timer b.urgent { color: var(--red-dark); animation: blink .8s infinite; }
@keyframes blink { 50% { opacity: .35; } }

.hud-bars {
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: rgba(253, 246, 230, .9);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(61, 45, 31, .3);
  padding: 10px 13px;
  min-width: 172px;
}
.meter label { display: block; font-size: 10.5px; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 3px; }
.track { height: 11px; background: #ded0b4; border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; }
.fill { display: block; height: 100%; width: 100%; transition: width .1s linear; border-radius: 5px; }
.fill.stam { background: linear-gradient(90deg, #4fa3e3, #7fd0ff); }
.fill.stam.empty { background: linear-gradient(90deg, #b0533f, #e0574a); }
.fill.bark { background: linear-gradient(90deg, #b8862c, var(--sun)); }
.fill.good { background: linear-gradient(90deg, var(--grass-dark), var(--grass)); }
.fill.warn { background: linear-gradient(90deg, #c98a1e, var(--sun)); }
.fill.bad { background: linear-gradient(90deg, var(--red-dark), var(--red)); }

#minimap-wrap {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  padding: 8px;
  line-height: 0;
}
#minimap { width: 150px; height: 150px; border-radius: 50%; display: block; }
.mm-label { display: block; text-align: center; font-size: 10px; line-height: 1.4; color: var(--ink-soft); margin-top: 5px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }

.hint {
  position: absolute;
  left: 50%;
  bottom: 74px;
  transform: translate(-50%, 12px);
  max-width: min(620px, 88vw);
  background: rgba(61, 45, 31, .93);
  color: var(--cream);
  border: 3px solid #241a12;
  border-radius: 14px;
  padding: 10px 20px;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
}
.hint.show { opacity: 1; transform: translate(-50%, 0); }

.alert {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translate(-50%, 0) scale(.85);
  padding: 12px 30px;
  border-radius: 16px;
  border: 4px solid var(--ink);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: .02em;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .28s cubic-bezier(.2, 1.5, .4, 1);
  box-shadow: var(--shadow);
  background: var(--cream);
}
.alert.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.alert.bad { background: linear-gradient(180deg, #ff8f7f, var(--red)); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.alert.warn { background: linear-gradient(180deg, #ffdf8a, var(--sun)); }
.alert.good { background: linear-gradient(180deg, #b9f09a, var(--grass)); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.28); }

#goal-arrow {
  position: absolute;
  left: 0;
  top: 0;
  width: 52px;
  text-align: center;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .45));
}
#goal-dist {
  display: block;
  font-size: 11px;
  font-weight: 900;
  color: var(--cream);
  text-shadow: 0 2px 3px rgba(0, 0, 0, .8);
  margin-top: -6px;
}

.controls-tip {
  position: absolute;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  font-size: 11.5px;
  font-weight: 700;
  color: rgba(253, 246, 230, .82);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
  white-space: nowrap;
}

/* ------------------------------------------------------------ touch stick */

#touch-stick {
  position: absolute;
  width: 116px;
  height: 116px;
  margin: -58px 0 0 -58px;
  border-radius: 50%;
  border: 3px solid rgba(253, 246, 230, .6);
  background: rgba(253, 246, 230, .16);
  display: none;
  z-index: 15;
  pointer-events: none;
}
#touch-nub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 50px;
  height: 50px;
  margin: -25px 0 0 -25px;
  border-radius: 50%;
  background: rgba(253, 246, 230, .8);
  border: 3px solid var(--ink);
}

/* ----------------------------------------------------------------- loader */

#loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #5aa8e0, #a8d47a);
  z-index: 40;
}
.loader-inner { text-align: center; }
.loader-sheep { font-size: 62px; animation: hop .7s ease-in-out infinite; }
@keyframes hop {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-16px) rotate(3deg); }
}
#loader-text { font-weight: 800; color: var(--ink); margin: 10px 0 14px; font-size: 16px; }
.loader-track {
  width: 240px;
  height: 16px;
  background: rgba(61, 45, 31, .22);
  border: 3px solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
}
#loader-bar { display: block; height: 100%; width: 5%; background: linear-gradient(90deg, var(--sun), #ffe9a8); transition: width .3s; }

#fatal { position: absolute; inset: 0; display: grid; place-items: center; background: #16202c; z-index: 50; padding: 20px; }
.fatal-card { background: var(--cream); border: var(--panel-border); border-radius: 20px; padding: 24px; max-width: 460px; }
.fatal-card pre { background: #efe3c9; padding: 10px; border-radius: 8px; font-size: 12px; overflow: auto; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 860px) {
  .breed-layout { grid-template-columns: 1fr; }
  .preview-box { max-width: 240px; margin: 0 auto; position: static; }
  .controls-tip { display: none; }
  #minimap { width: 108px; height: 108px; }
  .game-title { font-size: 56px; }
  .screen h2 { font-size: 27px; }
  .hud-bars { min-width: 138px; padding: 8px 10px; }
}

@media (max-width: 560px) {
  .hud-top { font-size: 13px; }
  .counter { font-size: 16px; }
  .counter b { font-size: 19px; }
  .level-name { display: none; }
  .alert { font-size: 18px; padding: 10px 20px; }
}
