/* ============================================================
   Physica — css/styles.css — the whole museum's look
   ============================================================ */

:root {
  --bg: #0e1526;
  --bg2: #131f38;
  --panel: #16223f;
  --panel2: #1b2a4a;
  --line: #26325a;
  --line2: #2c3d63;
  --ink: #e8f0ff;
  --ink-dim: #9db0d0;
  --gold: #ffd23f;
  --orange: #ff9a3c;
  --teal: #3fd2c7;
  --violet: #b38bff;
  --pink: #ff7ab6;
  --danger: #ff6b6b;
  --ok: #7ef7b0;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: radial-gradient(1200px 700px at 20% -10%, #1b2b55 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--ink);
  font-family: 'Baloo 2', 'Segoe UI', 'Nunito', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  min-height: 100vh;
}
[hidden] { display: none !important; }

a { color: var(--teal); }

.skip-link { position: absolute; top: -44px; left: 8px; background: var(--gold); color: #2b1c05; padding: 8px 14px; border-radius: 0 0 10px 10px; font-weight: 700; z-index: 80; transition: top .2s ease; text-decoration: none; }
.skip-link:focus { top: 0; }

/* ---------------- site bar ---------------- */
.sitebar {
  display: flex; align-items: center; gap: 18px;
  padding: 10px 18px;
  background: rgba(11, 17, 36, .92);
  border-bottom: 1px solid #1f2c52;
  position: sticky; top: 0; z-index: 40;
}
.logo { color: var(--ink); text-decoration: none; letter-spacing: .12em; font-size: 1.05rem; }
.logo strong { color: var(--gold); }
.site-nav { display: flex; gap: 14px; }
.site-nav a { color: var(--ink-dim); font-size: .9rem; text-decoration: none; }
.site-nav a:hover { color: var(--gold); }
.site-sound { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 1.25rem; color: var(--ink-dim); }
.site-sound:hover { color: var(--gold); }

/* ---------------- layout ---------------- */
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
.content-main { min-width: 0; }
#app { max-width: 1120px; margin: 0 auto; padding: 8px 12px 0; }
.screen { padding: 14px 4px; }

/* ---------------- buttons ---------------- */
.btn {
  font: inherit; color: var(--ink);
  background: var(--panel2);
  border: 1px solid var(--line2);
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.btn:hover { border-color: var(--gold); transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn.primary { background: linear-gradient(180deg, #ffcf7a, #ff9a3c); color: #2b1c05; font-weight: 700; border-color: #ffb75a; }
.btn.big { padding: 13px 26px; font-size: 1.05rem; }
.btn.danger { border-color: #a33b3b; color: #ffb1a1; }
.btn.hud-btn { padding: 7px 12px; font-size: .88rem; }

/* ---------------- title screen ---------------- */
.title-wrap { text-align: center; padding: 56px 16px 40px; }
.game-logo {
  margin: 0; letter-spacing: .18em; font-size: clamp(3rem, 9vw, 5.5rem); font-weight: 700;
  background: linear-gradient(180deg, var(--gold), var(--orange));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 18px rgba(255, 154, 60, .25));
}
.game-sub { margin: 4px 0 0; color: var(--ink-dim); letter-spacing: .34em; text-transform: uppercase; font-size: .8rem; }
.game-tag { margin: 20px auto 14px; max-width: 540px; }
.title-chips { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.chip { background: #131c3a; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: .85rem; color: var(--ink-dim); }
.title-note { color: var(--ink-dim); font-size: .8rem; margin-top: 18px; }

/* ---------------- level screen ---------------- */
.level-hud { display: flex; align-items: center; gap: 10px; padding: 8px 2px; flex-wrap: wrap; }
.hud-title { flex: 1; min-width: 220px; display: flex; flex-direction: column; }
.hud-name { font-weight: 700; }
.hud-goal { color: var(--ink-dim); font-size: .85rem; }
.hud-stars { color: var(--gold); letter-spacing: 3px; font-size: 1.1rem; }

.stage-wrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line2); background: #0c1226; }
#stage { width: 100%; display: block; touch-action: none; }
.stage-wrap.shake { animation: shake .38s ease; }
@keyframes shake {
  10% { transform: translateX(-5px); }
  30% { transform: translateX(5px); }
  50% { transform: translateX(-3px); }
  70% { transform: translateX(2px); }
  90% { transform: translateX(-1px); }
}

.level-controls { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-top: 10px; }
.ctl-grid { display: flex; flex-wrap: wrap; gap: 14px 26px; }
.ctl-row { display: flex; align-items: center; gap: 10px; flex: 1 1 360px; min-width: 0; }
.ctl-label { color: var(--ink-dim); font-size: .85rem; min-width: 115px; }
.ctl-slider { flex: 1; min-width: 120px; accent-color: var(--gold); }
.ctl-badge { color: var(--gold); min-width: 78px; text-align: right; font-size: .9rem; font-variant-numeric: tabular-nums; }
.ctl-toggle {
  font: inherit; color: var(--ink); background: #131c3a; border: 1px solid var(--line2);
  border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: .85rem;
}
.ctl-toggle:hover { border-color: var(--gold); }
.ctl-toggle.on { border-color: var(--gold); color: var(--gold); }
.ctl-choice { display: flex; gap: 6px; }
.ctl-choice-btn { font: inherit; background: #131c3a; color: var(--ink); border: 1px solid var(--line2); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: .85rem; }
.ctl-choice-btn:hover { border-color: var(--gold); }
.ctl-choice-btn.active { border-color: var(--gold); color: var(--gold); }
.ctl-actions { margin-top: 12px; display: flex; gap: 10px; }

.level-msg { min-height: 30px; color: var(--ink-dim); font-style: italic; padding: 8px 4px; font-size: .92rem; }

/* ---------------- museum map ---------------- */
.profile-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.pchip { background: #131c3a; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: .88rem; }
.profile-btns { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.halls { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.hall-card { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--gold); padding: 14px; border-radius: var(--radius); }
.hall-head { display: flex; align-items: center; gap: 10px; }
.hall-icon { font-size: 1.7rem; }
.hall-name { font-weight: 700; display: block; }
.hall-sub { color: var(--ink-dim); font-size: .82rem; display: block; }
.hall-done { margin-left: auto; color: var(--ok); font-size: .85rem; }
.hall-levels { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.level-chip { display: flex; align-items: center; gap: 10px; width: 100%; background: #131c3a; border: 1px solid var(--line2); border-radius: 10px; padding: 9px 12px; color: var(--ink); cursor: pointer; font: inherit; }
.level-chip:hover { border-color: var(--gold); }
.level-chip.locked { opacity: .55; cursor: not-allowed; }
.lc-icon { font-size: 1.25rem; }
.lc-title { flex: 1; text-align: left; }
.lc-stars { color: var(--gold); letter-spacing: 2px; }
.lc-stars.earned { text-shadow: 0 0 10px rgba(255, 210, 63, .55); }
.map-foot { margin-top: 16px; }

/* ---------------- awards ---------------- */
.awards-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.awards-title { margin: 0; font-size: 1.3rem; }
.awards-head .btn { margin-left: auto; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.ach-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; }
.ach-card.earned { border-color: var(--gold); }
.ach-icon { font-size: 2.1rem; display: block; }
.ach-name { font-weight: 700; display: block; margin-top: 4px; }
.ach-desc { color: var(--ink-dim); font-size: .85rem; display: block; }
.ach-date { font-size: .75rem; color: var(--gold); display: block; margin-top: 6px; }

.cert-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 12px; }
.cert-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.cert-card.locked { opacity: .75; border-style: dashed; }
.cert-img { width: 100%; height: auto; border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.cert-lock { font-size: 2.4rem; display: block; text-align: center; padding: 24px 0; }
.cert-req { color: var(--ink-dim); font-size: .85rem; display: block; text-align: center; }
.cert-kind { display: block; margin-top: 8px; font-weight: 700; }
.cert-card .btn { margin-top: 10px; width: 100%; }

/* ---------------- modals ---------------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(5, 8, 18, .78); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; z-index: 60; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card { width: min(560px, 94vw); max-height: min(86vh, 88vh); overflow: auto; background: var(--panel); border: 1px solid #3a4a7a; border-radius: 16px; padding: 18px 20px 16px; position: relative; box-shadow: 0 24px 70px rgba(0, 0, 0, .55); animation: pop .18s ease; }
@keyframes pop { from { transform: translateY(10px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-card.wide { width: min(900px, 94vw); }
.modal-title { font-weight: 700; font-size: 1.15rem; margin: 0 0 10px; padding-right: 44px; }
.modal-x { position: absolute; top: 10px; right: 10px; background: none; border: none; color: var(--ink-dim); font-size: 1.1rem; cursor: pointer; }
.modal-x:hover { color: var(--ink); }
.modal-body { color: var(--ink); }
.modal-p { line-height: 1.5; }
.modal-p.big { font-size: 1.02rem; }
.modal-goal { color: var(--gold); }
.modal-note { color: var(--ink-dim); font-size: .85rem; }
.modal-fact { background: #1a2547; border-left: 3px solid var(--gold); padding: 10px 12px; border-radius: 8px; margin-top: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* quiz */
.quiz-q { font-weight: 700; margin: 0 0 12px; }
.quiz-opts { display: grid; gap: 8px; }
.quiz-opt { font: inherit; color: var(--ink); background: #131c3a; border: 1px solid var(--line2); border-radius: 8px; cursor: pointer; text-align: left; padding: 10px 14px; }
.quiz-opt:hover:not(:disabled), .quiz-opt:focus-visible { border-color: var(--gold); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt.correct { border-color: var(--ok); color: var(--ok); background: rgba(126, 247, 176, .12); }
.quiz-opt.wrong { border-color: var(--danger); color: #ffb1a1; }
.quiz-why { margin-top: 10px; background: #1a2547; border-left: 3px solid var(--teal); padding: 10px 12px; border-radius: 8px; }
.quiz-progress { margin-top: 10px; color: var(--ink-dim); font-size: .8rem; }

/* onboarding & settings */
.ob-ages { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.ob-age { font: inherit; background: #131c3a; color: var(--ink); border: 1px solid var(--line2); border-radius: 10px; padding: 9px 13px; cursor: pointer; font-size: .88rem; }
.ob-age:hover { border-color: var(--gold); }
.ob-age.active { border-color: var(--gold); color: var(--gold); }
.ob-label { display: block; margin: 10px 0 6px; font-size: .9rem; color: var(--ink-dim); }
.ob-name { width: 100%; padding: 10px; border-radius: 10px; background: #0f1730; border: 1px solid var(--line2); color: var(--ink); font: inherit; }
.ob-note { color: var(--ink-dim); font-size: .8rem; margin-top: 12px; }
.set-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.set-label { color: var(--ink-dim); font-size: .9rem; }
.set-fm { display: flex; gap: 6px; }
.set-fm-btn { font: inherit; background: #131c3a; color: var(--ink); border: 1px solid var(--line2); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: .85rem; }
.set-fm-btn.active { border-color: var(--gold); color: var(--gold); }
.set-vol { flex: 1; accent-color: var(--gold); }
.set-links { display: flex; gap: 14px; margin-top: 14px; flex-wrap: wrap; }

/* ---------------- toasts ---------------- */
#toasts { position: fixed; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 70; }
.toast { background: var(--panel); border: 1px solid #3a4a7a; border-radius: 10px; padding: 10px 14px; display: flex; gap: 10px; align-items: center; opacity: 0; transform: translateY(10px); transition: opacity .3s ease, transform .3s ease; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); max-width: 340px; }
.toast.show { opacity: 1; transform: none; }
.toast.hint { border-color: var(--gold); }
.toast-icon { font-size: 1.2rem; }

/* ---------------- consent banner ---------------- */
.consent { position: fixed; left: 50%; transform: translateX(-50%); bottom: 12px; z-index: 65; width: min(720px, 94vw); }
.consent-inner { background: var(--panel); border: 1px solid #3a4a7a; border-radius: 14px; padding: 14px 16px; box-shadow: 0 14px 44px rgba(0, 0, 0, .5); }
.consent-text { margin: 0 0 10px; font-size: .9rem; color: var(--ink-dim); }
.consent-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.consent-link { color: var(--teal); font-size: .85rem; }

/* ---------------- ad slots ---------------- */
.ad-slot { margin: 10px auto; max-width: 1120px; }
.ad-demo { border: 1px dashed #33427a; border-radius: 10px; padding: 10px 12px; display: flex; gap: 12px; align-items: center; justify-content: center; color: #6f7fb0; font-size: .8rem; min-height: 44px; flex-direction: column; }
.ad-top .ad-demo { min-height: 92px; }
.ad-foot .ad-demo { min-height: 72px; }
.ad-word { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: #5c6ba8; }
.ad-note { color: #5c6ba8; font-size: .78rem; }
#ad-side { display: none; }
@media (min-width: 1280px) {
  .content-grid { grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
  #ad-side { display: block; position: sticky; top: 72px; }
  #ad-side .ad-demo { min-height: 560px; justify-content: flex-start; }
}
.ad-slot.real ins { display: block; width: 100%; }

/* ---------------- footer ---------------- */
.sitefoot { padding: 12px 12px 26px; }
.foot-links { display: flex; gap: 14px; flex-wrap: wrap; color: var(--ink-dim); font-size: .8rem; margin-top: 10px; align-items: center; }
.foot-links a { color: var(--teal); text-decoration: none; }
.foot-links a:hover { color: var(--gold); }
.noscript { padding: 24px; text-align: center; color: var(--ink-dim); }

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

/* ---------------- small screens ---------------- */
@media (max-width: 640px) {
  .sitebar { gap: 10px; padding: 10px; flex-wrap: wrap; }
  .site-nav { gap: 10px; }
  .ctl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .ctl-row .ctl-label { grid-column: 1 / -1; }
  .ctl-slider { width: 100%; min-width: 0; margin: 0; }
  .ctl-choice { flex-wrap: wrap; }
  .ctl-label { min-width: 90px; }
  .hud-title { min-width: 160px; }
  .profile-btns { margin-left: 0; }
  .toast { max-width: 240px; }
}
