/* ============================================================
   Geez Alphabet Explorer — living map styles
   ============================================================ */

/* Self-hosted Ethiopic-subset variable font (Google Fonts, OFL).
   Guarantees consistent fidel rendering on devices without an
   Ethiopic system font; local() lets installed copies win. */
@font-face {
  font-family: 'Noto Sans Ethiopic';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: local('Noto Sans Ethiopic'),
       url('fonts/NotoSansEthiopic-ethiopic.woff2') format('woff2');
  unicode-range: U+030E, U+1200-1399, U+2D80-2DDE, U+AB01-AB2E, U+1E7E0-1E7E6, U+1E7E8-1E7EB, U+1E7ED-1E7EE, U+1E7F0-1E7FE;
}

:root {
  --bg0: #0a0e1d;
  --bg1: #111735;
  --ink: #e9e7f4;
  --ink-dim: #9b98b8;
  --glass: rgba(20, 24, 48, 0.78);
  --glass-edge: rgba(255, 255, 255, 0.10);
  --ethiopic: 'Noto Sans Ethiopic', 'Ebrima', 'Nyala', 'Abyssinica SIL', 'Kefa', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background:
    radial-gradient(1200px 800px at 70% 20%, #1a2150 0%, transparent 60%),
    radial-gradient(900px 700px at 15% 85%, #251a45 0%, transparent 55%),
    var(--bg0);
  color: var(--ink);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* faint star field */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.2px 1.2px at 12% 22%, rgba(255,255,255,.5) 0, transparent 100%),
    radial-gradient(1px 1px at 28% 68%, rgba(255,255,255,.35) 0, transparent 100%),
    radial-gradient(1.4px 1.4px at 45% 12%, rgba(255,255,255,.4) 0, transparent 100%),
    radial-gradient(1px 1px at 62% 45%, rgba(255,255,255,.3) 0, transparent 100%),
    radial-gradient(1.3px 1.3px at 78% 78%, rgba(255,255,255,.45) 0, transparent 100%),
    radial-gradient(1px 1px at 88% 28%, rgba(255,255,255,.35) 0, transparent 100%),
    radial-gradient(1.1px 1.1px at 35% 88%, rgba(255,255,255,.4) 0, transparent 100%),
    radial-gradient(1px 1px at 55% 62%, rgba(255,255,255,.3) 0, transparent 100%);
}

/* near star layer — drifts with the camera (see applyView) */
#stars {
  position: fixed; inset: -12%;
  pointer-events: none;
  will-change: transform;
  background-image:
    radial-gradient(1.6px 1.6px at 8% 35%,  rgba(255,255,255,.55) 0, transparent 100%),
    radial-gradient(1.2px 1.2px at 21% 80%, rgba(190,210,255,.45) 0, transparent 100%),
    radial-gradient(1.8px 1.8px at 33% 18%, rgba(255,235,200,.5)  0, transparent 100%),
    radial-gradient(1.1px 1.1px at 47% 55%, rgba(255,255,255,.4)  0, transparent 100%),
    radial-gradient(1.5px 1.5px at 58% 90%, rgba(255,255,255,.5)  0, transparent 100%),
    radial-gradient(1.2px 1.2px at 69% 30%, rgba(200,255,230,.4)  0, transparent 100%),
    radial-gradient(1.7px 1.7px at 81% 65%, rgba(255,255,255,.5)  0, transparent 100%),
    radial-gradient(1.1px 1.1px at 92% 12%, rgba(255,220,220,.45) 0, transparent 100%),
    radial-gradient(1.3px 1.3px at 15% 58%, rgba(255,255,255,.35) 0, transparent 100%),
    radial-gradient(1.4px 1.4px at 73% 8%,  rgba(255,255,255,.4)  0, transparent 100%),
    radial-gradient(1px   1px   at 40% 92%, rgba(255,255,255,.35) 0, transparent 100%),
    radial-gradient(1.2px 1.2px at 96% 45%, rgba(255,255,255,.4)  0, transparent 100%);
  animation: twinkle 7s ease-in-out infinite alternate;
}
@keyframes twinkle {
  from { opacity: .55; }
  to   { opacity: 1; }
}

