/* Kota Lapis — tokens first (see DESIGN.md), then layout, then components. */
:root {
  --font-display: 'Bricolage Grotesque', 'IBM Plex Sans', system-ui, sans-serif;
  --font-text: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --surface: rgba(255, 255, 255, 0.9);
  --surface-solid: #FFFFFF;
  --ink: #1B1A17;
  --muted: #5A564F;
  --line: rgba(27, 26, 23, 0.12);
  --track: rgba(27, 26, 23, 0.07);
  --primary: #1B1A17;
  --on-primary: #FFFFFF;
  --accent: #C8352B;
  --good: #2F7A45;
  --bad: #A3261C;
  --shadow: 0 10px 30px rgba(20, 18, 14, 0.12), 0 1px 2px rgba(20, 18, 14, 0.08);
  --shadow-sm: 0 2px 10px rgba(20, 18, 14, 0.1);

  --r-sm: 6px; --r-md: 12px; --r-lg: 18px; --r-full: 9999px;
  --s-xs: 4px; --s-sm: 8px; --s-md: 16px; --s-lg: 24px; --s-xl: 40px; --s-2xl: 64px;

  --fs-hero: clamp(38px, 6.2vw, 76px);
  --fs-display: 30px;
  --fs-h2: 24px;
  --fs-h-sm: 19px;
  --fs-body: 15px;
  --fs-label: 13px;
  --fs-small: 12px;
  --fs-micro: 11px;

  --t-fast: 150ms;
  --t-base: 240ms;
  --hit: 38px;
  --bar-h: 56px;

  --b1: #D3C6AA; --b2: #7EA1C9; --b3: #8EB97F; --b4: #E4A955; --b5: #8F897F; --b6: #C8352B;
  --scene: #ECEAE4; --scene-in: #F6F5F1; --scene-out: #DEDCD6;
}

[data-chrome="dark"] {
  --surface-solid: var(--chrome, #151E2E);
  --surface: color-mix(in srgb, var(--surface-solid) 90%, transparent);
  --ink: #F2EEE6;
  --muted: #B2B8C4;
  --line: rgba(242, 238, 230, 0.16);
  --track: rgba(242, 238, 230, 0.09);
  --primary: #F2EEE6;
  --on-primary: #14171C;
  --accent: #F3C25B;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
}

@media (pointer: coarse) { :root { --hit: 44px; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; background: var(--scene); color: var(--ink); }
body { font: 400 var(--fs-body)/1.5 var(--font-text); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
body[data-page="studio"] { overflow: hidden; height: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-small); }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
svg { width: 18px; height: 18px; flex: none; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface-solid); padding: 8px 12px; border-radius: var(--r-sm); }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* ---------- controls ---------- */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-full); background: var(--track); }
.seg button, .seg a {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--hit); padding: 0 12px; border: 0;
  border-radius: var(--r-full); background: transparent; color: var(--muted); font-size: var(--fs-label); font-weight: 500; text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.seg button:hover { color: var(--ink); }
.seg [aria-pressed="true"], .seg [aria-selected="true"], .seg [aria-pressed="true"]:hover, .seg [aria-selected="true"]:hover { background: var(--primary); color: var(--on-primary); }
.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--hit); padding: 0 14px;
  border: 0; border-radius: var(--r-full); background: var(--track); color: var(--ink); font-size: var(--fs-label); font-weight: 500; text-decoration: none; white-space: nowrap;
}
.chip:hover { background: color-mix(in srgb, var(--ink) 12%, transparent); }
.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--hit); padding: 0 18px;
  border: 0; border-radius: var(--r-full); background: var(--primary); color: var(--on-primary);
  font-size: var(--fs-label); font-weight: 600; white-space: nowrap; text-decoration: none;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.primary:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); }
