/* Ohmy Studio — UI shell modelled on Pixel Point's Toolcraft panels (dark, Inter, 1px sliders). */
:root {
  --bg: #000;
  --fg: #f9f9f9;
  --fg-2: rgba(249, 249, 249, .75);
  --fg-3: rgba(249, 249, 249, .6);
  --muted-fg: #a1a1a1;
  --surface: rgba(23, 23, 23, .78);
  --surface-solid: #171717;
  --field: rgba(249, 249, 249, .05);
  --field-hover: rgba(249, 249, 249, .09);
  --line: rgba(249, 249, 249, .12);
  --line-2: rgba(249, 249, 249, .07);
  --track: rgba(161, 161, 161, .38);
  --accent: #0c8ce9;
  --btn: #ebebeb;
  --btn-fg: #171717;
  --radius: 8px;
  --panel-w: 300px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 12px; -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: rgba(12, 140, 233, .45); }

/* ---------- workspace ---------- */
#workspace { position: fixed; inset: 0; overflow: hidden; background-color: #050505;
  background-image: radial-gradient(rgba(249, 249, 249, .1) 1.5px, transparent 1.6px); background-size: 24px 24px; cursor: grab; touch-action: none; }
#workspace.panning { cursor: grabbing; }
#workspace.blank { background-image: none; }
#stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.artboard { position: relative; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 20px 60px rgba(0, 0, 0, .55); overflow: hidden; background: #111; }
.artboard.checker { background-color: #2a2a2a; background-image: linear-gradient(45deg, #333 25%, transparent 25%), linear-gradient(-45deg, #333 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #333 75%), linear-gradient(-45deg, transparent 75%, #333 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
.artboard > canvas, .artboard > svg, .artboard > .svg-host, .artboard > .svg-host > svg { display: block; width: 100%; height: 100%; }
.size-badge { position: absolute; left: 0; top: -22px; font-size: 11px; color: var(--muted-fg); white-space: nowrap; font-variant-numeric: tabular-nums; transform-origin: 0 100%; }

/* ---------- floating surfaces ---------- */
.surface { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); }

/* rail (tool switcher) */
#rail { position: fixed; left: 10px; top: 10px; bottom: 10px; width: 188px; display: flex; flex-direction: column; z-index: 20; padding: 10px 6px; gap: 2px; overflow-y: auto; }
#rail .brand { display: flex; align-items: center; gap: 8px; padding: 4px 8px 12px; font-weight: 500; font-size: 13px; }
#rail .brand svg { height: 14px; width: auto; }
#rail .brand small { color: var(--muted-fg); font-weight: 400; margin-left: auto; font-size: 11px; }
#rail .group { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--fg-2); padding: 12px 8px 6px; letter-spacing: .02em; }
#rail button.tool { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 8px; border: 0; background: none; border-radius: 6px; text-align: left; color: var(--fg-3); font-weight: 500; }
#rail button.tool:hover { background: var(--field); color: var(--fg); }
#rail button.tool.active { background: rgba(249, 249, 249, .1); color: var(--fg); }
#rail button.tool svg { width: 16px; height: 16px; flex: none; opacity: .9; }
#rail .foot { margin-top: auto; padding: 10px 8px 2px; color: var(--muted-fg); font-size: 11px; line-height: 1.45; }
#rail .foot b { color: var(--fg-2); font-weight: 500; }

/* panel */
#panel { position: fixed; right: 10px; top: 10px; bottom: 10px; width: var(--panel-w); z-index: 20; display: flex; flex-direction: column; overflow: hidden; }
#panel.collapsed { bottom: auto; }
#panel.collapsed .p-scroll, #panel.collapsed .p-foot { display: none; }
.p-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 10px 13px; border-bottom: 1px solid var(--line-2); flex: none; }
.p-head .title { font-size: 13px; font-weight: 500; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-scroll { overflow-y: auto; overflow-x: hidden; flex: 1; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .15) transparent; }
.p-foot { flex: none; border-top: 1px solid var(--line-2); padding: 10px 13px 12px; display: flex; flex-direction: column; gap: 8px; background: rgba(23, 23, 23, .6); }
.p-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 13px 12px; border-bottom: 1px solid var(--line-2); }

.icon-btn { width: 24px; height: 24px; display: inline-grid; place-items: center; border: 0; background: none; border-radius: 6px; color: var(--fg-3); padding: 0; flex: none; }
.icon-btn:hover { background: var(--field-hover); color: var(--fg); }
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn.boxed { background: var(--field); }

