/* Neutral, quiet chrome so the color on the stage is the only thing that stands out. System fonts, no web font. */
:root {
  --bg: #f4f5f7; --surface: #ffffff; --ink: #16181d; --muted: #5a6070; --line: #dfe2e8; --field-border: #858b99; --field: #ffffff;
  --primary: #16181d; --primary-ink: #ffffff; --link: #2f5bd8; --accent: #ffc83d; --focus: #2f5bd8;
  --radius: 16px; --shadow: 0 1px 2px rgba(16, 20, 30, .06), 0 8px 24px rgba(16, 20, 30, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317; --surface: #1a1d23; --ink: #eef0f4; --muted: #a2a8b6; --line: #2e323b; --field-border: #6c7280; --field: #111317;
    --primary: #ffffff; --primary-ink: #111317; --link: #8fb0ff; --focus: #8fb0ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 var(--font); }
a { color: var(--link); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.hint { margin: 6px 0 0; font-size: .86rem; color: var(--muted); line-height: 1.45; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 8px; top: -60px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { top: 8px; }
kbd { font: 600 .8em/1 var(--font); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 2px 6px; background: var(--surface); }

/* header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
/* Sticky header: always visible at the top (phones lost the nav mid-page) */
header.top{position:sticky;top:0;z-index:30}
@media print{header.top{position:static}}
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; }
.logo { flex-shrink: 0; white-space: nowrap; display: flex; align-items: center; gap: 8px; font-weight: 750; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.logo svg { width: 28px; height: 28px; }
.top-nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.top-nav::-webkit-scrollbar { display: none; }
.top-nav a { white-space: nowrap; padding: 6px 11px; border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 550; font-size: .93rem; }
.top-nav a:hover { background: var(--bg); }
.top-nav a[aria-current] { background: var(--primary); color: var(--primary-ink); }
@media (max-width: 560px) { .logo span { display: none; } }

/* tool */
.tool { padding: 22px 0 28px; }
h1 { font-size: clamp(1.9rem, 4.6vw, 2.9rem); font-weight: 800; line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 6px; }
.lead { margin: 0 0 18px; color: var(--muted); max-width: 72ch; }
.tool-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 880px) { .tool-grid { grid-template-columns: 1fr; } }

.stage { position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; max-height: 62vh; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); cursor: zoom-in; padding: 0; overflow: hidden; font: inherit; color: inherit; }
.stage-dim, .screen-dim { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; }
.stage-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px; background: rgba(20, 22, 28, .72); color: #fff; font-weight: 600; font-size: .98rem;
  white-space: nowrap; transition: transform .15s; }
.stage-hint svg { width: 20px; height: 20px; }
.stage:hover .stage-hint { transform: translate(-50%, -50%) scale(1.05); }
.stage-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 14px; }
.keys { font-size: .9rem; }

.btn { font: inherit; font-weight: 600; font-size: .95rem; border: 1px solid var(--field-border); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 8px 16px; cursor: pointer; min-height: 40px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.big { font-size: 1.05rem; padding: 12px 26px; min-height: 48px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: grid; gap: 16px; }
.panel label, .shades legend { font-weight: 600; font-size: .95rem; }
.ctl label { display: flex; justify-content: space-between; gap: 8px; }
.ctl output { font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.ctl.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
input[type="range"] { width: 100%; margin: 8px 0 0; accent-color: var(--primary); min-height: 28px; }
select, input[type="text"] { font: inherit; font-size: .95rem; color: var(--ink); background: var(--field); border: 1px solid var(--field-border); border-radius: 10px; padding: 7px 10px; min-height: 40px; }
.switch { display: flex; gap: 10px; align-items: flex-start; font-weight: 500 !important; cursor: pointer; }
.switch input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--primary); flex-shrink: 0; }