#map {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  cursor: grab;
}
#map:active { cursor: grabbing; }

/* ---------------- edges ---------------- */

.edge {
  fill: none;
  stroke-linecap: round;
  opacity: 0.42;
}

/* constellation starlines: dashed threads between same-shape letters */
.con-edge {
  fill: none;
  stroke-width: 1.2;
  stroke-dasharray: 3 6;
  stroke-linecap: round;
  opacity: 0.55;
}
.edge.depth1 { stroke-width: 2.6; }
.edge.depth2 { stroke-width: 1.8; opacity: 0.34; }
.edge.depth3 { stroke-width: 1.3; opacity: 0.28; }
.edge.depth4 { stroke-width: 1;   opacity: 0.24; }

/* ---------------- nodes ---------------- */

.node { cursor: pointer; }

.node .halo {
  fill: var(--c);
  opacity: 0;
  transition: opacity .25s;
}
.node:hover .halo { opacity: 0.16; }
.node.selected .halo { opacity: 0.30; }

.node .body {
  fill: var(--bg1);
  stroke: var(--c);
  stroke-width: 2;
  transition: fill .25s;
}
.node:hover .body { fill: #1a2150; }
.node.depth0 .body { stroke-width: 3; fill: #1c1a36; }

.node .dot { fill: var(--c); opacity: .85; }

.node .glyph {
  fill: var(--ink);
  text-anchor: middle;
  font-family: var(--ethiopic);
  pointer-events: none;
}
.node.depth0 .glyph { fill: #ffe9b0; }

.node .label {
  fill: var(--ink-dim);
  text-anchor: middle;
  font-size: 13px;
  letter-spacing: .03em;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(10, 14, 29, 0.85);
  stroke-width: 3px;
}
.node.depth0 .label { font-size: 17px; fill: var(--ink); font-weight: 600; }
.node.depth1 .label { font-size: 15px; fill: var(--ink); }
.node:hover .label { fill: var(--ink); }

.node .badge { cursor: pointer; }
.node .badge circle {
  fill: var(--c);
  stroke: var(--bg0);
  stroke-width: 2;
}
.node .badge text {
  fill: #10142a;
  font-size: 11px;
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
}
.node .badge:hover circle { filter: brightness(1.25); }

/* a softly breathing badge marks an unexplored bubble */
.node .badge.unexplored circle { animation: beckon 2.2s ease-in-out infinite; }
@keyframes beckon {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.55); }
}

/* sound badge: tap to hear the letter or word right on the map */
.node .sbadge { cursor: pointer; }
.node .sbadge circle {
  fill: var(--bg1);
  stroke: var(--c);
  stroke-width: 1.5;
  opacity: .92;
}
.node .sbadge text {
  font-size: 9px;
  text-anchor: middle;
  pointer-events: none;
}
.node .sbadge:hover circle { fill: #232a55; }
.node.lod-far .sbadge { opacity: 0; pointer-events: none; }

/* gentle resting glow so the universe feels lit from within */
.node.depth1 .halo { opacity: 0.07; }
.node.depth1:hover .halo { opacity: 0.16; }

/* ---------------- level of detail ----------------
   As bubbles shrink on screen they shed text, then glyphs,
   until distant clusters are just faint stars. */

.node .label, .node .glyph, .node .badge { transition: opacity .3s; }
.node.lod-far .label  { opacity: 0; }
.node.lod-far .badge  { opacity: 0; pointer-events: none; }
.node.lod-tiny .glyph { opacity: 0; }
.node.lod-tiny .body  { fill: var(--c); fill-opacity: .35; }

/* ---------------- breadcrumb trail ---------------- */

#crumbs {
  position: fixed; top: 16px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px;
  max-width: min(72vw, 760px);
  padding: 5px 10px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  z-index: 6;
  overflow: hidden;
  white-space: nowrap;
}
#crumbs button {
  border: none; background: none;
  color: var(--ink-dim);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
#crumbs button:hover {
  background: color-mix(in srgb, var(--c, #ffd166) 18%, transparent);
  color: var(--ink);
}
#crumbs button:last-of-type { color: var(--ink); font-weight: 600; }
#crumbs .sep { color: var(--ink-dim); font-size: 11px; opacity: .6; }

/* ---------------- brand / hint / controls ---------------- */

#brand {
  position: fixed; top: 18px; left: 22px;
  pointer-events: none;
}
#brand h1 {
  font-size: 19px; font-weight: 600;
  text-shadow: 0 2px 12px rgba(0,0,0,.6);
}
#brand h1 .geez {
  font-family: var(--ethiopic);
  color: #ffd166;
  margin-right: 6px;
}
#brand p { font-size: 12px; color: var(--ink-dim); margin-top: 2px; }

