@import url('./type.css');

:root {
  color-scheme: dark;
  --bg: #111916;
  --panel: #18221c;
  --line: #3b493e;
  --text: #f1f3e9;
  --muted: #b3bfb0;
  --lime: #d4ef86;
  --highlight: #40edff;
  font-family: Arial, Helvetica, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #080d0a; color: var(--text); }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; border: 0; background: #263329; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .4; cursor: not-allowed; }
button:hover:not(:disabled) { filter: brightness(1.12); }
button:focus-visible, input:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }
button[aria-pressed=true] { border-color: var(--lime); color: var(--lime); }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; pointer-events: none; }
.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.viewfinder { position: relative; width: 100%; height: 100dvh; overflow: hidden; isolation: isolate; background: #080d0a; }
.viewfinder.expanded, .viewfinder:fullscreen { position: fixed; inset: 0; width: 100%; height: 100dvh; }
canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: none; }
.active canvas { display: block; }
.camera-status { position: absolute; top: calc(16px + env(safe-area-inset-top)); left: calc(16px + env(safe-area-inset-left)); display: flex; gap: 8px; align-items: center; padding: 8px 11px; border-radius: 20px; background: #08110bd9; color: #e5ebdf; font-size: 12px; pointer-events: none; }
.status-dot { width: 6px; height: 6px; flex-shrink: 0; display: inline-block; border-radius: 50%; background: #a2ac9b; }
.status-dot.active, .ready .status-dot { background: var(--lime); }
.camera-start { position: absolute; inset: 65px 24px 110px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.camera-start p { color: var(--muted); max-width: 340px; font-size: 14px; line-height: 1.6; margin: 0; }
.button { min-height: 48px; padding: 12px 18px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-size: 14px; }
.button-primary { background: var(--lime); color: #162210; font-weight: 600; }
.button-quiet { background: transparent; border: 1px solid var(--line); }
.wide { width: 100%; }
.icon-button { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 8px; background: transparent; flex-shrink: 0; }
.camera-toolbar { position: absolute; bottom: calc(16px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid #ffffff25; border-radius: 22px; background: #0c170fe8; box-shadow: 0 4px 20px #0004; }
.tool-button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; width: 62px; min-height: 58px; border-radius: 13px; background: transparent; font-size: 11px; }
.tool-button.freeze-button { background: #e7eedb; color: #172314; }
.freeze-button[aria-pressed=true] { background: var(--lime); }
.compare-labels { position: absolute; top: calc(62px + env(safe-area-inset-top)); left: 14px; right: 14px; display: flex; justify-content: space-between; pointer-events: none; }
.compare-labels span { padding: 6px 9px; border-radius: 5px; background: #08110bd9; font: 10px 'Field Mono', monospace; letter-spacing: 1px; }
.split-line { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: #f2f5e5a0; pointer-events: none; }
.split-line span { position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #e7eedb; color: #172314; }
.sample-target { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; pointer-events: none; }
.sample-target>span { width: 35px; height: 35px; border: 1px solid white; border-radius: 50%; box-shadow: 0 0 0 1px #0008; }
.sample-target p { background: #08110be8; border-radius: 6px; padding: 8px 12px; font-size: 14px; }
.sample-target button { pointer-events: auto; background: #08110be8; border: 1px solid #ffffff40; }
.sampling { cursor: crosshair; }
.sampling .camera-toolbar { visibility: hidden; }

dialog { color: var(--text); border: 1px solid var(--line); background: var(--panel); padding: 0; }
dialog::backdrop { background: #0002; }
.sheet { position: fixed; inset: auto 0 0; margin: 0 auto; width: min(100%, 440px); max-width: 100%; border-radius: 18px 18px 0 0; max-height: 54dvh; padding-bottom: env(safe-area-inset-bottom); overflow: hidden; }
.sheet[open] { display: flex; flex-direction: column; }
.sheet-heading { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px 7px 20px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
h2 { font-size: 17px; margin: 0; font-weight: 600; }
.sheet-content { overflow-y: auto; overscroll-behavior: contain; padding: 16px 20px 22px; scrollbar-width: thin; }
fieldset { border: 0; margin: 0 0 17px; padding: 0; min-width: 0; }
legend { font-size: 13px; padding: 0; margin-bottom: 9px; }
.segments { display: flex; gap: 5px; }
.segments button { flex: 1; min-height: 44px; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; }
.segments button[aria-pressed=true] { border-color: var(--lime); background: #d4ef8610; }
.custom-swatch { width: 10px; height: 10px; border-radius: 50%; background: conic-gradient(#f55, #ee5, #5d9, #5cf, #a5e, #f55); }
.hint { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 8px 0 0; }
.color-options { display: flex; gap: 8px; }
.color-options button { display: flex; align-items: center; justify-content: center; gap: 7px; flex: 1; min-height: 44px; padding: 6px; border: 1px solid var(--line); border-radius: 7px; background: transparent; font-size: 12px; }
.color-options button[aria-pressed=true] { border-color: var(--lime); }
.color-swatch { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #111916; flex-shrink: 0; }
.color-swatch svg { width: 15px; height: 15px; opacity: 0; stroke-width: 2.5; }
[aria-pressed=true] .color-swatch svg { opacity: 1; }
.cyan { background: #40edff; }.yellow { background: #ffdf53; }.white { background: white; }
.setting { margin-bottom: 17px; font-size: 13px; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.label-row output { color: var(--lime); font: 12px 'Field Mono', monospace; }
.label-row label { min-height: 44px; display: flex; align-items: center; flex: 1; }
input[type=range] { appearance: none; -webkit-appearance: none; width: 100%; height: 36px; margin: 0; background: transparent; accent-color: var(--lime); cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: #57664f; }
input[type=range]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: var(--lime); margin-top: -10px; }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: #57664f; }
input[type=range]::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--lime); border: 0; }
.range-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
input[role=switch] { width: 44px; height: 28px; accent-color: var(--lime); cursor: pointer; }
.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.option-button { min-height: 48px; display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 7px; border: 1px solid var(--line); font-size: 12px; }
.option-button svg { width: 18px; height: 18px; }
.option-links { border-top: 1px solid var(--line); margin-top: 17px; padding-top: 8px; }
.option-link { display: flex; align-items: center; gap: 13px; width: 100%; min-height: 48px; text-align: left; padding: 10px 8px; background: transparent; font-size: 14px; border-radius: 6px; }
.offline-status { color: var(--muted); font-size: 12px; }
.offline-status .status-dot { margin: 0 8px; }
.offline-status.ready { color: var(--lime); }
.info-dialog { position: fixed; margin: auto; width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); border-radius: 16px; padding: 18px 22px 22px; overscroll-behavior: contain; }
.info-dialog::backdrop { background: #0008; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.eyebrow { font: 11px 'Field Mono', monospace; color: var(--muted); letter-spacing: 1px; }
.info-dialog h2 { margin: 10px 0 20px; font-size: 23px; }
.info-dialog h3 { font-size: 15px; margin: 23px 0 8px; }
.info-dialog p { font-size: 14px; line-height: 1.65; color: #c5cfbf; }
.info-dialog .button { width: 100%; margin-top: 12px; }
.install-step { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; font-size: 14px; }
#toast { position: fixed; top: calc(65px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); background: #142218ed; border: 1px solid #81976c; border-radius: 8px; padding: 12px 16px; font-size: 13px; line-height: 1.5; text-align: center; z-index: 100; pointer-events: none; }
@media (min-width: 700px) {
  .sheet { inset: auto 20px 20px auto; margin: 0; max-height: calc(100dvh - 40px); border-radius: 16px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .sheet { inset: 8px calc(8px + env(safe-area-inset-right)) 8px auto; width: min(360px, 52vw); max-height: calc(100dvh - 16px); border-radius: 14px; }
  .camera-toolbar { left: calc(16px + env(safe-area-inset-left)); transform: none; gap: 8px; }
  .camera-start { inset: 56px 24px 95px; }
}
@media (prefers-reduced-motion: reduce) { *, *:before, *:after { scroll-behavior: auto !important; } }
