:root {
  --ink: #111216; --muted: #5b5d68; --white: #fbfbfd;
  --card-1: #e3e2e8; --card-2: #d3d2dc;
  --ai: #e8454e; --real: #2fa66f; --mid: #e0a032;
  --font: "Lexend", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh; min-height: 100dvh; font-family: var(--font); color: var(--ink);
  display: flex; flex-direction: column; overflow-x: hidden;
  transition: background .6s;
}

/* Landing: lit center, darker diagonal corners top-left and bottom-right */
body.landing {
  background:
    linear-gradient(135deg, rgba(150, 156, 172, .75) 0%, rgba(180, 184, 198, .45) 16%, transparent 34%),
    linear-gradient(315deg, rgba(150, 156, 172, .75) 0%, rgba(180, 184, 198, .45) 16%, transparent 34%),
    radial-gradient(60% 55% at 50% 48%, #fbfbfd 0%, #e9e9ef 60%, #dcdce4 100%);
}
/* Result: cool blue top-left to warm mauve bottom-right */
body.result {
  background:
    radial-gradient(45% 40% at 52% 5%, rgba(210, 228, 245, .95), transparent 70%),
    linear-gradient(160deg, #a9b6cf 0%, #b7c3d8 30%, #b2adc0 60%, #b3a39d 100%);
}

/* ---------- side nav ---------- */
.side {
  position: fixed; left: clamp(.75rem, 3vw, 3.5rem); top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 1.6rem; z-index: 5;
}
.nav-btn {
  position: relative; background: none; border: 0; cursor: pointer; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .25rem;
  font: 300 .82rem var(--font);
}
.nav-btn svg { width: 2.6rem; height: 2.6rem; fill: none; stroke: currentColor; stroke-width: 1.3;
               stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.nav-btn:hover svg { transform: scale(1.08); }
.nav-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 10px; }
/* 3D black ball marks the current page */
.nav-btn.active::after {
  content: ""; position: absolute; left: calc(100% + 1.1rem); top: 1.3rem; translate: 0 -50%;
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #8a8a8f 0%, #2a2a2e 32%, #050506 70%);
  box-shadow: 0 6px 10px rgba(0, 0, 0, .35), inset -2px -3px 5px rgba(0, 0, 0, .6);
  animation: pop .35s ease;
}
@keyframes pop { from { transform: scale(0); } }

/* ---------- main ---------- */
main { flex: 1; display: grid; place-items: center;
       padding: 2rem clamp(1rem, 4vw, 3rem) 1rem clamp(6.5rem, 12vw, 11rem); }

/* Landing button */
.upload-view { position: relative; width: min(100%, 44rem); display: grid; place-items: center; }
.glow {
  position: absolute; inset: -55% -5%; pointer-events: none; filter: blur(18px);
  background:
    radial-gradient(28% 22% at 50% 30%, rgba(255, 196, 160, .85), transparent 70%),
    radial-gradient(30% 18% at 50% 72%, rgba(255, 170, 110, .9), transparent 70%),
    radial-gradient(45% 40% at 50% 50%, rgba(255, 255, 255, .9), transparent 70%);
}
.detect-btn {
  position: relative; width: 100%; min-height: clamp(5.5rem, 13vw, 9.5rem);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 clamp(1.5rem, 6vw, 4.5rem); border-radius: 999px; cursor: pointer;
  background: linear-gradient(180deg, #f1f1f5 0%, #e6e6ec 55%, #dedee6 100%);
  box-shadow:
    inset 0 2px 1px #fff, inset 0 -4px 8px rgba(80, 80, 100, .12),
    0 0 0 1px rgba(255, 255, 255, .9), 0 1px 0 2px rgba(190, 190, 205, .5),
    -2.5rem 3.5rem 3.5rem -1rem rgba(70, 72, 92, .45),
    -1rem 1.5rem 2rem rgba(70, 72, 92, .18);
  transition: transform .2s, box-shadow .2s;
}
.detect-btn:hover, .detect-btn.over { transform: translateY(-3px); }
.detect-btn:active { transform: translateY(1px); }
.detect-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 6px; }
.detect-btn.busy { pointer-events: none; animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(.985); filter: brightness(.97); } }
#btnText { font: 400 clamp(1.5rem, 4.4vw, 3rem) / 1.1 "Helvetica Neue", Arial, sans-serif; letter-spacing: -.01em; }
.btn-icon { flex: none; width: clamp(3rem, 7vw, 5rem); height: auto; fill: none; stroke: var(--ink);
            stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.status { position: relative; min-height: 1.5em; margin: 2.2rem 0 0; text-align: center; color: var(--muted); font-weight: 300; }
.status.err { color: var(--ai); font-weight: 400; }

/* Result card */
.result-card {
  width: min(100%, 62rem); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.85fr);
  gap: clamp(.75rem, 1.6vw, 1.2rem); padding: clamp(.75rem, 1.6vw, 1.2rem);
  background: var(--white); border-radius: 2rem;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .8), 0 30px 60px -20px rgba(40, 44, 70, .45);
  animation: rise .45s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.frame { position: relative; aspect-ratio: 9 / 16; border-radius: 1.4rem; overflow: hidden; background: #ccc; }
.frame-bg { position: absolute; inset: -10%; background: center / cover no-repeat; filter: blur(22px) brightness(.9); }
.frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

.scores { display: flex; flex-direction: column; gap: clamp(.75rem, 1.6vw, 1.2rem); min-width: 0; }
.score-card {
  --vc: var(--ai); flex: 1; display: flex; flex-direction: column; justify-content: center;
  padding: clamp(1.1rem, 3vw, 2.4rem) clamp(1.2rem, 4vw, 2.8rem); border-radius: 1.4rem; background: var(--card-1);
}
.score-card.alt { background: var(--card-2); }
.score-card.likely_real { --vc: var(--real); }
.score-card.inconclusive { --vc: var(--mid); }
.score-card small { font-weight: 600; font-size: clamp(.78rem, 1.3vw, .95rem); }
.score-card h2 { margin: .1rem 0 .9rem; font-weight: 700; font-size: clamp(1.5rem, 3vw, 2.2rem); line-height: 1.1; }
.pct { font-weight: 300; font-size: clamp(1.6rem, 3.2vw, 2.4rem); color: #3a3c45; margin-bottom: .7rem; }
.bar { height: clamp(1.4rem, 2.6vw, 2rem); border-radius: .35rem; background: #f3f3f6; padding: 3px;
       box-shadow: inset 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 1px rgba(255, 255, 255, .7); }
.bar i { display: block; height: 100%; width: 0; border-radius: .25rem; transition: width 1s cubic-bezier(.2, .8, .2, 1);
         background: repeating-linear-gradient(90deg, var(--vc) 0 5px, color-mix(in srgb, var(--vc) 55%, #fff) 5px 7px); }
.verdict { margin: .7rem 0 0; font-weight: 400; color: var(--vc); font-size: .95rem; }
.again { align-self: flex-end; background: none; border: 0; cursor: pointer; color: var(--muted);
         font: 400 .9rem var(--font); text-decoration: underline; text-underline-offset: 3px; padding: .2rem 0; }
.again:hover { color: var(--ink); }

/* Footer credit */
.credit { display: block; text-align: center; padding: 1.2rem 1rem 1.8rem; color: var(--ink);
          text-decoration: none; font-weight: 300; font-size: clamp(1rem, 1.6vw, 1.35rem); }
.credit b { font-weight: 700; }
.credit:hover b { text-decoration: underline; }

/* Method / Limit popups */
.pop {
  width: min(92vw, 34rem); max-height: 85vh; border: 0; border-radius: 1.4rem; padding: 2rem 2rem 1.6rem;
  background: #0d0d10; color: #eceef3; font: 300 .98rem/1.6 var(--font);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
}
.pop::backdrop { background: rgba(20, 22, 30, .45); backdrop-filter: blur(4px); }
.pop[open] { animation: rise .3s ease; }
.pop p, .pop li { text-align: justify; hyphens: auto; }
.pop h3 { margin: 0 0 .8rem; font-weight: 600; font-size: 1.5rem; }
.pop b { font-weight: 600; color: #fff; }
.pop a { color: #9fc3ff; }
.pop ul { padding-left: 1.1rem; margin: 0; } .pop li { margin-bottom: .55rem; }
.x { position: absolute; top: .8rem; right: 1rem; background: none; border: 0; color: #aaa;
     font-size: 1.8rem; line-height: 1; cursor: pointer; } .x:hover { color: #fff; }

/* ---------- tablet ---------- */
@media (max-width: 900px) {
  .result-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
}
/* ---------- phone: nav moves to a bottom bar ---------- */
@media (max-width: 640px) {
  main { padding: 1.5rem 1rem 1rem; }
  .side { top: auto; bottom: 0; left: 0; right: 0; transform: none; flex-direction: row; justify-content: space-around;
          gap: 0; padding: .55rem .5rem calc(.55rem + env(safe-area-inset-bottom));
          background: rgba(245, 245, 249, .82); backdrop-filter: blur(12px); border-top: 1px solid rgba(255, 255, 255, .7); }
  .nav-btn svg { width: 1.9rem; height: 1.9rem; }
  .nav-btn.active::after { left: 50%; top: -.55rem; translate: -50% 0; width: .8rem; height: .8rem; }
  .credit { padding-bottom: 6rem; }
  .result-card { grid-template-columns: 1fr; border-radius: 1.6rem; }
  .frame { aspect-ratio: auto; height: min(62vh, 30rem); }
  .detect-btn { border-radius: 2.5rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
