/* Camera Real World — a camera workspace with a realistic 3D globe, country facts, face masks and capture/share tools. */
:root {
  color-scheme: dark;
  --ink: #060a12; --panel: rgba(9, 14, 24, .82); --panel-solid: #0d1422; --line: rgba(190, 215, 245, .14); --line-2: rgba(190, 215, 245, .24);
  --text: #f2f6fc; --mute: rgba(214, 226, 244, .64); --accent: #79d7ff; --accent-2: #53b8ed; --gold: #ffc24a; --red: #ff5a6e; --mint: #83e6c0;
  --rail: 292px; --rail-mini: 76px; --radius: 14px;
  --shadow: 0 22px 70px rgba(0, 0, 0, .45);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--text); font: 14px/1.4 var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; }
#cam { position: absolute; width: 2px; height: 2px; opacity: 0; pointer-events: none; }
#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; cursor: grab; }
#stage.dragging { cursor: grabbing; }
.hide { display: none !important; }

button, .btn {
  font: inherit; font-size: 12.5px; font-weight: 650; color: #edf5ff; text-decoration: none;
  background: linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.035));
  border: 1px solid var(--line); border-radius: 11px; height: 38px; padding: 0 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
}
button:hover, .btn:hover { background: rgba(121,215,255,.13); border-color: rgba(121,215,255,.42); }
button:active, .btn:active { transform: scale(.97); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: .4; cursor: default; }
button.primary, .btn.primary { background: linear-gradient(135deg, #8be1ff, var(--accent-2)); color: #07121b; border-color: transparent; box-shadow: 0 7px 22px rgba(83,184,237,.25); }
button.primary:hover, .btn.primary:hover { background: linear-gradient(135deg, #b2edff, #70ccf6); }
.hand-hover { background: rgba(255,194,74,.22) !important; border-color: var(--gold) !important; box-shadow: 0 0 0 2px var(--gold) !important; }
.ic-btn { width: 34px; height: 34px; padding: 0; border-radius: 10px; font-size: 16px; flex: none; }
.sq { width: 38px; padding: 0; font-size: 18px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); display: inline-block; flex: none; }
@keyframes blink { 50% { opacity: .25; } }

/* ───────── Side bar ───────── */
#rail {
  position: fixed; z-index: 20; top: 12px; left: 12px; bottom: 12px; width: var(--rail);
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%); box-shadow: var(--shadow);
  transition: width .22s cubic-bezier(.2,.8,.3,1), transform .25s cubic-bezier(.2,.8,.3,1);
  overflow: hidden;
}
.rail-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px; border-bottom: 1px solid var(--line); }
.rail-back { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 12px; background: rgba(255,255,255,.05); border: 1px solid var(--line); flex: none; }
.rail-back:hover { border-color: rgba(121,215,255,.42); background: rgba(121,215,255,.12); }
.rail-brand { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; overflow: hidden; }
.rail-brand i { width: 9px; height: 9px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 16px rgba(121,215,255,.85); transform: rotate(45deg); flex: none; }
.rail-brand b { color: var(--accent); }
.rail-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 12px 12px; scrollbar-width: thin; scrollbar-color: rgba(190,215,245,.2) transparent; }
.rs { padding: 12px 0 6px; border-bottom: 1px solid var(--line); }
.rs:last-child { border-bottom: 0; }
.rs h3 { margin: 0 2px 9px; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--mute); font-weight: 800; }
.rgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.rb { height: 40px; justify-content: flex-start; padding: 0 10px; gap: 9px; border-radius: 11px; min-width: 0; }
.rb .ri { width: 22px; flex: none; display: inline-grid; place-items: center; font-size: 16px; line-height: 1; }
.rb .rl { overflow: hidden; text-overflow: ellipsis; }
.rb.on { background: rgba(121,215,255,.16); border-color: rgba(121,215,255,.55); color: #dff6ff; }
.rb em { font-style: normal; font-size: 10.5px; padding: 1px 6px; border-radius: 99px; background: rgba(121,215,255,.2); color: var(--accent); margin-left: 2px; }
#recBtn.recording { background: var(--red); border-color: var(--red); color: #fff; }
#recBtn.recording .dot { background: #fff; border-radius: 2px; animation: blink .8s steps(2) infinite; }
.rsel { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--mute); }
.rsel span { width: 56px; flex: none; }
select { flex: 1; min-width: 0; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: rgba(3,8,15,.72); color: var(--text); font: inherit; font-size: 12.5px; padding: 0 8px; }
.rsearch { margin-bottom: 8px; }
.rsearch input, input[type=text] { width: 100%; height: 40px; padding: 0 12px 0 34px; border-radius: 11px; border: 1px solid var(--line-2); color: var(--text); font: inherit;
  background: rgba(3,8,15,.72) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2379d7ff' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E") 11px 50% no-repeat; }
.rnote { margin: 8px 2px 4px; font-size: 11.5px; color: var(--mute); line-height: 1.45; }
.rail-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
#railOpen { position: fixed; z-index: 19; top: 14px; left: 14px; width: 44px; height: 44px; border-radius: 13px; font-size: 18px; display: none; background: var(--panel); backdrop-filter: blur(16px); }

/* collapsed: icon rail */
body.rail-mini #rail { width: var(--rail-mini); }
body.rail-mini .rl { display: none !important; }
body.rail-mini .rail-head { flex-direction: column; padding: 10px 8px; }
body.rail-mini .rail-back { width: 44px; justify-content: center; padding: 0; }
body.rail-mini #railToggle span { display: inline-block; transform: rotate(180deg); }
body.rail-mini .rail-scroll { padding: 4px 8px 10px; }
body.rail-mini .rgrid { grid-template-columns: 1fr; }
body.rail-mini .rb { justify-content: center; padding: 0; }
body.rail-mini .rail-foot { grid-template-columns: 1fr; padding: 8px; }
body.rail-mini .rs h3 { display: none; }

/* ───────── Status chips ───────── */
#status { position: fixed; z-index: 15; top: 14px; right: 14px; display: flex; gap: 6px; pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); font-size: 11.5px; font-weight: 700; letter-spacing: .02em; backdrop-filter: blur(14px); font-variant-numeric: tabular-nums; }
.chip.live { color: var(--mint); }
.chip.rec { background: var(--red); border-color: var(--red); color: #fff; }
.chip.rec .dot { background: #fff; animation: blink .8s steps(2) infinite; }

/* ───────── Country card ───────── */
#card {
  position: fixed; z-index: 16; top: 56px; right: 14px; bottom: 82px; width: min(370px, calc(100vw - 28px)); overflow-y: auto;
  background: linear-gradient(160deg, rgba(16,25,40,.94), rgba(8,13,22,.94)); border: 1px solid rgba(255,194,74,.45); border-radius: 20px;
  box-shadow: var(--shadow); backdrop-filter: blur(22px); padding: 18px 18px 14px; scrollbar-width: thin; animation: cardin .25s ease-out;
}
@keyframes cardin { from { opacity: 0; transform: translateX(16px); } }
#card header { display: flex; align-items: center; gap: 12px; }
.cflag { font-size: 40px; line-height: 1; flex: none; }
.ctitle { flex: 1; min-width: 0; }
.ctitle h2 { margin: 0; font-size: 23px; letter-spacing: -.02em; line-height: 1.15; }
.ctitle small { display: block; color: var(--mute); font-size: 12px; margin-top: 2px; }
.k { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }
.cpop { margin: 16px 0 6px; padding: 14px; border-radius: 14px; background: rgba(255,194,74,.07); border: 1px solid rgba(255,194,74,.18); }
.cpop b { display: block; font-size: 30px; color: var(--gold); letter-spacing: -.02em; margin: 3px 0 1px; font-variant-numeric: tabular-nums; }
.cpop small { display: block; color: var(--mute); font-size: 12px; }
.cbar { height: 7px; border-radius: 4px; background: rgba(255,255,255,.1); margin-top: 10px; overflow: hidden; }
.cbar i { display: block; height: 100%; background: var(--gold); border-radius: 4px; min-width: 4px; transition: width .4s; }
#cFacts { display: grid; grid-template-columns: 104px 1fr; gap: 0; margin: 10px 0; }
#cFacts dt, #cFacts dd { padding: 7px 0; border-bottom: 1px solid var(--line); margin: 0; }
#cFacts dt { font-size: 10.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--mute); padding-top: 9px; }
#cFacts dd { font-size: 13.5px; font-weight: 600; }
.cnb { display: flex; flex-wrap: wrap; gap: 5px; margin: 7px 0 12px; }
.cnb button { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 99px; }
.cnb .none { color: var(--mute); font-size: 12.5px; }
.cact { display: flex; gap: 6px; flex-wrap: wrap; position: sticky; bottom: -14px; padding: 10px 0 2px; background: linear-gradient(transparent, rgba(8,13,22,.96) 30%); }
.cact button { flex: 1; }

/* ───────── World bar ───────── */
#worldBar { position: fixed; z-index: 14; bottom: 14px; left: calc(50% + var(--rail) / 2 + 6px); transform: translateX(-50%); display: flex; gap: 6px; padding: 7px; border-radius: 17px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(22px); box-shadow: var(--shadow); max-width: calc(100vw - var(--rail) - 48px); overflow-x: auto; scrollbar-width: none; }
body.rail-mini #worldBar { left: calc(50% + var(--rail-mini) / 2 + 6px); max-width: calc(100vw - var(--rail-mini) - 48px); }
#worldBar button { height: 36px; flex: none; }
body.no-globe #worldBar, body.no-globe #card { display: none !important; }

#hint { position: fixed; z-index: 13; left: calc(50% + var(--rail) / 2 + 6px); transform: translateX(-50%); bottom: 76px; background: rgba(8,12,20,.82); border: 1px solid rgba(121,215,255,.25); padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; opacity: 0; transition: opacity .25s; pointer-events: none; max-width: min(640px, 80vw); text-align: center; backdrop-filter: blur(14px); }
body.rail-mini #hint { left: calc(50% + var(--rail-mini) / 2 + 6px); }
#hint.show { opacity: 1; }
#toast { position: fixed; z-index: 40; left: 50%; top: 16px; transform: translateX(-50%) translateY(-8px); background: #b7edff; color: #07121b; font-weight: 700; font-size: 13px; padding: 10px 16px; border-radius: 12px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: 90vw; text-align: center; box-shadow: var(--shadow); }
#toast.show { opacity: 1; transform: translateX(-50%); }
#count { position: fixed; inset: 0; z-index: 35; display: none; place-items: center; font-size: 30vh; font-weight: 800; text-shadow: 0 8px 45px rgba(0,0,0,.8); pointer-events: none; }
#count.show { display: grid; animation: countpop .95s ease-out both; }
@keyframes countpop { 0% { transform: scale(1.5); opacity: 0; } 15% { transform: scale(1); opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
#flash { position: fixed; inset: 0; z-index: 36; background: #fff; opacity: 0; pointer-events: none; }
#flash.go { animation: flash .45s ease-out; }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }

/* clean view for filming */
#filmBar { position: fixed; top: 12px; right: 12px; z-index: 30; display: none; align-items: center; gap: 10px; background: rgba(8,12,20,.86); border: 1px solid var(--line); border-radius: 13px; padding: 6px 6px 6px 14px; font-weight: 700; font-variant-numeric: tabular-nums; backdrop-filter: blur(18px); }
#filmBar button { height: 32px; }
body.clean #filmBar { display: flex; }
body.clean #rail, body.clean #railOpen, body.clean #worldBar, body.clean #hint, body.clean #status, body.clean #card { display: none !important; }
#filmBar .dot, #filmBar #filmTime, #filmBar #filmStop { display: none; }
#filmBar.filming .dot { display: block; animation: blink .8s steps(2) infinite; }
#filmBar.filming #filmTime, #filmBar.filming #filmStop { display: inline-flex; }

/* ───────── Modals ───────── */
.modal { position: fixed; inset: 0; z-index: 50; display: none; place-items: center; background: rgba(3,7,13,.72); backdrop-filter: blur(10px); padding: 20px; }
.modal.open { display: grid; }
.card { background: linear-gradient(155deg, rgba(20,29,44,.98), rgba(11,17,28,.98)); border: 1px solid rgba(190,215,245,.17); border-radius: 22px; padding: clamp(22px, 4vw, 34px); width: min(620px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 28px 90px rgba(0,0,0,.55); }
.card.wide { width: min(860px, 100%); }
.card h1 { margin: 0 0 8px; font-size: clamp(28px, 4vw, 38px); letter-spacing: -.035em; }
.card h1 b, .card h3 { color: var(--accent); }
.card h2 { margin: 0 0 14px; font-size: 22px; letter-spacing: -.02em; }
.card h3 { margin: 4px 0 8px; font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; }
.card p { line-height: 1.6; }
.card .lead { color: rgba(230,238,250,.86); font-size: 15px; }
.card ul { margin: 0; padding-left: 18px; line-height: 1.6; color: rgba(230,238,250,.9); }
.card li { margin-bottom: 4px; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px 26px; }
kbd { font: 700 11px var(--font); padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line-2); background: rgba(255,255,255,.06); }
.steps { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 12px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.steps .n { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid rgba(121,215,255,.65); color: var(--accent); background: rgba(121,215,255,.08); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; justify-content: flex-end; }
.actions button, .actions .btn { height: 44px; padding: 0 20px; font-size: 14px; }
#startModal .actions { justify-content: flex-start; }
.small { font-size: 12px; color: var(--mute); line-height: 1.5; }
.status { min-height: 20px; margin-top: 12px; color: var(--accent); font-weight: 600; }
.set { display: grid; grid-template-columns: 1fr 200px; gap: 16px 22px; align-items: center; }
.set label { color: var(--text); font-weight: 600; }
.set small { display: block; color: var(--mute); font-size: 12px; font-weight: 500; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); justify-self: start; }
.ghead { display: flex; align-items: baseline; gap: 12px; }
.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.gi { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: rgba(255,255,255,.03); display: flex; flex-direction: column; }
.gi img, .gi video { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: #000; display: block; }
.gi .gm { padding: 8px 10px 4px; font-size: 11.5px; color: var(--mute); display: flex; justify-content: space-between; }
.gi .ga { display: flex; gap: 4px; padding: 6px 8px 8px; }
.gi .ga button { flex: 1; height: 32px; padding: 0 6px; font-size: 11.5px; }

/* ───────── Small screens: the side bar becomes a drawer ───────── */
@media (max-width: 760px) {
  :root { --rail: min(300px, 86vw); }
  #rail { top: 0; left: 0; bottom: 0; border-radius: 0 20px 20px 0; transform: translateX(-105%); }
  body.rail-open #rail { transform: none; }
  body.rail-mini #rail { width: var(--rail); }
  body.rail-mini .rl { display: revert !important; }
  #railOpen { display: grid; }
  body.rail-open #railOpen { display: none; }
  #worldBar, body.rail-mini #worldBar { left: 50%; max-width: calc(100vw - 16px); bottom: 8px; }
  #worldBar button { padding: 0 10px; font-size: 11.5px; }
  #hint, body.rail-mini #hint { left: 50%; bottom: 64px; font-size: 12px; }
  #card { top: auto; bottom: 62px; left: 8px; right: 8px; width: auto; max-height: 46vh; border-radius: 18px; }
  #status { top: 18px; }
  .set { grid-template-columns: 1fr; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ───────── Hidden side bar (opened again with the hand string or the ☰ button) ───────── */
@media (min-width: 761px) {
  body.rail-hidden #rail { transform: translateX(calc(-100% - 24px)); pointer-events: none; }
  body.rail-hidden #railOpen { display: grid; }
  body.rail-hidden #worldBar, body.rail-hidden #hint { left: 50%; max-width: calc(100vw - 48px); }
}
/* with the spin pad on screen the hint moves to the top */
body.pad-on #hint { bottom: auto; top: 62px; }
