/* The Black Hole — exhibit styling.
   Dark space glass, warm disk-inspired accents, friendly rounded type. */

@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/Fraunces-600.woff2') format('woff2');
  font-weight: 100 1000; font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('../fonts/Nunito-400.woff2') format('woff2');
  font-weight: 100 1000; font-display: swap;
}

:root {
  --bg: #04060f;
  --panel: rgba(11, 15, 30, 0.78);
  --panel-border: rgba(150, 170, 255, 0.14);
  --ink: #eef1ff;
  --ink-dim: #b4bde2;
  --amber: #ffb35c;
  --amber-hot: #ff8a3d;
  --violet: #9d86ff;
  --blue: #6db8ff;
  --radius: 18px;
  --shadow: 0 14px 44px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font-family: 'Nunito', ui-rounded, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px; line-height: 1.5;
}

#view {
  position: fixed; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none; cursor: grab;
}
#view:active { cursor: grabbing; }
#app { position: fixed; inset: 0; pointer-events: none; }
#app > * { pointer-events: auto; }
.hidden { display: none !important; }

h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; letter-spacing: 0.2px; }
button { font-family: inherit; }

/* ---------- top bar ---------- */
#topbar {
  z-index: 14;
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 14px 18px;
  background: linear-gradient(rgba(3,5,12,0.72), transparent);
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }
.brand { display: flex; gap: 11px; align-items: center; }
.brand-dot {
  width: 15px; height: 15px; border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #1a2040 0%, #000 58%);
  box-shadow: 0 0 0 2px rgba(255,170,90,0.85), 0 0 16px 3px rgba(255,140,60,0.5);
  flex: none;
}
.brand h1 { margin: 0; font-size: 21px; font-weight: 700; }
.brand p { margin: -3px 0 0; font-size: 11.5px; color: var(--ink-dim); font-style: italic; }
.top-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: var(--panel); color: var(--ink);
  font-size: 17px; cursor: pointer;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .15s, border-color .15s;
}
.icon-btn:hover { transform: translateY(-1px); border-color: rgba(255,180,110,0.55); }
.icon-btn.small { width: 28px; height: 28px; font-size: 13px; border-radius: 9px; }

