/*
 * Digital Ring Light: the tool's own components, styled in the site's design language (14 Nov 2026, on the UltraCompress
 * Pro template). The first part copies the shared block of the Love Calculator's file (tokens, page, hero, buttons,
 * toolbar, fields, windows, toasts, information sections). Base: /libs/site-pages.css (tokens, Inter and Space Grotesk,
 * theme toggle, focus rings) and /libs/shared-nav.css (the site's header and footer). The second part is the tool: the
 * dark stage the light is drawn on (it is black in both themes: a light is judged against the dark), the eight kinds of
 * light, the light switch, the sliders and the full screen view. Light is the default; dark applies when <html> has no
 * data-theme. Written by hand: this file is the source.
 */

/* ----- Tokens the tool adds ----- */
:root {
    --surface: #ffffff;
    --surface-2: #f3f4f8;
    --ring: rgba(139, 92, 246, 0.18);
    --app-max: 1600px;
    --radius-lg: 16px;
    --line: rgba(0, 0, 0, 0.1);
    --line-strong: rgba(0, 0, 0, 0.24);
    --ok: #166534;
    --ok-soft: rgba(22, 101, 52, 0.09);
    --bad: #b91c1c;
    --bad-soft: rgba(185, 28, 28, 0.08);
    --warn: #92400e;
    --warn-soft: rgba(217, 119, 6, 0.1);
}
:root:not([data-theme="light"]) {
    --surface: #14141f;
    --surface-2: rgba(255, 255, 255, 0.05);
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.26);
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.1);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, 0.1);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.1);
}

/* ----- Page: full width, the page provides the side space ----- */
.container.app-container { max-width: calc(var(--app-max) + 2 * var(--content-gutter)); margin-top: 16px; }
@media (min-width: 640px) { .container.app-container { margin-top: 24px; } }

/* ----- The site header is the first thing on the page and stays at the top ----- */
body { padding-top: 0; }
body > header { position: sticky; top: 0; z-index: 50; }
header .site-nav { position: relative; top: auto; }
.theme-toggle { top: 90px; }
@media (max-width: 639.98px) { .theme-toggle { top: 75px; } } /* the header is 81 px tall from 640 px, 65 px below */

/* ----- Hero ----- */
.app-hero { margin: 0 0 2rem; text-align: center; }
.app-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 1.25rem; font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--text-strong); }
.app-brand img { width: 44px; height: 44px; border-radius: 12px; display: block; }
.app-hero h1 { margin-bottom: 0.75rem; }
.app-tagline { color: var(--text-2); font-size: 1.125rem; line-height: 1.6; max-width: 46rem; margin: 0 auto; }

/* ----- Small helpers ----- */
main [hidden], .dialog [hidden] { display: none !important; } /* the script hides fields that carry their own display */
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-2); }
.small { font-size: 0.9rem; }
.block { display: block; }
.hint { color: var(--text-3); font-size: 0.8rem; font-weight: 400; line-height: 1.45; }
.err { color: var(--bad); font-size: 0.85rem; font-weight: 600; }
.err:empty { display: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link:hover { color: var(--link-hover); }
code { font-size: 0.85em; padding: 1px 6px; border-radius: 6px; background: var(--code-bg); color: var(--code-text); }
kbd { font-family: inherit; font-size: 0.72rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); }

/* ----- Buttons ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 9999px; font-family: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2; padding: 12px 24px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn .ico { width: 17px; height: 17px; }
.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text-strong); border: 1px solid var(--surface-border); padding: 11px 23px; }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn-danger { background: var(--surface); color: var(--danger); border: 1px solid rgba(185, 28, 28, 0.35); padding: 11px 23px; }
.btn-danger:hover:not(:disabled) { background: var(--danger-strong); color: #fff; border-color: transparent; transform: translateY(-2px); }
.btn-sm { font-size: 0.85rem; padding: 9px 16px; }
.btn-secondary.btn-sm, .btn-danger.btn-sm { padding: 8px 15px; }
.btn-stack { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); flex-shrink: 0; padding: 0; font-family: inherit; transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.icon-btn:hover { border-color: var(--brand); color: var(--link); background: var(--surface); }
.icon-btn.del:hover { border-color: var(--danger); color: var(--danger); }
.icon-btn:focus-visible, .link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Toolbar ----- */
.app-shell { margin: 0 0 3rem; scroll-margin-top: 90px; }
.app-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin: 0 0 1.25rem; }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.shell-hint { margin-top: 14px; }

