/* =========================
   BASE
========================= */

:root{
--bg: #05060c;
--bg2: #0a0c14;
--text: #f3e8d0;
--muted: rgba(243,232,208,0.75);
--gold: #f39c12;
--gold2: rgba(243,156,18,0.35);
--panel: rgba(255,255,255,0.03);
--panel2: rgba(255,255,255,0.05);
--border: rgba(243,156,18,0.85);
--borderSoft: rgba(243,156,18,0.35);
--shadow: 0 20px 60px rgba(0,0,0,0.55);
}

*{ box-sizing: border-box; }

html, body{
height: 100%;
}

body{
margin: 0;
font-family: Georgia, serif;
background: radial-gradient(1200px 800px at 50% 10%, rgba(243,156,18,0.07), transparent 55%),
radial-gradient(900px 700px at 20% 30%, rgba(255,255,255,0.04), transparent 60%),
linear-gradient(180deg, var(--bg), var(--bg2));
color: var(--text);
overflow-x: hidden;
}

.container{
width: min(1100px, 100%);
padding: 0 20px;
margin: 0 auto;
}

/* =========================
   SCREENS (FIXED CUT ISSUE)
   - no absolute positioning
   - screens can scroll
========================= */

.screen{
min-height: 100vh;
width: 100%;
display: none;
padding: 56px 0;
}

.screen.active{
display: block;
animation: screenFade 420ms ease both;
}

@keyframes screenFade{
from{ opacity: 0; transform: translateY(10px); }
to{ opacity: 1; transform: translateY(0); }
}

/* =========================
   HERO / START
========================= */

.hero{
text-align: center;
padding: 24px 0 10px;
}

.hero h1{
font-size: clamp(30px, 4vw, 56px);
line-height: 1.05;
margin: 0 0 14px;
letter-spacing: 0.5px;
}

.hero p{
margin: 0 auto;
max-width: 640px;
color: var(--muted);
font-size: clamp(14px, 1.5vw, 18px);
line-height: 1.5;
}

button{
appearance: none;
border: none;
background: var(--gold);
color: #120b00;
font-weight: 700;
padding: 14px 34px;
border-radius: 999px;
font-size: 16px;
cursor: pointer;
box-shadow: 0 10px 22px rgba(243,156,18,0.25);
transition: transform 120ms ease, opacity 120ms ease, box-shadow 200ms ease;
}

button:hover{
opacity: 0.95;
box-shadow: 0 12px 26px rgba(243,156,18,0.32);
}

button:active{
transform: translateY(1px);
}

.hero button{
margin-top: 26px;
}

/* =========================
   QUIZ
========================= */

.quiz-container{
width: min(760px, 100%);
margin: 0 auto;
padding: 10px 0 0;
}

.progress-bar{
height: 6px;
background: rgba(255,255,255,0.10);
border-radius: 999px;
overflow: hidden;
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
margin: 0 0 28px;
}

#progressFill{
height: 100%;
width: 0%;
background: linear-gradient(90deg, var(--gold), #ffd08a);
border-radius: 999px;
transition: width 260ms ease;
}

#questionText{
font-size: clamp(18px, 2vw, 28px);
line-height: 1.2;
margin: 0 0 18px;
text-align: left;
}

#answersContainer{
display: grid;
gap: 12px;
}

.answer{
border: 1px solid var(--borderSoft);
background: rgba(255,255,255,0.02);
padding: 16px 18px;
border-radius: 14px;
cursor: pointer;
transition: background 160ms ease, transform 120ms ease, border-color 160ms ease;
text-align: left;
font-size: 16px;
line-height: 1.35;
}

.answer:hover{
background: rgba(243,156,18,0.12);
border-color: var(--border);
transform: translateY(-1px);
}

.answer:active{
transform: translateY(0);
}

/* =========================
   SHUFFLE
========================= */

.shuffle{
text-align: center;
padding: 36px 0 0;
}

.shuffle h2{
margin: 18px 0 0;
font-size: clamp(18px, 2vw, 26px);
color: var(--muted);
letter-spacing: 0.6px;
}

.card-back{
width: 170px;
height: 245px;
margin: 0 auto;
border-radius: 16px;
background:
radial-gradient(120px 140px at 30% 20%, rgba(243,156,18,0.20), transparent 65%),
linear-gradient(45deg, rgba(255,255,255,0.06), rgba(255,255,255,0.01)),
linear-gradient(180deg, rgba(20,20,28,1), rgba(10,10,16,1));
border: 1px solid var(--borderSoft);
box-shadow: var(--shadow);
position: relative;
transform-style: preserve-3d;
animation: flip 1.6s linear infinite;
}

.card-back:before{
content:"";
position:absolute;
inset: 14px;
border-radius: 12px;
border: 1px solid rgba(243,156,18,0.25);
}

@keyframes flip{
0%{ transform: rotateY(0deg); }
100%{ transform: rotateY(360deg); }
}

/* =========================
   RESULT
========================= */

.result-container{
width: min(1100px, 100%);
margin: 0 auto;
}

.result-container h1{
font-size: clamp(26px, 3.2vw, 52px);
line-height: 1.05;
margin: 0 0 22px;
text-align: center;
}

