/* No font or image network requests: the entire workbench works offline. */
:root {
  color-scheme: dark;
  --background: #050505;
  --panel: #0c0d0c;
  --line: #242724;
  --muted: #858d85;
  --text: #e5e9e4;
  --green: #b7f897;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-family: var(--mono);
  font-size: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; color: var(--text); background: var(--background); }
body::before { content: ""; position: fixed; z-index: -1; inset: 0; pointer-events: none; background-image: linear-gradient(#ffffff03 1px, transparent 1px), linear-gradient(90deg, #ffffff03 1px, transparent 1px); background-size: 56px 56px; mask-image: linear-gradient(#000, transparent 85%); }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button, a, input { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--green); outline-offset: 5px; }
button:disabled { opacity: .4; cursor: not-allowed; }
button svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
p { margin: 0; }
.app-shell { width: min(1600px, 100%); margin: 0 auto; padding: 0 40px; }
.site-header { min-height: 80px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #1d201d; gap: 20px; }
.wordmark { display: flex; align-items: center; gap: 13px; color: #f0f3ef; text-decoration: none; font-size: 20px; font-weight: 700; letter-spacing: 4px; }
.brand-mark { display: flex; align-items: center; justify-content: center; gap: 0; width: 38px; height: 38px; border: 1px solid #464e41; color: var(--green); letter-spacing: -4px; padding-right: 4px; font-size: 22px; }
.brand-mark span { font-size: 19px; }
.wordmark-divider { margin: 0 13px; color: #424942; font-weight: 400; letter-spacing: 0; }
.wordmark-description { font-size: 12px; color: #a0a69e; font-weight: 400; letter-spacing: .02em; }
.environment-label, .eyebrow, .metadata-key, .live-label, .controls-heading, .range-endpoints, .runtime-metrics, .site-footer > p:last-child { font-size: 12px; letter-spacing: .06em; }
.environment-label { display: inline-flex; align-items: center; gap: 9px; color: #a0a99b; }
.status-dot { width: 5px; height: 5px; border-radius: 50%; flex: 0 0 5px; background: var(--green); box-shadow: 0 0 8px #b7f8272b; display: inline-block; }
.version { margin-left: 16px; color: #8b9684; }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 26px; padding: 20px 0; }
.eyebrow { color: var(--green); margin-bottom: 10px; font-size: 12px; letter-spacing: .12em; }
h1 { margin: 0; font-family: var(--mono); font-size: clamp(23px, 2.3vw, 34px); font-weight: 500; line-height: 1.35; letter-spacing: -1.8px; }
h1 span { color: #91988e; }
.intro-description { color: #a0aa99; font-size: 14px; line-height: 1.8; padding-bottom: 3px; flex-shrink: 0; }

/* The canvas owns interaction; the surrounding chrome stays light and readable. */
.workbench { display: grid; grid-template-columns: minmax(0, 1fr) 304px; grid-template-rows: minmax(560px, calc(100svh - 300px)) auto; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; background: #000; }
.portrait-stage { position: relative; min-width: 0; min-height: 420px; background: #000; overflow: hidden; isolation: isolate; }
#portrait-canvas { display: block; width: 100%; height: 100%; position: absolute; inset: 0; touch-action: none; }
.is-over-wish:not(.is-setting-eyes) #portrait-canvas { cursor: grab; }
.is-moving-wish:not(.is-setting-eyes) #portrait-canvas { cursor: grabbing; }
.is-setting-eyes #portrait-canvas { cursor: crosshair; }
.noscript-message { position: absolute; inset: 35% 12% auto; color: var(--text); font-size: 16px; line-height: 1.8; text-align: center; }
.stage-topline { position: absolute; inset: 24px 27px auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; pointer-events: none; z-index: 2; font-size: 12px; }
.source-label { display: flex; min-width: 0; gap: 11px; color: #a4aaa0; align-items: center; }
.metadata-key { color: #87917f; font-size: 12px; }
#source-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.live-label { display: flex; gap: 8px; align-items: center; color: #a1b295; white-space: nowrap; font-size: 12px; }
.stage-corner { position: absolute; width: 11px; height: 11px; border-color: #4b5644; border-style: solid; pointer-events: none; z-index: 2; }
.corner-tl { top: 63px; left: 26px; border-width: 1px 0 0 1px; }
.corner-tr { top: 63px; right: 26px; border-width: 1px 1px 0 0; }
.corner-bl { bottom: 63px; left: 26px; border-width: 0 0 1px 1px; }
.corner-br { bottom: 63px; right: 26px; border-width: 0 1px 1px 0; }
.stage-caption { position: absolute; bottom: 25px; left: 20px; right: 20px; color: #929e88; display: flex; align-items: center; justify-content: center; gap: 9px; pointer-events: none; font-size: 12px; letter-spacing: .01em; z-index: 2; }
.is-setting-eyes .stage-tip { display: none; }
#eye-guide { color: var(--green); }
.cursor-icon { font-size: 18px; line-height: 1; color: #a1aa96; }
.caption-divider { margin: 0 10px; color: #444e3d; }
.drop-overlay, .loading-overlay { position: absolute; inset: 12px; display: grid; place-items: center; z-index: 5; text-align: center; background: #020702e8; pointer-events: none; }
.drop-overlay { border: 1px dashed var(--green); color: var(--green); }
.drop-overlay span { display: block; margin-bottom: 16px; font-size: 46px; font-weight: 300; }
.drop-overlay strong, .loading-overlay strong { display: block; font-size: 17px; font-weight: 400; }
.drop-overlay p { margin-top: 13px; font-size: 12px; color: #9aac90; }
.loading-overlay { background: #000c; }
.loading-spinner { display: block; width: 23px; height: 23px; margin: 0 auto 18px; border: 1px solid #2a3723; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
.portrait-stage.is-dragging, .portrait-stage.drag-over { outline: 1px solid var(--green); outline-offset: -2px; }

.controls { background: var(--panel); border-left: 1px solid var(--line); padding: 24px; display: flex; flex-direction: column; gap: 0; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #445239 #0c0d0c; }
.controls > * { flex-shrink: 0; }
.controls-heading { display: flex; justify-content: space-between; align-items: center; color: #a6ae9f; font-size: 12px; letter-spacing: .1em; margin-bottom: 20px; }
.control-symbol { color: #697361; letter-spacing: 0; }
.control-description { font-size: 12px; color: #899282; margin-bottom: 13px; }
.button { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; border: 1px solid transparent; min-height: 44px; border-radius: 3px; padding: 10px 11px; font-size: 14px; font-weight: 500; cursor: pointer; transition: background .16s, border-color .16s, color .16s; }
.button-primary { background: var(--green); color: #13200b; border-color: var(--green); }
.button-primary:hover { background: #c9ffaf; border-color: #c9ffaf; }
.file-hint { margin-top: 11px; color: #89967e; font-size: 12px; text-align: center; line-height: 1.5; }
.source-control > .button-secondary { margin-top: 10px; }
#set-eyes-button[aria-pressed="true"] { border-color: var(--green); color: var(--green); }
.greeting-controls { margin-top: 10px; border: 1px solid #30392a; border-radius: 3px; background: #11150e; }
.greeting-controls > summary { min-height: 44px; padding: 12px; color: #b7bfb1; font-size: 14px; line-height: 20px; cursor: pointer; }
.greeting-controls > summary::marker { color: var(--green); }
.greeting-fields { display: grid; gap: 8px; padding: 4px 12px 10px; }
.greeting-fields > label { color: #b7bfb1; font-size: 14px; }
.greeting-fields select, .greeting-fields textarea { width: 100%; min-width: 0; min-height: 44px; padding: 8px; font: inherit; border: 1px solid #46543d; border-radius: 3px; color: var(--text); background: #0b0d09; }
.greeting-fields textarea { resize: vertical; }
.greeting-controls :is(summary, select, textarea):focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
#wish-position-hint { color: #a0aa99; font-size: 12px; line-height: 1.5; }
.greeting-axes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding-top: 4px; }
.sliders { display: grid; gap: 8px; margin: 17px 0 12px; }
.control-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; font-size: 14px; color: #b7bfb1; }
.control-label output { font-size: 12px; color: var(--green); }
/* A thick input hit area surrounds the thin track for comfortable touch use. */
input[type="range"] { display: block; width: 100%; height: 44px; margin: 0; padding: 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; accent-color: var(--green); }
input[type="range"]::-webkit-slider-runnable-track { height: 2px; border-radius: 2px; background: linear-gradient(to right, #a6cf8f var(--range-progress, 50%), #333b2d var(--range-progress, 50%)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 10px; margin-top: -4px; background: var(--green); border: 2px solid #c0e9a8; border-radius: 1px; box-shadow: 0 0 0 4px #0c0d0c; }
input[type="range"]::-moz-range-track { height: 2px; border-radius: 2px; background: #333b2d; }
input[type="range"]::-moz-range-progress { height: 2px; background: #a6cf8f; }
input[type="range"]::-moz-range-thumb { width: 7px; height: 7px; background: var(--green); border: 2px solid #c0e9a8; border-radius: 1px; box-shadow: 0 0 0 4px #0c0d0c; }
.range-endpoints { display: flex; justify-content: space-between; color: #8b9684; font-size: 12px; letter-spacing: .04em; margin-top: -6px; }
.animation-control { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-block: 1px solid #252b21; gap: 12px; }
.animation-control > div > label { font-size: 14px; color: #b7bfb1; cursor: pointer; }
.animation-control p { margin-top: 6px; color: #89967e; font-size: 12px; }
.animation-control.framing-control { border-bottom: 0; padding-block: 0; }
.switch { position: relative; display: flex; align-items: center; min-width: 44px; min-height: 44px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track { display: block; width: 34px; height: 18px; border-radius: 30px; background: #303829; border: 1px solid #424e39; transition: background .2s; pointer-events: none; }
.switch-track::after { content: ""; display: block; width: 10px; height: 10px; border-radius: 50%; background: #89987d; margin: 3px; transition: transform .2s, background .2s; }
.switch input:checked + .switch-track { background: #455c35; border-color: #68884e; }
.switch input:checked + .switch-track::after { background: var(--green); transform: translateX(15px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--green); outline-offset: 5px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + .switch-track { opacity: .4; }
.character-set { display: grid; gap: 10px; padding: 10px 0; }
#character-ramp { color: #9aa88e; font-size: 13px; letter-spacing: .05em; white-space: nowrap; }
.action-controls { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 8px; }
.action-controls > .button { grid-column: 1 / -1; font-size: 14px; gap: 6px; padding-inline: 7px; }
.button-secondary { background: #11150e; border-color: #30392a; color: #a6b09d; }
.button-secondary:hover { background: #1a2215; border-color: #56654b; color: #d6e4cb; }
.button-pair { display: contents; }
.button-pair .button { font-size: 14px; gap: 6px; padding-inline: 7px; }
.button-pair svg { width: 15px; height: 15px; }
.button-text { color: #87947b; font-size: 12px; background: transparent; min-height: 44px; }
.button-text:hover { color: var(--green); }
.button-text svg { width: 14px; height: 14px; }

.workbench-status { grid-column: 1 / -1; border-top: 1px solid var(--line); background: #0b0d09; display: flex; align-items: center; justify-content: space-between; min-height: 43px; padding: 10px 22px; gap: 20px; }
.runtime-status { color: #9baa8e; font-size: 12px; display: flex; align-items: center; gap: 8px; min-width: 0; }
#status-text { overflow-wrap: anywhere; }
#status-text.is-error { color: #ffb5a7; }
.runtime-metrics { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 15px; color: #8b9684; font-size: 12px; letter-spacing: .03em; }
.runtime-metrics strong { color: #a3b395; font-weight: 400; }
.metric-divider { width: 1px; height: 9px; background: #303a28; }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 60px; padding: 16px 0; color: #8b9684; }
.site-footer > p:first-child { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.site-footer svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 1.1; }
.site-footer > p:last-child { font-size: 12px; letter-spacing: .05em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Both targets are supported so fullscreen can retain controls or isolate the art. */
.workbench:fullscreen { width: 100vw; height: 100dvh; border: 0; border-radius: 0; grid-template-rows: minmax(0, 1fr) auto; }
.portrait-stage:fullscreen { width: 100vw; height: 100dvh; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (min-width: 1700px) { .app-shell { padding: 0 48px; } }
@media (max-width: 1100px) {
  .app-shell { padding-inline: 25px; }
  .intro { display: block; padding-block: 20px; }
  .intro-description { margin-top: 12px; }
  .intro-description br { display: none; }
  .workbench { grid-template-columns: minmax(0, 1fr) 288px; }
  .controls { padding: 22px; }
  .site-footer > p:last-child { max-width: 220px; text-align: right; line-height: 1.7; }
}
@media (max-width: 760px) {
  .app-shell { padding-inline: 18px; }
  .site-header { min-height: 80px; }
  .wordmark { font-size: 18px; letter-spacing: 3px; gap: 10px; }
  .brand-mark { width: 32px; height: 32px; }
  .wordmark-description { font-size: 12px; }
  .wordmark-divider { margin-inline: 9px; }
  .environment-label { font-size: 0; gap: 0; }
  .environment-label .status-dot { width: 6px; height: 6px; }
  .version { display: none; }
  .intro { padding: 28px 0; }
  h1 { font-size: clamp(23px, 5vw, 34px); letter-spacing: -1.1px; }
  h1 span { display: block; }
  .eyebrow { margin-bottom: 12px; }
  .intro-description { line-height: 1.7; max-width: 360px; }
  .workbench { grid-template-columns: 1fr; grid-template-rows: clamp(420px, 72vh, 650px) auto auto; }
  .controls { border-left: 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 22px 28px; padding: 24px; }
  .controls-heading { grid-column: 1 / -1; margin-bottom: 0; }
  .source-control { grid-column: 1; }
  .sliders { grid-column: 2; grid-row: span 3; margin: 0; gap: 21px; align-self: start; }
  .animation-control { padding: 12px 0; }
  .character-set { padding: 0; align-self: start; }
  .action-controls { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; align-items: start; margin: 0; padding: 0; gap: 10px; }
  .button-text { grid-column: 1 / -1; }
  .workbench-status { flex-wrap: wrap; gap: 10px; padding-inline: 17px; }
  .runtime-metrics { gap: 10px; }
  .workbench:fullscreen { overflow-y: auto; grid-template-rows: max(420px, 65dvh) auto auto; }
  .site-footer { align-items: flex-start; padding-block: 20px; }
  .site-footer > p:last-child { max-width: 220px; }
}
@media (max-width: 560px) {
  .controls { grid-template-columns: 1fr; }
  .source-control, .sliders, .animation-control, .character-set { grid-column: 1; grid-row: auto; }
  .sliders { gap: 20px; }
  .site-footer { display: grid; gap: 11px; }
  .site-footer > p:last-child { max-width: none; text-align: left; }
}
@media (max-width: 440px) {
  .app-shell { padding-inline: 12px; }
  .controls { padding: 22px 18px; gap: 22px 20px; }
  .animation-control { gap: 4px; }
  .stage-topline { inset: 22px 19px auto; }
  .source-label { gap: 7px; }
  #source-name { max-width: 105px; }
  .live-label { gap: 6px; }
  .stage-caption { gap: 6px; text-align: center; }
  .caption-divider { margin-inline: 5px; }
  .corner-tl, .corner-bl { left: 18px; }
  .corner-tr, .corner-br { right: 18px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