.section { border-bottom: 1px solid var(--line-2); }
.s-head { display: flex; align-items: center; gap: 4px; padding: 12px 10px 10px 13px; user-select: none; }
.s-head .s-title { flex: 1; font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--fg-2); letter-spacing: .01em; cursor: pointer; }
.s-head .chev svg { transition: transform .18s ease; }
.section.closed .s-head .chev svg { transform: rotate(180deg); }
.section.closed .s-body { display: none; }
.s-body { padding: 0 13px 14px; display: flex; flex-direction: column; gap: 12px; }
.s-note { color: var(--muted-fg); font-size: 11px; line-height: 1.45; margin-top: -2px; }
.s-note.warn { color: #f5b27a; }

/* field */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.f-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 17px; }
.f-label { color: var(--fg-3); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; gap: 4px; }
.f-label .help { width: 13px; height: 13px; border-radius: 50%; display: inline-grid; place-items: center; background: rgba(255, 255, 255, .14); color: var(--fg); font-size: 9px; font-weight: 600; cursor: help; flex: none; }
.f-value { color: var(--muted-fg); font-variant-numeric: tabular-nums; cursor: text; min-width: 4ch; text-align: right; border-radius: 4px; padding: 0 2px; }
.f-value:hover { color: var(--fg); }
.f-value input { width: 64px; background: var(--field); border: 1px solid var(--line); border-radius: 4px; text-align: right; padding: 0 4px; outline: none; color: var(--fg); }
.inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
.inline > .f-label { flex: none; max-width: 45%; }
.inline > :last-child { flex: 1; min-width: 0; max-width: 62%; }

/* slider */
.slider { position: relative; height: 18px; touch-action: none; cursor: pointer; }
.slider .track { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--track); border-radius: 1px; }
.slider .fill { position: absolute; left: 0; top: 50%; height: 1px; background: var(--fg); }
.slider .thumb { position: absolute; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; background: var(--fg); border-radius: 2px; transition: transform .12s ease; }
.slider:hover .thumb, .slider.drag .thumb { transform: scale(1.25); }
.slider .center-tick { position: absolute; top: 50%; width: 1px; height: 7px; margin-top: -3.5px; background: var(--track); }
.slider:focus-visible { outline: none; }
.slider:focus-visible .thumb { box-shadow: 0 0 0 3px rgba(12, 140, 233, .5); }

/* select, input, segmented */
.select { position: relative; }
.select select { appearance: none; -webkit-appearance: none; width: 100%; height: 28px; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 26px 0 9px; font-weight: 500; outline: none; cursor: pointer; }
.select select:hover { background: var(--field-hover); }
.select select:focus-visible { border-color: var(--accent); }
.select select option { background: #1b1b1b; color: var(--fg); }
.select::after { content: ""; position: absolute; right: 10px; top: 11px; width: 5px; height: 5px; border-right: 1.5px solid var(--muted-fg); border-bottom: 1.5px solid var(--muted-fg); transform: rotate(45deg); pointer-events: none; }
.input, .textarea { width: 100%; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 9px; outline: none; font-weight: 500; }
.input { height: 28px; }
.textarea { resize: vertical; min-height: 64px; line-height: 1.45; font-weight: 400; }
.textarea.mono { font-family: var(--mono); font-size: 11px; }
.input:focus, .textarea:focus { border-color: var(--accent); }
.seg { display: flex; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); padding: 2px; gap: 2px; }
.seg button { flex: 1; min-width: 0; height: 22px; border: 0; background: none; border-radius: 6px; color: var(--fg-3); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
.seg button:hover { color: var(--fg); }
.seg button.on { background: rgba(249, 249, 249, .14); color: var(--fg); }

/* toggle */
.toggle { width: 28px; height: 16px; border-radius: 9px; background: rgba(249, 249, 249, .16); border: 0; position: relative; padding: 0; flex: none; transition: background .15s; }
.toggle::after { content: ""; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--fg); transition: transform .15s; }
.toggle.on { background: var(--accent); }
.toggle.on::after { transform: translateX(12px); }

/* color */
.color { display: flex; align-items: center; gap: 6px; height: 28px; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 4px 0 4px; }
.color .chip { width: 20px; height: 20px; border-radius: 5px; border: 1px solid rgba(255, 255, 255, .18); position: relative; overflow: hidden; flex: none; }
.color .chip input { position: absolute; inset: -6px; width: 40px; height: 40px; opacity: 0; cursor: pointer; }
.color .hex { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-family: var(--mono); font-size: 11px; text-transform: uppercase; }
.swatches { display: flex; gap: 4px; flex-wrap: wrap; }
.swatches button { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, .2); padding: 0; }
.swatches button:hover { transform: scale(1.12); }

