/* ─────────────────────────────────────────
   DESIGN TOKENS
───────────────────────────────────────── */
:root {
  /* Color */
  --color-bg:           #070B14;
  --color-surface:      #0B1220;
  --color-border:       rgba(141, 177, 255, 0.16);
  --color-accent:       #66A3FF;
  --color-text:         #EDF5FF;
  --color-text-muted:   #8FA4C2;
  --color-danger:       #FF5A5A;
  --color-danger-dim:   #341417;
  --color-btn-bg:       #F4F8FF;
  --color-btn-text:     #07101F;
  --color-btn-hover:    #DCE8FF;
  --color-btn-active:   #C8D9F7;

  /* Type scale — minor third (×1.2), 16px base */
  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 16px;
  --text-lg:   19px;
  --text-xl:   23px;
  --text-2xl:  28px;
  --text-3xl:  33px;
  --text-4xl:  40px;
  --text-5xl:  48px;

  /* Font weight */
  --weight-regular: 400;
  --weight-medium:  500;
  --weight-bold:    700;
  --weight-black:   800;

  /* Spacing (4px base unit) */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-7:  28px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Border radius */
  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   14px;
  --radius-full: 999px;

  /* Transitions */
  --transition-fast: 0.15s ease-out;
  --transition-base: 0.35s ease-out;
}


/* ─────────────────────────────────────────
   RESET & BASE
───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: 'Inter', sans-serif;
  font-size: var(--text-base);
  -webkit-font-smoothing: antialiased;
}


/* ─────────────────────────────────────────
   LAYOUT
───────────────────────────────────────── */
.wrap {
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  margin: 0 auto;
  padding: 0 var(--space-5);
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: var(--space-8);
  padding-bottom: var(--space-4);
}

footer {
  text-align: center;
  padding-bottom: var(--space-4);
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.3);
}

footer a {
  color: rgba(255, 255, 255, 0.45);
  text-decoration: none;
}


/* ─────────────────────────────────────────
   LANDING
───────────────────────────────────────── */
.landing-copy {
  margin-bottom: var(--space-7);
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  color: var(--color-text-muted);
}

.eyebrow-name { font-weight: var(--weight-medium); }

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: var(--space-1) 9px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-accent);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}

h1 {
  margin: 0;
  font-size: var(--text-5xl);
  line-height: 0.98;
  font-weight: var(--weight-black);
  color: var(--color-text);
}

.subtext {
  margin: var(--space-5) 0 0;
  font-size: var(--text-lg);
  line-height: 1.5;
  color: var(--color-text-muted);
}

.disclaimer {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.35);
  margin-top: var(--space-4);
  text-align: center;
  line-height: 1.5;
}


/* ─────────────────────────────────────────
   FORM
───────────────────────────────────────── */
label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  color: var(--color-text-muted);
}

.row {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

input[type="text"] {
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-family: 'Inter', sans-serif;
  font-size: var(--text-base);
  padding: 13px var(--space-4);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast);
}

input[type="text"]:focus   { border-color: var(--color-accent); }
input[type="text"]::placeholder { color: var(--color-text-muted); }

.url-error {
  display: none;
  color: #ff5555;
  font-size: var(--text-sm);
  margin-top: var(--space-2);
  text-align: center;
}


/* ─────────────────────────────────────────
   BUTTONS
───────────────────────────────────────── */
button {
  font-family: 'Inter', sans-serif;
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  background: var(--color-btn-bg);
  color: var(--color-btn-text);
  border: none;
  padding: 13px var(--space-4);
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast);
}

button:hover    { background: var(--color-btn-hover); }
button:active   { background: var(--color-btn-active); }
button:disabled { opacity: 0.4; cursor: default; }

button.secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  padding: 10px var(--space-4);
}

#submitBtn { width: 100%; }


/* ─────────────────────────────────────────
   SCAN / PRELOADER
───────────────────────────────────────── */
.preloader {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) 0;
  text-align: center;
}

.big-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

#scanLabel {
  margin-top: var(--space-4);
  font-size: 14px;
  font-weight: var(--weight-regular);
  color: var(--color-text-muted);
}


/* ─────────────────────────────────────────
   STAGE (3D scene + caption)
───────────────────────────────────────── */
#stage {
  display: none;
  position: relative;
  text-align: center;
}

canvas#scene {
  --scene-size: min(100%, 300px);
  width: var(--scene-size);
  height: var(--scene-size);
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-full);
  border: 1px solid rgba(141, 177, 255, 0.18);
  background: #050A13;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  filter: drop-shadow(0 0 18px rgba(102, 163, 255, 0.22));
}

#caption {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  right: 0;
  z-index: 2;
  font-size: var(--text-base);
  line-height: 1.6;
  min-height: 72px;
  margin: 0;
  opacity: 1;
  transition: opacity var(--transition-fast);
}


/* ─────────────────────────────────────────
   RESULT AREA
───────────────────────────────────────── */
#resultArea {
  display: none;
  text-align: center;
  margin-top: var(--space-7);
  min-height: 170px;
}

.wrap.is-reviewing #resultArea           { display: block; visibility: hidden; }
.wrap.is-reviewing #resultArea.is-visible { visibility: visible; }


/* ─────────────────────────────────────────
   SCORE CARD
───────────────────────────────────────── */
#score {
  width: min(100%, 320px);
  margin: 0 auto var(--space-7);
  padding: var(--space-4);
  border: 1px solid rgba(141, 177, 255, 0.18);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(11, 18, 32, 0.96), rgba(7, 11, 20, 0.88));
  box-shadow: 0 0 34px rgba(255, 90, 90, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.score-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}

.score-value {
  font-size: var(--text-3xl);
  font-weight: var(--weight-black);
  line-height: 1;
  color: var(--color-danger);
}

.score-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
}

.score-bar {
  height: 8px;
  border-radius: var(--radius-full);
  background: rgba(141, 177, 255, 0.14);
  overflow: hidden;
}

.score-fill {
  width: var(--score-fill, 0%);
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, #FF7A7A, var(--color-danger));
  box-shadow: 0 0 14px rgba(255, 90, 90, 0.24);
  transition: width var(--transition-base);
}


/* ─────────────────────────────────────────
   ACTIONS
───────────────────────────────────────── */
#actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: center;
}

#resultArea #actions button {
  min-width: 156px;
  background: var(--color-btn-bg);
  color: var(--color-btn-text);
  border: none;
  padding: 13px var(--space-4);
}

#resultArea #actions button:hover  { background: var(--color-btn-hover); }
#resultArea #actions button:active { background: var(--color-btn-active); }


/* ─────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 430px) {
  h1         { font-size: var(--text-4xl); }
  .subtext   { font-size: var(--text-base); }
}
