:root{
  --bg: #0b0b0c;
  --bg-2: #0e0e10;
  --surface: #121214;
  --surface-2: #161618;
  --text: #e8e8ea;
  --muted: #a0a0a6;
  --primary: #8b5cf6;
  --primary-600: #7c3aed;
  --ring: rgba(139,92,246,0.40);
  --success: #10b981;
  --danger: #ef4444;
}
/* Ensure elements with the HTML hidden attribute are actually hidden
   despite any class-based display styles */
[hidden]{ display: none !important; }
*{ box-sizing: border-box }
html, body { height: 100% }
body{
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 20% -10%, #111114, var(--bg)),
    radial-gradient(900px 500px at 80% -20%, #141416, transparent),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Animated background accents (subtle, psychology vibes) */
body::before{
  content: "";
  position: fixed; inset: -20% -10% -30% -10%;
  background:
    radial-gradient(680px 360px at 12% 14%, rgba(124,58,237,0.10), transparent 60%),
    radial-gradient(520px 280px at 50% 86%, rgba(255,255,255,0.04), transparent 60%);
  filter: blur(40px) saturate(110%);
  animation: bg-float 22s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

/* Soft techy grid overlay */
body::after{
  content: "";
  position: fixed; inset: 0;
  /* Static noise texture + soft grid (no animation) */
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='64' height='64'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.06'/></svg>"),
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 64px 64px, 22px 22px, 22px 22px;
  opacity: .14;
  mask-image: radial-gradient(65% 55% at 50% 18%, rgba(0,0,0,0.9), transparent 80%);
  pointer-events: none;
  z-index: 0;
}
#app{
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  z-index: 1;
  padding-top: clamp(8px, 2vh, 24px);
}
#app.align-top{
  align-content: start;
  place-items: start center;
  padding-top: calc(clamp(8px, 4vh, 24px) + env(safe-area-inset-top));
}
.screen{ display: none; width: 100%; max-width: 920px }
.screen.active{ display: block }

/* Animate cards on screen activation */
.screen.active .card{ animation: card-enter 420ms cubic-bezier(.21,.99,.43,1.01) both }

@keyframes card-enter{
  from{ opacity: 0; transform: translateY(10px) scale(.98) }
  to{ opacity: 1; transform: translateY(0) scale(1) }
}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow:
    0 24px 80px rgba(0,0,0,0.65),
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 0 0 0 rgba(139,92,246,0);
  border-radius: 18px;
  padding: 24px;
  backdrop-filter: blur(10px);
}
:root[data-theme="light"] .card{
  background: linear-gradient(180deg, rgba(0,0,0,0.03), rgba(0,0,0,0.02));
  border-color: rgba(0,0,0,0.06);
  box-shadow: 0 24px 60px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.6);
}

.title{
  margin: 0 0 8px;
  font-size: clamp(26px, 5vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.tagline{ color: var(--muted); margin: 6px 0 18px }
.hint{ color: var(--muted); font-size: 14px }

.btn{
  appearance: none; border: none; cursor: pointer;
  background: rgba(255,255,255,0.06); color: var(--text);
  padding: 12px 16px; border-radius: 12px; font-weight: 600;
  transition: transform .06s ease, background .2s ease, box-shadow .25s ease, filter .2s ease;
}
.btn:hover{ background: rgba(255,255,255,0.1); box-shadow: 0 10px 26px rgba(0,0,0,0.4) }
.btn:active{ transform: translateY(1px) }
.btn-primary{
  background: linear-gradient(90deg, var(--primary), var(--primary-600));
  box-shadow: 0 10px 26px var(--ring), 0 0 0 0 rgba(139,92,246,0);
}
.btn-primary:hover{ filter: brightness(1.06); box-shadow: 0 12px 30px var(--ring), 0 0 0 3px rgba(139,92,246,0.15) inset }
.btn:focus-visible{
  outline: none;
  box-shadow: 0 0 0 4px var(--ring), 0 6px 22px rgba(0,0,0,0.65);
}

.topbar{ display:flex; align-items:center; justify-content:space-between; margin-bottom: 12px; gap: 12px }
.progress{ color: var(--muted) }
.progress-bar{ flex: 1 1 auto; height: 8px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; border: 1px solid rgba(255,255,255,0.08) }
.progress-fill{ height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary), var(--primary-600)); box-shadow: 0 8px 22px var(--ring), 0 0 0 1px rgba(139,92,246,0.2) inset }

.input{
  width: 100%; background: rgba(255,255,255,0.05); color: var(--text); border: 1px solid rgba(255,255,255,0.1);
  padding: 12px 14px; border-radius: 12px; outline: none; font-size: 16px;
}
:root[data-theme="light"] .input{ background: rgba(0,0,0,0.035); border-color: rgba(0,0,0,0.08) }
.input:focus{ border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring), 0 10px 26px rgba(0,0,0,0.4) }
.input::placeholder{ color: #9aa1ab }

.interpretation{
  padding: 12px 14px; border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; background: rgba(16,185,129,0.1);
}
:root[data-theme="light"] .interpretation{ border-color: rgba(0,0,0,0.08) }
.results-list{ display: grid; gap: 10px; padding-left: 20px }
.muted{ color: var(--muted) }

.actions{ display:flex; gap: 10px; margin-top: 6px }

.gender-prompt{ display:flex; align-items:center; gap: 12px; }
.gender-label{ color: var(--muted); }

.sr-only{
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 1px, 1px); white-space: nowrap; border: 0;
}

