@font-face {
  font-family: 'General Sans';
  src: url('../fonts/general-sans-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: optional;
}
@font-face {
  font-family: 'General Sans';
  src: url('../fonts/general-sans-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: optional;
}
@font-face {
  font-family: 'General Sans';
  src: url('../fonts/general-sans-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: optional;
}
@font-face {
  font-family: 'General Sans';
  src: url('../fonts/general-sans-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: optional;
}
:root {
  --bg: #F7F3EC;
  --ink: #201A12;
  --text: #201A12;
  --dim: #6B6152;
  --hairline: rgba(32, 26, 18, 0.16);
  --hairline-soft: rgba(32, 26, 18, 0.09);
  --accent: #B23A22;
  --accent-hover: #8F2E1A;
  --panel: #fff;
  --modal-bg: rgba(20, 16, 10, 0.55);
  --modal-bg-dark: rgba(20, 16, 10, 0.82);
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg);
}

body {
  font-family: 'General Sans', ui-sans-serif, system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  padding: 0 0 72px;
}

::selection {
  background: var(--accent);
  color: #fff;
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
  text-decoration-color: var(--hairline);
}

a:hover {
  text-decoration-color: var(--accent);
}

button, select {
  cursor: pointer;
}

input, select, textarea {
  font-family: inherit;
  color: inherit;
}

input:focus-visible,
button:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- header ---------- */
header {
  max-width: 1240px;
  margin: 0 auto;
  padding: 48px 24px 26px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

h1 {
  margin: 0;
  font-family: 'Fraunces', Georgia, serif;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1;
  color: var(--text);
}

.dev-credit {
  font-size: 12px;
  color: var(--dim);
  margin-top: 8px;
}

.head-note {
  font-size: 13.5px;
  color: var(--dim);
  max-width: 320px;
  line-height: 1.55;
  text-align: right;
}

@media (max-width: 760px) {
  .head-note {
    text-align: left;
  }
}

/* ---------- toolbar ---------- */
.toolbar {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 24px;
  border-bottom: 1px solid var(--hairline-soft);
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--hairline);
  margin: 0 6px;
}

.toolbar-spacer {
  flex: 1;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  background: none;
  border: 1px solid var(--hairline);
  color: var(--text);
  font: 500 13.5px 'General Sans', sans-serif;
  padding: 10px 16px;
  border-radius: 7px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.selbtn {
  background: none;
  border: 1px solid var(--hairline);
  color: var(--text);
  font: 500 13px 'General Sans', sans-serif;
  padding: 9px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.selbtn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.colorpick {
  width: 34px;
  height: 34px;
  padding: 3px;
  background: none;
  border: 1px solid var(--hairline);
  border-radius: 7px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.colorpick:hover {
  border-color: var(--accent);
}

.colorpick::-webkit-color-swatch-wrapper {
  padding: 0;
}

.colorpick::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.colorpick::-moz-color-swatch {
  border: none;
  border-radius: 4px;
}

#status {
  max-width: 1240px;
  margin: 0 auto;
  padding: 8px 24px 0;
  font-size: 12px;
  color: var(--accent);
  min-height: 22px;
}

/* ---------- split layout ---------- */
.split {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 24px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 36px;
  align-items: flex-start;
}

.left {
  flex: 1 1 340px;
  max-width: 440px;
  position: sticky;
  top: 16px;
}

#results {
  flex: 2 1 520px;
  min-width: 300px;
}

/* ---------- chart/cards ---------- */
.chart {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.card {
  position: relative;
  border-radius: 4px;   /* sharper than the app's chrome - reads as a printed color chip, not a UI panel */
  padding: 16px 14px 14px;
  min-height: 196px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.3s ease;
  /* idle: no border - the color fill is already the card's boundary, a
     decorative border was redundant. hover/active below use a box-shadow
     ring rather than an outline flush against the card edge on purpose:
     the app's swatches span the whole color wheel, so a same-hue card
     (e.g. an Aries red) would make an accent-colored *edge* ring nearly
     invisible against its own fill. A ring that starts with a cream gap
     stays visible regardless of the card's color, because it's contrasting
     against the neutral page background, not the card itself. */
}

.card:hover {
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent);
}

.card.active {
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--accent);
}

.card .slot-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-bottom: 8px;
}

.card .sign {
  font-family: 'Fraunces', Georgia, serif;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0;
  font-size: 21px;
  line-height: 1.15;
  opacity: 1;
}

.card .cname {
  font-size: 12.5px;
  opacity: 0.85;
  margin-top: 3px;
}

.card .bottom {
  margin-top: auto;
  padding-top: 16px;
  font-size: 12px;
  position: relative;
  z-index: 1;
  max-width: 62%;
}

.card .hx {
  font-family: 'Space Mono', monospace;   /* an actual code, unlike the pickname/slot-label words below */
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0;
  opacity: 1;
}

.card .hx .hash {
  font-weight: 400;   /* Space Mono's bold "#" is stubby/fat next to the hex digits - keep it light, let the code carry the weight */
  opacity: 0.6;
}

.card .rgb {
  font-family: 'Space Mono', monospace;
  font-size: 10.5px;
  margin-top: 4px;
  display: none;
}

.card .pickname {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 5px;
  opacity: 0.7;
}

.card .mon {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 52%;
  max-width: 118px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  object-position: right bottom;
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.3));
  animation: settle 0.8s ease both;
}

