/* Arctic Companion – yötaivas ja revontulten vihreä–turkoosi–violetti hehku.
   Tumma teema on tietoinen valinta: sovellusta käytetään pimeässä ulkona. */
:root {
  --sky: #070d14;            /* yötaivas, sivun pohja */
  --sky-2: #0d1823;
  --glass: rgba(18, 30, 42, 0.72);
  --glass-2: rgba(28, 44, 58, 0.78);
  --line: rgba(140, 200, 190, 0.14);
  --text: #e9f3f2;
  --muted: #93a9b0;
  --aurora-1: #47e3a1;       /* vihreä, revontulten yleisin väri */
  --aurora-2: #2cc6d6;       /* turkoosi */
  --aurora-3: #9b7cf2;       /* violetti yläreuna */
  --accent-ink: #04150f;
  --warn: #f0c35b;
  --danger: #ef6b6b;
  --lvl-low: #4c6170;
  --lvl-possible: #e3c35a;
  --lvl-good: #47e3a1;
  --lvl-excellent: #8ff5d2;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--sky); }
body { margin: 0; color: var(--text); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; background: var(--sky); min-height: 100vh; }

/* Revontulikerros taustalla: kolme pehmeää valovyötä, hidas liike */
body::before {
  content: ""; position: fixed; inset: -20% -10% auto -10%; height: 70vh; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 45% at 25% 30%, rgba(71, 227, 161, 0.36), transparent 70%),
    radial-gradient(50% 40% at 70% 20%, rgba(44, 198, 214, 0.26), transparent 70%),
    radial-gradient(45% 35% at 55% 5%, rgba(155, 124, 242, 0.28), transparent 70%);
  filter: blur(18px);
  animation: aurora-drift 40s ease-in-out infinite alternate;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, var(--sky) 65%);
}
@keyframes aurora-drift {
  0% { transform: translate3d(-3%, 0, 0) scaleY(1); opacity: .85; }
  50% { transform: translate3d(3%, 2%, 0) scaleY(1.08); opacity: 1; }
  100% { transform: translate3d(-1%, -1%, 0) scaleY(0.96); opacity: .8; }
}

.app { max-width: 560px; margin: 0 auto; padding: 0 16px calc(92px + env(safe-area-inset-bottom)); }

h1 { font-size: 26px; line-height: 1.15; margin: 0; letter-spacing: -0.015em; text-wrap: balance; }
h2 { font-size: 17px; margin: 0 0 10px; text-wrap: balance; }
h3 { font-size: 16px; margin: 0; }
p { margin: 6px 0; }
a { color: var(--aurora-1); }

