/* Unni Hop Journey — local, offline styling. No external fonts, URLs or assets. */
:root {
  --sky1: #fff1f7;
  --sky2: #e7f7ff;
  --ink: #5b4550;
  --ink-soft: #7d6c78;
  --accent: #ff9bb4;
  --accentDeep: #e77498;
  --cream: #fffaf3;
  --line: #f0d9e5;
  --shadow: 0 10px 24px rgba(90, 70, 80, 0.13);
  --radius: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--sky1) 0%, var(--sky2) 70%, #f5fbe9 100%);
  min-height: 100vh;
}
.sky { max-width: 960px; margin: 0 auto; padding: 18px 18px 30px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }

.topbar {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between;
  background: rgba(255, 255, 255, 0.78); border: 2px solid #fff; border-radius: var(--radius);
  padding: 14px 18px; box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { width: 50px; height: 50px; flex: none; display: block; }
.brand-icon svg { width: 100%; height: 100%; }
.brand h1 { margin: 0; font-size: clamp(1.15rem, 3vw, 1.6rem); letter-spacing: 0.3px; }
.brand p { margin: 2px 0 0; color: var(--ink-soft); font-size: 0.86rem; }
.top-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.pill, .level-card, .upgrade, .touch-btn, .close {
  font: inherit; color: var(--ink); cursor: pointer;
  border: 2px solid var(--line); background: var(--cream);
  border-radius: 999px; padding: 8px 15px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.pill:hover, .level-card:hover:not(:disabled), .upgrade:hover:not(:disabled), .touch-btn:hover {
  transform: translateY(-2px); box-shadow: 0 6px 14px rgba(90, 70, 80, 0.16);
}
.pill:active, .level-card:active, .touch-btn:active { transform: translateY(0); }
.pill.round { width: 40px; height: 40px; padding: 0; font-weight: 800; }
.pill.primary { background: var(--accent); border-color: var(--accentDeep); color: #4a2735; font-weight: 700; }
:focus-visible { outline: 3px solid #7b5cff; outline-offset: 2px; }

.view { margin-top: 18px; }
.intro h2 { margin: 0 0 6px; font-size: 1.5rem; }
.intro p, .message { margin: 0 0 14px; color: var(--ink-soft); }
.soft { color: var(--ink-soft); font-size: 0.86rem; }
.center { text-align: center; }
kbd { background: #fff; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; font-size: 0.82em; }

.hub-panel {
  background: rgba(255, 255, 255, 0.72); border: 2px solid #fff; border-radius: 18px;
  padding: 14px 18px; box-shadow: var(--shadow);
}
.hub-head { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; justify-content: space-between; }
.hub-head h3 { margin: 0; }
.hub-head p { margin: 0; color: var(--ink-soft); font-size: 0.9rem; }
.hub-head strong { color: var(--accentDeep); font-size: 1.2rem; }
.hub-upgrades { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: 12px; }
.upgrade { border-radius: 14px; text-align: left; display: grid; gap: 3px; padding: 10px 13px; min-height: 76px; }
.upgrade span { font-size: 0.8rem; color: var(--ink-soft); }
.upgrade-cost { font-weight: 700; color: var(--accentDeep) !important; }
.upgrade:disabled { opacity: 0.55; cursor: not-allowed; }

.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin: 16px 0; }
.level-card {
  border-radius: 18px; padding: 14px; text-align: left; display: grid; gap: 4px;
  background: linear-gradient(150deg, #fff, var(--cream)); min-height: 112px;
}
.level-card .level-num { font-size: 1.35rem; font-weight: 800; color: var(--accentDeep); }
.level-card strong { font-size: 1rem; }
.level-goal { font-size: 0.8rem; color: var(--ink-soft); }
.level-stars { color: #e9a23b; letter-spacing: 2px; font-size: 1.05rem; }
.level-card.daily { background: linear-gradient(150deg, #f0eaff, #eaf6ff); border-color: #d9cdf5; }
.level-card.locked { opacity: 0.5; cursor: not-allowed; }

.hud {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px;
  background: rgba(255, 255, 255, 0.8); border: 2px solid #fff; border-radius: 18px;
  padding: 12px 16px; box-shadow: var(--shadow);
}
.hud-cell { display: grid; gap: 2px; }
.hud-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-soft); }
.hud-cell strong { font-size: 1rem; }
.goal-cell { grid-column: span 2; }
.bar { height: 8px; background: #f3e4ee; border-radius: 99px; overflow: hidden; margin-top: 4px; }
.bar > div { height: 100%; width: 0%; background: linear-gradient(90deg, #b9e8ce, var(--accent)); transition: width 0.2s ease; }

.stage-wrap { display: flex; justify-content: center; margin: 16px 0 10px; }
#stage {
  display: block; width: min(100%, 800px); height: auto; aspect-ratio: 2 / 1;
  border-radius: 22px; border: 4px solid #fff; box-shadow: var(--shadow);
  background: var(--sky2); image-rendering: auto;
}
.touch-pad { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 0 0 12px; }
.touch-btn { min-width: 70px; min-height: 52px; font-weight: 800; border-radius: 16px; touch-action: none; user-select: none; }
.touch-btn.jump { background: #fff0d8; border-color: #e9c98f; }
.touch-btn.ability { background: #eef0ff; border-color: #cdd3f5; }
.touch-btn.held { transform: translateY(2px); box-shadow: inset 0 3px 8px rgba(90, 70, 80, 0.2); background: var(--accent); }

.game-foot { background: rgba(255, 255, 255, 0.62); border-radius: 18px; padding: 14px 18px; }
.row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 10px 0; }
.footer { text-align: center; color: var(--ink-soft); font-size: 0.8rem; margin-top: 24px; }

.gate-card {
  max-width: 560px; margin: 30px auto; padding: 26px; text-align: center;
  background: var(--cream); border: 3px solid #fff; border-radius: 24px; box-shadow: var(--shadow);
}
.gate-card h2 { margin-top: 0; }
.gate-card p { line-height: 1.55; }
.gate-card .dialog-actions { justify-content: center; }

.overlay {
  position: fixed; inset: 0; z-index: 10; background: rgba(75, 58, 68, 0.38);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.dialog {
  position: relative; width: min(100%, 540px); max-height: 88vh; overflow: auto;
  background: var(--cream); border: 3px solid #fff; border-radius: 24px;
  padding: 24px; box-shadow: 0 24px 60px rgba(75, 58, 68, 0.28);
}
.dialog h2 { margin: 0 0 12px; }
.dialog p, .dialog ul { line-height: 1.6; }
.dialog ul { padding-left: 20px; }
.close { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; padding: 0; line-height: 1; font-size: 1.4rem; }
.dialog-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.stars-big { font-size: 2.4rem; color: #e9a23b; text-align: center; margin: 4px 0 10px; letter-spacing: 6px; }
.toggle { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-size: 1rem; }
.toggle input { width: 20px; height: 20px; accent-color: var(--accentDeep); }

body.high-contrast { --ink: #241820; --ink-soft: #4b3a44; --line: #8a6478; --cream: #fff; }
body.high-contrast .soft, body.high-contrast .intro p, body.high-contrast .message { color: #4b3a44; }
body.high-contrast .pill, body.high-contrast .touch-btn { border-width: 3px; }
body.reduced-motion *, body.reduced-motion *::before, body.reduced-motion *::after {
  animation: none !important; transition: none !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 620px) {
  .sky { padding: 10px; }
  .topbar { padding: 10px 12px; }
  .brand p { display: none; }
  .goal-cell { grid-column: span 2; }
  .touch-btn { min-width: 64px; }
}
