:root {
  --bg: #071522;
  --glass: rgba(12, 31, 44, 0.88);
  --glass-edge: rgba(99, 193, 181, 0.24);
  --text: #effaf7;
  --muted: #9cbabf;
  --accent: #62e3c4;
  --accent-2: #d5a977;
  --good: #5dffa0;
  --warn: #ff7a6b;
  --radius: 20px;
  --font: Arial, "Helvetica Neue", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); overflow: hidden; }
canvas#gl, canvas#overlay { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
canvas#overlay { pointer-events: none; }
video#cam { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
button { font: inherit; color: inherit; cursor: pointer; }

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ---------- brand */
.brand { position: fixed; top: 18px; left: 20px; display: flex; gap: 12px; align-items: center; z-index: 5; pointer-events: none; }
.brand-name { font-weight: 700; letter-spacing: 0.2em; font-size: 21px; }
.brand-sub { color: var(--muted); font-size: 12px; letter-spacing: 0.06em; }
.logo { width: 44px; height: 44px; display: block; filter: drop-shadow(0 0 12px rgba(98, 227, 196, .18)); }
.logo.big { width: 72px; height: 72px; margin: 0 auto 16px; }

/* ---------- left panel */
.panel { position: fixed; top: 88px; left: 20px; width: 300px; max-height: calc(100vh - 170px); overflow: auto; padding: 16px 16px 12px; z-index: 4; }
.panel section + section { margin-top: 14px; }
.now .cat { display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent); border: 1px solid rgba(98, 227, 196, 0.35); padding: 2px 8px; border-radius: 99px; }
.now h1 { margin: 8px 0 2px; font-size: 24px; line-height: 1.15; }
.fact { margin: 0; color: #c3d9dc; font-size: 15px; line-height: 1.45; }
.k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }
.status .row { display: flex; justify-content: space-between; align-items: center; margin: 6px 0; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.1); text-transform: uppercase; letter-spacing: 0.06em; }
.pill[data-state="sphere"] { color: var(--accent); border-color: rgba(98, 227, 196, 0.5); }
.pill[data-state="formed"] { color: var(--good); border-color: rgba(93, 255, 160, 0.5); }
.pill[data-state="dissolve"] { color: var(--warn); border-color: rgba(255, 122, 107, 0.5); }
.pill.pose { text-transform: none; }
.sensitivity { margin-top: 10px; }
.sensitivity-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.sensitivity select { max-width: 145px; padding: 4px 7px; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 7px; background: #101826; color: var(--text); font: inherit; font-size: 12px; }
.sensitivity .hint { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.3; }
.meter { margin-top: 10px; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.meter-head b { font-size: 13px; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; transition: width 0.08s linear; }
.explode input[type="range"] { width: 100%; accent-color: var(--accent-2); }
.explode .hint { color: var(--muted); font-size: 11px; margin-top: 2px; }
.guide { list-style: none; padding: 0; margin: 6px 0 0; }
.guide li { display: grid; grid-template-columns: 30px 1fr; gap: 6px; align-items: center; padding: 6px 8px; border-radius: 10px; font-size: 15px; line-height: 1.45; color: #c3d9dc; transition: background 0.2s, color 0.2s; }
.guide li .e { font-size: 18px; text-align: center; }
.guide li b { color: var(--text); font-weight: 650; }
.guide li.hot { background: rgba(98, 227, 196, 0.1); color: var(--text); box-shadow: inset 0 0 0 1px rgba(98, 227, 196, 0.25); }
.buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.buttons button, .start-buttons button { background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 10px; padding: 8px 10px; font-size: 13px; transition: background 0.15s, border-color 0.15s, transform 0.1s; }
.buttons button:hover, .start-buttons button:hover { background: rgba(98, 227, 196, 0.14); border-color: rgba(98, 227, 196, 0.4); }
button:active { transform: translateY(1px); }
button:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- catalog: category tabs + chips */
.catalog { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 8px 12px; z-index: 4; width: max-content; max-width: min(1180px, calc(100vw - 32px)); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.tab { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; padding: 4px 10px; border-radius: 8px; background: transparent; border: 1px solid transparent; color: var(--muted); }
.tab:hover { color: var(--text); }
.tab.active { color: #fff; border-color: rgba(98, 227, 196, 0.45); background: rgba(98, 227, 196, 0.1); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.chip { white-space: nowrap; font-size: 11.5px; padding: 5px 9px; border-radius: 99px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); display: inline-flex; align-items: center; gap: 6px; }
.chip[hidden] { display: none; }
.chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; box-shadow: 0 0 8px currentColor; }
.chip:hover { border-color: rgba(98, 227, 196, 0.45); }
.chip.active { background: rgba(98, 227, 196, 0.16); border-color: var(--accent); color: #fff; }

/* ---------- part card + quiz */
.part-card { position: fixed; right: 16px; top: 288px; width: 300px; padding: 12px 14px; z-index: 6; font-size: 15px; }
.part-card[hidden], .quiz[hidden] { display: none; }
.part-card .phead { display: flex; align-items: center; gap: 8px; }
.part-card .swatch { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 10px currentColor; flex: none; }
.part-card .pname { font-weight: 800; font-size: 20px; flex: 1; }
.part-card .pinfo { margin: 8px 0 6px; color: var(--text); line-height: 1.5; font-size: 16px; }
.part-card .pmodel, .part-card .phint { color: #c3d9dc; font-size: 13px; line-height: 1.4; }
.part-card .pactions { display: flex; gap: 6px; margin: 8px 0 6px; }
.part-card .pactions button { flex: 1; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 8px; padding: 5px 8px; font-size: 12px; }
.part-card.pulled { border-color: rgba(255, 159, 67, 0.7); box-shadow: 0 0 24px rgba(255, 159, 67, 0.25); }
.x { background: transparent; border: none; color: var(--muted); font-size: 14px; padding: 2px 4px; }
.quiz { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); min-width: 360px; max-width: calc(100vw - 32px); padding: 10px 40px 10px 18px; z-index: 6; text-align: center; }
.quiz .q { font-weight: 800; font-size: 20px; }
.quiz .qs { color: var(--muted); font-size: 12px; margin-top: 2px; }
.quiz .qf { margin-top: 6px; font-size: 13px; }
.quiz.good { border-color: rgba(93, 255, 160, 0.6); }
.quiz.bad { border-color: rgba(255, 122, 107, 0.6); }
.quiz .x { position: absolute; right: 8px; top: 8px; }
.rec { color: #ff5a5a; font-weight: 700; }

/* ---------- top right */
.top-right { position: fixed; top: 74px; right: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 5; }
.stats { font-size: 11px; color: var(--muted); padding: 8px 12px; font-variant-numeric: tabular-nums; line-height: 1.5; text-align: right; }
.stats b { color: var(--text); font-weight: 650; }
.icons { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 330px; }
.icon { width: 36px; height: 36px; border-radius: 10px; background: var(--glass); border: 1px solid var(--glass-edge); font-size: 15px; }
.icon.on { border-color: rgba(98, 227, 196, 0.55); box-shadow: 0 0 12px rgba(98, 227, 196, 0.25); }
.help { position: fixed; top: 288px; right: 16px; width: 330px; padding: 14px 16px; z-index: 6; font-size: 15px; }
.help h2 { margin: 0 0 8px; font-size: 15px; }
.help td { padding: 4px 6px; vertical-align: top; color: var(--muted); }
.help td:first-child { white-space: nowrap; color: var(--text); }
kbd { font-family: inherit; font-size: 11px; padding: 1px 6px; border: 1px solid rgba(255, 255, 255, 0.25); border-bottom-width: 2px; border-radius: 6px; background: rgba(255, 255, 255, 0.06); }

/* ---------- titles, toast */
.big-title { position: fixed; right: 5vw; top: 282px; text-align: right; z-index: 3; opacity: 0; transform: translateY(8px); transition: opacity 0.6s, transform 0.6s; pointer-events: none; text-shadow: 0 0 24px rgba(0, 0, 0, 0.8); }
.big-title.show { opacity: 1; transform: none; }
.big-title .t { font-size: clamp(22px, 3.2vw, 44px); font-weight: 800; letter-spacing: 0.02em; }
.big-title .s { color: var(--muted); font-size: 14px; margin-top: 2px; }
.toast { position: fixed; left: 50%; top: 20px; transform: translate(-50%, -8px); background: rgba(8, 14, 24, 0.8); border: 1px solid var(--glass-edge); padding: 8px 16px; border-radius: 99px; font-size: 14px; opacity: 0; transition: opacity 0.25s, transform 0.25s; z-index: 7; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- recording format */
.record-format-backdrop { position: fixed; inset: 0; z-index: 24; display: grid; place-items: center; padding: 20px; background: rgba(3, 13, 22, 0.72); backdrop-filter: blur(12px); }
.record-format-backdrop[hidden] { display: none; }
.record-format { position: relative; width: min(560px, 100%); padding: 26px; border-top: 2px solid var(--accent); }
.record-format .x { position: absolute; top: 12px; right: 12px; }
.record-kicker { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.record-format h2 { margin: 7px 0 6px; font-size: 25px; }
.record-format > p { margin: 0 0 18px; color: var(--muted); }
.record-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.record-options button { min-height: 132px; padding: 18px; text-align: left; border-radius: 14px; border: 1px solid var(--glass-edge); background: rgba(255,255,255,.045); color: var(--text); }
.record-options button:not(:disabled):hover { border-color: var(--accent); background: rgba(98,227,196,.1); transform: translateY(-1px); }
.record-options b { display: block; font-size: 25px; letter-spacing: .04em; }
.record-options span { display: block; margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.record-options small { display: block; margin-top: 10px; color: var(--accent); }
.record-options button:disabled { opacity: .48; cursor: not-allowed; }
.record-options button:disabled small { color: var(--accent-2); }
.record-format .record-note { min-height: 1.3em; margin: 14px 0 0; font-size: 12px; }
@media (max-width: 560px) { .record-options { grid-template-columns: 1fr; } .record-options button { min-height: 108px; } }

/* ---------- start overlay */
.start { position: fixed; inset: 0; display: grid; place-items: center; z-index: 10; background: radial-gradient(ellipse at 60% 40%, rgba(23, 94, 89, 0.35), rgba(5, 17, 29, 0.94)); padding: 16px; }
.start[hidden] { display: none; }
.start-card { max-width: 560px; padding: 28px 30px; text-align: center; }
.start-card h1 { margin: 4px 0 12px; font-size: 34px; letter-spacing: 0.22em; }
.start-card p { color: var(--muted); margin: 0 0 12px; line-height: 1.5; }
.steps { text-align: left; color: var(--muted); line-height: 1.55; margin: 0 0 18px; padding-left: 22px; }
.steps b { color: var(--text); }
.start-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.start-buttons button { padding: 11px 18px; font-size: 15px; }
.start-buttons .primary { background: linear-gradient(90deg, rgba(98, 227, 196, 0.35), rgba(213, 169, 119, 0.3)); border-color: rgba(98, 227, 196, 0.6); font-weight: 700; }
.start-msg { min-height: 1.4em; margin-top: 12px !important; color: var(--accent-2) !important; }

@media (max-width: 820px) {
  .panel { width: calc(100vw - 32px); left: 16px; top: auto; bottom: 86px; max-height: 38vh; }
  .brand-sub { display: none; }
  .big-title { right: 16px; top: 70px; }
  .help { width: calc(100vw - 32px); }
}

/* LUMORA language controls stay reachable above the welcome screen. */
.language-switch { position: fixed; top: 20px; right: 20px; z-index: 20; display: flex; gap: 3px; padding: 4px; border: 1px solid var(--glass-edge); border-radius: 12px; background: #0c2432; }
.language-switch button { border: 0; border-radius: 8px; padding: 7px 12px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 750; min-height: 32px; }
.language-switch button[aria-pressed="true"] { background: var(--accent); color: #082c2b; }
.start-card { max-height: calc(100svh - 100px); overflow: auto; border-top: 2px solid var(--accent); }
.start { padding-top: 76px; }
@media (max-width: 820px) {
  .top-right { top: 76px; }
  .big-title { top: 278px; max-width: calc(100vw - 32px); }
  .big-title .t { font-size: 21px; }
  .big-title .s { font-size: 11px; }
  .brand { top: 16px; left: 16px; }
  .brand-name { font-size: 18px; }
  .language-switch { right: 16px; top: 18px; }
  .start-card { padding: 20px; }
}

.sound-controls { display:flex; align-items:center; gap:8px; padding:6px 10px; font-size:11px; }
.sound-controls button { background:transparent; border:0; min-width:32px; min-height:32px; }
.sound-controls input { width:90px; accent-color:var(--accent); }
