/* vinylise — one stylesheet, system fonts, light/dark from the OS. */

:root {
  --bg: #f3f1ec;
  --fg: #1b1b1b;
  --muted: #6b6864;
  --line: #d9d5cd;
  --panel: #ffffff;
  --accent: #e5484d;
  --accent-ink: #ffffff;
  --focus: #2f7ddc;
  --critical: #c62828;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --fg: #ececec;
    --muted: #9a9792;
    --line: #2e2e2e;
    --panel: #1c1c1c;
    --accent: #ff5d61;
    --accent-ink: #1b0b0b;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: 24px clamp(16px, 4vw, 40px) 40px;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.top { margin-bottom: 20px; }

.wordmark {
  margin: 0;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}
.wordmark span { color: var(--accent); }

.tagline { margin: 6px 0 0; color: var(--muted); max-width: 60ch; }

/* ── Layout ─────────────────────────────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
@media (min-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; }
}

/* ── Stage ──────────────────────────────────────────────────────────────── */

.stage {
  position: relative;
  min-height: min(70vh, 640px);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
  transition: box-shadow 0.15s ease;
}
.stage.dragover { box-shadow: 0 0 0 3px var(--focus); }
.stage.is-busy { cursor: progress; }

.stage[data-ground='checker'] {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #dedad4 25%, transparent 25%, transparent 75%, #dedad4 75%),
    linear-gradient(45deg, #dedad4 25%, transparent 25%, transparent 75%, #dedad4 75%);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
}
.stage[data-ground='white'] { background: #fff; }
.stage[data-ground='dark'] { background: #17191c; }
.stage[data-ground='wood'] {
  background-color: #a9764a;
  background-image:
    repeating-linear-gradient(92deg, rgba(0,0,0,0.06) 0 3px, transparent 3px 11px, rgba(255,255,255,0.05) 11px 13px, transparent 13px 29px),
    linear-gradient(180deg, #b5824f, #9a6a40);
}
.stage[data-ground='laptop'] {
  background-color: #b9bcc1;
  background-image: radial-gradient(ellipse at 30% 20%, rgba(255,255,255,0.35), transparent 60%), linear-gradient(160deg, #c9ccd1, #a6a9ae);
}

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding: 32px;
  border-radius: 12px;
  cursor: pointer;
  color: #1b1b1b;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(4px);
}
.drop strong { font-size: 18px; }
.drop span { font-size: 13px; color: #5d5a55; }
.drop__icon { width: 96px; height: 96px; margin-bottom: 8px; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.18)); }
.stage.has-result .drop, .stage.is-busy .drop { display: none; }

.preview {
  display: none;
  max-width: 100%;
  max-height: min(78vh, 900px);
  width: auto;
  height: auto;
}
.stage.has-result .preview { display: block; }

.status {
  position: absolute;
  inset: auto 16px 16px 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
}
.status__label { font-weight: 600; }
.status__detail { color: var(--muted); font-size: 13px; }
.status[data-tone='critical'] .status__label { color: var(--critical); }

.progress { flex-basis: 100%; height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 6px; }
.progress__bar { height: 100%; width: 0; background: var(--accent); transition: width 0.2s ease-out; }

/* ── Panel ──────────────────────────────────────────────────────────────── */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 16px;
}

.meta { margin: 0; font-size: 12px; color: var(--muted); word-break: break-all; }

.control { display: flex; flex-direction: column; gap: 6px; }
.control--row { flex-direction: row; align-items: center; justify-content: space-between; }

.control label, .control .label { font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; }
.control output { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }

input[type='range'] { width: 100%; accent-color: var(--accent); }
input[type='color'] {
  width: 44px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer;
}

.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--accent); margin-top: 3px; }

.grounds { display: flex; gap: 6px; }
.ground {
  width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
}
.ground.is-active { outline: 2px solid var(--focus); outline-offset: 1px; }
.ground[data-ground='checker'] {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #dedad4 25%, transparent 25%, transparent 75%, #dedad4 75%),
    linear-gradient(45deg, #dedad4 25%, transparent 25%, transparent 75%, #dedad4 75%);
  background-size: 12px 12px; background-position: 0 0, 6px 6px;
}
.ground[data-ground='white'] { background: #fff; }
.ground[data-ground='dark'] { background: #17191c; }
.ground[data-ground='wood'] { background: linear-gradient(180deg, #b5824f, #9a6a40); }
.ground[data-ground='laptop'] { background: linear-gradient(160deg, #c9ccd1, #a6a9ae); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.btn {
  appearance: none; font: inherit; font-weight: 600; font-size: 14px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--fg); cursor: pointer;
}
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); flex: 1; }
.btn:disabled { opacity: 0.45; cursor: default; }

/* ── Footer ─────────────────────────────────────────────────────────────── */

.foot { margin-top: 28px; font-size: 12px; color: var(--muted); }
.foot p { margin: 2px 0; }
.foot a { color: inherit; }