.primary:active { transform: scale(0.97); }
.primary[disabled] { opacity: 0.45; cursor: default; }
.icon-btn {
  display: inline-grid; place-items: center; width: var(--hit); height: var(--hit); padding: 0;
  border: 0; border-radius: var(--r-full); background: var(--track); color: var(--ink);
}
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20; height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(var(--s-md), env(safe-area-inset-right)) 0 max(var(--s-md), env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-md);
}
body:not([data-page="studio"]) .topbar { background: color-mix(in srgb, var(--scene) 86%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; min-height: var(--hit); }
.brand-name { font: 800 17px/1 var(--font-display); letter-spacing: -0.02em; }
.mark {
  width: 22px; height: 22px; border-radius: 5px; flex: none;
  background: linear-gradient(to top, var(--b1) 0 16.66%, var(--b2) 0 33.33%, var(--b3) 0 50%, var(--b4) 0 66.66%, var(--b5) 0 83.33%, var(--b6) 0);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: var(--hit); padding: 0 12px;
  border-radius: var(--r-full); text-decoration: none; font-size: var(--fs-label); font-weight: 600; color: var(--ink);
}
body[data-page="studio"] .nav-link, body[data-page="studio"] .lang { background: var(--surface); box-shadow: var(--shadow-sm); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.nav-link:hover { background: var(--track); }
.nav-link[aria-current="page"] { background: var(--primary); color: var(--on-primary); }
.nav-link .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); position: absolute; top: 6px; right: 6px; }
.nav-link .count:empty { display: none; }
.nav-link .count { font-size: var(--fs-micro); padding: 1px 6px; border-radius: var(--r-full); background: var(--track); }
.lang { font-weight: 600; }

/* ---------- pages ---------- */
.page { display: none; }
body[data-page="home"] .page-home, body[data-page="studio"] .page-studio, body[data-page="teka"] .page-teka,
body[data-page="resipi"] .page-resipi, body[data-page="koleksi"] .page-koleksi { display: block; }
.wrap { max-width: 980px; margin: 0 auto; padding: calc(var(--bar-h) + 40px) var(--s-lg) var(--s-2xl); }
.lead { font-size: 17px; line-height: 1.55; color: var(--muted); max-width: 60ch; margin: 10px 0 0; }
.eyebrow:has(.num:empty) { visibility: hidden; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: var(--fs-label); font-weight: 600; color: var(--muted); }
.mini-bands { display: inline-flex; flex-direction: column-reverse; width: 16px; height: 16px; border-radius: 3px; overflow: hidden; }
.mini-bands i { flex: 1; }
.mini-bands i:nth-child(1) { background: var(--b1); } .mini-bands i:nth-child(2) { background: var(--b2); } .mini-bands i:nth-child(3) { background: var(--b3); }
.mini-bands i:nth-child(4) { background: var(--b4); } .mini-bands i:nth-child(5) { background: var(--b5); } .mini-bands i:nth-child(6) { background: var(--b6); }

