/* hdwDP. White and black, one accent, outlines over fills, hierarchy by size.
   Follows the phone's light or dark mode. */

:root {
  --paper: #FFFFFF;
  --ink: #000000;
  --line: rgba(0, 0, 0, 0.16);
  --line-soft: rgba(0, 0, 0, 0.08);
  --muted: rgba(0, 0, 0, 0.45);
  --accent: #ff2e00;

  --r-sm: 12px;
  --r-lg: 20px;

  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue',
          Inter, system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #000000;
    --ink: #FFFFFF;
    --line: rgba(255, 255, 255, 0.22);
    --line-soft: rgba(255, 255, 255, 0.10);
    --muted: rgba(255, 255, 255, 0.5);
  }
}

* { box-sizing: border-box; }

/* Layout rules below set display, which would otherwise beat the hidden attribute. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }

.app {
  max-width: 460px;
  margin: 0 auto;
  padding: 0 20px;
}

.cap {
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.small { font-size: 12px; line-height: 1.45; color: var(--muted); }

/* ---------- header ---------- */

.bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: max(18px, env(safe-area-inset-top)) 0 18px;
}

.bar h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.ghost {
  font-size: 13px;
  color: var(--muted);
  padding: 6px 0;
}
.ghost:active { color: var(--accent); }

/* ---------- preview ---------- */

.stage { display: flex; flex-direction: column; align-items: center; gap: 16px; }

.frame {
  width: min(100%, 44vh);
  aspect-ratio: 1;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line-soft);
  transition: border-radius 180ms ease;
}
.frame.circle { border-radius: 50%; }

.frame canvas { display: block; width: 100%; height: 100%; }

.shape {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.shape button {
  font-size: 13px;
  padding: 7px 18px;
  border-radius: 999px;
  color: var(--muted);
}
.shape button.on { background: var(--ink); color: var(--paper); }

/* ---------- readability note ---------- */

.note {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 0;
  padding: 11px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--accent);
}
.note button {
  margin-left: auto;
  font-size: 13px;
  border-bottom: 1px solid currentColor;
  color: var(--accent);
  padding-bottom: 1px;
}

/* ---------- the two colour slots ---------- */

.slots {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 8px;
  margin-top: 24px;
}

.slot {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  min-width: 0;
  transition: border-color 140ms ease;
}
.slot.on { border-color: var(--ink); }

.dot {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #E6E6E6;
}

.txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.label { font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
/* Names wrap rather than clip, so "Bright Yellow" is never cut to "Bright Yel...". */
.name { font-size: 13.5px; line-height: 1.2; letter-spacing: -0.01em; }
.hex { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

.swap {
  align-self: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 15px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.swap:active { border-color: var(--accent); color: var(--accent); }

/* ---------- hex + wheel ---------- */

.entry { display: flex; gap: 8px; margin-top: 8px; }

.field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.field:focus-within { border-color: var(--ink); }
.field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font-family: var(--mono);
  font-size: 14px;
  text-transform: uppercase;
}

.wheel {
  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.wheel input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

/* ---------- pasting ---------- */

.source { margin-top: 16px; }

.drop {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 20px 18px;
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
  text-align: center;
}
.drop:active { border-color: var(--ink); }
.drop .big { font-size: 15px; letter-spacing: -0.01em; }
.drop .small { color: var(--muted); }

.quiet {
  display: block;
  width: 100%;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.lifted { display: flex; gap: 14px; margin-top: 16px; align-items: flex-start; }
.lifted canvas {
  flex: none;
  width: 104px;
  height: 104px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  cursor: crosshair;
  display: block;
}
.lifted-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.swatches button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
}
.swatches button:active { transform: scale(0.92); }

/* ---------- safe pairs ---------- */

.suggest { margin-top: 28px; }
.suggest h2 { margin: 0 0 12px; font-weight: inherit; }

.chips { display: flex; gap: 10px; }
.chips button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  font-size: 11px;
  color: var(--muted);
}
.chips canvas {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line-soft);
  display: block;
}
.chips button:active { border-color: var(--ink); }

.spacer { height: 140px; }

/* ---------- save ---------- */

.save {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  background: var(--paper);
  border-top: 1px solid var(--line-soft);
}
.save > * { max-width: 420px; margin-inline: auto; }

.save button {
  display: block;
  width: 100%;
  height: 54px;
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--paper);
  font-size: 16px;
  letter-spacing: -0.01em;
}
.save button:active { background: var(--accent); }

.filename {
  margin: 9px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
}

@media (min-width: 720px) {
  .app { max-width: 520px; }
  .save { border-top: 0; }
}
