/* 
   Unfold 3D — styles
   Dark glass panels over the camera, gold accents (like the hand ring)
   */




:root {
  --bg: #05070d;
  --glass: rgba(14, 17, 27, 0.66);
  --glass-strong: rgba(14, 17, 27, 0.88);
  --line: rgba(255, 255, 255, 0.09);
  --text: #eef2fa;
  --muted: #9aa5bb;
  --gold: #ffc94d;
  --cyan: #7ee8fa;
  --green: #6ef2a8;
  --pink: #ff8fd8;
  --radius: 14px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Space Grotesk', var(--font);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  background: radial-gradient(ellipse at 60% 40%, #111a2e 0%, #080b15 55%, var(--bg) 100%);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* layers  */
#cam { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.6s; }
body.mirror #cam { transform: scaleX(-1); }
#camShade { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.6s; background: radial-gradient(ellipse at 60% 50%, rgba(5, 7, 13, 0.12), rgba(5, 7, 13, 0.55)); }
body.hand-on #cam, body.hand-on #camShade { opacity: 1; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#leader, #labels, #handLayer { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#leader polyline { stroke-width: 1; }
.hidden { visibility: hidden; }
#handCursor {
  position: fixed; left: -12px; top: -12px; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9); box-shadow: 0 0 14px rgba(255, 201, 77, 0.7);
  pointer-events: none; opacity: 0; transition: opacity 0.2s;
}





/*  labels (two columns, name + one line)  */
.label {
  position: absolute; left: 0; top: 0; max-width: 210px;
  display: flex; flex-direction: column; gap: 1px; padding: 3px 8px; text-align: left;
  background: none; border: 0; border-radius: 8px; transition: opacity 0.2s, background 0.2s;
}
.label.left { text-align: right; align-items: flex-end; }
.label b { font-size: 12.5px; font-weight: 600; color: var(--text); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9); white-space: nowrap; }
.label b::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: 2px; box-shadow: 0 0 8px var(--c); }
.label.left b::before { display: none; }
.label.left b::after { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--c); margin-left: 6px; vertical-align: 2px; box-shadow: 0 0 8px var(--c); }
.label i { font-style: normal; color: var(--gold); margin-left: 4px; }
.label span { font-size: 10.5px; color: #b6c0d3; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.95); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.label:hover, .label.active { background: rgba(14, 17, 27, 0.72); }




/* brand  */
#brand { position: fixed; top: 14px; left: 18px; display: flex; gap: 10px; align-items: center; pointer-events: none; }
.logo { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--gold); display: grid; place-items: center; box-shadow: 0 0 14px rgba(255, 201, 77, 0.5); }
.logo::after { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); }
#brand .name { font: 700 17px/1.1 var(--display); letter-spacing: 0.01em; }
#brand .name b { color: var(--gold); }
#brand .tag { font-size: 11px; color: var(--muted); }




