/* ============================================================
   Hardphone Hearts — styles
   A SIP dating simulator. Retro-telecom console meets pixel art.
   ============================================================ */

:root {
  --bg: #0e1420;
  --bg-panel: #16203046;
  --bg-panel-solid: #182335;
  --bg-card: #1e2c42;
  --ink: #e8eef7;
  --ink-dim: #9fb2cc;
  --ink-faint: #64768f;
  --accent: #35c6f4;      /* SIP signal cyan */
  --accent-2: #ff5d8f;    /* heart pink */
  --good: #57e08a;        /* 200 OK green */
  --warn: #ffcc57;
  --bad: #ff6b6b;         /* 4xx/6xx red */
  --line: #2c3d59;
  --line-soft: #223349;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --mono: "SFMono-Regular", "JetBrains Mono", "Fira Code", Consolas, "Courier New", monospace;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1200px 600px at 50% -10%, #1a2942 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 100%, #241a33 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

img, svg { image-rendering: pixelated; image-rendering: crisp-edges; }

.app {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 18px 8px;
  display: flex;
  flex-direction: column;
}

/* ---------- Shared typography / helpers ---------- */
h1, h2, h3 { line-height: 1.15; margin: 0 0 .4em; }
.mono { font-family: var(--mono); }
.dim { color: var(--ink-dim); }
.faint { color: var(--ink-faint); }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 12px; align-items: center; }
.hidden { display: none !important; }

