/* Plasma Sign Maker: the stevensbored navy and mint. Preview first, settings in tabs. */
:root {
  --bg: #0c1020;
  --panel: #171b2b;
  --field: #0f1426;
  --line: #2a3048;
  --ink: #f4ede6;
  --dim: #a9adc0;
  --mint: #acf8b4;
  --warm: #ffa470;
  --bad: #ff8f8f;
  --focus: #ffffff;
  --steel: #c3c8d4;
}
@font-face { font-family: "PSM Archivo"; src: url(fonts/archivo-black.woff) format("woff"); font-display: swap; }
@font-face { font-family: "PSM Arvo"; src: url(fonts/arvo-bold.woff) format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "PSM Pacifico"; src: url(fonts/pacifico.woff) format("woff"); font-display: swap; }
@font-face { font-family: "PSM Stencil"; src: url(fonts/allerta-stencil.woff) format("woff"); font-display: swap; }
@font-face { font-family: "PSM Rye"; src: url(fonts/rye.woff) format("woff"); font-display: swap; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: rgba(172, 248, 180, .2); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 16px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.skip { position: absolute; left: 12px; top: -80px; z-index: 5; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
a { color: var(--mint); text-underline-offset: 3px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 16px; border-bottom: 1px solid var(--line); }
.home { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); text-decoration: none; font-weight: 700; }
.home b { color: var(--mint); }
.home:hover { text-decoration: underline; text-underline-offset: 4px; }
h1 { margin: 0; font-size: 1.05rem; font-weight: 600; color: var(--dim); }

/* ---------- layout: phone first ---------- */
.app { display: grid; gap: 0; }
.view { display: contents; }
.view > * { margin-left: 16px; margin-right: 16px; }
.stagewrap { position: sticky; top: 0; z-index: 2; margin: 0; padding: 10px 16px 8px; background: var(--bg); }
.stage { position: relative; height: 32vh; min-height: 200px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); overflow: hidden; }
.stage.dragging { outline: 3px dashed var(--mint); outline-offset: -6px; }
#preview { display: block; width: 100%; height: 100%; }
.drop { position: absolute; inset: auto 0 10px; margin: 0; text-align: center; color: var(--mint); font-weight: 600; }