/* left panel  */
#panel {
  position: fixed; top: 58px; left: 16px; bottom: 96px; width: 300px;
  display: flex; flex-direction: column;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform 0.35s ease, opacity 0.35s;
}
.panelBody { overflow-y: auto; padding: 14px 16px; scrollbar-width: thin; }
body.panel-closed #panel { transform: translateX(calc(-100% - 24px)); opacity: 0; }
#panelToggle {
  position: fixed; top: 58px; left: 324px; z-index: 3; width: 34px; height: 34px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 10px; transition: left 0.35s ease;
}
body.panel-closed #panelToggle { left: 16px; }
.chip { display: inline-block; font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--green); border: 1px solid rgba(110, 242, 168, 0.45); border-radius: 999px; padding: 2px 9px; }
#title { margin: 8px 0 2px; font: 700 21px/1.2 var(--display); }
.sub { margin: 0 0 8px; color: var(--muted); font-size: 12.5px; }
#crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 4px 0 8px; font-size: 12px; }
#crumbs button { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; }
#crumbs button:disabled { color: var(--gold); border-color: rgba(255, 201, 77, 0.5); cursor: default; }
#crumbs span { color: var(--muted); }
.rows { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin: 10px 0; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.rows dt { align-self: center; } .rows dd { margin: 0; }
.pill { display: inline-block; min-width: 76px; text-align: center; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); color: var(--text); }
.pill[data-state='formed'] { color: var(--green); border-color: rgba(110, 242, 168, 0.55); box-shadow: 0 0 12px rgba(110, 242, 168, 0.18); }
.pill[data-state='orb'], .pill[data-state='forming'], .pill[data-state='dissolving'], .pill[data-state='moving'] { color: var(--gold); border-color: rgba(255, 201, 77, 0.5); }
#handPill { text-transform: none; letter-spacing: 0; }
#handPill[data-state='off'] { color: var(--muted); }
.meter { display: flex; justify-content: space-between; margin-top: 8px; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.meter b { color: var(--text); letter-spacing: 0; }
.bar { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--gold)); border-radius: 3px; transition: width 0.1s; }
input[type='range'] { width: 100%; accent-color: var(--gold); margin: 6px 0 0; }
.hint { font-size: 11.5px; color: var(--muted); margin: 6px 0 4px; }
#panel h2 { font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
#gestures { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
#gestures li p { margin: 0; }
#gestures li { display: flex; gap: 8px; align-items: baseline; padding: 5px 8px; border-radius: 8px; border: 1px solid transparent; color: #c9d1e0; transition: background 0.2s, border-color 0.2s; }
#gestures li span { width: 18px; flex: none; }
#gestures li b { color: var(--text); }
#gestures li.active { background: rgba(255, 201, 77, 0.12); border-color: rgba(255, 201, 77, 0.45); }
.buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.buttons button { padding: 7px 8px; border-radius: 9px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); font-size: 13px; }
.buttons button:hover { border-color: rgba(255, 201, 77, 0.6); }
.buttons .wide { grid-column: span 2; color: var(--gold); }
details { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
summary { cursor: pointer; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
summary span { text-transform: none; letter-spacing: 0; color: var(--text); font-size: 12.5px; margin-left: 4px; }
.aboutRow { display: flex; gap: 8px; align-items: flex-start; }
#infoText { font-size: 13px; color: #d2d9e6; margin: 8px 0 0; }
button.icon { flex: none; width: 32px; height: 32px; border-radius: 9px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); margin-top: 8px; }
#partList { list-style: none; margin: 6px 0 0; padding: 0; }
#partList button { width: 100%; display: flex; align-items: center; gap: 8px; text-align: left; padding: 5px 6px; border-radius: 8px; border: 1px solid transparent; background: none; font-size: 13px; }
#partList button:hover { background: rgba(255, 255, 255, 0.05); border-color: var(--line); }
#partList i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
#partList span { flex: 1; } #partList em { font-style: normal; color: var(--muted); font-size: 11.5px; } #partList b { color: var(--gold); }




/* top right */
#topRight { position: fixed; top: 12px; right: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
#stats { font: 500 11px var(--font); color: var(--muted); background: var(--glass); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }
#tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; pointer-events: auto; max-width: min(560px, 60vw); }
#tools button, #tools select { height: 32px; min-width: 32px; padding: 0 8px; border-radius: 8px; background: var(--glass); border: 1px solid var(--line); font-size: 14px; backdrop-filter: blur(10px); }
#tools select { font-size: 12px; background: var(--glass-strong); }
#tools button:hover { border-color: rgba(255, 201, 77, 0.6); }
#tools button.on { background: rgba(255, 201, 77, 0.18); border-color: var(--gold); }
#tools button.loading { animation: pulse 1s infinite; }
#tools button.rec { background: rgba(255, 80, 100, 0.25); border-color: #ff5a6e; color: #ff9aa6; animation: pulse 1.2s infinite; }
#camBtn { display: none; } body.hand-on #camBtn { display: inline-block; }
@keyframes pulse { 50% { opacity: 0.5; } }
#bigTitle { margin-top: 10px; font: 700 26px/1.15 var(--display); text-align: right; text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6); }
#bigSub { font-size: 12px; color: var(--muted); text-align: right; max-width: 320px; }



/* status toast (top centre)      */
#status {
  position: fixed; top: 14px; left: 50%; transform: translate(-50%, -8px);
  padding: 6px 16px; border-radius: 999px; font-size: 13px; font-weight: 500;
  background: var(--glass-strong); border: 1px solid rgba(255, 201, 77, 0.4);
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; max-width: calc(100vw - 32px); text-align: center;
}
#status.show { opacity: 1; transform: translate(-50%, 0); }

/* bottom category bar  */
#catBar {
  position: fixed; left: 0; right: 0; bottom: 14px; margin: 0 auto; width: fit-content;
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 10px;
  max-width: calc(100vw - 24px);
  background: var(--glass-strong); border: 1px solid var(--line); border-radius: 16px; backdrop-filter: blur(14px);
}
#catTabs, #chips { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
#catTabs button { background: none; border: 1px solid transparent; border-radius: 8px; padding: 3px 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
#catTabs button em { font-style: normal; opacity: 0.7; margin-left: 2px; }
#catTabs button.on { color: var(--text); border-color: rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.06); }
#chips button { display: flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); font-size: 12.5px; white-space: nowrap; }
#chips button i { width: 7px; height: 7px; border-radius: 50%; }
#chips button.on { border-color: var(--cyan); background: rgba(126, 232, 250, 0.12); }





