:root{
  --bg-start:#ff9a3c;
  --bg-mid:#c2702a;
  --bg-deep:#6a442e;
  --bg-violet:#4b2d5f;
  --bg-blue:#4d5cff;
  --accent:#ffd18a;
  --accent-2:#b79cff;
  --correct:#22c55e;
  --incorrect:#ef4444;
}
*{box-sizing:border-box}
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: #fff;
  background:
    radial-gradient(circle at top left, rgba(255,154,60,0.6), transparent 55%),
    radial-gradient(circle at bottom right, rgba(77,92,255,0.5), transparent 55%),
    linear-gradient(135deg, var(--bg-start), var(--bg-mid), var(--bg-deep), var(--bg-violet), var(--bg-blue));
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 24px;
}
.game-container {
  width: 100%;
  max-width: 1200px;
  background: rgba(15,15,24,0.7);
  border-radius: 24px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.45);
  padding: 20px 24px 24px;
  backdrop-filter: blur(18px);
  position:relative;
}
.header-row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:10px;
  color:#ffeedd;
  font-size:13px;
}
.brand{font-weight:800; letter-spacing:0.06em; text-transform:uppercase; font-size:12px;}
.badge{padding:3px 8px; border-radius:999px; background:rgba(255,255,255,0.12); border:1px solid rgba(255,255,255,0.3); font-size:11px;}
.meta-block{text-align:right;}
.score-label{font-size:12px; margin-bottom:4px;}
.score-value{font-weight:800; font-size:18px;}

.timer-label{font-size:11px; text-transform:uppercase; letter-spacing:0.08em; opacity:.8; margin-bottom:2px;}
.timer-display{
  font-variant-numeric:tabular-nums;
  font-weight:800;
  font-size:18px;
  background:#000;
  padding:4px 10px;
  border-radius:8px;
  display:inline-block;
  min-width:82px;
  text-align:right;
}

h1 {
  font-size: 1.8rem;
  margin: 16px 0 30px;
  text-align: center;
}
/* highlight the word "not" when present */
h1 em{
  text-decoration:underline;
  color:#ffd84a;
  font-style:italic;
  margin-right:5px;
}

.question-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 900px){
  .question-layout{grid-template-columns:1fr;}
}
.category {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align:center;
}
.category img {
  width: 160px;
  height: 160px;
  object-fit: contain;
  border-radius: 20px;
  padding: 12px;
  background: rgba(0,0,0,0.25);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2);
  margin-bottom:10px;
}
.category p.label{
  margin:0 0 10px;
  font-weight:800;
  letter-spacing:0.05em;
  text-transform:uppercase;
  font-size:13px;
}

/* under icon: timer + submit */
.category-actions{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  margin-bottom:10px;
}
.timer-block{
  text-align:center;
}

.category-note{
  font-size:15px;
  line-height:1.4;
  color:#fffbe9;
  min-height:2.8em;
  opacity:0;
  transition:opacity .3s ease;
}
.category-note.visible{opacity:1;}
.nav-next{
  margin-top:12px;
}
.next-btn{
  border:none;
  padding:8px 16px;
  border-radius:999px;
  background:rgba(255,255,255,0.14);
  color:#fff;
  font-weight:700;
  font-size:13px;
  cursor:pointer;
  border:1px solid rgba(255,255,255,0.4);
}
.next-btn:disabled{
  opacity:0.5;
  cursor:not-allowed;
}

.right-column{
  display:flex;
  flex-direction:column;
  gap:16px;
}
.submit-section{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
}
.submit-section.hidden{visibility:hidden; pointer-events:none;}
.submit-intro{margin:0; font-size:14px; color:#fff9e1;}
.submit-btn{
  border:none;
  padding:10px 20px;
  border-radius:999px;
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  color:#1f1726;
  font-weight:800;
  cursor:pointer;
  font-size:14px;
  box-shadow:0 10px 22px rgba(0,0,0,0.35);
  transform-origin:center;
  animation:beacon 1.1s infinite ease-in-out;
}
.submit-btn:disabled{opacity:.6; cursor:not-allowed; animation:none;}

@keyframes beacon{
  0%{
    transform:scale(1);
    box-shadow:0 0 0 0 rgba(255,209,138,0.0);
    background:linear-gradient(135deg,var(--accent),var(--accent-2));
  }
  50%{
    transform:scale(1.12);
    box-shadow:0 0 30px 8px rgba(183,156,255,0.8);
    background:linear-gradient(135deg,var(--accent-2),#ffffff);
  }
  100%{
    transform:scale(1);
    box-shadow:0 0 0 0 rgba(255,209,138,0.0);
    background:linear-gradient(135deg,var(--accent),var(--accent-2));
  }
}

.books-grid {
  position:relative;
  margin-top:4px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 900px){
  .books-grid{grid-template-columns:repeat(2,1fr);}
}

.books-overlay{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  background:rgba(10,10,20,0.7);
  backdrop-filter:blur(8px);
  z-index:10;
  text-align:center;
  padding:16px;
}
.books-overlay h2{
  margin:0 0 12px;
  font-size:20px;
}
.books-overlay p{
  margin:0 0 16px;
  font-size:14px;
  color:#fef9e7;
}
.overlay-start-btn{
  border:none;
  padding:10px 22px;
  border-radius:999px;
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  color:#1f1726;
  font-weight:800;
  cursor:pointer;
  font-size:14px;
  box-shadow:0 10px 22px rgba(0,0,0,0.35);
}

.book-card {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 10px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, background 0.2s;
  cursor: pointer;
  position: relative;
  border:1px solid rgba(255,255,255,0.3);
  overflow:hidden;
  min-height:260px;
  perspective:1000px;
}
.book-card:hover {
  transform: translateY(-3px);
  box-shadow:0 12px 28px rgba(0,0,0,0.35);
}
.book-card.selected{
  border-color:var(--accent);
  box-shadow:0 0 0 2px rgba(255,209,138,0.9);
  background:rgba(255,255,255,0.16);
}

/* result animations */
.book-card.correct-guess{
  border-color:var(--correct);
  animation:correctGlow 1.2s ease-in-out infinite;
}
.book-card.incorrect-guess{
  border-color:var(--incorrect);
  animation:shake 0.4s ease-in-out 0s 2;
}

@keyframes correctGlow{
  0%{ box-shadow:0 0 0 0 rgba(34,197,94,0); }
  50%{ box-shadow:0 0 18px 4px rgba(34,197,94,0.9); }
  100%{ box-shadow:0 0 0 0 rgba(34,197,94,0); }
}
@keyframes shake{
  0%{ transform:translateX(0); }
  25%{ transform:translateX(-3px); }
  50%{ transform:translateX(3px); }
  75%{ transform:translateX(-3px); }
  100%{ transform:translateX(0); }
}

.book-card-inner{
  position:relative;
  width:100%;
  height:100%;
  transform-style:preserve-3d;
  transition:transform .5s ease;
}
.card-front, .card-back{
  position:absolute;
  inset:0;
  backface-visibility:hidden;
}
.card-front{
  z-index:2;
  display:flex;
  flex-direction:column;
  height:100%;
  position:relative;
}
/* Centered info overlay shown after evaluation */
.card-info-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #ffffff;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none; /* let clicks pass through to the card */
  z-index: 4;
}

.info-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

/* dim overlay over cover, behind pills */
.card-front-overlay{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,0.55);
  opacity:0;
  transition:opacity 0.2s ease;
  pointer-events:none;
  z-index:2;
}
.book-card.evaluated .card-front-overlay{
  opacity:1;
}
/* Only show the info overlay once the round has been evaluated
   and only while we're on the FRONT of the card */
