/* ══════════════════════════════════════════
   PsychoQuant — Design System
   ══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Surface */
  --bg:          #080808;
  --bg-raised:   #0f0e0d;
  --bg-input:    #141210;
  --line:        #1e1c1a;
  --line-light:  #2a2520;

  /* Card */
  --card:        #f5f2ed;
  --card-back:   #ebe8e3;
  --card-text:   #2a2520;

  /* Text */
  --t1:          #e8e4df;
  --t2:          #c8c0b8;
  --t3:          #9b9590;
  --t4:          #6b6560;
  --t5:          #3a3530;

  /* Accent */
  --yes:         #3d8b5e;
  --no:          #b85450;
  --accent:      #c8c0b8;

  /* Type */
  --serif:       'Source Serif 4', Georgia, serif;
  --sans:        'DM Sans', 'Helvetica Neue', Arial, sans-serif;

  /* Sizing */
  --max-w:       440px;
  --page-max:    680px;
  --pad:         28px;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--t1);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── TYPOGRAPHY ── */

.brand {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--t4);
  font-weight: 500;
}

h1 {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--t1);
}
h2 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--t1);
}

.body-lg {
  font-size: 17px;
  line-height: 1.75;
  color: var(--t3);
}
.body-md {
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--t3);
}
.body-sm {
  font-size: 14px;
  line-height: 1.7;
  color: var(--t3);
}

.body-lg em, .body-md em, .body-sm em {
  font-style: normal;
  color: var(--t2);
}

.label {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--t4);
  font-weight: 500;
}

.rule {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--t4);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

/* ── LAYOUT ── */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.page-center {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.wrap {
  width: 100%;
  max-width: var(--max-w);
  padding: 0 var(--pad);
}

.wrap-wide {
  width: 100%;
  max-width: var(--page-max);
  padding: 0 var(--pad);
}

.stack { display: flex; flex-direction: column; }
.stack-xs { gap: 8px; }
.stack-sm { gap: 16px; }
.stack-md { gap: 24px; }
.stack-lg { gap: 32px; }
.stack-xl { gap: 48px; }

.center { text-align: center; align-items: center; }

/* ── BUTTONS ── */

.btn {
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 500;
  border: none;
  padding: 16px 48px;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.2s ease, opacity 0.25s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }

.btn-primary {
  color: var(--bg);
  background: var(--t1);
}
.btn-primary:hover { background: #fff; }

.btn-secondary {
  color: var(--t1);
  background: transparent;
  border: 1px solid var(--line-light);
}
.btn-secondary:hover { border-color: var(--t4); }

.btn-sm {
  font-size: 12px;
  padding: 10px 28px;
}

/* ── INPUTS ── */

.input {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--t1);
  background: var(--bg-input);
  border: 1px solid var(--line);
  padding: 14px 18px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s ease;
}
.input::placeholder { color: var(--t5); }
.input:focus { border-color: var(--t4); }

.input-label {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--t4);
  font-weight: 500;
  margin-bottom: 8px;
  display: block;
}

/* ── DIVIDERS ── */

.divider {
  width: 100%;
  height: 1px;
  background: var(--line);
}

/* ── SCREEN TRANSITIONS ── */

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.screen.active {
  opacity: 1;
  pointer-events: auto;
}

/* ── LOADING ── */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--line);
  border-top-color: var(--t3);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── CARD (SWIPE) ── */

.card-area {
  position: relative;
  width: 100%;
  max-width: var(--max-w);
  height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
}

.card {
  position: absolute;
  width: calc(100% - 40px);
  min-height: 240px;
  border-radius: 12px;
  padding: 36px 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  will-change: transform;
  -webkit-user-select: none;
  user-select: none;
}
.card-bg {
  background: var(--card-back);
  transform: scale(0.96) translateY(8px);
  z-index: 1;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.card-top {
  background: var(--card);
  z-index: 10;
  cursor: grab;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
  transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.card-top.dragging {
  cursor: grabbing;
  transition: none;
}
.card-top.exiting {
  transition: transform 0.28s cubic-bezier(0.4, 0, 1, 1), opacity 0.28s ease;
  opacity: 0;
}

.card-text {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.72;
  text-align: center;
  font-weight: 400;
  color: var(--card-text);
}

.swipe-label {
  position: absolute;
  top: 20px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 6px;
  border: 2px solid;
  opacity: 0;
  pointer-events: none;
}
.label-yes { right: 20px; color: var(--yes); border-color: var(--yes); }
.label-no  { left: 20px;  color: var(--no);  border-color: var(--no); }

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s ease;
  z-index: 100;
}
.progress-text {
  position: fixed;
  top: 16px;
  right: 20px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--t5);
  z-index: 100;
}

.hint-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: var(--max-w);
  padding: 20px var(--pad) 0;
}
.hint {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--t5);
  display: flex;
  align-items: center;
  gap: 8px;
}
.hint-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line-light);
  border-radius: 4px;
  font-size: 10px;
  color: var(--t4);
}

/* ── STATS (COMPLETE / REPORT) ── */

.stat-number {
  font-family: var(--sans);
  font-size: 48px;
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--t1);
}
.stat-number-sm {
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 300;
  color: var(--t1);
}

/* ── RESPONSIVE ── */

@media (max-height: 680px) {
  .card-area { height: 300px; }
  .card { min-height: 200px; padding: 28px 24px; }
  .card-text { font-size: 15.5px; line-height: 1.65; }
  h1 { font-size: 26px; }
}
@media (max-width: 380px) {
  :root { --pad: 20px; }
  .card { padding: 28px 22px; }
  .card-text { font-size: 15px; }
}