/* ---------- panels ---------- */
.panel {
  z-index: 12;
  position: absolute; top: 78px; width: min(348px, calc(100vw - 24px));
  max-height: calc(100dvh - 190px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius); padding: 14px 16px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  animation: pop .25s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
#panelJourney { left: 18px; }
#panelMission { right: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

.chip {
  display: inline-block; padding: 4px 11px; border-radius: 999px;
  background: rgba(255, 150, 70, 0.13); border: 1px solid rgba(255,170,100,0.35);
  color: var(--amber); font-size: 12px; font-weight: 800; letter-spacing: 0.4px;
}

#tourBody h2 { margin: 4px 0 8px; font-size: 21px; color: #ffd9a8; }
#tourBody p { margin: 0 0 10px; font-size: 14.5px; }
.tour-hint {
  font-size: 12.5px; color: var(--ink-dim);
  background: rgba(120,140,255,0.09); border: 1px dashed rgba(140,160,255,0.3);
  border-radius: 12px; padding: 8px 10px; margin-top: 8px;
}
.tour-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 8px; }
.dots { display: flex; gap: 5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,0.18); }
.dot.on { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.dot.done { background: rgba(255,180,110,0.5); }

.btn {
  border: 1px solid var(--panel-border); border-radius: 12px;
  background: rgba(255,255,255,0.06); color: var(--ink);
  padding: 8px 14px; font-size: 13.5px; font-weight: 700; cursor: pointer;
  transition: all .15s;
}
.btn:hover { border-color: rgba(255,180,110,0.6); transform: translateY(-1px); }
.btn.primary { background: linear-gradient(135deg, #ff9a3d, #ff6a3d); border: none; color: #2a1400; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: 0.35; cursor: default; transform: none; }
.linklike { background: none; border: none; color: var(--blue); cursor: pointer; font-size: inherit; text-decoration: underline; padding: 0; }

/* ---------- mission control ---------- */
.ctl { margin: 12px 0; }
.ctl label { display: flex; justify-content: space-between; font-weight: 800; font-size: 13px; color: #ffd9a8; }
.ctl .val { color: var(--ink-dim); font-weight: 600; }
.ctl .mini { margin: 3px 0 0; font-size: 11.5px; color: var(--ink-dim); }
input[type=range] {
  width: 100%; margin: 8px 0 2px; appearance: none; -webkit-appearance: none;
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, #3d2a1a, #ff9a3d);
  outline: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff2df; border: 3px solid var(--amber-hot);
  box-shadow: 0 0 10px rgba(255,150,70,0.7); cursor: grab;
}
input[type=range]::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: #fff2df; border: 3px solid var(--amber-hot); cursor: grab;
}
select {
  width: 100%; padding: 8px 10px; border-radius: 10px;
  background: rgba(255,255,255,0.07); color: var(--ink);
  border: 1px solid var(--panel-border); font-family: inherit; font-size: 13px;
}
select option { background: #0d1226; }

.toggles { display: flex; flex-direction: column; gap: 9px; margin: 14px 0; }
.toggle { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.toggle em { font-style: normal; font-weight: 500; color: var(--ink-dim); font-size: 11.5px; }
.toggle input { display: none; }
.toggle span {
  width: 38px; height: 21px; border-radius: 999px; flex: none;
  background: rgba(255,255,255,0.12); border: 1px solid var(--panel-border);
  position: relative; transition: background .2s;
}
.toggle span::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 15px; height: 15px; border-radius: 50%;
  background: #cfd6f5; transition: all .2s;
}
.toggle input:checked + span { background: linear-gradient(135deg, #ff9a3d, #ff6a3d); }
.toggle input:checked + span::after { left: 19px; background: #fff; }

/* ---------- readout ---------- */
.readout {
  z-index: 8;
  position: absolute; left: 18px; bottom: 78px;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 14px; padding: 10px 14px; min-width: 255px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-size: 12.5px; box-shadow: var(--shadow);
}
.ro-row { display: flex; justify-content: space-between; gap: 12px; margin: 3px 0; }
.ro-row span { color: var(--ink-dim); }
.ro-row b { text-align: right; color: #ffe6c4; font-weight: 700; }
.ro-row.mini i { color: var(--ink-dim); font-size: 11px; }

/* ---------- floating name tags ---------- */
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.map-tag {
  position: absolute; transform: translate(-50%, -50%);
  pointer-events: auto; cursor: pointer;
  background: rgba(10, 14, 28, 0.85); color: #ffe2bb;
  border: 1px solid rgba(255, 190, 120, 0.55); border-radius: 999px;
  padding: 4px 11px; font-size: 11.5px; font-weight: 800; white-space: nowrap;
  box-shadow: 0 0 14px rgba(255, 150, 70, 0.35);
  animation: tagpulse 2.6s ease-in-out infinite;
}
@keyframes tagpulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255,150,70,0.25); }
  50% { box-shadow: 0 0 18px rgba(255,150,70,0.6); }
}

/* ---------- popover ---------- */
#popover {
  position: absolute; width: min(320px, calc(100vw - 20px));
  background: rgba(13, 17, 34, 0.94); border: 1px solid rgba(255,190,120,0.4);
  border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow); z-index: 30;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  animation: pop .2s ease;
}
#popover h3 { margin: 0 0 6px; font-size: 17px; color: #ffd9a8; }
#popover p { margin: 0; font-size: 13.5px; }
#popover .mini { margin-top: 8px; font-size: 12px; color: var(--ink-dim); }
.pop-close { position: absolute; top: 8px; right: 8px; }

/* ---------- photon paths panel ---------- */
#pathsPanel {
  z-index: 12;
  position: absolute; right: 18px; bottom: 78px; width: min(360px, 46vw);
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius); overflow: hidden;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow); animation: pop .25s ease;
}
.paths-head { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; }
#pathCanvas { display: block; width: 100%; height: 230px; cursor: ns-resize; }