.book-card.evaluated:not(.flipped) .card-info-overlay {
  opacity: 1;
}
/* top-left badges */
.card-badges{
  position:absolute;
  top:8px;
  left:8px;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:6px;
  z-index:5;
}
.badge-pill{
  display:flex;
  align-items:center;
  gap:6px;
  padding:4px 8px;
  border-radius:999px;
  font-size:14px;
  line-height:1.2;
}
.badge-correct-answer{
  background:rgba(0,0,0,0.5);
  border:1px solid rgba(209,213,219,0.95);
  color:#e5e7eb;
}
.badge-user-result{
  background:rgba(255,255,255,0.65);
  border:1px solid rgba(249,250,251,0.85);
  color:#111827;
}
.pill-icon{
  font-size:14px;
}
.icon-green{color:#013220;}
.icon-red{color:#ef4444;}

.card-front img{
  width:100%;
  border-radius:8px;
  display:block;
  max-height:95%;
  object-fit:contain;
  z-index:1;
  position:relative;
}
.card-back{
  transform:rotateY(180deg);
  padding:6px 4px 10px;
  font-size:13px;
  line-height:1.45;
}
.card-back p{margin-top:0; margin-bottom:8px;}
.book-card.flipped .book-card-inner{
  transform:rotateY(180deg);
}

.card-footer{
  margin-top:8px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:6px;
  flex-shrink:0;
}
.result-label{
  display:none; /* hide old Correct/Incorrect text */
}
.details-link, .back-link{
  border:none;
  background:transparent;
  color:#c7d2ff;
  font-size:11px;
  cursor:pointer;
  text-decoration:underline;
  padding:0;
}
.details-link.hidden{display:none;}
.back-link{margin-top:6px; display:inline-block;}

.view-link{
  display:inline-block;
  margin-top:4px;
  padding:6px 10px;
  border-radius:999px;
  border:none;
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  color:#1f1726;
  font-size:11px;
  font-weight:700;
  text-decoration:none;
  cursor:pointer;
}

.footer-brand{
  margin-top:26px;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:4px;
  font-size:13px;
  color:#fffbe5;
}
.footer-brand-title{font-weight:700;}
.footer-brand-by{font-size:12px; opacity:.9;}
.footer-logo svg * {max-height:30px; fill: #fff !important; stroke: #fff !important;}

.hidden{display:none !important;}

/* Results screen */
.results-screen{
  margin-top:24px;
}
.results-layout{
  display:grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap:24px;
  align-items:flex-start;
}
@media (max-width: 900px){
  .results-layout{grid-template-columns:1fr;}
}
.results-left h2{
  margin-top:0;
  margin-bottom:12px;
  font-size:20px;
}
.results-list{
  list-style:none;
  padding:0;
  margin:0;
  font-size:14px;
}
.results-list li{
  padding:6px 10px;
  border-radius:999px;
  background:rgba(255,255,255,0.08);
  margin-bottom:6px;
  display:flex;
  justify-content:space-between;
  gap:8px;
}
.results-right{
  text-align:center;
  padding:18px 14px;
  border-radius:18px;
  background:rgba(255,255,255,0.12);
  border:1px solid rgba(255,255,255,0.3);
}
.results-score{
  font-size:40px;
  font-weight:800;
  margin-bottom:8px;
}
.results-message{
  font-size:16px;
  font-weight:600;
}
.results-actions{
  margin-top:18px;
  display:flex;
  justify-content:center;
}