.result-grid{
display: grid;
grid-template-columns: 360px 1fr;
gap: 34px;
align-items: start;
}

.card-image{
position: sticky;
top: 18px;
align-self: start;
}

.card-image img{
width: 100%;
max-width: 360px;
height: auto;
border-radius: 16px;
border: 2px solid var(--border);
box-shadow: var(--shadow);
display: block;
}

.result-text{
display: grid;
gap: 16px;
}

.block{
border: 1px solid var(--border);
background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.02));
border-radius: 16px;
padding: 20px 20px;
box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.block h3{
margin: 0 0 10px;
font-size: 18px;
letter-spacing: 0.2px;
}

.block p{
margin: 0;
white-space: pre-line;
line-height: 1.6;
font-size: 16px;
color: rgba(243,232,208,0.92);
}

.result-container > button{
display: block;
margin: 26px auto 0;
min-width: 240px;
}

/* =========================
   MOBILE
========================= */

@media (max-width: 1024px){
.result-grid{
grid-template-columns: 1fr;
}
.card-image{
position: relative;
top: auto;
display: flex;
justify-content: center;
}
.card-image img{
max-width: 320px;
}
}

@media (max-width: 640px){
.screen{
padding: 34px 0;
}
.hero{
padding-top: 6px;
}
.quiz-container{
padding-top: 0;
}
#questionText{
text-align: left;
}
.answer{
padding: 14px 14px;
font-size: 15px;
}
.block{
padding: 16px;
}
.block p{
font-size: 15px;
}
button{
width: 100%;
padding: 14px 18px;
}
.result-container > button{
width: min(420px, 100%);
}
}

/* =========================
   SMALL FIXES
========================= */

img{
max-width: 100%;
}

a{
color: var(--text);
}

/* =========================
   RESULT ACTIONS
========================= */

.result-actions{
display: flex;
flex-direction: column;
align-items: center;
gap: 14px;
margin-top: 30px;
}

.btn-primary{
display: inline-block;
background: linear-gradient(90deg, #f39c12, #ffd08a);
color: #120b00;
font-weight: 700;
padding: 16px 28px;
border-radius: 999px;
text-decoration: none;
font-size: 16px;
text-align: center;
box-shadow: 0 14px 30px rgba(243,156,18,0.35);
transition: transform 120ms ease, box-shadow 200ms ease;
}

.btn-primary:hover{
transform: translateY(-2px);
box-shadow: 0 18px 40px rgba(243,156,18,0.45);
}

.btn-secondary{
background: transparent;
border: 1px solid rgba(243,156,18,0.6);
color: #f3e8d0;
padding: 12px 24px;
border-radius: 999px;
font-size: 15px;
cursor: pointer;
transition: background 150ms ease, border 150ms ease;
}

.btn-secondary:hover{
background: rgba(243,156,18,0.15);
border-color: #f39c12;
}

/* =========================
   MODAL
========================= */

body.modal-open {
  overflow: hidden;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
  z-index: 9999;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal {
  width: min(550px, calc(100vw - 32px));
  max-height: min(86vh, 760px);
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(8,10,18,0.98), rgba(4,5,10,0.98));
  border: 1px solid rgba(243, 156, 18, 0.75);
  border-radius: 22px;
  padding: 22px 22px 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  position: relative;
  transform: translateY(10px) scale(0.985);
  transition: transform 180ms ease;
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(243, 156, 18, 0.45);
  background: transparent;
  color: #f3e8d0;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.modal-close:hover {
  background: rgba(243, 156, 18, 0.12);
  border-color: rgba(243, 156, 18, 0.8);
}

.modal-title {
  margin: 0 48px 12px 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  text-align: left;
  color: #f3e8d0;
}

.modal-text {
  margin-top: 16px;
  margin-bottom: 0;
  color: rgba(243, 232, 208, 0.82);
  line-height: 1.45;
  text-align: left;
  font-size: 14px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-note {
  margin: 8px 0 2px;
  text-align: left;
  color: rgba(243, 232, 208, 0.72);
  font-size: 14px;
  line-height: 1.4;
}

.modal-btn {
  display: block;
  width: 100%;
  text-decoration: none;
  text-align: center;
  padding: 14px 16px;
  border-radius: 999px;
  border: 1px solid rgba(243, 156, 18, 0.55);
  background: rgba(255,255,255,0.02);
  color: #f3e8d0;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  transition: background 160ms ease, transform 120ms ease, border-color 160ms ease;
}

.modal-btn:hover {
  background: rgba(243, 156, 18, 0.14);
  border-color: rgba(243, 156, 18, 0.9);
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .modal {
    width: min(100%, calc(100vw - 24px));
    padding: 18px 16px 16px;
    border-radius: 18px;
    max-height: 84vh;
  }

  .modal-close {
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  .modal-title {
    margin: 0 40px 10px 0;
    font-size: 19px;
    line-height: 1.18;
  }

  .modal-text {
    font-size: 13px;
    margin-top: 14px;
  }

  .modal-note {
    font-size: 13px;
  }

  .modal-btn {
    padding: 13px 14px;
    font-size: 15px;
  }
}