:root {
  --night: #121c28;
  --locker: #1a2736;
  --locker-hi: #213145;
  --rivet: #2c3e54;
  --paper: #e6ecf2;
  --mute: #93a3b5;
  --amber: #f5b83d;
  --amber-ink: #241a04;
  --ok: #5cc790;
  --err: #f07c7c;
  --display: "Chakra Petch", "Segoe UI", sans-serif;
  --body: "Figtree", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--night);
  color: var(--paper);
  font: 400 1rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--amber); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
kbd {
  font: 600 .9em var(--display);
  background: var(--locker-hi);
  border: 1px solid var(--rivet);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 .35em;
  color: var(--paper);
}
img { max-width: 100%; }

/* Hazard tape: the one loud element */
.tape {
  background: repeating-linear-gradient(-45deg, var(--amber) 0 14px, var(--night) 14px 28px);
  padding: 6px 16px;
  text-align: center;
}
.tape span {
  display: inline-block;
  background: var(--amber);
  color: var(--amber-ink);
  font: 600 .9rem/1.4 var(--display);
  padding: 3px 12px;
  border-radius: 3px;
  user-select: all;
}
.tape strong { font-weight: 700; }

.bar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--paper);
  text-decoration: none;
  font: 700 1.3rem/1 var(--display);
}
.brand svg { width: 32px; height: 32px; }
.brand .c1 { fill: var(--amber); }
.brand .c2 { fill: var(--night); }
.brand em { font-style: normal; color: var(--mute); font-weight: 500; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who img { border-radius: 4px; }
.who span { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 18ch; }
.ghost {
  color: var(--mute);
  text-decoration: none;
  border: 1px solid var(--rivet);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: .9rem;
}
.ghost:hover { color: var(--paper); border-color: var(--mute); }

/* Landing */
.landing { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 48px;
  align-items: center;
  padding: 48px 0 64px;
}
.hero h1 {
  font: 700 clamp(2.1rem, 4.6vw, 3.4rem)/1.08 var(--display);
  letter-spacing: -.01em;
  margin: 0 0 20px;
  max-width: 16ch;
  text-wrap: balance;
}
.lede { font-size: 1.15rem; color: var(--mute); max-width: 46ch; margin: 0 0 28px; }
.lede kbd, .how kbd { color: var(--amber); }
.steam {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, #2a475e, #1b2838);
  color: #fff;
  text-decoration: none;
  font: 600 1.05rem var(--body);
  padding: 13px 22px 13px 18px;
  border-radius: 6px;
  border: 1px solid #3d6c8d;
  transition: border-color .15s, background-color .15s;
}
.steam:hover { border-color: #66c0f4; }
.steam svg { width: 26px; height: 26px; color: #c7d5e0; }
.fine { font-size: .875rem; color: var(--mute); max-width: 52ch; margin: 14px 0 0; }

.locker {
  position: relative;
  min-height: 360px;
  background: radial-gradient(60% 55% at 50% 45%, var(--locker-hi), transparent 72%);
  border-radius: 10px;
}
.locker figure { position: absolute; margin: 0; width: 62%; }
.locker figure img { display: block; filter: drop-shadow(0 18px 18px rgba(0,0,0,.45)); }
.locker figure:nth-child(1) { left: 0;   top: 4%;  transform: rotate(-8deg); }
.locker figure:nth-child(2) { right: 0;  top: 28%; transform: rotate(4deg); }
.locker figure:nth-child(3) { left: 14%; top: 52%; transform: rotate(-2deg); }

.trust, .how { border-top: 1px solid var(--rivet); padding: 40px 0; }
.trust h2, .how h2 { font: 600 1.4rem/1.2 var(--display); margin: 0 0 20px; }
.trust ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.trust li { color: var(--mute); padding-left: 18px; border-left: 3px solid var(--amber); }
.trust b { display: block; color: var(--paper); font-weight: 600; margin-bottom: 4px; }
.how ol { margin: 0; padding: 0; list-style: none; counter-reset: s; display: flex; gap: 12px; flex-wrap: wrap; }
.how li {
  counter-increment: s;
  flex: 1 1 220px;
  display: flex;
  gap: 12px;
  align-items: baseline;
  background: var(--locker);
  border-radius: 8px;
  padding: 16px 18px;
}
.how li::before { content: counter(s); font: 700 1.5rem/1 var(--display); color: var(--amber); }

/* App */
.app { max-width: 1180px; margin: 0 auto; padding: 0 20px 24px; }
.flash {
  margin: 0 0 20px;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--locker);
  border-left: 3px solid var(--mute);
  color: var(--mute);
}
.flash.ok { border-color: var(--ok); color: var(--paper); }
.flash.error { border-color: var(--err); color: var(--paper); }
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--rivet);
  margin-bottom: 20px;
  scrollbar-width: none;
}
.tabs button {
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--mute);
  font: 600 1rem var(--display);
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
}
.tabs button:hover { color: var(--paper); }
.tabs button[aria-selected="true"] { color: var(--paper); border-bottom-color: var(--amber); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.tile {
  display: flex;
  flex-direction: column;
  text-align: left;
  background: var(--locker);
  border: 1px solid var(--rivet);
  border-radius: 8px;
  padding: 14px;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.tile:hover { border-color: var(--amber); background: var(--locker-hi); }
.tile img { aspect-ratio: 4 / 3; object-fit: contain; width: 100%; margin-bottom: 10px; }
.tile .w { font: 600 .95rem/1.2 var(--display); }
.tile .s { font-size: .875rem; color: var(--amber); }
.tile .s.dim { color: var(--mute); }
.empty { color: var(--mute); grid-column: span 2; align-self: center; }

/* Picker */
dialog {
  width: min(880px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 1px solid var(--rivet);
  border-radius: 10px;
  background: var(--night);
  color: var(--paper);
}
dialog::backdrop { background: rgba(6, 10, 16, .75); }
dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 42px); }
dialog header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 8px; }
dialog h2 { font: 600 1.25rem var(--display); margin: 0; }
.x { background: none; border: 0; color: var(--mute); font-size: 1.8rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.x:hover { color: var(--paper); }
#picker-search {
  margin: 0 20px 12px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--rivet);
  background: var(--locker);
  color: var(--paper);
  font: inherit;
}
.choices {
  overflow-y: auto;
  padding: 4px 20px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  min-height: 200px;
}
.choice {
  background: var(--locker);
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 8px;
  color: var(--paper);
  font: 500 .8rem/1.3 var(--body);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}