/* buttons */
.btn { height: 28px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--field); font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 10px; white-space: nowrap; }
.btn:hover { background: var(--field-hover); }
.btn svg { width: 13px; height: 13px; }
.btn.primary { background: var(--btn); color: var(--btn-fg); border-color: transparent; font-size: 13px; }
.btn.primary:hover { background: #fff; }
.btn.primary:disabled { opacity: .5; cursor: progress; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 6px; }
.btn-row > * { flex: 1; }

/* drop zone */
.drop { border: 1px dashed rgba(249, 249, 249, .2); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--muted-fg); cursor: pointer; position: relative; }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--fg); background: rgba(12, 140, 233, .06); }
.drop img { max-width: 100%; max-height: 110px; border-radius: 4px; display: block; }
.drop .x { position: absolute; right: 4px; top: 4px; }

/* preset grid */
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.presets button { border: 1px solid var(--line); background: var(--field); border-radius: 7px; padding: 0; overflow: hidden; text-align: left; display: flex; flex-direction: column; }
.presets button:hover { border-color: rgba(249, 249, 249, .35); }
.presets button.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.presets .thumb { aspect-ratio: 16 / 10; width: 100%; height: auto; display: block; background: #111; object-fit: cover; }
.presets svg.thumb { background: none; }
.presets .thumb > svg { width: 100%; height: 100%; display: block; }
.presets span { padding: 5px 7px 6px; font-weight: 500; font-size: 11px; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.presets.icons { grid-template-columns: repeat(6, 1fr); }
.presets.icons button { aspect-ratio: 1; align-items: center; justify-content: center; }
.presets.icons button svg { width: 70%; height: 70%; }

/* toolbar */
#toolbar { position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 4px; z-index: 20; }
#toolbar .sep { width: 1px; height: 16px; background: var(--line); margin: 0 4px; }
#toolbar .zoom { min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 11px; color: var(--fg-2); cursor: pointer; border: 0; background: none; height: 24px; border-radius: 6px; }
#toolbar .zoom:hover { background: var(--field-hover); }

/* toast */
#toast { position: fixed; left: 50%; top: 14px; transform: translate(-50%, -8px); opacity: 0; pointer-events: none; z-index: 50; padding: 8px 12px; font-weight: 500; transition: opacity .18s, transform .18s; max-width: 70vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* gallery mode (photos) */
.gallery { position: absolute; inset: 0; overflow-y: auto; padding: 24px 330px 80px 222px; cursor: default; }
.gallery h2 { font-size: 13px; font-weight: 600; margin: 4px 0 4px; }
.gallery p.lead { color: var(--muted-fg); margin: 0 0 14px; max-width: 760px; line-height: 1.5; }
.gallery .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 28px; }
.gallery figure { margin: 0; position: relative; border-radius: 8px; overflow: hidden; background: #111; border: 1px solid var(--line-2); }
.gallery figure img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; display: block; }
.gallery figure.wide img { aspect-ratio: 16 / 9; }
.gallery figure figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 10px 8px; display: flex; gap: 6px; justify-content: flex-end; background: linear-gradient(transparent, rgba(0, 0, 0, .6)); opacity: 0; transition: opacity .15s; }
.gallery figure:hover figcaption { opacity: 1; }
.gallery .rules { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; max-width: 760px; margin: 0 0 16px; color: var(--fg-2); line-height: 1.45; }
.gallery .rules div::before { content: "✓ "; color: #7bd88f; }
.gallery .rules div.no::before { content: "✕ "; color: #ff8a7a; }

.hidden { display: none !important; }
@media (max-width: 900px) { #rail { width: 52px; } #rail .brand span, #rail .brand small, #rail .group, #rail .tool span, #rail .foot { display: none; } .gallery { padding-left: 76px; } }
.gallery .chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.gallery .chip { height: 28px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--field); color: var(--fg-2); font-weight: 500; }
.gallery .chip:hover { color: var(--fg); background: var(--field-hover); }
.gallery .chip.on { background: var(--fg); color: #111; border-color: transparent; }
.gallery .grid.small { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.gallery figure.square img { aspect-ratio: 1; }
.gallery .empty { border: 1px dashed rgba(249, 249, 249, .18); border-radius: 8px; padding: 28px; color: var(--muted-fg); max-width: 760px; margin-bottom: 24px; line-height: 1.5; }
