/* PC Picker. Same HUD look as the rest of shayanisaac.cc: cyan on black, blueprint
   grid, Orbitron headings, Rajdhani text. Colours copied from Card Vault's hud.css. */

:root {
  --bg: #05080b;
  --surface: #071219;
  --panel-2: #040b10;
  --line: rgba(63, 216, 255, 0.28);
  --line-strong: rgba(63, 216, 255, 0.55);
  --ink: #d6f3ff;
  --muted: #6f97ab;
  --cyan: #3fd8ff;
  --cyan-glow: rgba(63, 216, 255, 0.45);
  --cyan-faint: rgba(63, 216, 255, 0.06);
  --red: #ff3b5c;
  --amber: #ffc53d;
  --green: #4ade80;
  --display: "Orbitron", system-ui, sans-serif;
  --body: "Rajdhani", system-ui, sans-serif;
  --glow: 0 0 28px rgba(63, 216, 255, 0.22), inset 0 0 28px rgba(63, 216, 255, 0.08);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 500 17px/1.4 var(--body);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(63, 216, 255, 0.10), transparent 60%),
    linear-gradient(var(--cyan-faint) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, var(--cyan-faint) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--bg);
}
button { font: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.page {
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* never wider than the screen */
  gap: 24px;
}

/* ---------- Header ---------- */

header { display: grid; justify-items: center; gap: 6px; text-align: center; }
.kicker {
  font: 600 11px var(--display);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.kicker:hover { color: var(--cyan); }
h1 {
  margin: 0;
  font: 900 clamp(34px, 9vw, 64px)/1.05 var(--display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(63, 216, 255, 0.35);
}
h1 span { color: var(--cyan); }
@media (max-width: 420px) { h1 { letter-spacing: 0.06em; } .sub { letter-spacing: 0.14em; } }
.sub {
  margin: 0;
  font: 500 11px var(--display);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}
.stripe {
  width: min(520px, 100%);
  height: 2px;
  margin-top: 10px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), #9eeaff, var(--cyan), transparent);
  background-size: 200% 100%;
  box-shadow: 0 0 12px var(--cyan-glow);
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Summary: total, power, status ---------- */

.hud { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.stat {
  min-width: 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.stat.status { grid-column: 1 / -1; }
@media (min-width: 760px) {
  .hud { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat.status { grid-column: auto; }
}
.label {
  font: 600 11px var(--display);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.value {
  margin: 4px 0 2px;
  font: 700 clamp(24px, 6vw, 36px)/1.15 var(--display);
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(63, 216, 255, 0.4);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.small { font-size: 15px; color: var(--muted); }
.meter {
  height: 6px;
  margin: 6px 0 4px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 99px;
}
.meter i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
  transition: width 0.5s, background-color 0.3s;
}
.meter i.tight { background: var(--amber); }
.meter i.over { background: var(--red); }

.status.ready { border-color: var(--green); box-shadow: 0 0 28px rgba(74, 222, 128, 0.18); }
.status.ready .value { color: var(--green); text-shadow: 0 0 18px rgba(74, 222, 128, 0.45); }
.status.warn { border-color: rgba(255, 197, 61, 0.6); }
.status.warn .value { color: var(--amber); text-shadow: 0 0 18px rgba(255, 197, 61, 0.35); }
.status.bad { border-color: rgba(255, 59, 92, 0.7); box-shadow: 0 0 28px rgba(255, 59, 92, 0.15); }
.status.bad .value { color: var(--red); text-shadow: 0 0 18px rgba(255, 59, 92, 0.4); }
.status.cheer { animation: cheer 0.9s ease; }
@keyframes cheer {
  30% { transform: scale(1.04); box-shadow: 0 0 60px rgba(74, 222, 128, 0.5); }
}

/* ---------- Example builds ---------- */

.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.presets-label {
  font: 600 11px var(--display);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 14px;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 99px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chip b { margin-left: 8px; color: var(--cyan); font-weight: 700; font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--cyan); box-shadow: var(--glow); }
.chip.on { color: var(--cyan); border-color: var(--cyan); background: rgba(63, 216, 255, 0.08); }
.picker-groups { padding: 0 16px 12px; border-bottom: 1px solid var(--line); }
.picker-groups:empty { display: none; }
.picker-groups .chip { padding: 4px 11px; font-size: 15px; }
.picker-groups .chip b { margin-left: 6px; }

/* ---------- Panels ---------- */

.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.side { display: grid; gap: 16px; align-content: start; min-width: 0; }
@media (min-width: 1000px) { .layout { grid-template-columns: minmax(0, 1fr) 380px; } }
/* Wide screens: the blueprint column is half the page. */
@media (min-width: 1200px) { .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
/* The side column follows you down the page, if the screen is tall enough to hold it. */
@media (min-width: 1000px) and (min-height: 900px) { .side { position: sticky; top: 16px; } }
.panel {
  min-width: 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.panel h2 {
  margin: 0;
  font: 700 14px var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}
.head-actions { display: flex; gap: 8px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  font: 700 12px var(--display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  text-decoration: none;
  color: var(--bg);
  background: var(--cyan);
  border: 1px solid var(--cyan);
  border-radius: 8px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
}
.btn:hover { box-shadow: 0 0 18px var(--cyan-glow); }
.btn:active { transform: translateY(1px); }
.btn.ghost { color: var(--cyan); background: transparent; }
.btn.small { padding: 7px 10px; font-size: 11px; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.icon-btn:hover { color: var(--red); border-color: var(--red); }
/* Fingers, not mouse pointers: Apple asks for 44px tap targets, so the small buttons grow. */
@media (pointer: coarse) {
  .btn.small, .icon-btn, .chip { min-height: 44px; }
  .icon-btn { width: 44px; }
}
.link {
  padding: 0;
  color: var(--cyan);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ---------- The build ---------- */

.slots { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.slot {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  grid-template-areas: "tag main price" "tag actions actions";
  align-items: center;
  gap: 8px 16px;
  padding: 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.slot.empty {
  grid-template-areas: "tag main actions";
  background: transparent;
  border-style: dashed;
}
@media (min-width: 640px) {
  .slot { grid-template-columns: 48px minmax(0, 1fr) auto auto; grid-template-areas: "tag main price actions"; }
  .slot.empty { grid-template-columns: 48px minmax(0, 1fr) auto; }
}
.slot-tag {
  grid-area: tag;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  font: 700 11px var(--display);
  letter-spacing: 0.06em;
  color: var(--cyan);
  background: rgba(63, 216, 255, 0.05);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}
.slot.empty .slot-tag { color: var(--muted); border-color: var(--line); background: none; }
.slot-main { grid-area: main; min-width: 0; }
.slot-label {
  font: 600 11px var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.part-name { font-size: 17px; font-weight: 700; line-height: 1.2; }
.part-spec { font-size: 15px; color: var(--muted); }
.slot-price { grid-area: price; align-self: start; font: 700 15px var(--display); font-variant-numeric: tabular-nums; }
@media (min-width: 640px) { .slot-price { align-self: center; } }
.slot-actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.slot.is-error { border-color: var(--red); box-shadow: 0 0 18px rgba(255, 59, 92, 0.15); }
.slot.is-error .slot-tag { color: var(--red); border-color: var(--red); background: rgba(255, 59, 92, 0.08); }
.slot.is-warn { border-color: rgba(255, 197, 61, 0.7); }
.slot.is-warn .slot-tag { color: var(--amber); border-color: rgba(255, 197, 61, 0.7); background: rgba(255, 197, 61, 0.06); }
.slot.pop { animation: pop 0.6s ease; }
@keyframes pop {
  0% { transform: scale(0.97); }
  40% { transform: scale(1.01); border-color: var(--cyan); box-shadow: 0 0 30px var(--cyan-glow); }
}

/* ---------- Blueprint ---------- */

.blueprint .panel-head { margin-bottom: 8px; }
.bp-hint, .bp-foot {
  font: 600 11px var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.bp-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  max-height: clamp(320px, calc(100vh - 380px), 760px); /* square, but never taller than the screen */
  /* Drafting paper: fine 20 mm-style grid, heavier every fifth line, soft light in the middle */
  background:
    linear-gradient(rgba(63, 216, 255, 0.045) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(90deg, rgba(63, 216, 255, 0.045) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(rgba(63, 216, 255, 0.09) 1px, transparent 1px) 0 0 / 100px 100px,
    linear-gradient(90deg, rgba(63, 216, 255, 0.09) 1px, transparent 1px) 0 0 / 100px 100px,
    radial-gradient(circle at 50% 45%, rgba(63, 216, 255, 0.09), transparent 70%),
    var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: grab;
  touch-action: pan-y; /* sideways drag spins it, up and down still scrolls the page */
}
.bp-canvas:active { cursor: grabbing; }
.bp-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  margin-top: 8px;
  line-height: 1.5;
}
#bpCase { color: var(--ink); }

/* ---------- Checks ---------- */

.issues { display: grid; gap: 8px; margin: 16px 0; padding: 0; list-style: none; }
.issue {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  padding: 10px 12px;
  font-size: 15px;
  line-height: 1.3;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.issue .ico {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  font: 700 11px var(--display);
  color: var(--bg);
  background: var(--cyan);
  border-radius: 50%;
}
.issue.error { border-color: rgba(255, 59, 92, 0.6); }
.issue.error .ico { background: var(--red); }
.issue.warn { border-color: rgba(255, 197, 61, 0.5); }
.issue.warn .ico { background: var(--amber); }
.issue.good { border-color: rgba(74, 222, 128, 0.5); }
.issue.good .ico { background: var(--green); }
.issue.hint { color: var(--muted); border-style: dashed; }
.issue.hint .ico { background: none; }
.fineprint { margin: 0; font-size: 15px; color: var(--muted); }
.fineprint b { color: var(--ink); }

footer {
  text-align: center;
  font: 500 11px var(--display);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Part list (pop-up) ---------- */

dialog {
  width: min(760px, calc(100vw - 32px));
  height: min(720px, calc(100dvh - 48px));
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 0 60px rgba(63, 216, 255, 0.18);
}
dialog::backdrop { background: rgba(2, 5, 8, 0.78); backdrop-filter: blur(3px); }
/* Opens with a short fade and lift rather than popping in. Older browsers just skip it. */
dialog[open] { opacity: 1; transform: none; transition: opacity 0.2s ease-out, transform 0.2s ease-out; }
@starting-style { dialog[open] { opacity: 0; transform: translateY(10px) scale(0.98); } }
@media (max-width: 640px) {
  dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .picker-head { padding-top: calc(14px + env(safe-area-inset-top)); }
  .picker-foot { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
}
.picker { display: flex; flex-direction: column; height: 100%; }
.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.picker-head h2 {
  margin: 0;
  font: 700 15px var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
}
.picker-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.picker-tools input[type="search"] { flex: 1 1 220px; }
input[type="search"], select {
  min-width: 0;
  padding: 9px 12px;
  font: 600 16px var(--body); /* 16px stops iPhone zooming in */
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
input[type="search"]:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 12px rgba(63, 216, 255, 0.25); }
.list {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 6px;
  margin: 0;
  padding: 10px;
  overflow-y: auto;
  list-style: none;
}
.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  color: inherit;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.item:hover { border-color: var(--cyan); box-shadow: var(--glow); }
.item.current { border-color: var(--cyan); }
.item.current .item-name::after {
  content: "PICKED";
  margin-left: 8px;
  font: 700 11px var(--display);
  letter-spacing: 0.14em;
  color: var(--cyan);
  vertical-align: middle;
}
/* Parts that do not fit: shown so you know why, but they cannot be picked. */
.item.locked { cursor: not-allowed; }
.item.locked .item-name, .item.locked .item-spec, .item.locked .item-price { opacity: 0.6; }
.item.locked:hover { border-color: var(--line); box-shadow: none; }
.item.locked .item-name::after {
  content: "DOES NOT FIT";
  margin-left: 8px;
  font: 700 11px var(--display);
  letter-spacing: 0.14em;
  color: var(--red);
  vertical-align: middle;
}
.item.locked .item-price { color: var(--muted); }
.locked-head { padding: 10px 4px 4px; font-size: 15px; }
.item-name { display: block; font-size: 17px; font-weight: 700; line-height: 1.2; }
.item-spec { display: block; font-size: 15px; color: var(--muted); }
.item-why { display: block; margin-top: 2px; font-size: 15px; color: var(--red); }
.item-price { font: 700 15px var(--display); font-variant-numeric: tabular-nums; color: var(--cyan); }
.nothing { padding: 20px; text-align: center; color: var(--muted); }
.picker-foot {
  margin: 0;
  padding: 10px 16px;
  font-size: 15px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  font-size: 15px;
  background: var(--surface);
  border: 1px solid var(--cyan);
  border-radius: 10px;
  box-shadow: 0 0 24px rgba(63, 216, 255, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.toast .link { font: 700 12px var(--display); letter-spacing: 0.1em; text-transform: uppercase; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