/* ---------- home ---------- */
.page-home { background: radial-gradient(1200px 700px at 75% 10%, var(--scene-in), var(--scene) 60%); }
.hero {
  max-width: 1200px; margin: 0 auto; padding: calc(var(--bar-h) + 48px) var(--s-lg) var(--s-xl);
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: var(--s-xl); align-items: center;
}
.hero h1 { font-size: var(--fs-hero); line-height: 0.98; font-weight: 800; letter-spacing: -0.035em; max-width: 13ch; }
.hero .lead { font-size: 18px; }
.bigsearch {
  position: relative; display: flex; align-items: center; gap: 10px; margin: 28px 0 0; padding: 6px 6px 6px 16px; max-width: 560px;
  border-radius: var(--r-full); background: var(--surface-solid); box-shadow: var(--shadow);
}
.bigsearch svg { color: var(--muted); }
.bigsearch input { flex: 1; min-width: 0; min-height: 44px; border: 0; background: none; outline: none; font-size: 16px; }
.bigsearch .primary { min-height: 44px; }
.results.floating {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 10; margin: 0; padding: 6px; list-style: none;
  border-radius: var(--r-md); background: var(--surface-solid); box-shadow: var(--shadow); max-height: 340px; overflow: auto;
}
.results.floating:empty { display: none; }
.teka-card {
  display: flex; align-items: center; gap: 14px; margin-top: 18px; padding: 12px 12px 12px 14px; max-width: 560px;
  border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-sm); text-decoration: none; border: 1px solid var(--line);
}
.teka-card b { display: block; font: 700 17px/1.2 var(--font-display); }
.teka-card small { display: block; color: var(--muted); font-size: var(--fs-label); }
.teka-card > span:nth-child(2) { flex: 1; }
.teka-card-plate { width: 48px; height: 48px; border-radius: 50%; background: conic-gradient(var(--b2) 0 25%, var(--track) 0); display: grid; place-items: center; flex: none; }
.teka-card-plate i { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-solid); }
.hero-art { margin: 0; position: relative; }
.hero-art img { width: 100%; height: auto; display: block; filter: drop-shadow(0 30px 40px rgba(30, 20, 10, 0.16)); }
.shelf-wrap { max-width: 1200px; margin: 0 auto; padding: var(--s-lg) var(--s-lg) var(--s-xl); }
.section-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2 { font-size: var(--fs-h2); }
.section-head p { margin: 0; color: var(--muted); }
.shelf { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 28px 18px; }
.shelf li a { display: block; text-decoration: none; position: relative; padding-bottom: 14px; }
.shelf li a::after {
  content: ''; position: absolute; left: -9px; right: -9px; bottom: 54px; height: 10px; border-radius: 3px;
  background: linear-gradient(#C9A47A, #A9825A); box-shadow: 0 6px 10px rgba(80, 50, 20, 0.18); z-index: 0;
}
[data-chrome="dark"] .shelf li a::after { background: linear-gradient(#4A3A2A, #2E2218); }
.shelf img { position: relative; z-index: 1; display: block; width: 100%; aspect-ratio: 1; object-fit: contain; transition: transform var(--t-base); }
.shelf li a:hover img { transform: translateY(-6px) rotate(-1.5deg); }
.shelf .shelf-name { display: block; margin-top: 18px; font: 700 16px/1.2 var(--font-display); }
.shelf .shelf-meta { display: block; font-size: var(--fs-small); color: var(--muted); }
.foot { max-width: 1200px; margin: 0 auto; padding: var(--s-lg) var(--s-lg) var(--s-2xl); color: var(--muted); border-top: 1px solid var(--line); }
.foot p { max-width: 80ch; }

/* ---------- studio ---------- */
.page-studio { position: fixed; inset: 0; background: radial-gradient(120% 90% at 50% 38%, var(--scene-in), var(--scene) 55%, var(--scene-out)); }
.stage { position: absolute; inset: 0; }
.stage-scene { touch-action: none; }
body[data-mode="kek"] .stage-map { visibility: hidden; }
body[data-mode="peta"] .stage-scene, body[data-mode="peta"] .legend { visibility: hidden; }
.scene-canvas { display: block; }
.scene-labels { position: absolute; inset: 0; pointer-events: none; }
.studio-top {
  position: absolute; z-index: 6; top: calc(var(--bar-h) + env(safe-area-inset-top) + 2px); left: max(var(--s-md), env(safe-area-inset-left));
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: min(460px, calc(100vw - 32px));
}
.city {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; max-width: 100%;
  border: 0; border-radius: var(--r-md); padding: 10px 14px; background: var(--surface); box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.city-name { font: 800 var(--fs-display)/1.04 var(--font-display); letter-spacing: -0.025em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.city-meta { display: flex; align-items: center; gap: 6px; font-size: var(--fs-small); color: var(--muted); }
.city-meta .chev { width: 15px; height: 15px; margin-left: 2px; }
.flavour {
  display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 12px 0 8px; border: 0; border-radius: var(--r-full);
  background: var(--surface); box-shadow: var(--shadow-sm); font-weight: 600; font-size: var(--fs-label);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.flavour-dot { width: 20px; height: 20px; border-radius: 50%; background: conic-gradient(var(--b6) 0 17%, var(--b5) 0 33%, var(--b4) 0 50%, var(--b3) 0 67%, var(--b2) 0 83%, var(--b1) 0); }
.friend { margin: 0; padding: 8px 12px; border-radius: var(--r-md); background: var(--primary); color: var(--on-primary); font-size: var(--fs-label); font-weight: 600; }
.friend a { color: inherit; text-underline-offset: 3px; }

.legend {
  position: absolute; z-index: 5; right: max(var(--s-md), env(safe-area-inset-right)); top: 50%; transform: translateY(-50%);
  width: 214px; padding: 12px 8px 8px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.legend h2 { margin: 0 8px 6px; font: 600 var(--fs-small)/1.2 var(--font-text); color: var(--muted); letter-spacing: 0.02em; }
.legend ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column-reverse; gap: 1px; }
.layer-row { display: flex; align-items: center; border-radius: var(--r-md); }
.layer-row:hover, .layer-row.is-hover { background: var(--track); }
.layer-open { flex: 1; min-width: 0; display: grid; grid-template-columns: 26px 1fr; align-items: center; column-gap: 10px; min-height: var(--hit); padding: 3px 6px; border: 0; background: none; text-align: left; border-radius: var(--r-md); }
.layer-band { width: 26px; height: 24px; border-radius: 4px; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.12), inset 0 0 0 1px rgba(0, 0, 0, 0.08); }
.layer-name { font-size: var(--fs-label); font-weight: 600; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-en { display: block; font-size: var(--fs-micro); font-weight: 400; color: var(--muted); }
.layer-eye { width: var(--hit); height: var(--hit); display: grid; place-items: center; border: 0; background: none; color: var(--muted); border-radius: var(--r-full); }
.layer-eye:hover { color: var(--ink); }
.layer-row.is-off .layer-open { opacity: 0.42; }
.relief-note { margin: 6px 8px 2px; font-size: var(--fs-micro); color: var(--muted); }
.relief-note:empty { display: none; }

.dock {
  position: absolute; z-index: 6; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: var(--r-full); background: var(--surface); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); max-width: calc(100vw - 16px);
}
.dock .seg.views button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.dock .seg.shapes button { padding: 0 9px; }
.dock .seg.shapes svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.dock-tools { display: flex; align-items: center; gap: 4px; }
.tool {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--hit); padding: 0 12px; border: 0; border-radius: var(--r-full);
  background: transparent; color: var(--ink); font-size: var(--fs-label); font-weight: 500; white-space: nowrap;
}
.tool:hover { background: var(--track); }
.tool[aria-pressed="true"], .tool[aria-pressed="true"]:hover { background: var(--primary); color: var(--on-primary); }
.tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.tool.icon-only { width: var(--hit); padding: 0; justify-content: center; }
#soundBtn[aria-pressed="false"] .wave { opacity: 0.15; }
.theme-dot { width: 20px; height: 20px; border-radius: 50%; flex: none; background: conic-gradient(from 200deg, var(--sw-a) 0 50%, var(--sw-b) 0 75%, var(--sw-c) 0); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18); }
.share-btn { min-height: calc(var(--hit) + 4px); padding: 0 20px; background: var(--accent); color: #fff; }
[data-chrome="dark"] .share-btn { color: #1B1300; }
.share-btn svg, .slice-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; }
body[data-mode="kek"] .slice-btn { display: none; }
body[data-mode="peta"] .views, body[data-mode="peta"] .shapes, body[data-mode="peta"] #lidiBtn, body[data-mode="peta"] #spinBtn,
body[data-mode="peta"] .share-btn, body[data-mode="peta"] .save-pop { display: none; }
.pop-wrap { position: relative; }
.popover {
  position: absolute; bottom: calc(100% + 12px); right: 0; z-index: 30; padding: 6px; border-radius: var(--r-md);
  background: var(--surface-solid); box-shadow: var(--shadow); min-width: 240px;
}
.menu { display: flex; flex-direction: column; }
.menu button { min-height: var(--hit); padding: 8px 12px; border: 0; background: none; text-align: left; border-radius: var(--r-sm); font-size: var(--fs-label); }
.menu button:hover, .menu button:focus-visible { background: var(--track); }
.theme-menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; width: 300px; left: 50%; right: auto; transform: translateX(-50%); }
.swatch { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px; border: 0; border-radius: var(--r-sm); background: none; text-align: left; font-size: var(--fs-label); font-weight: 500; }
.swatch:hover { background: var(--track); }
.swatch[aria-pressed="true"] { background: var(--track); box-shadow: inset 0 0 0 2px var(--ink); }
.swatch .sw { width: 26px; height: 26px; border-radius: 50%; flex: none; background: conic-gradient(from 200deg, var(--sw-a) 0 50%, var(--sw-b) 0 75%, var(--sw-c) 0); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); }
.swatch small { display: block; color: var(--muted); font-size: var(--fs-micro); }

.hint {
  position: absolute; z-index: 7; left: 50%; top: calc(var(--bar-h) + 90px); transform: translateX(-50%);
  padding: 10px 16px; border-radius: var(--r-full); background: var(--primary); color: var(--on-primary); font-weight: 600; font-size: var(--fs-label);
  box-shadow: var(--shadow); white-space: nowrap;
}
.probe {
  position: fixed; z-index: 8; pointer-events: none; padding: 6px 10px; border-radius: var(--r-sm);
  background: var(--primary); color: var(--on-primary); font-size: var(--fs-small); font-weight: 600; white-space: nowrap;
  transform: translate(14px, 14px); box-shadow: var(--shadow-sm);
}
.probe i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin: 0 3px 0 6px; }
.draw-layer { position: absolute; inset: 0; z-index: 4; touch-action: none; cursor: crosshair; }
.draw-layer svg { width: 100%; height: 100%; }
.draw-layer line { stroke: var(--accent); stroke-width: 3; stroke-dasharray: 8 6; stroke-linecap: round; }

.profile {
  position: absolute; z-index: 6; left: max(var(--s-md), env(safe-area-inset-left)); bottom: calc(96px + env(safe-area-inset-bottom));
  width: min(420px, calc(100vw - 32px)); padding: 12px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.profile-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.profile h3 { font-size: 16px; }
.profile canvas { width: 100%; height: auto; display: block; border-radius: var(--r-sm); }
.profile-meta { margin: 6px 0 0; font-size: var(--fs-small); color: var(--muted); }
.credit {
  position: absolute; z-index: 5; right: var(--s-sm); bottom: max(4px, env(safe-area-inset-bottom)); margin: 0; padding: 1px 8px;
  border-radius: var(--r-full); font-size: var(--fs-micro); color: var(--muted); background: var(--surface);
}

/* 3D labels */
.tag {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px 0 4px; margin-left: 6px;
  border: 0; border-radius: var(--r-full); background: var(--surface); color: var(--ink);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12); font-size: var(--fs-small); font-weight: 600; white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}
.tag-band { width: 8px; height: 20px; border-radius: 3px; flex: none; }
.tag-no { font-variant-numeric: tabular-nums; color: var(--muted); font-size: var(--fs-micro); }
.tag.is-hover { background: var(--primary); color: var(--on-primary); }
.tag.is-hover .tag-no { color: inherit; opacity: 0.7; }

/* ---------- overlays ---------- */
.progress { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; pointer-events: none; }
.progress-card { display: flex; align-items: center; gap: var(--s-md); padding: 16px 22px 16px 18px; border-radius: var(--r-lg); background: var(--surface-solid); box-shadow: var(--shadow); min-width: 300px; max-width: calc(100vw - 32px); }
.cake { display: flex; flex-direction: column-reverse; width: 46px; height: 52px; border-radius: 6px 6px 4px 4px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); flex: none; }
.cake i { flex: 1; background: var(--band); transform: translateY(-140%); opacity: 0; transition: transform 360ms cubic-bezier(.3, 1.5, .5, 1), opacity 200ms; }
.cake i.is-done { transform: none; opacity: 1; }
.cake i.is-now { transform: none; opacity: 0.45; animation: pulse 800ms ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: 0.2; } }
.progress-title { margin: 0; font: 700 var(--fs-h-sm)/1.15 var(--font-display); }
.progress-step { margin: 4px 0 0; font-size: var(--fs-label); color: var(--muted); }
.notice { position: fixed; z-index: 45; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(380px, calc(100vw - 32px)); padding: 20px; border-radius: var(--r-lg); background: var(--surface-solid); box-shadow: var(--shadow); text-align: center; }
.notice p { margin: 0 0 12px; }
.toast {
  position: fixed; z-index: 50; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  padding: 10px 16px; border-radius: var(--r-full); background: var(--primary); color: var(--on-primary); font-weight: 600; font-size: var(--fs-label);
  box-shadow: var(--shadow); max-width: calc(100vw - 32px); text-align: center;
}

