:root {
  --bg: #0E1116;
  --panel: #161B22;
  --line: #262D36;
  --ink: #E8EAED;
  --muted: #9AA4B2;
  --accent: #4B8E8D;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", Optima, "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: #7FD1CF; }
a:hover { color: #A8E6E4; }

.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;
}

/* ---- masthead ---- */
.masthead {
  max-width: 1120px;
  margin: 0 auto;
  padding: 54px 24px 26px;
}
.masthead h1 {
  margin: 0 0 6px;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.masthead h1 span { font-weight: 400; opacity: .6; }
.masthead p { margin: 0; color: var(--muted); }

main { max-width: 1120px; margin: 0 auto; padding: 0 24px 60px; }

/* ---- lookup ---- */
.lookup { display: flex; gap: 10px; }

.lookup input {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font: 400 17px/1.4 ui-monospace, "SF Mono", Menlo, monospace;
  padding: 15px 18px;
}
.lookup input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}
.lookup input::placeholder { color: #5C6673; }

button {
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 13px 20px;
  transition: background .12s ease, border-color .12s ease;
}
button:hover:not(:disabled) { background: #1E252E; border-color: #39424D; }
button:disabled { opacity: .5; cursor: default; }

#go, .primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #06201F;
  font-weight: 600;
  padding-inline: 26px;
}
#go:hover:not(:disabled), .primary:hover:not(:disabled) {
  background: #5DA5A4; border-color: #5DA5A4;
}

.status {
  min-height: 22px;
  margin: 12px 2px 0;
  font-size: 14px;
  color: var(--muted);
}
.status.err { color: #FF8B7B; }

/* ---- preview stage ---- */
.stage-wrap { margin-top: 18px; }

.stage {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  overflow: hidden;
}
.stage[data-bg="checker"] {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #D4D8DD 25%, transparent 25%, transparent 75%, #D4D8DD 75%),
    linear-gradient(45deg, #D4D8DD 25%, transparent 25%, transparent 75%, #D4D8DD 75%);
  background-size: 22px 22px;
  background-position: 0 0, 11px 11px;
}
.stage[data-bg="dark"]  { background: #101418; }
.stage[data-bg="light"] { background: #FFFFFF; }

#preview { display: block; width: 100%; height: auto; }

.stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.seg { display: flex; gap: 0; }
.seg button {
  border-radius: 0;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--muted);
  border-right-width: 0;
}
.seg button:first-child { border-radius: 8px 0 0 8px; }
.seg button:last-child  { border-radius: 0 8px 8px 0; border-right-width: 1px; }
.seg button.on { color: var(--ink); background: #222A33; }

.dims { font: 400 13px ui-monospace, Menlo, monospace; color: var(--muted); }

/* ---- controls ---- */
.panel {
  margin-top: 22px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px 26px;
}

.ctl { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ctl > label {
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

select, .fields input {
  width: 100%;
  background: #0E1116;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  padding: 10px 12px;
}
select:focus, .fields input:focus, input[type="color"]:focus {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.sw {
  width: 26px; height: 26px; padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.22);
}
.sw:hover { transform: scale(1.08); }

input[type="color"] {
  width: 100%; height: 34px; padding: 2px;
  background: #0E1116;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.checks { gap: 10px; justify-content: center; }
.chk {
  display: flex; align-items: center; gap: 9px;
  font-size: 14px; color: var(--ink); cursor: pointer;
  text-transform: none; letter-spacing: 0;
}
.chk input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---- edit text ---- */
.fields {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.fields summary {
  padding: 14px 22px;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
}
.fields summary:hover { color: var(--ink); }
.fields .grid {
  padding: 4px 22px 22px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}
.fields label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.fields label.wide { grid-column: 1 / -1; }
.fields input { font-size: 14px; }

/* ---- actions ---- */
.actions {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.ctl.inline { flex-direction: row; align-items: center; gap: 10px; }
.ctl.inline select { width: auto; }
.ctl.inline > label { text-transform: none; letter-spacing: 0; font-size: 14px; }

/* ---- footer ---- */
.foot {
  border-top: 1px solid var(--line);
  padding: 26px 24px 50px;
  max-width: 1120px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 14px;
}
.foot p { margin: 0 0 6px; }

@media (max-width: 620px) {
  .masthead { padding-top: 34px; }
  .lookup { flex-direction: column; }
  .stage { padding: 14px; }
}