.under { display: flex; margin-top: 0; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.sum { margin: 0; font-size: .88rem; color: var(--dim); font-variant-numeric: tabular-nums; min-width: 0; }
.exports { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.exports small { font-weight: 400; opacity: .8; }
.warns { list-style: none; margin-top: 8px; margin-bottom: 0; padding: 0; display: grid; gap: 6px; max-height: 22vh; overflow: auto; }
.warns:empty { display: none; }
.warns li { padding: 8px 10px; border-radius: 8px; background: var(--panel); border-left: 3px solid var(--warm); font-size: .86rem; }
.warns li.note { border-left-color: var(--line); color: var(--dim); }
.legend { display: none; margin-top: 8px; margin-bottom: 0; font-size: .82rem; color: var(--dim); align-items: center; gap: 6px; flex-wrap: wrap; }
.key { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-left: 6px; }
.key:first-child { margin-left: 0; }
.k-metal { background: var(--steel); }
.k-bridge { background: var(--mint); }
.k-warn { background: var(--warm); }

.controls { padding: 14px 16px 24px; min-width: 0; border-top: 1px solid var(--line); margin-top: 10px; }
#textBits, #imageBits { display: grid; gap: 14px; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.tabs button { min-height: 44px; border: 0; border-radius: 9px; background: transparent; color: var(--dim); font: inherit; font-weight: 600; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--mint); color: #0c1020; }
.panel { padding: 14px 2px 0; display: grid; gap: 14px; }

/* ---------- controls ---------- */
.btn { min-height: 46px; padding: 0 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--mint); border-color: var(--mint); color: #0c1020; }
.btn.small { min-height: 44px; padding: 0 12px; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.units { display: inline-flex; flex: none; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--field); }
.seg { min-height: 44px; min-width: 52px; padding: 0 12px; border: 0; background: transparent; color: var(--dim); font: inherit; font-weight: 600; cursor: pointer; }
.seg[aria-pressed="true"] { background: var(--mint); color: #0c1020; }
.mode { display: grid; grid-template-columns: 1fr 1fr; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 12px 14px; align-items: start; }
.field { display: grid; gap: 4px; min-width: 0; margin: 0; }
.field .name, legend { font-size: .9rem; font-weight: 600; color: var(--dim); }
.field output { color: var(--ink); font-variant-numeric: tabular-nums; margin-left: 4px; }
.hint { margin: 0; font-size: .82rem; color: var(--dim); }
textarea, .inp { border: 1px solid var(--line); border-radius: 10px; background: var(--field); }
textarea { width: 100%; min-height: 64px; padding: 10px 12px; color: var(--ink); font: inherit; font-size: 1.05rem; resize: vertical; }
textarea:focus-visible { outline: 2px solid var(--mint); outline-offset: 1px; }
.inp { display: flex; align-items: stretch; min-width: 0; }
.inp:focus-within { outline: 2px solid var(--mint); outline-offset: 1px; }
.inp input, .inp select {
  flex: 1; width: 100%; min-width: 0; min-height: 46px; padding: 8px 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink); font: inherit; outline: none;
}
.inp select { background: var(--field); }
.inp input + select { flex: 0 0 auto; width: auto; padding-left: 4px; color: var(--dim); }
.unit { display: flex; align-items: center; padding: 0 12px 0 4px; color: var(--dim); font-size: .9rem; white-space: nowrap; }
input[type="range"] { width: 100%; min-height: 44px; margin: 0; accent-color: var(--mint); }
input[type="file"] { min-height: 44px; padding: 8px 0; color: var(--dim); font: inherit; font-size: .9rem; max-width: 100%; }
input[type="file"]::file-selector-button { min-height: 44px; margin-right: 10px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.check { display: flex; align-items: center; gap: 10px; min-height: 46px; cursor: pointer; align-self: end; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--mint); flex: none; }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; }
.fonts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); gap: 6px; }
.fonts legend, .chips legend { grid-column: 1 / -1; }
.fonts label, .chips label { position: relative; display: block; }
.fonts input, .chips input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.fonts span, .chips span { display: flex; align-items: center; min-height: 48px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); cursor: pointer; line-height: 1.15; }
.fonts span { flex-direction: column; align-items: flex-start; justify-content: center; }
.fonts span b { font-weight: normal; font-size: 1.15rem; }
.fonts span small { font: .74rem/1.2 "Segoe UI", system-ui, sans-serif; color: var(--dim); }
.fonts input:checked + span, .chips input:checked + span { border-color: var(--mint); box-shadow: inset 0 0 0 1px var(--mint); }
.fonts input:checked + span small { color: var(--mint); }
.fonts input:focus-visible + span, .chips input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span { padding: 0 14px; border-radius: 999px; font-weight: 600; }
.chips input:checked + span { background: var(--mint); color: #0c1020; }
.f-archivo { font-family: "PSM Archivo", sans-serif; }
.f-arvo { font-family: "PSM Arvo", serif; font-weight: 700; }
.f-pacifico { font-family: "PSM Pacifico", cursive; }
.f-stencil { font-family: "PSM Stencil", sans-serif; }
.f-rye { font-family: "PSM Rye", serif; }

.row2 { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.saved { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.saved li { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.saved li span { min-width: 0; overflow-wrap: anywhere; }
.saved li small { display: block; color: var(--dim); font-size: .78rem; }
.saved .empty { display: block; padding: 10px 12px; color: var(--dim); }

.fine { padding: 8px 16px 40px; font-size: .86rem; color: var(--dim); max-width: 72ch; }
.fine p { margin: 0 0 10px; }

/* preview svg bits */
.pv-metal { fill: var(--steel); fill-rule: evenodd; }
.pv-bridge { fill: var(--mint); }
.pv-warn { fill: var(--warm); }
.pv-ruler { fill: var(--panel); }
.pv-tick { stroke: var(--dim); }
.pv-lab { fill: var(--dim); font: 10px "Segoe UI", system-ui, sans-serif; }
.pv-empty { fill: var(--dim); font: 14px "Segoe UI", system-ui, sans-serif; }

/* ---------- desktop: settings left, preview right ---------- */
@media (min-width: 900px) {
  .app { grid-template-columns: minmax(360px, 420px) 1fr; grid-template-areas: "controls view"; gap: 22px; padding: 18px 20px 0; max-width: 1500px; margin: 0 auto; align-items: start; }
  .controls { grid-area: controls; padding: 0 0 24px; }
  .view { grid-area: view; display: block; min-width: 0; }
  .view > * { margin-left: 0; margin-right: 0; }
  .stagewrap { position: static; padding: 0; }
  .controls { border-top: 0; margin-top: 0; }
  .under { margin-top: 8px; }
  .stage { height: calc(100vh - 290px); min-height: 360px; }
  .exports { grid-template-columns: auto auto 1fr; }
  .warns { max-height: none; }
  .legend { display: flex; }
  .fine { padding: 22px 20px 40px; margin: 0 auto; max-width: 1500px; }
  .fine p { max-width: 80ch; }
}
@media (min-width: 900px) and (max-height: 700px) { .stage { height: 420px; } }