#hint {
  position: fixed; bottom: 22px; left: 50%;
  transform: translateX(-50%);
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 12.5px;
  color: var(--ink-dim);
  white-space: nowrap;
  transition: opacity 1.2s;
  pointer-events: none;
}
#hint.fade { opacity: 0; }

#controls {
  position: fixed; right: 18px; bottom: 18px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 5;
}
#controls button {
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid var(--glass-edge);
  background: var(--glass);
  backdrop-filter: blur(8px);
  color: var(--ink);
  font-size: 19px;
  cursor: pointer;
  transition: background .2s, transform .1s;
}
#controls button:hover { background: #232a55; }
#controls button:active { transform: scale(.93); }

/* ---------------- voice language toggle ---------------- */

#langToggle {
  position: fixed; top: 14px; right: 16px;
  display: flex; gap: 4px;
  padding: 4px;
  border-radius: 13px;
  border: 1px solid var(--glass-edge);
  background: var(--glass);
  backdrop-filter: blur(8px);
  z-index: 6;
}
#langToggle button {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 48px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background .18s, border-color .18s;
}
#langToggle button:hover { background: #232a55; }
#langToggle button.on {
  background: #2a3170;
  border-color: rgba(255, 209, 102, .7);
}
#langToggle .lg { font-size: 17px; line-height: 1; }
#langToggle .ls { font-size: 9px; opacity: .7; letter-spacing: .3px; }

@media (max-width: 640px) {
  #langToggle { top: 10px; right: 10px; padding: 3px; }
  #langToggle button { min-width: 40px; padding: 4px 6px; }
  #langToggle .ls { display: none; }
}

/* ---------------- detail panel ---------------- */

#panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(400px, 100vw);
  background: var(--glass);
  backdrop-filter: blur(18px);
  border-left: 1px solid var(--glass-edge);
  transform: translateX(105%);
  transition: transform .38s cubic-bezier(.2, .9, .25, 1);
  z-index: 10;
  display: flex;
}
#panel.open { transform: translateX(0); }

#panelClose {
  position: absolute; top: 14px; right: 14px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--glass-edge);
  background: rgba(255,255,255,.06);
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  z-index: 2;
}
#panelClose:hover { background: rgba(255,255,255,.14); }

#panelBody {
  flex: 1;
  overflow-y: auto;
  padding: 26px 26px 40px;
  user-select: text;
}
#panelBody::-webkit-scrollbar { width: 8px; }
#panelBody::-webkit-scrollbar-thumb { background: #2c3463; border-radius: 4px; }

.hero {
  width: 132px; height: 132px;
  margin: 8px auto 16px;
  border-radius: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 72px;
  font-family: var(--ethiopic);
  color: var(--ink);
  background:
    radial-gradient(closest-side, color-mix(in srgb, var(--c) 28%, transparent), transparent),
    #161c3d;
  border: 1.5px solid color-mix(in srgb, var(--c) 55%, transparent);
  box-shadow: 0 0 42px color-mix(in srgb, var(--c) 22%, transparent);
}
.hero.small { font-size: 34px; }