.screen {
  animation: fade-in .35s ease both;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  background: linear-gradient(180deg, #24344e, #1a273a);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 18px;
  cursor: pointer;
  transition: transform .08s ease, border-color .15s ease, background .15s ease;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn--primary {
  background: linear-gradient(180deg, #2ec2ef, #1c93c4);
  border-color: #4bd4ff;
  color: #04222f;
}
.btn--accent {
  background: linear-gradient(180deg, #ff6f9c, #e64377);
  border-color: #ff8fb2;
  color: #2a0713;
}
.btn--ghost { background: transparent; }
.btn--lg { padding: 14px 26px; font-size: 1.08rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Title screen ---------- */
.title {
  text-align: center;
  margin-top: 6vh;
}
.title__logo {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  font-weight: 800;
  letter-spacing: .5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: .1em;
}
.title__tag {
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 1rem;
  margin-bottom: 1.6em;
}
.title__phones { font-size: 2.4rem; letter-spacing: .3em; margin-bottom: 1em; filter: saturate(1.1); }
.title__progress {
  margin-top: 1.4em;
  font-family: var(--mono);
  color: var(--ink-faint);
  font-size: .85rem;
}

/* ---------- Device grid (select screen) ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.device-tile {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: transform .1s ease, border-color .15s ease, box-shadow .15s ease;
}
.device-tile:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.device-tile.is-selected { border-color: var(--accent-2); box-shadow: 0 0 0 2px var(--accent-2) inset; }
.device-tile.is-done { opacity: .55; }
.device-tile__art { height: 130px; display: flex; align-items: center; justify-content: center; }
.device-tile__art img { max-height: 128px; max-width: 100%; }
.device-tile__name { font-weight: 700; margin-top: 8px; }
.device-tile__brand { font-size: .75rem; color: var(--ink-faint); font-family: var(--mono); text-transform: uppercase; letter-spacing: .1em; }
.device-tile__badge {
  display: inline-block; margin-top: 6px; font-size: .72rem; font-family: var(--mono);
  color: var(--good); border: 1px solid var(--good); border-radius: 20px; padding: 1px 8px;
}

/* ---------- Screen header ---------- */
.screen-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 6px; flex-wrap: wrap;
}
.screen-head h2 { margin: 0; }
.screen-head__meta { font-family: var(--mono); color: var(--ink-faint); font-size: .82rem; }

/* ---------- Swipe deck ---------- */
.deck-wrap { position: relative; display: flex; flex-direction: column; align-items: center; }
.deck {
  position: relative;
  width: min(340px, 92vw);
  height: 480px;
  margin: 10px auto 6px;
}
.swipe-card {
  position: absolute;
  inset: 0;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
  will-change: transform;
  touch-action: none;
}
.swipe-card__art {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 35%, #24374f, #16202f);
  padding: 14px;
}
.swipe-card__art img { max-height: 240px; max-width: 90%; }
.swipe-card__body { padding: 14px 16px 18px; }
.swipe-card__name { font-size: 1.3rem; font-weight: 800; }
.swipe-card__brand { font-family: var(--mono); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.swipe-card__bio { color: var(--ink-dim); margin: 8px 0 10px; min-height: 3em; }
.swipe-card__specs { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--mono); font-size: .72rem; color: var(--ink-dim);
  background: #10192750; border: 1px solid var(--line-soft); border-radius: 20px; padding: 2px 9px;
}
.swipe-stamp {
  position: absolute; top: 22px; font-family: var(--mono); font-weight: 800; font-size: 1.6rem;
  padding: 4px 14px; border: 3px solid; border-radius: 10px; opacity: 0; transform: rotate(-14deg);
  pointer-events: none; letter-spacing: .05em;
}
.swipe-stamp--like { right: 18px; color: var(--good); border-color: var(--good); }
.swipe-stamp--nope { left: 18px; color: var(--bad); border-color: var(--bad); transform: rotate(14deg); }

.deck-controls { display: flex; gap: 18px; justify-content: center; margin-top: 8px; }
.round-btn {
  width: 62px; height: 62px; border-radius: 50%; font-size: 1.5rem; display: grid; place-items: center;
  border: 2px solid var(--line); background: var(--bg-card); cursor: pointer; transition: transform .08s, border-color .15s;
}
.round-btn:hover { transform: scale(1.08); }
.round-btn--nope { color: var(--bad); border-color: var(--bad); }
.round-btn--like { color: var(--good); border-color: var(--good); }
.deck-empty { text-align: center; color: var(--ink-dim); padding: 40px 10px; }

/* ---------- Match banner ---------- */
.match-flash {
  text-align: center; padding: 40px 16px;
}
.match-flash__title {
  font-size: clamp(2rem, 8vw, 3.4rem); font-weight: 900;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- SIP puzzle ---------- */
.puzzle-intro { color: var(--ink-dim); margin-bottom: 14px; }
.puzzle-intro.wrong-banner { color: var(--bad); font-weight: 600; }
.puzzle-layout { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 760px) { .puzzle-layout { grid-template-columns: 1.3fr .9fr; } }

.ladder {
  background: var(--bg-panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 18px;
}
.ladder__heads { display: grid; grid-template-columns: 1fr 1fr; text-align: center; margin-bottom: 6px; }
.ladder__head { font-family: var(--mono); font-size: .8rem; color: var(--accent); }
.ladder__head b { display: block; color: var(--ink); font-size: .95rem; }
.ladder__rows { display: flex; flex-direction: column; gap: 8px; }

.slot {
  position: relative;
  min-height: 46px;
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  display: flex; align-items: center;
  padding: 4px;
  background: #0f18260f;
  transition: border-color .12s, background .12s;
}
.slot.drag-over { border-color: var(--accent); background: #35c6f41a; }
.slot.filled { border-style: solid; }
.slot.correct { border-color: var(--good); background: #57e08a12; }
.slot.wrong { border-color: var(--bad); background: #ff6b6b14; }
.slot__index { position: absolute; left: -26px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: .72rem; color: var(--ink-faint); width: 20px; text-align: right; }

.msg {
  font-family: var(--mono); font-size: .82rem; font-weight: 600;
  border-radius: 8px; padding: 7px 10px; cursor: grab; user-select: none;
  border: 1px solid var(--line); background: var(--bg-card); color: var(--ink);
  display: flex; align-items: center; gap: 8px; width: 100%;
  touch-action: none;
}
.msg:active { cursor: grabbing; }
.msg[data-dir="req"] { border-left: 3px solid var(--accent); }
.msg[data-dir="res"] { border-left: 3px solid var(--warn); }
.msg--distractor { border-left-color: var(--bad); }
.msg__arrow { color: var(--ink-faint); font-family: var(--mono); }
.msg.dragging { opacity: .4; }

.tray {
  background: var(--bg-panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  align-self: start;
}
.tray h3 { font-size: .95rem; margin-bottom: 4px; }
.tray__hint { font-size: .8rem; color: var(--ink-faint); margin-bottom: 10px; }
.tray__msgs { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.tray.drag-over { border-color: var(--accent); }

.puzzle-actions { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }

.mos-meter { margin-top: 14px; }
.mos-meter__label { font-family: var(--mono); font-size: .8rem; color: var(--ink-dim); display: flex; justify-content: space-between; }
.mos-bar { height: 12px; border-radius: 8px; background: #0d1524; border: 1px solid var(--line); overflow: hidden; margin-top: 4px; }
.mos-bar__fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--bad), var(--warn), var(--good)); transition: width .5s ease; }

/* ---------- Result / ending ---------- */
.result { text-align: center; padding: 20px 10px; }
.result__art img { max-height: 190px; }
.result__badge {
  display: inline-block; font-family: var(--mono); font-weight: 800; font-size: 1.2rem;
  padding: 6px 16px; border-radius: 10px; border: 2px solid; margin: 6px 0 14px;
}
.result__badge.good { color: var(--good); border-color: var(--good); }
.result__badge.bad { color: var(--bad); border-color: var(--bad); }
.result__text { max-width: 520px; margin: 0 auto 8px; color: var(--ink-dim); }
.result__sip { font-family: var(--mono); font-size: .85rem; color: var(--ink-faint); margin-bottom: 18px; }

/* ---------- Win screen ---------- */
.win { text-align: center; padding: 30px 12px; }
.win__title {
  font-size: clamp(2rem, 7vw, 3.2rem); font-weight: 900;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--good));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.win__phones { font-size: 2rem; letter-spacing: .25em; margin: 12px 0 18px; }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 14px;
  color: var(--ink-faint);
  font-size: .78rem;
  font-family: var(--mono);
  border-top: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 2px;
}
.site-footer__note { color: #3a4a63; }

/* ---------- Utility: nav row ---------- */
.nav-row { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 10px; }