@keyframes settle {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mon {
    animation: none;
  }
  .card {
    transition: none;
  }
}

.card .clear {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: rgba(0, 0, 0, 0.22);
  color: inherit;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  display: none;
  z-index: 3;
  cursor: pointer;
}

.card.has-pick .clear {
  display: block;
}

.left .shoutout {
  font-size: 12.5px;
  color: var(--text);
  letter-spacing: 0.01em;
  line-height: 1.65;
  margin-top: 14px;
  transition: opacity 0.25s ease, max-height 0.25s ease, margin-top 0.25s ease;
}

/* ---------- results ---------- */
.res-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.res-head .swatch {
  width: 13px;
  height: 13px;
  border-radius: 2px;
  transform: translateY(1.5px);
  border: 1px solid var(--hairline);
  flex: none;
}

.res-head h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-style: normal;
  font-weight: 500;
  font-size: 21px;
  line-height: 1.1;
  color: var(--text);
}

.res-head .tgt {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0;
}

.searchwrap {
  margin-left: auto;
  position: relative;
}

#monSearch {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 7px;
  font-family: 'General Sans', sans-serif;
  font-size: 13px;
  padding: 8px 12px;
  width: 200px;
  color: var(--text);
  transition: border-color 0.2s;
}

#monSearch:focus {
  border-color: var(--accent);
}

#searchResults {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 7px;
  width: 280px;
  max-height: 320px;
  overflow: auto;
  display: none;
}

#searchResults .srow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--hairline-soft);
}

#searchResults .srow:last-child {
  border-bottom: none;
}

#searchResults .srow span {
  font-size: 13px;
  flex: 1;
}

#searchResults .srow button {
  background: none;
  border: 1px solid var(--hairline);
  color: var(--text);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

#searchResults .srow button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#searchResults img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}


.genrow {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 16px;
  align-items: center;
}

.genrow .glab {
  font-family: 'Space Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--dim);
  margin-right: 4px;
  text-transform: uppercase;
}

.gchip {
  font-family: 'Space Mono', monospace;
  background: none;
  border: 1px solid var(--hairline-soft);
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.02em;
  padding: 5px 10px;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.35s, color 0.35s, background 0.35s;
}

.gchip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.gchip.on {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(139, 120, 93, 0.08);
}

.showmore {
  display: block;
  margin: 14px auto 0;
  background: none;
  border: 1px solid var(--hairline-soft);
  color: var(--dim);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  padding: 8px 22px;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.35s, color 0.35s;
}

.showmore:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.variant-label {
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--accent);
  text-transform: uppercase;
  margin: 24px 0 12px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.variant-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hairline-soft);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 11px;
}

.tile {
  background: var(--panel);
  border: 1px solid var(--hairline-soft);
  border-radius: 4px;
  padding: 12px 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.35s, box-shadow 0.35s;
}

.tile:hover {
  border-color: var(--accent);
}

.tile.picked {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--accent);
}