#panelBody h2 {
  text-align: center;
  font-size: 23px;
  font-weight: 650;
}
.sub-geez {
  text-align: center;
  font-family: var(--ethiopic);
  font-size: 17px;
  color: var(--ink-dim);
  margin-top: 2px;
}

.audio-btn {
  display: block;
  margin: 14px auto 4px;
  padding: 9px 22px;
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  background: rgba(255, 209, 102, .12);
  color: #ffd166;
  font-size: 14px;
  cursor: pointer;
  transition: background .2s;
}
.audio-btn:hover { background: rgba(255, 209, 102, .22); }
.audio-btn.playing {
  background: rgba(255, 209, 102, .30);
  animation: playing-pulse 1s ease-in-out infinite;
}
@keyframes playing-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 209, 102, .35); }
  50%      { box-shadow: 0 0 0 6px rgba(255, 209, 102, 0); }
}
.mini-audio.playing { opacity: 1; filter: drop-shadow(0 0 4px #ffd166); }
.node .sbadge.playing circle { fill: #ffd166; animation: playing-pulse 1s ease-in-out infinite; }

/* voice provenance under the play button */
.audio-status {
  text-align: center;
  font-size: 11px;
  color: var(--ink-dim);
  margin-top: 6px;
  letter-spacing: .04em;
}
.audio-status.rec { color: #6ee7a0; }

/* 26-family recording map */
.recmap { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.rec-chip {
  border: 1px solid var(--glass-edge);
  background: rgba(255,255,255,.04);
  border-radius: 10px;
  padding: 6px 2px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  transition: background .2s;
}
.rec-chip:hover { background: rgba(255,255,255,.10); }
.rec-chip .rg { font-family: var(--ethiopic); font-size: 17px; color: var(--ink); }
.rec-chip .rs { font-size: 9px; color: var(--ink-dim); }
.rec-chip.rec .rs { color: #6ee7a0; }

#panelBody p {
  margin-top: 14px;
  font-size: 14.5px;
  line-height: 1.65;
  color: #cfccdf;
}

#panelBody h3 {
  margin: 22px 0 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-dim);
}

/* seven-form strip on letter pages */
.forms-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.form-chip {
  border: 1px solid var(--glass-edge);
  background: rgba(255,255,255,.04);
  border-radius: 10px;
  padding: 7px 2px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: background .2s, transform .1s;
}
.form-chip:hover { background: rgba(255,255,255,.10); transform: translateY(-2px); }
.form-chip .fg { font-family: var(--ethiopic); font-size: 21px; color: var(--ink); }
.form-chip .ft { font-size: 10px; color: var(--ink-dim); }

/* examples */
.examples { list-style: none; }
.examples li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  margin-bottom: 6px;
  border-radius: 12px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.06);
}
.ex-geez {
  font-family: var(--ethiopic);
  font-size: 19px;
  flex-shrink: 0;
}
.ex-tr { font-size: 13px; color: #ffd166; font-style: italic; }
.ex-mean { font-size: 13px; color: var(--ink-dim); margin-left: auto; text-align: right; }
.mini-audio {
  border: none; background: none;
  font-size: 14px; cursor: pointer;
  opacity: .55; flex-shrink: 0;
}
.mini-audio:hover { opacity: 1; }

/* related chips */
.related { display: flex; flex-wrap: wrap; gap: 7px; }
.rel-chip {
  border: 1px solid color-mix(in srgb, var(--c) 50%, transparent);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background .2s, transform .1s;
}
.rel-chip:hover {
  background: color-mix(in srgb, var(--c) 26%, transparent);
  transform: translateY(-1px);
}

/* ---------------- mini-games ---------------- */

#gameArea {
  margin-top: 20px;
  padding: 18px;
  border-radius: 16px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.07);
  text-align: center;
}
.game-start {
  padding: 12px 34px;
  font-size: 16px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #ff5d73, #ff9e64);
  color: #1a0d12;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s, filter .2s;
}
.game-start:hover { transform: scale(1.05); filter: brightness(1.1); }