@media (max-width: 480px){
  .card{ padding: 18px }
  .image-wrap{ min-height: clamp(200px, 42vh, 420px); }
}

/* Compact, top-centered layout for the test screen */
#screen-test .card{
  max-width: 640px;
  margin: 0 auto;
}

#screen-test .image-wrap{
  max-width: min(92vw, 720px);
  margin-left: auto;
  margin-right: auto;
}

/* Szondi styles */
.screen#screen-szondi .card,
#screen-szondi .card{
  max-width: 560px;
  margin: 4px auto 0;
}
.szondi-image-wrap{
  position: relative; width: 100%; border-radius: 16px; overflow: hidden; background: #0c0c10; border: 1px solid rgba(255,255,255,0.08);
  display: grid; place-items: center; margin-bottom: 16px;
}
:root[data-theme="light"] .szondi-image-wrap{ background: #eef2ff; border-color: rgba(0,0,0,0.06) }
.screen#screen-szondi .szondi-image-wrap,
#screen-szondi .szondi-image-wrap{
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}
.szondi-image{ width: 100%; height: auto; max-height: 260px; display: block; object-fit: contain }
.image-fallback{ color: var(--muted); font-size: 14px }

.qa{ display: grid; gap: 12px }
.question{ font-size: 18px; margin: 0 0 6px }
.input{
  width: 100%; background: rgba(255,255,255,0.05); color: var(--text); border: 1px solid rgba(255,255,255,0.1);
  padding: 12px 14px; border-radius: 12px; outline: none; font-size: 16px;
}
:root[data-theme="light"] .input{ background: rgba(0,0,0,0.035); border-color: rgba(0,0,0,0.08) }
.input:focus{ border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring), 0 10px 26px rgba(0,0,0,0.4) }
.input::placeholder{ color: #9aa1ab }

.interpretation{
  padding: 12px 14px; border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; background: rgba(16,185,129,0.1);
}
:root[data-theme="light"] .interpretation{ border-color: rgba(0,0,0,0.08) }
.results-list{ display: grid; gap: 10px; padding-left: 20px }
.muted{ color: var(--muted) }

.actions{ display:flex; gap: 10px; margin-top: 6px }

.gender-prompt{ display:flex; align-items:center; gap: 12px; }
.gender-label{ color: var(--muted); }

.sr-only{
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 1px, 1px); white-space: nowrap; border: 0;
}

/* Szondi choices layout (ensure present after dark mode refactor) */
.choices{ display: grid; grid-template-columns: repeat(8, minmax(34px, 1fr)); gap: 10px; width: 100% }
.choices .btn, .choice{ background: rgba(255,255,255,0.06) }

/* Better selection color */
::selection{ background: rgba(124,58,237,0.35) }

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce){
  *{ animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* Pure neutral dark overrides */
:root[data-theme="dark"] body{
  background: linear-gradient(180deg, var(--bg), var(--bg-2));
}
:root[data-theme="dark"] body::before{
  /* Static, neutral vignette accents (no animation, no color cast) */
  animation: none;
  opacity: 0.28;
  background:
    radial-gradient(520px 280px at 12% 16%, rgba(255,255,255,0.05), transparent 60%),
    radial-gradient(520px 280px at 50% 84%, rgba(255,255,255,0.035), transparent 60%);
}
:root[data-theme="dark"] .image-wrap{ background: #0c0c10; }
:root[data-theme="dark"] .szondi-image-wrap{ background: #0c0c10; }
:root[data-theme="dark"] .site-header{
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border-bottom-color: rgba(255,255,255,0.06);
}

/* Light theme overrides */
:root[data-theme="light"]{
  --bg: #f7f7fb;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --text: #0b1220;
  --muted: #5b6573;
  --primary: #7c3aed;
  --primary-600: #6d28d9;
  --ring: rgba(124,58,237,0.25);
}
:root[data-theme="light"] body{
  background:
    radial-gradient(1200px 700px at 20% -10%, #eef2ff, var(--bg)),
    radial-gradient(900px 500px at 80% -20%, #f5f7ff, transparent),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}

/* Sticky header */
.site-header{
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
:root[data-theme="light"] .site-header{ border-bottom-color: rgba(0,0,0,0.08); }
.brand{ display:flex; align-items:center; gap: 8px; font-weight: 700; letter-spacing: -0.01em }
.brand-mark{ filter: saturate(110%) }
.brand-name{ opacity: .92 }

/* Footer */
.site-footer{
  display: grid; place-items: center; padding: 18px; opacity: .8;
}

/* Icon button variant */
.icon-btn{ padding: 8px 10px; line-height: 1; border-radius: 10px; }

/* Scrollbar styling (WebKit-based browsers) */
*::-webkit-scrollbar{ width: 10px; height: 10px }
*::-webkit-scrollbar-track{ background: rgba(255,255,255,0.04) }
*::-webkit-scrollbar-thumb{
  background: linear-gradient(180deg, rgba(139,92,246,0.8), rgba(124,58,237,0.7));
  border-radius: 10px; border: 2px solid transparent; background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover{ filter: brightness(1.05) }

.image-wrap{
  position: relative; width: 100%; border-radius: 16px; overflow: hidden; background: #0c0c10; border: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
  min-height: clamp(220px, 48vh, 560px);
}
.image-wrap img{ max-width: 100%; max-height: 80vh; height: auto; width: auto; object-fit: contain; object-position: center; display:block }
/* Orientation-specific tweaks */
.image-wrap.portrait img{ max-height: 70vh; width: auto }
.image-wrap.landscape img{ max-width: 100%; height: auto }