.tile .imgbox {
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile img {
  width: 96px;
  height: 96px;
  object-fit: contain;
}

.tile .tname {
  font-size: 13px;
  margin-top: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.tile .meta {
  font-family: 'Space Mono', monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 9px;
  color: var(--dim);
}

.tile .chip {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid var(--hairline);
  flex: none;
}

/* ---------- footer ---------- */
footer {
  max-width: 1240px;
  margin: 56px auto 0;
  padding: 18px 24px 40px;
  border-top: 1px solid var(--hairline-soft);
  font-size: 12px;
  color: var(--dim);
  line-height: 1.7;
}

footer p + p {
  margin-top: 10px;
}

footer .method-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

footer .method {
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.65;
  max-width: 640px;   /* keeps the longer explanation at a readable line length instead of stretching the full footer width */
}

/* ---------- modals ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: var(--modal-bg);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal.open {
  display: flex;
}

.modal .box {
  background: var(--panel);
  border-radius: 10px;
  padding: 30px;
  max-width: min(620px, 94vw);
  max-height: 92vh;
  overflow: auto;
  box-shadow: 0 30px 60px -20px rgba(20, 16, 10, 0.35);
}

.modal .box.plain {
  background: none;
  padding: 0;
  text-align: center;
  box-shadow: none;
}

.modal h3 {
  margin: 0 0 6px;
  font-family: 'Fraunces', Georgia, serif;
  font-style: normal;
  font-weight: 500;
  font-size: 24px;
  color: var(--text);
}

.modal .sub {
  font-size: 12.5px;
  color: var(--dim);
  margin-bottom: 20px;
  line-height: 1.55;
}

.edit-row {
  display: grid;
  grid-template-columns: 70px 1fr 1fr 104px 96px;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.edit-row .lab {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.edit-row input {
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  font-size: 13.5px;
  padding: 9px 11px;
  width: 100%;
  color: var(--text);
  font-family: 'General Sans', sans-serif;
  transition: border-color 0.2s;
}

.edit-row input:focus {
  border-color: var(--accent);
}

.edit-row input.ehex {
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.hexcell {
  display: flex;
  align-items: center;
  gap: 7px;
}

.hexcell .sw {
  width: 20px;
  height: 20px;
  border-radius: 2px;
  border: 1px solid var(--hairline);
  flex: none;
}

.edit-row select.eink {
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  font-family: 'General Sans', sans-serif;
  font-size: 11px;
  padding: 8px 6px;
  width: 100%;
  color: var(--text);
}

#captionText {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  font-family: 'General Sans', sans-serif;
  font-size: 13px;
  color: var(--text);
  padding: 11px;
  resize: vertical;
}

.modal .row {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  flex-wrap: wrap;
}

.modal .box.plain .row {
  justify-content: center;
}

/* plain box has no background, floats on the dark backdrop - non-primary
   controls need light-on-dark colors (primary is solid-filled already) */
.modal .box.plain .btn:not(.primary) {
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.modal .box.plain .btn:not(.primary):hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

#exportImg {
  max-width: 100%;
  max-height: 74vh;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
}

.modal .note {
  font-size: 11px;
  color: var(--dim);
  margin-top: 10px;
  letter-spacing: 0.04em;
}

.modal .box.plain .note {
  color: rgba(255, 255, 255, 0.55);
}

/* ---------- mobile: compact sticky chart strip ----------
   kept below the desktop rules it overrides - same selectors, and source
   order breaks ties when a media query and a plain rule share specificity */
@media (max-width: 900px) {
  .split {
    gap: 16px;
    padding: 10px 16px 0;
  }

  /* .left carries the sticky pin, not #chart - its containing block (.split)
     spans the full results height, so it stays pinned the whole scroll */
  .left {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--bg);
    padding: 8px 0;
    box-shadow: 0 8px 16px -10px rgba(10, 10, 30, 0.28);
    max-width: 100%;
  }

  .chart {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px;
  }

  /* toggled by main.js after a few px of scroll */
  .left.scrolled .shoutout {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
    overflow: hidden;
  }

  .card {
    min-width: 0;   /* grid items don't shrink below content width by default - long signs widen their track past the viewport otherwise */
    min-height: 112px;
    padding: 9px 8px 8px;
  }

  .card .cname,
  .card .rgb,
  .card .pickname {
    display: none;
  }

  .card .slot-label {
    font-size: 8px;
    letter-spacing: 0.22em;
    margin-bottom: 4px;
  }

  .card .sign {
    font-size: 11px;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 3;   /* "Sagittarius" alone needs 2 lines here - 3rd keeps "Moon"/"Rising" visible */
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: break-word;   /* otherwise a too-wide word gets clipped instead of wrapping */
  }

  .card .bottom {
    padding-top: 8px;
    max-width: 58%;
  }

  .card .hx {
    font-size: 9.5px;
  }

  .card .mon {
    max-width: 70px;
    width: 60%;
    right: 0;
    bottom: 0;
  }

  .card .clear {
    width: 18px;
    height: 18px;
    top: 4px;
    right: 4px;
    font-size: 10px;
  }

  .left .shoutout {
    font-size: 10.5px;
    line-height: 1.5;
    margin-top: 8px;
    max-height: 80px;   /* transitions need an explicit start value to animate from */
  }

  .searchwrap {
    flex: 1 1 100%;
    margin-left: 0;
  }

  #monSearch {
    width: 100%;
    font-size: 16px;
  }

  #searchResults {
    width: 100%;
  }

  header {
    padding: 26px 16px 14px;
  }

  .toolbar {
    padding: 10px 16px;
    gap: 8px;
  }

  .btn {
    padding: 8px 12px;
  }

  #status {
    padding: 6px 16px 0;
  }

  footer {
    padding: 16px 16px 0;
  }
}

@media (max-width: 560px) {
  .modal .box {
    padding: 20px;
  }

  .edit-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--hairline-soft);
  }

  .edit-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
  }

  .edit-row input,
  .edit-row select.eink {
    font-size: 16px;
    padding: 12px 14px;
  }

  .hexcell .sw {
    width: 28px;
    height: 28px;
  }
}

input[type="file"] {
  display: none;
}