/* ---------- bottom dock ---------- */
#dock {
  z-index: 14;
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; padding: 7px;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 999px; box-shadow: var(--shadow);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.dock-btn {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  background: transparent; border: none; color: var(--ink-dim);
  font-size: 16px; padding: 7px 15px; border-radius: 999px; cursor: pointer;
  transition: all .15s;
}
.dock-btn span { font-size: 10.5px; font-weight: 800; letter-spacing: 0.3px; }
.dock-btn:hover { color: var(--ink); background: rgba(255,255,255,0.07); }
.dock-btn.active { color: #2a1400; background: linear-gradient(135deg, #ffb35c, #ff8a3d); }

/* ---------- dpad ---------- */
.dpad-tag { display:block; text-align:center; font-size:9.5px; font-weight:800; letter-spacing:0.14em; text-transform:uppercase; color:var(--ink-dim); margin-bottom:4px; }
#dpad {
  z-index: 8;
  position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  opacity: 0.75;
}
#dpad div { display: flex; gap: 6px; }
#dpad button {
  width: 42px; height: 42px; border-radius: 12px; font-size: 14px;
  background: var(--panel); border: 1px solid var(--panel-border); color: var(--ink);
  cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
#dpad button:active { background: rgba(255,160,80,0.35); border-color: var(--amber); }
/* hide the steering pad while panels/sheets are open — avoids collisions */
body.ui-open #dpad {
  z-index: 8; opacity: 0; pointer-events: none; }

/* ---------- sheet / modal ---------- */
#sheet {
  position: absolute; inset: 0; z-index: 40;
  background: rgba(2, 4, 10, 0.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
#sheetCard {
  width: min(560px, 96vw); max-height: 82dvh; overflow-y: auto;
  background: rgba(13, 17, 34, 0.97); border: 1px solid var(--panel-border);
  border-radius: 22px; padding: 22px 24px; box-shadow: var(--shadow);
  animation: pop .25s ease;
}
#sheetCard h2 { margin: 0 0 10px; color: #ffd9a8; font-size: 23px; }
#sheetCard h3 { color: #ffd9a8; }
#sheetCard h4 { color: var(--amber); margin: 14px 0 6px; }
#sheetCard p, #sheetCard li { font-size: 14px; }
#sheetCard ul { padding-left: 20px; }
.sheet-close { margin-top: 16px; width: 100%; }

.glossary dt { font-weight: 800; color: #ffd9a8; margin-top: 10px; font-size: 14px; }
.glossary dd { margin: 2px 0 0; font-size: 13.5px; color: var(--ink); }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 13px; }
.help-grid > div { background: rgba(255,255,255,0.05); border-radius: 12px; padding: 10px 12px; }