.sheet {
  width: min(560px, calc(100vw - 24px)); max-height: min(760px, calc(100dvh - 40px)); padding: 0;
  border: 0; border-radius: var(--r-lg); background: var(--surface-solid); color: var(--ink); box-shadow: var(--shadow); overflow: auto;
}
.sheet[open] { display: flex; flex-direction: column; }
.sheet::backdrop { background: rgba(10, 10, 10, 0.4); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 16px 8px 20px; }
.sheet-head h2 { font-size: 21px; }
.search { display: flex; align-items: center; gap: 8px; margin: 0 16px; padding: 4px 4px 4px 14px; border-radius: var(--r-full); background: var(--track); }
.search svg { color: var(--muted); }
.search input { flex: 1; min-width: 0; min-height: 44px; border: 0; background: none; outline: none; font-size: 16px; }
.search-state { margin: 8px 20px 0; font-size: var(--fs-label); color: var(--muted); }
.search-state:empty { display: none; }
.results, .cities { list-style: none; margin: 0; padding: 6px 8px 8px; }
.results:empty { display: none; }
.results li button, .cities li button {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px;
  padding: 8px 12px; border: 0; background: none; text-align: left; border-radius: var(--r-md);
}
.results li button:hover, .cities li button:hover, .results li button:focus-visible, .cities li button:focus-visible, .results li[aria-selected="true"] button { background: var(--track); }
.place-name { font-weight: 600; }
.place-kind { font-size: var(--fs-micro); padding: 1px 6px; border-radius: var(--r-full); background: var(--track); color: var(--muted); margin-left: 6px; font-weight: 500; }
.place-state { font-size: var(--fs-small); color: var(--muted); text-align: right; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-sub { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px 0 20px; border-top: 1px solid var(--line); margin-top: 6px; }
.sheet-sub h3 { font: 600 var(--fs-small)/1 var(--font-text); color: var(--muted); }
.cities { display: grid; grid-template-columns: 1fr 1fr; }
.cities li button { flex-direction: column; align-items: flex-start; gap: 0; }
.cities .place-state { text-align: left; max-width: 100%; }

.share-sheet { width: min(620px, calc(100vw - 24px)); }
.share-tabs { margin: 0 16px; align-self: flex-start; }
.occasions { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 16px 0; }
.occasions .chip[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.share-preview { margin: 14px 16px 0; display: grid; place-items: center; min-height: 220px; border-radius: var(--r-md); background: var(--track); overflow: hidden; }
.share-preview img, .share-preview video { display: block; max-width: 100%; max-height: min(52vh, 460px); border-radius: var(--r-sm); box-shadow: var(--shadow-sm); }
.share-status { margin: 10px 20px 0; font-size: var(--fs-label); color: var(--muted); min-height: 1.2em; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 18px; }
.wa { background: #25D366; color: #0B2B17; }
.wa:hover { background: #1FBE5A; }
.recipe-flavour { margin: 0 20px; font: 700 18px/1.25 var(--font-display); }
.recipe { list-style: none; margin: 10px 0 0; padding: 0 20px; display: grid; gap: 10px; }
.recipe li { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 10px; font-size: var(--fs-label); }
.recipe .bar { height: 12px; border-radius: var(--r-full); background: var(--track); overflow: hidden; }
.recipe .bar i { display: block; height: 100%; border-radius: inherit; background: var(--c); }
.recipe .val { font-weight: 600; font-variant-numeric: tabular-nums; }
.recipe .rank { grid-column: 2 / 4; margin-top: -8px; font-size: var(--fs-micro); color: var(--muted); }
.field { display: grid; gap: 6px; margin: 0 20px; font-size: var(--fs-label); font-weight: 600; }
.field input { min-height: 46px; padding: 0 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-solid); font-size: 16px; }
.toggle { display: flex; align-items: center; gap: 10px; margin: 14px 20px 0; font-size: var(--fs-label); font-weight: 600; min-height: 32px; }
.toggle input { width: 20px; height: 20px; accent-color: var(--accent); }
.lidi-sheet .muted { margin: 4px 20px 0; }

.focus { position: fixed; inset: 0; z-index: 35; display: flex; flex-direction: column; background: var(--scene); }
.focus-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 16px 12px; }
.focus-bar h2 { font-size: 22px; }
.focus-bar h2 .num { color: var(--muted); margin-right: 4px; }
.focus-en { font: 400 var(--fs-label) var(--font-text); color: var(--muted); margin-left: 6px; }
.focus-actions { display: flex; gap: 6px; }
.focus-stage { flex: 1; display: grid; place-items: center; padding: 8px 16px 32px; min-height: 0; }
.focus-stage img { max-width: 100%; max-height: 100%; width: min(82vh, 92vw); aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.18)); }