.card { background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
.ok { color: var(--aurora-1); }
.center { text-align: center; }
.pad { padding: 8px 0; }
.strong { font-weight: 600; }
.row { display: flex; align-items: center; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.row.gap { gap: 10px; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 2px 8px; font-weight: 600; }

/* Painikkeet */
.btn { appearance: none; border: 1px solid var(--line); background: var(--glass-2); color: var(--text); border-radius: 12px; padding: 10px 14px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.primary { background: linear-gradient(120deg, var(--aurora-1), var(--aurora-2)); color: var(--accent-ink); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.icon-btn { appearance: none; border: 1px solid var(--line); background: var(--glass); color: var(--text); border-radius: 12px; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn.spin .icon { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn:focus-visible, .seg:focus-visible, .input:focus-visible, .bottom-nav a:focus-visible, .tile:focus-visible, .link-row:focus-visible, .icon-btn:focus-visible, .quick-btn:focus-visible, .back:focus-visible, .aurora-hero:focus-visible, summary:focus-visible { outline: 2px solid var(--aurora-1); outline-offset: 2px; }

.input { flex: 1; min-width: 0; background: rgba(4, 10, 16, 0.6); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 10px 12px; font: inherit; min-height: 44px; width: 100%; }
select.input { margin: 6px 0 4px; }

.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.sm { width: 16px; height: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--line); color: var(--muted); margin-left: 6px; }
.chips .chip { margin-left: 0; }
.chip.ok { color: var(--aurora-1); border-color: rgba(71,227,161,.4); }

/* ---------- Etusivu ---------- */
.home-head { padding: calc(18px + env(safe-area-inset-top)) 0 4px; }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1;
  background: linear-gradient(100deg, var(--aurora-1) 0%, var(--aurora-2) 45%, var(--aurora-3) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-place { font-size: 13px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.greet { color: var(--muted); margin: 8px 0 10px; }
.quick { display: inline-flex; background: var(--glass); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.quick-btn { appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; padding: 6px 14px; border-radius: 999px; cursor: pointer; min-height: 36px; }
.quick-btn.on { background: var(--glass-2); color: var(--text); box-shadow: inset 0 0 0 1px rgba(71,227,161,.35); }

.aurora-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; text-decoration: none; color: var(--text); padding: 20px; position: relative; overflow: hidden; }
.aurora-hero::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: radial-gradient(80% 120% at 0% 0%, rgba(71,227,161,.18), transparent 60%), radial-gradient(60% 100% at 100% 0%, rgba(155,124,242,.16), transparent 60%); }
.aurora-hero > * { position: relative; }
.aurora-hero.lvl-excellent, .aurora-hero.lvl-good { border-color: rgba(71,227,161,.5); box-shadow: 0 0 40px rgba(71,227,161,.15); }
.hero-score { display: flex; align-items: baseline; }
.hero-num { font-size: 56px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-of { color: var(--muted); font-size: 15px; margin-left: 2px; }
.lvl-good .hero-num, .lvl-excellent .hero-num { color: var(--lvl-good); }
.lvl-possible .hero-num { color: var(--lvl-possible); }
.hero-text { min-width: 0; overflow-wrap: anywhere; }
.hero-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; color: var(--aurora-1); font-weight: 600; font-size: 14px; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--text); background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-height: 128px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: border-color .2s, transform .2s; }
.tile:hover { border-color: rgba(71,227,161,.45); transform: translateY(-1px); }
.tile-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tile-icon { color: var(--aurora-2); width: 26px; height: 26px; }
.chev { color: var(--muted); width: 18px; height: 18px; }
.tile-title { font-size: 13px; color: var(--muted); }
.tile-value { font-size: 19px; font-weight: 700; line-height: 1.2; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
.tile-sub { font-size: 12px; color: var(--muted); }
.tile.lvl-good .tile-value, .tile.lvl-excellent .tile-value { color: var(--lvl-good); }
.tile.lvl-possible .tile-value { color: var(--lvl-possible); }

.access-ok { display: flex; align-items: center; gap: 6px; color: var(--aurora-1); font-size: 14px; margin: 14px 2px; }
.locked-compact { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); border-style: dashed; }
.locked-compact > div { flex: 1; min-width: 0; }
.tip p { margin-top: 4px; }
.links { padding: 4px 0; }
.link-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--line); }
.link-row:last-child { border-bottom: 0; }
.link-icon { color: var(--aurora-2); }
.link-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.emergency { display: flex; align-items: center; gap: 12px; }
.emergency > div { flex: 1; min-width: 0; }
.emergency .icon { color: var(--danger); }

/* ---------- Alasivun otsikko ---------- */
.page-head { padding: calc(10px + env(safe-area-inset-top)) 0 6px; }
.back { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: 15px; padding: 8px 8px 8px 0; min-height: 44px; }
.back:hover { color: var(--text); }
.page-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-sub { color: var(--muted); font-size: 13px; margin: 4px 0 0; min-height: 1em; }

/* Lataus- ja virhetilat */
.skeleton-wrap { display: grid; gap: 12px; margin: 12px 0; }
.skeleton { height: 64px; border-radius: var(--radius); background: linear-gradient(90deg, var(--glass) 0%, var(--glass-2) 50%, var(--glass) 100%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
.skeleton.s1 { height: 96px; } .skeleton.s2 { height: 48px; }
.aurora-hero .skeleton-wrap { grid-column: 1 / -1; margin: 0; }
.tiles .skeleton-wrap { grid-column: 1 / -1; grid-template-columns: repeat(2, 1fr); margin: 0; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.card.error { border-color: rgba(239,107,107,.5); }

/* ---------- Revontulisivu ---------- */
.hero { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; align-items: center; }
.hero > div:last-child { min-width: 0; overflow-wrap: anywhere; }
.hero.lvl-excellent, .hero.lvl-good { border-color: rgba(71,227,161,.5); box-shadow: 0 0 36px rgba(71,227,161,.14); }
.gauge { width: 112px; height: 112px; display: block; }
.g-track { fill: none; stroke: var(--glass-2); stroke-width: 12; }
.g-val { fill: none; stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.g-num { fill: var(--text); font-size: 30px; font-weight: 700; }
.lvl-low .g-val { stroke: var(--lvl-low); }
.lvl-possible .g-val { stroke: var(--lvl-possible); }
.lvl-good .g-val { stroke: var(--lvl-good); }
.lvl-excellent .g-val { stroke: var(--lvl-excellent); }
.level { font-size: 20px; font-weight: 700; line-height: 1.2; }
.hero.lvl-good .level, .hero.lvl-excellent .level, .aurora-hero.lvl-good .level, .aurora-hero.lvl-excellent .level { color: var(--lvl-good); }
.hero.lvl-possible .level, .aurora-hero.lvl-possible .level { color: var(--lvl-possible); }
.action { margin: 4px 0 0; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.cell-val { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }

.plan { display: flex; gap: 4px; align-items: flex-end; height: 120px; margin-top: 10px; }
.plan-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.plan-bar-box { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.plan-bar { width: 100%; border-radius: 4px 4px 0 0; background: var(--lvl-low); }
.plan-bar.lvl-possible { background: var(--lvl-possible); }
.plan-bar.lvl-good { background: linear-gradient(180deg, var(--aurora-1), var(--aurora-2)); }
.plan-bar.lvl-excellent { background: linear-gradient(180deg, var(--lvl-excellent), var(--aurora-1)); }
.plan-col.best .plan-lbl { color: var(--aurora-1); font-weight: 700; }
.plan-lbl { font-size: 11px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

.help details { border-top: 1px solid var(--line); padding: 4px 0; }
.help details:first-child { border-top: 0; }
.help summary { cursor: pointer; font-weight: 600; padding: 8px 0; list-style-position: inside; }

/* ---------- Sää ---------- */
.hero-wx .big { font-size: 44px; font-weight: 700; margin: 4px 0; font-variant-numeric: tabular-nums; }
.hours { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.hour { min-width: 52px; text-align: center; background: var(--glass-2); border-radius: 10px; padding: 8px 4px; font-variant-numeric: tabular-nums; }
.segs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 12px; }
.seg { appearance: none; border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 14px; cursor: pointer; min-height: 40px; }
.seg.on { background: linear-gradient(120deg, var(--aurora-1), var(--aurora-2)); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.list { margin: 8px 0; padding-left: 20px; }
.list li { margin: 4px 0; }

/* ---------- Reitti ---------- */
.trail-map { width: 100%; height: auto; background: rgba(4,10,16,.6); border-radius: 12px; margin: 10px 0; }
.tm-line { fill: none; stroke: rgba(44,198,214,.4); stroke-width: 3; stroke-dasharray: 6 5; }
.tm-pt { fill: var(--sky-2); stroke: var(--muted); stroke-width: 2; }
.tm-pt.heard { fill: var(--aurora-1); stroke: var(--aurora-1); }
.tm-num { fill: var(--text); font-size: 11px; font-weight: 700; }
.tm-me { fill: #58a6ff; stroke: #fff; stroke-width: 2; }
.tm-n { fill: var(--muted); font-size: 11px; }
.story { border-color: rgba(71,227,161,.5); }
.next { display: flex; gap: 14px; align-items: center; margin-top: 6px; }
.arrow { font-size: 34px; color: var(--aurora-1); display: inline-block; width: 40px; text-align: center; transition: transform .4s; }
.stories { padding-left: 22px; margin: 8px 0 0; }
.stories li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }

/* ---------- Lukittu ---------- */
.locked { border-style: dashed; border-color: rgba(71,227,161,.35); }
.locked-head { display: flex; align-items: center; gap: 8px; }
.locked-head h2 { margin: 0; }
.perks { margin: 8px 0; padding-left: 20px; color: var(--text); }
.perks li { margin: 3px 0; }

/* ---------- Alanavi ---------- */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: rgba(7,13,20,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.bottom-nav a { flex: 1; max-width: 112px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 10px; color: var(--muted); text-decoration: none; font-size: 11px; position: relative; }
.bottom-nav a.active { color: var(--aurora-1); }
.bottom-nav a.active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--aurora-1), var(--aurora-2)); }

@media (max-width: 360px) {
  .hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .chips { justify-content: center; }
  .brand-name { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