.fun-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--panel-border); background: rgba(255,255,255,0.05);
  color: var(--ink-dim); padding: 6px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 800; cursor: pointer;
}
.tab.on { background: linear-gradient(135deg, #ffb35c, #ff8a3d); color: #2a1400; border: none; }
.fact-card {
  background: linear-gradient(135deg, rgba(255,150,70,0.13), rgba(140,110,255,0.13));
  border: 1px solid rgba(255,170,100,0.3); border-radius: 14px;
  padding: 18px; font-size: 15px; margin-bottom: 12px;
}
.challenge {
  background: rgba(255,255,255,0.05); border: 1px solid var(--panel-border);
  border-radius: 12px; padding: 10px 13px; margin-bottom: 9px;
}
.challenge.done { border-color: rgba(120,255,170,0.45); background: rgba(80,220,140,0.08); }
.challenge .ch-head { display: flex; gap: 7px; align-items: baseline; }
.challenge p { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-dim); }
.ch-state { margin-left: auto; font-size: 11.5px; }
.quiz-q h3 { margin: 6px 0 12px; font-size: 17px; }
.quiz-a { display: flex; flex-direction: column; gap: 7px; }
.quiz-a .ans { text-align: left; }
.quiz-a .ans.right { background: rgba(90,230,150,0.22); border-color: rgba(120,255,170,0.6); }
.quiz-a .ans.wrong { background: rgba(255,90,80,0.16); border-color: rgba(255,120,100,0.5); }
.quiz-why { margin-top: 10px; font-size: 13px; background: rgba(120,140,255,0.1); padding: 8px 11px; border-radius: 10px; }
.quiz-end { text-align: center; padding: 14px 0; }
.big-score { font-family: 'Fraunces', serif; font-size: 46px; color: var(--amber); }

.noodle-scene {
  position: relative; height: 170px; border-radius: 14px; margin: 10px 0;
  background: radial-gradient(circle at 28% 50%, rgba(255,140,60,0.22), rgba(5,8,18,0.9) 62%);
  border: 1px solid var(--panel-border); overflow: hidden;
}
.noodle-bh {
  position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
  width: 74px; height: 74px; border-radius: 50%;
  background: radial-gradient(circle at 40% 36%, #131a38 0%, #000 62%);
  box-shadow: 0 0 0 3px rgba(255,170,90,0.7), 0 0 30px 8px rgba(255,140,60,0.45);
}
.astro {
  position: absolute; right: 30px; top: 50%; margin-top: -22px;
  font-size: 44px; transform-origin: left center;
  transition: transform .12s ease-out; display: inline-block;
}
.noodle-msg { font-size: 13px; color: #ffd9a8; min-height: 2.2em; }

/* ---------- toast / hints ---------- */
#toast {
  position: absolute; top: 126px; left: 50%; transform: translateX(-50%);
  max-width: min(520px, 92vw); z-index: 50;
  background: rgba(13, 17, 34, 0.95); border: 1px solid rgba(255,190,120,0.5);
  border-radius: 999px; padding: 10px 20px; font-size: 13.5px; font-weight: 700;
  box-shadow: var(--shadow); text-align: center;
  animation: pop .25s ease;
}
#startHint {
  position: absolute; top: 76px; left: 50%; transform: translateX(-50%); z-index: 15;
  background: rgba(13, 17, 34, 0.9); border: 1px solid var(--panel-border);
  border-radius: 999px; padding: 8px 18px; font-size: 12.5px; color: var(--ink-dim);
  white-space: nowrap; animation: pop .4s ease;
}

.fatal {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  background: var(--bg); color: var(--ink); padding: 20px; z-index: 99;
}

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  body { font-size: 14px; }
  .brand h1 { font-size: 17px; }
  .brand p { display: none; }
  .panel {
    top: auto; bottom: 84px; left: 10px; right: 10px; width: auto;
    max-height: 46dvh;
  }
  .readout {
  z-index: 8;
    left: 10px; bottom: auto; top: 64px; min-width: 0; max-width: 66vw;
    font-size: 11px; padding: 8px 11px;
  }
  .ro-row { flex-wrap: wrap; gap: 4px 10px; }
  .ro-row span { white-space: nowrap; }
  .ro-row b { flex: 1 1 60%; text-align: left; }
  #pathsPanel { right: 10px; left: 10px; width: auto; bottom: 84px; }
  #pathCanvas { height: 180px; }
  #dpad {
  z-index: 8; right: 10px; top: auto; bottom: 176px; transform: none; }
  #dpad button { width: 40px; height: 40px; }
  .dock-btn { padding: 6px 9px; }
  .dock-btn span { font-size: 9px; letter-spacing: 0; white-space: nowrap; }
  #startHint { max-width: calc(100vw - 20px); font-size: 11px; }
  #startHint { display: none; }
  #toast { top: 60px; font-size: 12.5px; }
  .help-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .map-tag, .panel, #popover, #sheetCard { animation: none; }
}

.serif-i { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-weight: 700; font-size: 17px; }