/* ---------- teka ---------- */
.page-teka { background: radial-gradient(900px 600px at 30% 20%, var(--scene-in), var(--scene) 65%); min-height: 100vh; }
.teka { max-width: 1080px; margin: 0 auto; padding: calc(var(--bar-h) + 28px) var(--s-lg) var(--s-2xl); }
.teka-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.teka-head h1 { font-size: clamp(30px, 4.6vw, 46px); font-weight: 800; }
.teka-head .eyebrow { margin-bottom: 4px; }
.teka-stats { display: flex; align-items: center; gap: 12px; }
.teka-stats span { display: grid; text-align: center; }
.teka-stats b { font: 800 24px/1 var(--font-display); }
.teka-stats small { color: var(--muted); font-size: var(--fs-micro); }
.teka-help { margin: 12px 0 0; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-sm); max-width: 70ch; }
.teka-board { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-xl); margin-top: 22px; align-items: start; }
.teka-plate-wrap { position: relative; display: flex; gap: 14px; align-items: center; }
.teka-plate { width: 100%; max-width: 520px; aspect-ratio: 1; height: auto; border-radius: 50%; background: var(--surface-solid); box-shadow: 0 30px 50px rgba(30, 20, 10, 0.16), 0 0 0 10px var(--surface-solid), 0 0 0 11px var(--line); }
.teka-bands { display: flex; flex-direction: column-reverse; gap: 3px; width: 18px; flex: none; }
.teka-bands i { height: 28px; border-radius: 4px; background: var(--track); transition: background var(--t-base); }
.teka-loading { position: absolute; left: 0; right: 32px; top: 50%; transform: translateY(-50%); text-align: center; font-weight: 600; color: var(--muted); }
.teka-layers { margin: 0 0 10px; font-weight: 600; color: var(--muted); }
.teka-form { position: relative; display: flex; gap: 8px; padding: 6px 6px 6px 14px; border-radius: var(--r-full); background: var(--surface-solid); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.teka-form input { flex: 1; min-width: 0; min-height: 44px; border: 0; background: none; outline: none; font-size: 16px; }
.teka-msg { min-height: 1.4em; margin: 8px 4px 0; font-size: var(--fs-label); color: var(--bad); }
.guesses { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.guesses li { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 12px; min-height: 46px; padding: 6px 12px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-sm); font-weight: 600; }
.guesses .km { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 500; }
.guesses .arrow { width: 22px; height: 22px; display: inline-block; }
.guesses .prox { min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.guesses li.win { background: var(--good); color: #fff; }
.guesses li.win .km { color: #fff; }
.guesses li.empty { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.teka-result { margin-top: 16px; padding: 16px; border-radius: var(--r-lg); background: var(--surface-solid); box-shadow: var(--shadow); }
.teka-result h2 { font-size: 24px; }
.teka-result p { margin: 6px 0; }
.teka-emoji { margin: 10px 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--track); font: 500 16px/1.4 var(--font-text); white-space: pre-wrap; }

/* ---------- resipi & koleksi ---------- */
.vs { margin: 28px 0 8px; padding: 18px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.vs h2, .rank-title { font-size: 22px; }
.rank-title { margin-top: 34px; }
.vs-pick { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; margin: 14px 0; }
.vs-pick input { min-height: 46px; padding: 0 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-solid); font-size: 16px; font-weight: 600; min-width: 0; }
.vs-x { font: 800 18px/1 var(--font-display); color: var(--muted); }
.vs-rows { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.vs-rows li { display: grid; grid-template-columns: 56px 1fr 110px 1fr 56px; align-items: center; gap: 8px; font-size: var(--fs-label); }
.vs-rows .lbl { text-align: center; font-weight: 600; }
.vs-rows .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.vs-rows .v.b { text-align: right; }
.vs-rows .bar { height: 14px; border-radius: var(--r-full); background: var(--track); overflow: hidden; display: flex; }
.vs-rows .bar.l { justify-content: flex-end; }
.vs-rows .bar i { display: block; height: 100%; border-radius: inherit; background: var(--c); opacity: 0.45; }
.vs-rows .win i { opacity: 1; }
.page-resipi, .page-koleksi { min-height: 100vh; background: radial-gradient(900px 600px at 70% 0%, var(--scene-in), var(--scene) 65%); }
.page-resipi h1, .page-koleksi h1 { font-size: clamp(32px, 5vw, 52px); font-weight: 800; }
.rank-tabs { margin: 24px 0 8px; flex-wrap: wrap; border-radius: var(--r-lg); }
.ranks { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.ranks li a { display: grid; grid-template-columns: 34px 1fr minmax(80px, 2fr) 64px; align-items: center; gap: 12px; min-height: 52px; padding: 6px 12px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-sm); text-decoration: none; }
.ranks .pos { font: 800 18px/1 var(--font-display); color: var(--muted); font-variant-numeric: tabular-nums; }
.ranks .nm b { display: block; font-weight: 600; }
.ranks .nm small { color: var(--muted); font-size: var(--fs-small); }
.ranks .bar { height: 12px; border-radius: var(--r-full); background: var(--track); overflow: hidden; }
.ranks .bar i { display: block; height: 100%; border-radius: inherit; background: var(--c); }
.ranks .val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.koleksi { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: var(--s-xl); align-items: start; }
.koleksi-count { font: 800 22px/1.2 var(--font-display); margin: 18px 0 8px; }
.koleksi-list { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 4px; }
.koleksi-list li { font-size: var(--fs-label); }
.koleksi-list b { font-weight: 600; }
.koleksi-map { width: 100%; height: auto; }
.koleksi-map path { stroke: var(--surface-solid); stroke-width: 0.06; transition: fill var(--t-base); }

/* ---------- tablet & phone ---------- */
@media (max-width: 1100px) {
  .dock .seg.views span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .dock .seg.views button { padding: 0 10px; }
}
@media (max-width: 980px) {
  .legend { width: 180px; }
  .layer-en { display: none; }
  .tool span:not(.theme-dot) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

@media (max-width: 760px) {
  :root { --fs-display: 22px; --bar-h: 52px; }
  .brand-name { font-size: 16px; }
  .nav-link span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav-link { padding: 0 10px; }
  .hero { grid-template-columns: 1fr; padding-top: calc(var(--bar-h) + 24px); gap: 8px; }
  .hero-art { order: -1; max-width: 320px; margin: 0 auto; }
  .hero h1 { font-size: clamp(34px, 10vw, 46px); }
  .hero .lead { font-size: 16px; }
  .bigsearch .primary { padding: 0 14px; }
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; }
  .shelf li a::after { bottom: 50px; }

  .studio-top { left: 10px; right: 10px; max-width: none; top: calc(var(--bar-h) + env(safe-area-inset-top)); }
  .city { padding: 8px 12px; max-width: 100%; }
  .legend {
    left: 8px; right: 8px; top: auto; transform: none; width: auto; bottom: calc(138px + env(safe-area-inset-bottom));
    padding: 4px; border-radius: var(--r-md);
  }
  .legend h2, .relief-note { display: none; }
  .legend ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
  .layer-open { grid-template-columns: 10px 1fr; column-gap: 7px; min-height: 36px; padding: 2px 8px; }
  .layer-band { width: 10px; height: 20px; }
  .layer-name { font-size: var(--fs-small); }
  .layer-eye { display: none; }
  body[data-view="potong"] .scene-labels, body[data-view="belah"] .scene-labels, body[data-view="bentang"] .legend, body[data-view="belah"] .legend { display: none; }
  .dock {
    left: 8px; right: 8px; transform: none; bottom: calc(14px + env(safe-area-inset-bottom)); border-radius: var(--r-lg);
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "views share" "tools tools"; gap: 6px;
  }
  .dock .views { grid-area: views; justify-content: space-between; }
  .dock .seg.views button { flex: 1; justify-content: center; padding: 0 4px; }
  .share-btn, .slice-btn { grid-area: share; padding: 0 14px; }
  .share-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .dock-tools { grid-area: tools; justify-content: space-between; }
  .dock-tools > * { flex-shrink: 0; }
  body[data-mode="peta"] .dock { grid-template-areas: "share share" "tools tools"; }
  .tool { padding: 0 10px; }
  .popover { position: fixed; left: 8px; right: 8px; bottom: calc(126px + env(safe-area-inset-bottom)); transform: none; width: auto; }
  .theme-menu { left: 8px; right: 8px; transform: none; width: auto; }
  .hint { top: auto; bottom: calc(186px + env(safe-area-inset-bottom)); white-space: normal; text-align: center; width: max-content; max-width: calc(100vw - 32px); }
  .profile { left: 8px; right: 8px; width: auto; bottom: calc(126px + env(safe-area-inset-bottom)); }
  .sheet { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .cities { grid-template-columns: 1fr; }
  .focus-bar { flex-direction: column; align-items: flex-start; }
  .credit { display: none; }

  .teka { padding: calc(var(--bar-h) + 16px) var(--s-md) var(--s-xl); }
  .teka-board { grid-template-columns: 1fr; gap: 18px; margin-top: 14px; }
  .teka-plate { max-width: min(76vw, 360px); }
  .teka-plate-wrap { justify-content: center; }
  .wrap { padding: calc(var(--bar-h) + 24px) var(--s-md) var(--s-xl); }
  .ranks li a { grid-template-columns: 28px 1fr 64px; }
  .ranks .bar { grid-column: 2 / 4; grid-row: 2; }
  .koleksi { grid-template-columns: 1fr; }
  .vs-rows li { grid-template-columns: 44px 1fr 84px 1fr 44px; gap: 6px; font-size: var(--fs-small); }
  .recipe li { grid-template-columns: 92px 1fr auto; }
}

@media (max-width: 480px) {
  #spinBtn { display: none; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .legend, .studio-top .flavour { display: none; }
  body[data-view="potong"] .scene-labels, body[data-view="belah"] .scene-labels { display: none; }
  .dock { bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation: none !important; }
}