.game-head {
  display: flex; justify-content: space-between;
  font-size: 12.5px; color: var(--ink-dim);
  margin-bottom: 10px;
}
.q-glyph {
  font-family: var(--ethiopic);
  font-size: 64px;
  line-height: 1.15;
}
.q-sound { font-size: 36px; color: #ffd166; font-style: italic; padding: 8px 0; }
.q-ask { font-size: 13.5px; color: var(--ink-dim); margin: 6px 0 14px; }

.opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.opt {
  padding: 13px 6px;
  border-radius: 13px;
  border: 1px solid var(--glass-edge);
  background: rgba(255,255,255,.05);
  color: var(--ink);
  font-size: 17px;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.opt:hover:not(:disabled) { background: rgba(255,255,255,.12); transform: translateY(-2px); }
.opt .opt-glyph { font-family: var(--ethiopic); font-size: 27px; }
.opt.right { background: rgba(110, 231, 160, .25); border-color: #6ee7a0; }
.opt.wrong { background: rgba(255, 93, 115, .25); border-color: #ff5d73; }
.opt:disabled { cursor: default; }

/* tracing lab */
#traceCv {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 1;
  margin: 4px auto;
  display: block;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--glass-edge);
  border-radius: 16px;
  cursor: crosshair;
  touch-action: none;
}
.trace-row {
  display: flex; gap: 8px; justify-content: center;
  margin: 10px 0 2px;
}
.trace-row .opt { padding: 9px 14px; font-size: 14px; }

/* ---------------- guided tour ---------------- */

#tour {
  position: fixed; inset: 0;
  z-index: 20;
  pointer-events: none;        /* map stays usable; only the card catches taps */
  display: none;
}
#tour.on { display: block; }

#tourCard {
  position: fixed;
  left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 28px));
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(14px);
  border-radius: 18px;
  padding: 18px 18px 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  pointer-events: auto;
  animation: tour-in .35s cubic-bezier(.2, .9, .25, 1);
}
@keyframes tour-in {
  from { opacity: 0; transform: translateX(-50%) translateY(14px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#tourText { font-size: 14.5px; line-height: 1.6; color: var(--ink); }
#tourText .t-geez { font-family: var(--ethiopic); color: #ffd166; }

#tourFoot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px;
}
#tourDots { display: flex; gap: 6px; }
#tourDots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,.22);
  transition: background .2s, transform .2s;
}
#tourDots span.cur { background: #ffd166; transform: scale(1.25); }

#tourNav { display: flex; gap: 8px; }
#tourNav button {
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: background .2s;
}
#tourSkip { background: transparent; color: var(--ink-dim); }
#tourSkip:hover { background: rgba(255,255,255,.08); color: var(--ink); }
#tourNext {
  background: rgba(255, 209, 102, .16);
  color: #ffd166;
  border-color: rgba(255, 209, 102, .4);
  font-weight: 600;
}
#tourNext:hover { background: rgba(255, 209, 102, .28); }

/* the tour's "look here" pulse on the toolbar and minimap */
#controls.tour-glow button,
#minimap.tour-glow {
  border-color: rgba(255, 209, 102, .8);
  animation: tour-pulse 1.4s ease-in-out infinite;
}
@keyframes tour-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 209, 102, .45); }
  50%      { box-shadow: 0 0 0 7px rgba(255, 209, 102, 0); }
}

/* ---------------- feedback ---------------- */

#brand #ver { color: #5a5778; font-size: 10px; margin-left: 4px; }

#feedback {
  position: fixed; inset: 0;
  background: rgba(6, 8, 20, .65);
  backdrop-filter: blur(3px);
  z-index: 30;
  display: none;
  align-items: center; justify-content: center;
}
#feedback.on { display: flex; }