.shades { border: 0; padding: 0; margin: 0; min-width: 0; }
.shades legend { padding: 0; margin-bottom: 8px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.sw { display: grid; justify-items: start; gap: 2px; font: inherit; text-align: start; background: var(--field); color: var(--ink);
  border: 1px solid var(--field-border); border-radius: 12px; padding: 6px 8px 7px; cursor: pointer; min-height: 44px; }
.sw i { display: block; width: 100%; height: 26px; border-radius: 7px; border: 1px solid rgba(0, 0, 0, .14); margin-bottom: 3px; }
.sw span { font-size: .84rem; font-weight: 600; line-height: 1.2; }
.sw code { font-size: .74rem; color: var(--muted); }
.sw[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

.picker { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 10px; align-items: center; }
.picker > label:first-child { grid-column: 1 / -1; }
.picker input[type="color"] { width: 52px; height: 40px; padding: 0; border: 1px solid var(--field-border); border-radius: 10px; background: none; cursor: pointer; }
.picker input[type="text"] { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
.picker .hint { grid-column: 1 / -1; margin: 0; }
.picker input[aria-invalid="true"] { border-color: #d33; }

.dl summary { cursor: pointer; font-weight: 600; font-size: .95rem; }
.dl-in { display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; align-items: center; margin-top: 10px; }
.dl-in .btn { grid-column: 1 / -1; justify-self: start; }

/* full screen layer */
.screen { position: fixed; inset: 0; z-index: 1000; cursor: none; touch-action: manipulation; }
.screen[hidden] { display: none; }
.screen.show-ui { cursor: default; }
.screen-hint { position: absolute; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); margin: 0; max-width: calc(100% - 32px);
  padding: 9px 16px; border-radius: 999px; background: rgba(20, 22, 28, .72); color: #fff; font-size: .9rem; text-align: center;
  opacity: 0; transition: opacity .4s; pointer-events: none; }
.screen.show-ui .screen-hint { opacity: 1; }
html.locked, html.locked body { overflow: hidden; }

/* content */
.content { padding-top: 8px; }
.block, .faq { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 16px; }
.block h2, .faq h2, .related h2 { font-size: 1.35rem; line-height: 1.25; margin: 0 0 8px; letter-spacing: -0.01em; }
.block p, .block ul, .block ol { max-width: 75ch; }
.block p:last-child, .block ul:last-child, .block ol:last-child { margin-bottom: 0; }
.block li { margin-bottom: 4px; }
.faq details { border-top: 1px solid var(--line); padding: 10px 0; }
.faq details:first-of-type { border-top: 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 8px 0 0; max-width: 75ch; }
table { border-collapse: collapse; font-size: .95rem; }
th, td { text-align: start; padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); }

.related { padding: 8px 0 28px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.card { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; color: var(--ink); text-decoration: none; line-height: 1.3; }
.card span { display: grid; min-width: 0; }
.card small { color: var(--muted); font-size: .82rem; }
.card:hover { border-color: var(--muted); }
.dot { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .18); flex-shrink: 0; }
.dot.rainbow { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.dot.emoji { border: 0; font-style: normal; font-size: 20px; line-height: 22px; text-align: center; width: 24px; height: 24px; }
.hub-h { font-size: 1.35rem; margin: 26px 0 10px; }

.foot { border-top: 1px solid var(--line); padding: 20px 0 32px; font-size: .9rem; }
.foot-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; margin-bottom: 14px; }
.foot-groups h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px; }
.foot-groups a { display: block; color: var(--ink); padding: 2px 0; }

/* shared tool pieces (common.js) */
.tool-stage { position: relative; width: 100%; aspect-ratio: 16 / 10; max-height: 64vh; background: #000; color: #fff; border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.tool-stage > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tool-stage.is-full, .tool-stage:fullscreen { position: fixed; inset: 0; z-index: 1000; width: 100%; height: 100%; max-height: none; aspect-ratio: auto;
  border-radius: 0; border: 0; box-shadow: none; }
.st-idle, .st-idle * { cursor: none !important; }
.fs-btn { position: absolute; right: 12px; bottom: 12px; z-index: 5; display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600;
  font-size: .9rem; padding: 8px 14px; border-radius: 999px; border: 0; background: rgba(20, 22, 28, .72); color: #fff; cursor: pointer; }
.fs-btn svg { width: 18px; height: 18px; }
.is-full .fs-btn, :fullscreen .fs-btn { opacity: 0; transition: opacity .3s; }
.is-full:not(.st-idle) .fs-btn { opacity: .85; }
.st-hint { position: absolute; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); margin: 0; z-index: 6;
  max-width: calc(100% - 32px); padding: 9px 16px; border-radius: 999px; background: rgba(20, 22, 28, .78); color: #fff; font-size: .9rem;
  text-align: center; opacity: 0; transition: opacity .4s; pointer-events: none; }
.st-hint.on { opacity: 1; }
.st-modal { position: fixed; inset: 0; z-index: 2000; background: rgba(0, 0, 0, .6); display: grid; place-items: center; padding: 16px; }
.st-modal-in { background: var(--surface); color: var(--ink); border-radius: var(--radius); padding: 20px; max-width: 460px; box-shadow: var(--shadow); }
.st-modal-in h2 { margin: 0 0 8px; font-size: 1.25rem; }
.st-modal-b { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }
.ios-tip { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; margin: 0 0 16px; font-size: .92rem; }
.ios-tip p { margin: 0; flex: 1; }
.share-ic svg { width: 16px; height: 16px; vertical-align: -2px; }
.ios-x { font: inherit; font-size: 1.3rem; line-height: 1; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 4px; min-height: 32px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { font: inherit; font-size: .9rem; font-weight: 600; border: 1px solid var(--field-border); background: var(--field); color: var(--ink);
  border-radius: 999px; padding: 6px 12px; min-height: 36px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.ctl input[type="number"], .ctl input[type="time"], .ctl input[type="text"] { font: inherit; font-size: .95rem; color: var(--ink); background: var(--field);
  border: 1px solid var(--field-border); border-radius: 10px; padding: 7px 10px; min-height: 40px; }
.stat { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .st-hint { transition: none; } }
.wall-prev { width: 100%; aspect-ratio: 16 / 10; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }
.panel-h { font-weight: 600; font-size: .95rem; margin: 0 0 8px; }
.dl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dl-b { display: grid; text-align: start; border-radius: 12px; padding: 8px 12px; }
.dl-b small { color: var(--muted); font-weight: 500; font-size: .8rem; }
.ctl label.switch, label.switch { justify-content: flex-start; }

/* languages */
.lang-tag { font-weight: 500; color: var(--muted); font-size: .78em; }
.langs { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 10px; font-size: .9rem; }
.langs [aria-current] { font-weight: 700; }
/* right to left (Arabic) */
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] .logo { letter-spacing: 0; }
[dir="rtl"] .fs-btn { right: auto; left: 12px; }
[dir="rtl"] .px-exit { right: auto !important; left: 10px; }
[dir="rtl"] code, [dir="rtl"] kbd, [dir="rtl"] output { unicode-bidi: isolate; direction: ltr; }
[dir="rtl"] th, [dir="rtl"] td { padding: 6px 0 6px 12px; }
.foot-info { margin: 0 0 8px; font-size: .9rem; } .foot-info a { color: var(--ink); }
/* consent banner */
.consent { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 1500; max-width: 720px; margin: 0 auto; display: flex; flex-wrap: wrap;
  align-items: center; gap: 10px 16px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25); padding: 12px 14px; font-size: .92rem; }
.consent[hidden] { display: none; }
.consent p { margin: 0; flex: 1 1 320px; }
.consent-btns { display: flex; gap: 8px; }
.consent-btns .btn { min-width: 96px; }
.is-full ~ .consent, html.locked .consent { display: none; }
/* header language menu */
.lang-menu { position: relative; flex-shrink: 0; }
.lang-menu summary { list-style: none; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--line); font-weight: 600; font-size: .85rem; min-height: 36px; }
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary svg { width: 17px; height: 17px; }
.lang-menu[open] summary, .lang-menu summary:hover { background: var(--bg); }
.lang-menu ul { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 60; margin: 0; padding: 6px; list-style: none; min-width: 160px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.lang-menu li a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.lang-menu li a:hover { background: var(--bg); }
.lang-menu li a[aria-current] { font-weight: 700; background: var(--bg); }
.top-in { gap: 10px; }
.top-nav { flex: 1; justify-content: flex-end; min-width: 0; }

/* audit 27 Sep 2026: controls that hide while idle in full screen stay visible while they have keyboard focus, and the
   faint prank exit buttons become readable on hover and focus */
.is-full .fs-btn:focus-visible, .is-full .px-exit:focus-visible, :fullscreen .fs-btn:focus-visible { opacity: 1 !important; pointer-events: auto !important; }
.px-exit:hover, .px-exit:focus-visible, .px-show .px-exit { opacity: 1 !important; background: rgba(0, 0, 0, .72) !important; color: #fff !important; }
:focus-visible { box-shadow: 0 0 0 5px #fff; }
.st-pause { position: absolute; left: 12px; bottom: 12px; z-index: 5; width: 40px; height: 40px; border-radius: 999px; border: 0; background: rgba(20, 22, 28, .72);
  color: #fff; cursor: pointer; display: grid; place-items: center; }
[dir="rtl"] .st-pause { left: auto; right: 12px; }
.st-pause svg { width: 18px; height: 18px; }
.is-full .st-pause { opacity: 0; transition: opacity .3s; } .is-full:not(.st-idle) .st-pause, .st-pause:focus-visible { opacity: .85; }
nav.langs { display: flex; }