.choice:hover { background: var(--locker-hi); }
.choice[aria-pressed="true"] { border-color: var(--amber); background: var(--locker-hi); }
.choice img { aspect-ratio: 4 / 3; object-fit: contain; width: 100%; }
.loading { color: var(--mute); grid-column: 1 / -1; }
dialog footer {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
  padding: 14px 20px;
  border-top: 1px solid var(--rivet);
  background: var(--locker);
}
dialog footer label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--mute); }
dialog footer select, dialog footer input {
  background: var(--night);
  color: var(--paper);
  border: 1px solid var(--rivet);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  font-size: .95rem;
}
dialog footer input { width: 8ch; }
.go {
  margin-left: auto;
  background: var(--amber);
  color: var(--amber-ink);
  border: 0;
  border-radius: 6px;
  padding: 10px 22px;
  font: 700 1rem var(--display);
  cursor: pointer;
}
.go:disabled { opacity: .45; cursor: not-allowed; }

.foot {
  max-width: 1180px;
  margin: 24px auto 0;
  padding: 24px 20px 40px;
  border-top: 1px solid var(--rivet);
  color: var(--mute);
  font-size: .85rem;
}
.foot p { margin: 0 0 4px; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 28px; gap: 24px; }
  .locker { min-height: 260px; }
  .trust ul { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 520px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tile { padding: 10px; }
  .choices { grid-template-columns: repeat(2, 1fr); }
  .who span { display: none; }
  .go { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