#feedbackCard {
  position: relative;
  width: min(420px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: #161c3d;
  border: 1px solid var(--glass-edge);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 16px 50px rgba(0,0,0,.55);
  animation: tour-in .3s cubic-bezier(.2, .9, .25, 1);
}
#feedbackCard h2 { font-size: 17px; margin-bottom: 14px; }
#feedbackCard label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-dim);
  margin-bottom: 12px;
}
#feedbackCard input, #feedbackCard select, #feedbackCard textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--glass-edge);
  background: rgba(255,255,255,.05);
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}
#feedbackCard select option { background: #161c3d; }
#feedbackClose {
  position: absolute; top: 12px; right: 12px;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--glass-edge);
  background: rgba(255,255,255,.06);
  color: var(--ink);
  cursor: pointer;
}
#fbActions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 4px; }
#fbActions button {
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  padding: 9px 16px;
  font-size: 13px;
  cursor: pointer;
  background: rgba(255,255,255,.06);
  color: var(--ink);
}
#fbSend {
  background: rgba(255, 209, 102, .16) !important;
  color: #ffd166 !important;
  border-color: rgba(255, 209, 102, .4) !important;
  font-weight: 600;
}
#fbActions button:hover { filter: brightness(1.25); }
#fbHint { font-size: 11px; color: #5a5778; margin-top: 12px; text-align: center; }

/* ---------------- minimap ---------------- */

#minimap {
  position: fixed; left: 18px; bottom: 18px;
  width: 168px; height: 168px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  z-index: 6;
  cursor: pointer;
  overflow: hidden;
}
#minimap .mm-root { fill: #ffd166; }
#minimap .mm-b    { opacity: .95; }
#minimap .mm-d    { opacity: .55; }
#minimap .mm-t {
  font-family: var(--ethiopic);
  font-size: 7px;
  fill: var(--ink-dim);
  text-anchor: middle;
  pointer-events: none;
}
#minimap .mm-view {
  fill: rgba(255, 209, 102, .07);
  stroke: #ffd166;
  stroke-width: 1;
  opacity: .9;
}
#minimap .mm-here {
  fill: none;
  stroke: #ffd166;
  stroke-width: 1.4;
  animation: here-pulse 1.8s ease-in-out infinite;
}
@keyframes here-pulse {
  0%, 100% { opacity: .9; }
  50%      { opacity: .35; }
}

/* ---------------- small screens ---------------- */

@media (max-width: 600px) {
  #brand { top: 12px; left: 14px; right: 14px; }
  #brand h1 { font-size: 16px; }
  #brand p { font-size: 11px; }

  #crumbs { top: 58px; max-width: 94vw; }   /* sits below the brand on phones */
  #crumbs button { font-size: 11px; padding: 4px 6px; }

  /* minimap moves to the top-right corner, clear of controls and sheet */
  #minimap {
    left: auto; bottom: auto;
    right: 10px; top: 96px;
    width: 108px; height: 108px;
  }

  #hint {
    font-size: 11px; padding: 7px 14px;
    max-width: 92vw; white-space: normal; text-align: center;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px)); /* clear the controls row */
  }

  /* controls become a horizontal row along the bottom, inside the safe area */
  #controls {
    right: 50%; transform: translateX(50%);
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    flex-direction: row; gap: 10px;
  }

  /* detail panel becomes a bottom sheet so the map stays visible above it */
  #panel {
    top: auto; left: 0; right: 0; bottom: 0;
    width: 100vw;
    height: min(62vh, 560px);
    border-left: none;
    border-top: 1px solid var(--glass-edge);
    border-radius: 22px 22px 0 0;
    transform: translateY(105%);
  }
  #panel.open { transform: translateY(0); }
  #panel::before {            /* grab handle */
    content: '';
    position: absolute; top: 8px; left: 50%;
    transform: translateX(-50%);
    width: 42px; height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,.25);
  }
  #panelBody { padding: 26px 18px calc(30px + env(safe-area-inset-bottom, 0px)); }
  .hero { width: 104px; height: 104px; font-size: 56px; margin-top: 2px; }
  .forms-row { grid-template-columns: repeat(4, 1fr); }

  #tourCard { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
}

/* comfortable touch targets on coarse pointers */
@media (pointer: coarse) {
  #controls button { width: 46px; height: 46px; }
  #panelClose { width: 40px; height: 40px; }
  .opt { padding: 15px 6px; }
}