/* ----- Fields ----- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.label { font-weight: 600; font-size: 0.85rem; color: var(--text-strong); }
.input, .select { width: 100%; min-width: 0; min-height: 44px; padding: 10px 14px; background: var(--field); border: 1px solid var(--field-border); border-radius: 12px; font-family: inherit; font-size: 0.95rem; color: var(--text); outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.input::placeholder { color: var(--placeholder); }
.input[aria-invalid="true"] { border-color: var(--bad); }
.select { width: auto; max-width: 100%; appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; cursor: pointer; }
.select option { color: #0a0a14; background: #fff; }
.check-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 0.925rem; color: var(--text); padding: 4px 0; }
.check-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex-shrink: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--surface); font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease; }
.seg button:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.seg button[aria-pressed="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.seg button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--chip); font-family: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease; }
.chip .ico { width: 15px; height: 15px; color: var(--link); }
.chip:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Windows ----- */
.dialog { margin: auto; border: 1px solid var(--surface-border); border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 16px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35); }
.dialog--narrow { width: min(420px, calc(100vw - 16px)); }
.dialog--wide { width: min(680px, calc(100vw - 16px)); }
.dialog::backdrop { background: rgba(10, 10, 20, 0.6); backdrop-filter: blur(6px); }
.dialog[open] { animation: pop 0.2s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }
.dialog-head { padding: 18px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-title { margin: 0; font-size: 1.15rem; }
.dialog-close { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; transition: border-color 0.2s ease, color 0.2s ease; }
.dialog-close:hover { border-color: var(--brand); color: var(--link); }
.dialog-body { padding: 20px; overflow-y: auto; max-height: calc(100vh - 210px); display: flex; flex-direction: column; gap: 14px; }
.dialog-actions { padding: 14px 20px; border-top: 1px solid var(--surface-border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.confirm-message { margin: 0; color: var(--text); }

/* ----- Toasts ----- */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { pointer-events: auto; background: #0a0a14; color: #fff; border: 1px solid rgba(255, 255, 255, 0.12); border-left: 4px solid var(--brand); border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; gap: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3); min-width: 260px; max-width: 420px; font-size: 0.875rem; font-weight: 500; overflow-wrap: anywhere; animation: slideIn 0.3s ease; transition: opacity 0.3s ease, transform 0.3s ease; }
.toast button { background: none; border: 0; padding: 0; color: #c4b5fd; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; white-space: nowrap; }
.toast.leaving { opacity: 0; transform: translateX(40px); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.toast.good { border-left-color: #4ade80; }
.toast.bad { border-left-color: #f87171; }

/* ----- Information sections ----- */
.info-section { margin: 0 0 2.5rem; }
.info-section h2 { font-size: 1.75rem; margin: 0 0 1.25rem; }
.info-section .info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.info-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 1rem 0 1.5rem; }
.info-stack { display: grid; gap: 12px; }
.info-card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 16px; box-shadow: var(--surface-shadow); padding: 20px; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.info-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.info-card--small { padding: 16px; box-shadow: none; }
.info-card h3 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.info-card p { color: var(--text-2); margin-bottom: 0.75rem; }
.info-card p:last-child { margin-bottom: 0; }
.step-card { position: relative; padding-top: 24px; }
.step-num { position: absolute; top: -16px; left: 20px; width: 34px; height: 34px; border-radius: 50%; background: var(--gradient-brand); color: #fff; font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.step-head h3 { margin: 0; }
.step-emoji { font-size: 1.6rem; line-height: 1; }
.info-section details.info-card { padding: 0; }
.info-section details.info-card summary { cursor: pointer; padding: 16px 20px; font-weight: 600; color: var(--text-strong); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.info-section details.info-card summary::-webkit-details-marker { display: none; }
.info-section details.info-card summary::after { content: '+'; color: var(--link); font-weight: 700; font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.info-section details.info-card[open] summary::after { content: '\2212'; }
.info-section details.info-card p { padding: 0 20px 16px; margin: 0; color: var(--text-2); }

/* ===== Digital Ring Light components ===== */

/* ----- The site's text rules (p, ul, li, headings) must not reach the tool: same weight as the site's, loaded later ----- */
:where(.app-shell) p, :where(.app-shell) ul, :where(.app-shell) li, :where(.dialog) p { margin: 0; line-height: 1.5; }
:where(.app-shell) h2, :where(.app-shell) h3, :where(.app-shell) h4 { margin: 0; line-height: 1.25; }
:root { --head: 81px; }
@media (max-width: 639.98px) { :root { --head: 65px; } }
.app-shell { scroll-margin-top: calc(var(--head) + 16px); }

/* ----- Cards: the site's white cards, one layer ----- */
.card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card-title { font-size: 1.3rem; color: var(--text-strong); }
.sub-title { font-size: 1rem; color: var(--text-strong); }
.controls { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); margin-top: 20px; }
@media (min-width: 1000px) { .controls { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; } }

/* ----- The light switch ----- */
.power { display: inline-flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 18px 6px 8px; border-radius: 9999px; border: 1px solid var(--surface-border); background: var(--surface); color: var(--text-strong); font-family: inherit; font-size: 1rem; font-weight: 600; cursor: pointer; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.power:hover { border-color: var(--brand); box-shadow: var(--surface-hover-shadow); }
.power:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.power-track { position: relative; width: 60px; height: 34px; border-radius: 17px; background: var(--line-strong); flex: none; transition: background 0.2s ease; }
.power-thumb { position: absolute; top: 4px; left: 4px; width: 26px; height: 26px; border-radius: 50%; background: #ffffff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); transition: transform 0.2s ease; }
.power[aria-checked="true"] .power-track { background: var(--gradient-brand); }
.power[aria-checked="true"] .power-thumb { transform: translateX(26px); }
.power-text strong { display: inline-block; min-width: 1.9em; font-weight: 800; }
.status { color: var(--text-2); font-size: 0.95rem; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* ----- The stage: black in both themes ----- */
.stage-slot { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: min(64vh, 620px); min-height: 220px; border-radius: 16px; background: #000000; }
.slot-note { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px; color: #d1d5db; font-weight: 600; }
.stage { position: absolute; inset: 0; overflow: hidden; display: grid; place-items: center; border-radius: 16px; background: #000000; isolation: isolate; --unlit: #1f1f29; --light: #ffffff; --glow: rgba(255, 255, 255, 0.45); }
.stage[data-on="false"] { --light: var(--unlit); --glow: rgba(0, 0, 0, 0); }
.lamp { position: relative; box-sizing: border-box; transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease; }
.stage[data-type="full"] .lamp { width: 100%; height: 100%; background: var(--light); }
.stage[data-type="ring"] .lamp { height: var(--lh, 86%); width: var(--lw, auto); aspect-ratio: 1 / 1; border-radius: 50%; border: var(--band, 28px) solid var(--light); box-shadow: 0 0 var(--halo, 24px) var(--glow), inset 0 0 var(--halo, 24px) var(--glow); }
.stage[data-type="spot"] .lamp { height: var(--lh, 56%); width: var(--lw, auto); aspect-ratio: 1 / 1; border-radius: 50%; background: var(--light); box-shadow: 0 0 var(--halo, 24px) var(--glow); }
.stage[data-type="edge"] .lamp { width: 100%; height: 100%; border: var(--band, 40px) solid var(--light); box-shadow: inset 0 0 var(--halo, 24px) var(--glow); }
.stage[data-type="side"] .lamp { width: 100%; height: 100%; border: 0 solid var(--light); border-left-width: var(--band, 20%); border-right-width: var(--band, 20%); box-shadow: inset var(--halo, 24px) 0 var(--halo, 24px) calc(var(--halo, 24px) * -1) var(--glow), inset calc(var(--halo, 24px) * -1) 0 var(--halo, 24px) calc(var(--halo, 24px) * -1) var(--glow); }
.stage[data-type="tube"] .lamp { width: var(--lw, 90%); height: var(--lh, 22%); border-radius: 9999px; background: var(--light); box-shadow: 0 0 var(--halo, 24px) var(--glow); }
.stage[data-type="bulb"] .lamp, .stage[data-type="candle"] .lamp { display: none; }
.art { display: none; position: relative; width: var(--lw, 30%); height: var(--lh, 70%); max-width: none; overflow: visible; }
.stage[data-type="bulb"] .art-bulb, .stage[data-type="candle"] .art-candle { display: block; }
.halo-a { stop-color: var(--light); stop-opacity: 0.5; }
.halo-b { stop-color: var(--light); stop-opacity: 0.16; }
.halo-c { stop-color: var(--light); stop-opacity: 0; }
.halo { opacity: var(--flick, 1); transition: opacity var(--flick-ms, 250ms) ease-in-out; }
.stage[data-on="false"] .halo { opacity: 0; }
.glass { fill: var(--light); transition: fill 0.25s ease; }
.flame { fill: var(--flame, var(--light)); transition: fill var(--flick-ms, 250ms) ease-in-out; }
.stage[data-on="false"] .flame { fill: var(--unlit); }
.shine { fill: none; stroke: #ffffff; stroke-width: 7; stroke-linecap: round; opacity: 0.45; }
.flame-core { fill: #ffffff; opacity: 0.5; }
.stage[data-on="false"] .shine { opacity: 0.1; }
.stage[data-on="false"] .flame-core { opacity: 0; }
.cap { fill: #8b8f9a; }
.thread { fill: none; stroke: #5b5f69; stroke-width: 3; }
.tip { fill: #3f424a; }
.wick { fill: none; stroke: #57504a; stroke-width: 4; stroke-linecap: round; }
.wax-a { stop-color: #4a433c; }
.wax-b { stop-color: #1c1917; }

/* ----- Light types ----- */
.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.type-btn { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 7px 10px; border-radius: 12px; border: 1px solid var(--chip-border); background: var(--surface); font-family: inherit; font-size: 0.9rem; font-weight: 600; color: var(--text-strong); text-align: left; cursor: pointer; transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease; }
.type-btn:hover { border-color: var(--brand); transform: translateY(-1px); }
.type-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.type-btn[aria-pressed="true"] { border-color: var(--brand); background: var(--tint-brand); box-shadow: 0 0 0 1px var(--brand); }
.type-ico { width: 42px; height: 28px; flex: none; display: block; }
.ti-bg { fill: #0a0a14; }
.ti-on { fill: #ffd8a5; }
.ti-line { fill: none; stroke: #ffd8a5; stroke-width: 5; }
.ti-cap { fill: #8b8f9a; }
.type-hint { min-height: 2.9em; }

/* ----- Sliders ----- */
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.value { font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.05rem; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.range { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 32px; margin: 0; padding: 0; background: transparent; cursor: pointer; --fill: 100%; }
.range:focus { outline: none; }
.range::-webkit-slider-runnable-track { height: 12px; border-radius: 9999px; border: 1px solid var(--line); background: linear-gradient(90deg, var(--brand) 0, var(--brand-2) var(--fill), var(--surface-2) var(--fill), var(--surface-2) 100%); }
.range::-moz-range-track { height: 12px; border-radius: 9999px; border: 1px solid var(--line); background: linear-gradient(90deg, var(--brand) 0, var(--brand-2) var(--fill), var(--surface-2) var(--fill), var(--surface-2) 100%); }
.range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; margin-top: -8px; border-radius: 50%; background: #ffffff; border: 2px solid var(--brand); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); }
.range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #ffffff; border: 2px solid var(--brand); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); }
.range:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--brand); outline-offset: 2px; }
.range:focus-visible::-moz-range-thumb { outline: 2px solid var(--brand); outline-offset: 2px; }
.range-kelvin { --kelvin-track: linear-gradient(90deg, #ffaf4d 0%, #ffd7a1 34%, #ffebce 60%, #ffffff 100%); }
.range-kelvin::-webkit-slider-runnable-track { background: var(--kelvin-track); border-color: var(--line-strong); }
.range-kelvin::-moz-range-track { background: var(--kelvin-track); border-color: var(--line-strong); }
.range-ends { display: flex; justify-content: space-between; gap: 12px; font-size: 0.8rem; color: var(--text-3); }
.card[data-mode="colour"] .range-kelvin { opacity: 0.55; }

/* ----- Chips with a colour dot ----- */
.chip[aria-pressed="true"] { border-color: var(--brand); color: var(--text-strong); background: var(--tint-brand); box-shadow: 0 0 0 1px var(--brand); }
.chip { color: var(--text-strong); min-height: 36px; }
.chip-k { color: var(--text-3); font-weight: 500; }
.presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.preset { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 7px 12px; border-radius: 12px; border: 1px solid var(--chip-border); background: var(--surface); font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-strong); text-align: left; cursor: pointer; transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease; }
.preset:hover { border-color: var(--brand); transform: translateY(-1px); }
.preset:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.preset[aria-pressed="true"] { border-color: var(--brand); background: var(--tint-brand); box-shadow: 0 0 0 1px var(--brand); }
.preset-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.preset .chip-k { font-size: 0.8rem; }
.preset .dot { width: 20px; height: 20px; }
.dot { width: 16px; height: 16px; border-radius: 50%; flex: none; background: var(--dot, var(--surface-2)); border: 1px solid var(--line-strong); }

/* ----- Brightness steps: five in one row at every width ----- */
#levelList { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
#levelList button { padding-left: 4px; padding-right: 4px; }

/* ----- Timer, keep awake, reset ----- */
.card .select { width: 100%; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; font-size: 0.925rem; color: var(--text-strong); }
.switch-row .hint { font-weight: 400; display: block; margin-top: 2px; }
.switch { position: relative; width: 52px; height: 44px; flex: none; padding: 0; border: 0; background: transparent; cursor: pointer; }
.switch::before { content: ""; position: absolute; left: 3px; top: 8px; width: 46px; height: 28px; border-radius: 14px; background: var(--line-strong); transition: background 0.2s ease; }
.switch::after { content: ""; position: absolute; top: 12px; left: 7px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s ease; }
.switch[aria-checked="true"]::before { background: var(--gradient-brand); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
.switch:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 16px; }
.reset { align-self: flex-start; padding: 6px 0; font-weight: 600; }

/* ----- Full screen view: the tool's own window over the whole page ----- */
.full { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000000; color: #ffffff; overflow: hidden; }
.full::backdrop { background: #000000; }
.full-wrap { position: absolute; inset: 0; width: 100%; height: 100%; background: #000000; }
.full-stage { position: absolute; inset: 0; }
.full .stage { border-radius: 0; }
.full:not(.show-ui) { cursor: none; }
.full-bar { position: absolute; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 8px; max-width: calc(100% - 24px); padding: 8px; border-radius: 9999px; background: #14141f; border: 1px solid rgba(255, 255, 255, 0.28); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5); opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.full.show-ui .full-bar, .full-bar:has(:focus-visible) { opacity: 1; pointer-events: auto; }
.bar-btn { min-height: 44px; padding: 8px 16px; border-radius: 9999px; border: 1px solid rgba(255, 255, 255, 0.3); background: #23232f; color: #ffffff; font-family: inherit; font-size: 0.95rem; font-weight: 600; white-space: nowrap; cursor: pointer; }
.bar-btn:hover { border-color: #c4b5fd; }
.bar-btn:focus-visible { outline: 2px solid #c4b5fd; outline-offset: 2px; }
.bar-btn[aria-checked="true"] { background: #6d28d9; border-color: #6d28d9; }
.bar-btn { flex: none; }
.bar-round { width: 44px; padding: 0; font-size: 1.3rem; line-height: 1; }
.bar-level { min-width: 3.2em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; color: #ffffff; }

/* ----- Phones ----- */
@media (max-width: 639px) {
    .app-hero { margin-bottom: 1.5rem; }
    .app-tagline { font-size: 1rem; }
    .card { padding: 16px; }
    .stage-slot { aspect-ratio: 4 / 3; }
    .toolbar-left, .toolbar-right { width: 100%; }
    .toolbar-right .btn { width: 100%; }
    .types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .full-bar { gap: 6px; padding: 6px; }
    .bar-btn { padding: 8px 12px; }
    .toasts { bottom: 16px; right: 16px; left: 16px; align-items: stretch; }
    .toast { min-width: 0; max-width: none; }
    .info-section h2 { font-size: 1.4rem; }
    .info-section .info-grid, .info-three { grid-template-columns: 1fr; }
    .info-card { padding: 16px; }
    .step-num { left: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .btn, .info-card, .toast, .seg button, .chip, .type-btn, .preset, .power, .power-track, .power-thumb, .switch::before, .switch::after,
    .lamp, .glass, .flame, .halo, .full-bar { transition: none; animation: none; }
}

/* Phones: 16 px text, 44 px tap targets (AdSense audit H-04, 8 Oct 2026). The stage is a picture. */
@media (max-width: 639.98px) {
    main button, main select, main summary, main [role="button"],
    main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]) { min-height: 44px; }
    main input[type="range"] { height: 44px; }
    main .seg button, main .chip, main .type-btn { min-height: 44px; }
    main .seg button { min-width: 44px; }
    main :is(p, li, .hint, .label, .select, .seg button, .chip, .chip-k, .type-btn, .preset, .muted, .status, .range-ends, .switch-row, .link, .power) { font-size: 1rem; }
    .full .bar-btn, .full .bar-level { font-size: 1rem; }
}