/*  small pop-ups  */
#tip { position: fixed; left: 0; top: 0; pointer-events: none; opacity: 0; display: flex; flex-direction: column; gap: 1px; padding: 8px 12px; border-radius: 10px; max-width: 270px; background: var(--glass-strong); border: 1px solid rgba(255, 201, 77, 0.35); transition: opacity 0.15s; }
#tip.show { opacity: 1; }
#tip b { font-size: 14px; } #tip span { font-size: 12px; color: #c3cbdb; } #tip em { font-style: normal; font-size: 11.5px; color: var(--gold); margin-top: 3px; }
#quizBar { position: fixed; top: 52px; left: 50%; transform: translate(-50%, -8px); display: flex; align-items: center; gap: 14px; padding: 7px 10px 7px 18px; border-radius: 999px; background: var(--glass-strong); border: 1px solid var(--gold); opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; }
#quizBar.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
#quizQ { font-weight: 600; } #quizScore { color: var(--gold); font-family: var(--display); }
#quizClose { background: none; border: 1px solid var(--line); border-radius: 50%; width: 26px; height: 26px; }





/* hand diagnostics  */
#diag { position: fixed; right: 16px; bottom: 110px; z-index: 5; width: 330px; padding: 12px 14px; border-radius: 12px; background: var(--glass-strong); border: 1px solid rgba(126, 232, 250, 0.4); font-size: 12px; }
#diag h2 { margin: 0 0 8px; font-size: 13px; }
#diag h2 small { color: var(--muted); font-weight: 400; margin-left: 6px; }
#diag dl { display: grid; grid-template-columns: 92px 1fr; gap: 3px 8px; margin: 0; }
#diag dt { color: var(--muted); } #diag dd { margin: 0; font-variant-numeric: tabular-nums; }
#diag p { margin: 8px 0 0; color: var(--muted); }
.card p.small { font-size: 12px; margin: 0 0 6px; color: var(--muted); }




/* help and file warning  */
#help, #fileWarn { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; background: rgba(5, 7, 13, 0.72); backdrop-filter: blur(6px); }
.card { width: min(720px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px 24px; border-radius: 18px; background: var(--glass-strong); border: 1px solid rgba(255, 201, 77, 0.4); }
.card h2 { margin: 0 0 6px; font: 700 22px var(--display); }
.card h3 { font-size: 13px; color: var(--gold); margin: 12px 0 6px; }
.card p { color: #c9d1e0; margin: 0 0 8px; }
.card ul { margin: 0; padding-left: 18px; color: #c9d1e0; font-size: 13px; }
.card li { margin: 4px 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.helpButtons { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
/* on a small screen the start buttons stay in view while the card scrolls */
@media (max-width: 700px) {
  .helpButtons { position: sticky; bottom: -22px; margin: 16px -24px -22px; padding: 12px 16px 14px; gap: 8px; background: #0b101b; border-top: 1px solid var(--line); }
  .helpButtons button { flex: 1 1 40%; padding: 9px 10px; font-size: 13px; }
}
#helpCamera, #helpBack { padding: 10px 20px; border-radius: 10px; border: 1px solid var(--gold); background: rgba(255, 201, 77, 0.22); font-weight: 700; }
#helpClose { padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); }
#tools .camBtn { padding: 0 12px; font-weight: 600; }
#tools .camBtn span { font-size: 12.5px; }
.card pre { background: #000; padding: 10px 12px; border-radius: 8px; color: var(--green); overflow-x: auto; }



/* phones  */
@media (max-width: 760px) {
  #brand .tag { display: none; }
  #brand { top: 10px; left: 12px; }
  #panelToggle { top: 10px; left: auto; right: 12px; }
  body.panel-closed #panelToggle { left: auto; }
  #panel { top: auto; left: 8px; right: 8px; bottom: 112px; width: auto; max-height: 52vh; }
  body.panel-closed #panel { transform: translateY(calc(100% + 130px)); }
  #topRight { top: 50px; right: 8px; }
  #tools { max-width: 58vw; }
  #tools button, #tools select { height: 30px; min-width: 30px; padding: 0 6px; font-size: 13px; }
  #stats, #bigSub, #quality, #fullBtn { display: none; }
  #bigTitle { font-size: 18px; }
  #catBar { bottom: 8px; width: calc(100vw - 16px); padding: 6px; }
  #catTabs, #chips { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; width: 100%; scrollbar-width: none; }
  #catTabs button { flex: none; } #chips button { flex: none; font-size: 12px; }
  .label b { font-size: 11px; } .label span { display: none; }
  .cols { grid-template-columns: 1fr; }
  #status { top: 52px; font-size: 12px; }
}
