/* Dark UI only. Layout: preview fills the left, one scrolling settings column on the right. */
:root {
  --bg: #090c0b; --surface: #0e1111; --stage: #050606; --text: #f6f6f7; --muted: #a1a7af; --line: #202325; --line-2: #2f3135;
  --field: #121416; --accent: #fcfc62; --accent-ink: #171d1c; --focus: #848a90;
  --font: "SF Pro", "SF Pro Text", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/20px var(--font); }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.mono { font-family: var(--mono); }

.app { display: grid; grid-template-columns: minmax(0, 1fr) 360px; height: 100%; }
.preview-col { display: flex; flex-direction: column; min-width: 0; background: var(--stage); }
.preview-wrap { flex: 1; min-height: 0; display: grid; place-items: center; padding: 32px; }
.preview-wrap { overflow: hidden; }
.preview-wrap img { display: block; max-width: 100%; max-height: calc(100vh - 128px); width: auto; height: auto; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .6); }
.meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px 20px; color: var(--muted); font-size: 12px; }
.hist { display: flex; gap: 6px; overflow-x: auto; max-width: 60%; padding: 2px; }
.hist button { flex: 0 0 auto; height: 40px; padding: 0; border-radius: 6px; overflow: hidden; border: 1px solid var(--line-2); background: var(--surface); }
.hist button[aria-current="true"] { box-shadow: 0 0 0 2px var(--accent); }
.hist img { display: block; height: 100%; width: auto; }

.controls { overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; background: var(--surface); border-left: 1px solid var(--line); }
h1 { margin: 0; font-size: 20px; line-height: 28px; font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lbl { font-size: 12px; line-height: 18px; font-weight: 500; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; min-width: 0; }
.row.between { justify-content: space-between; }
.row > * { min-width: 0; }

.control { width: 100%; min-width: 0; height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--field); }
.control:focus-visible, .btn:focus-visible, .seg button:focus-visible, .chips button:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--focus); }
.btn { height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--field); font-weight: 500; white-space: nowrap; transition: background .15s; }
.btn:hover { background: var(--line); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover { background: #e9e957; }
.kbd { font-family: var(--mono); font-size: 11px; opacity: .6; margin-left: 6px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 2px; gap: 2px; border-radius: 10px; background: var(--line); }
.seg button { height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--text); color: #121416; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--field); font-size: 12px; font-weight: 500; color: var(--muted); }
.chips button[aria-pressed="true"] { background: var(--text); border-color: transparent; color: #121416; }
.dims { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; color: var(--muted); }

.sw { display: flex; flex-wrap: wrap; gap: 6px; }
.sw label { position: relative; display: block; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line-2); overflow: hidden; cursor: pointer; }
.sw input { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); border: 0; padding: 0; cursor: pointer; background: none; }
.sw .break { flex-basis: 100%; height: 0; }
.sw .inkwrap { position: relative; display: block; width: 32px; height: 32px; }
.sw .rm { position: absolute; top: -6px; right: -6px; width: 16px; height: 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--field); color: var(--muted); font-size: 12px; line-height: 1; display: none; place-items: center; z-index: 1; }
.sw .inkwrap:hover .rm, .sw .inkwrap:focus-within .rm { display: grid; }
.sw .add { width: 32px; height: 32px; border-radius: 8px; border: 1px dashed var(--line-2); background: transparent; color: var(--muted); font-size: 16px; }
.sw .add:hover { background: var(--line); }

input[type="range"] { accent-color: var(--accent); min-width: 0; width: 100%; }
.slider-row { display: grid; grid-template-columns: minmax(0, 1fr) 72px auto; gap: 12px; align-items: center; }
.grid3 { display: grid; grid-template-columns: 32px minmax(0, 1fr) 56px; gap: 8px 12px; align-items: center; color: var(--muted); }
.val { text-align: right; color: var(--muted); font-size: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.check { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { accent-color: var(--accent); }
.grid-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.toast { min-height: 18px; font-size: 12px; color: var(--muted); }

@media (max-width: 860px) {
  html, body { height: auto; }
  .app { grid-template-columns: minmax(0, 1fr); height: auto; }
  .preview-wrap { padding: 16px; }
  .preview-wrap img { max-height: 70vh; }
  .controls { border-left: 0; border-top: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.row .control { width: auto; flex: 1; }
.grid3.wide { grid-template-columns: 64px minmax(0, 1fr) 56px; }

/* floating dock with the randomize buttons, centred over the preview column */
.dock { position: fixed; bottom: 20px; left: calc((100vw - 360px) / 2); transform: translateX(-50%); z-index: 20; width: min(360px, calc(100vw - 32px)); display: grid; gap: 8px; padding: 10px; border-radius: 18px; background: rgba(14, 17, 17, .86); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--line-2); box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .7); }
.dock-row { display: grid; grid-template-columns: auto 1fr 1fr 1fr; gap: 8px; align-items: center; }
.dock-label { font: 500 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 4px; }
.btn.wide { width: 100%; }
.preview-col { padding-bottom: 128px; }
.preview-wrap img { max-height: calc(100vh - 300px); }
select.control { text-overflow: ellipsis; }
@media (max-width: 860px) { .dock { left: 50%; bottom: 12px; } .preview-col { padding-bottom: 0; } .preview-wrap img { max-height: 70vh; } .controls { padding-bottom: 150px; } }

.controls h1 a.home { color: inherit; text-decoration: none; }
.controls h1 a.home:hover { text-decoration: underline; text-underline-offset: 4px; }
.controls .hint a.back { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.controls .hint a.back:hover { color: var(--fg, #fff); }

.share-row { display: flex; gap: 8px; }
.share-row .btn.wide { flex: 1; }
.share-row .btn[hidden] { display: none; }
