/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(135deg, #E8F5E9 0%, #E3F2FD 50%, #F3E5F5 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== SCREENS ===== */
.screen { display: none; min-height: 100vh; padding: 20px; max-width: 960px; margin: 0 auto; }
.screen.active { display: block; }

/* ===== HOME ===== */
.home-content {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100vh; text-align: center; gap: 18px;
}
.home-icon { font-size: 5rem; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-16px); } }

.main-title {
  font-size: clamp(2.4rem, 8vw, 4rem); font-weight: 900; line-height: 1.1;
  background: linear-gradient(135deg, #1E88E5, #43A047, #7B1FA2);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  animation: bounce-in 0.7s cubic-bezier(0.36,0.07,0.19,0.97);
}
@keyframes bounce-in { 0% { transform:scale(0.3);opacity:0; } 60% { transform:scale(1.06); } 100% { transform:scale(1);opacity:1; } }

.subtitle { font-size: 1.2rem; color: #555; font-weight: 700; line-height: 1.5; }
.home-btns { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }

/* ===== BUTTONS ===== */
.btn-primary {
  background: linear-gradient(135deg, #1E88E5, #43A047);
  color: white; border: none; border-radius: 50px; padding: 16px 44px;
  font-size: 1.3rem; font-weight: 900; font-family: 'Nunito', sans-serif; cursor: pointer;
  box-shadow: 0 6px 18px rgba(30,136,229,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-primary:hover  { transform: translateY(-3px) scale(1.04); box-shadow: 0 10px 26px rgba(30,136,229,0.5); }
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  background: white; color: #1E88E5; border: 3px solid #1E88E5;
  border-radius: 50px; padding: 13px 32px; font-size: 1.15rem; font-weight: 800;
  font-family: 'Nunito', sans-serif; cursor: pointer; transition: background 0.15s, transform 0.15s;
}
.btn-secondary:hover { background: #E3F2FD; transform: translateY(-2px); }
.btn-secondary.btn-sm { padding: 8px 18px; font-size: 0.95rem; }

.btn-back {
  background: rgba(255,255,255,0.7); border: 2px solid #ddd; border-radius: 50px;
  padding: 8px 20px; font-size: 1rem; font-weight: 700; font-family: 'Nunito', sans-serif;
  cursor: pointer; color: #555; transition: background 0.15s; white-space: nowrap;
}
.btn-back:hover { background: white; }

/* ===== SCREEN HEADER ===== */
.screen-header {
  display: flex; align-items: center; gap: 14px; padding: 16px 0 22px; flex-wrap: wrap;
}
.screen-header h2 { font-size: 1.7rem; font-weight: 900; color: #333; flex: 1; }

/* ===== INFO LAYOUT ===== */
.info-layout {
  display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start;
}
@media (max-width: 740px) {
  .info-layout { grid-template-columns: 1fr; }
}

/* ===== LEARN MODE ===== */
.learn-layout {
  display: flex; flex-direction: column; gap: 20px;
}
@media (min-width: 1025px) {
  .learn-layout { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; }
}
.learn-map-wrap {
  position: relative; border-radius: 12px; overflow: hidden;
  background: #e8e8e8; aspect-ratio: 616 / 557;
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
  width: 100%; max-width: 100%; max-height: 350px;
  order: 1;
}
@media (min-width: 1025px) {
  .learn-map-wrap { max-width: 280px; max-height: none; }
}
.learn-map-wrap .map-svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.learn-content-wrap {
  background: white; border-radius: 16px; padding: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  order: 2;
}
#learn-title {
  font-size: 1.5rem; font-weight: 900; color: #222; margin-bottom: 14px;
}
@media (max-width: 1024px) {
  #learn-title { font-size: 1.8rem; margin-bottom: 18px; }
}
.learn-content {
  margin-bottom: 16px; max-height: 50vh; overflow-y: auto;
}
@media (max-width: 1024px) {
  .learn-content { max-height: 40vh; }
}
.learn-content ul {
  list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px;
}
.learn-content li {
  background: #F3F4F6; padding: 9px 12px; border-radius: 8px;
  font-size: 0.9rem; font-weight: 700; color: #444; border-left: 4px solid #1E88E5; line-height: 1.3;
}
@media (max-width: 1024px) {
  .learn-content li { font-size: 0.88rem; padding: 8px 11px; }
}
.learn-nav {
  display: flex; gap: 12px; justify-content: flex-end; margin-top: 14px;
  flex-wrap: wrap;
}
.learn-nav .btn-primary {
  padding: 11px 20px; font-size: 0.9rem; flex: 1; min-width: 120px;
}
@media (max-width: 1024px) {
  .learn-nav .btn-primary { padding: 10px 16px; font-size: 0.85rem; min-width: 100px; }
}
@media (max-width: 600px) {
  .learn-nav { justify-content: center; }
  .learn-nav .btn-primary { flex: 1; }
}
.learn-nav button:disabled {
  opacity: 0.5; cursor: not-allowed;
}

/* ===== MAP ===== */
.map-wrap {
  position: relative; border-radius: 16px; overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15); background: #e8e8e8;
  aspect-ratio: 616 / 557;
}
.map-bg {
  display: block; width: 100%; height: 100%; object-fit: cover; user-select: none;
}
.map-svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  cursor: pointer;
}
.quiz-map-wrap   { max-width: 520px; margin: 0 auto 16px; }
.quiz-map-wrap-b { max-width: 560px; margin: 0 auto; }

/* Quiz A: hide PNG so district names aren't visible */
.svg-only { background: #f0f4f8; }
.svg-only .map-bg { visibility: hidden; }
.svg-only .d-poly { fill-opacity: 0.82; stroke: white; stroke-width: 1.5; }
.svg-only .d-poly.highlight { fill-opacity: 1; }
.svg-only .d-poly.dimmed    { fill-opacity: 0.28; }

/* SVG district styles (set via JS) */
.d-poly {
  transition: fill-opacity 0.18s, stroke-width 0.18s;
  stroke: rgba(255,255,255,0.7);
  stroke-width: 1;
  fill-opacity: 0.35;
}
.d-poly:hover  { fill-opacity: 0.72; stroke-width: 2; stroke: white; cursor: pointer; }
.d-poly.active { fill-opacity: 0.85; stroke-width: 2.5; stroke: white; }
.d-poly.highlight { fill-opacity: 1; stroke: #FFD700; stroke-width: 3; animation: pulse-ring 1.2s ease-in-out infinite; }
.d-poly.correct   { fill: #22C55E !important; fill-opacity: 1 !important; stroke: white; stroke-width: 2.5; }
.d-poly.wrong     { fill: #EF4444 !important; fill-opacity: 1 !important; stroke: white; stroke-width: 2.5; }
.d-poly.dimmed    { fill-opacity: 0.12; stroke-width: 0.5; }

@keyframes pulse-ring {
  0%,100% { stroke-width: 3; stroke: #FFD700; }
  50%      { stroke-width: 5; stroke: #FFA000; }
}

.d-label {
  font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 11px;
  pointer-events: none; dominant-baseline: middle; text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(0,0,0,0.45); stroke-width: 3px;
  fill: white;
}

/* ===== INFO PANEL ===== */
.info-panel {
  background: white; border-radius: 20px; padding: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.info-nav {
  display: flex; gap: 8px; margin-bottom: 16px;
}
.btn-nav {
  flex: 1; background: #F3F4F6; border: 2px solid #E5E7EB; border-radius: 12px;
  padding: 10px 6px; font-size: 0.9rem; font-weight: 800; font-family: 'Nunito', sans-serif;
  cursor: pointer; transition: background 0.15s, transform 0.1s; text-align: center;
}
.btn-nav:hover    { background: #E0F2FE; border-color: #81D4FA; transform: scale(1.04); }
.btn-nav.rand     { background: #FFF9C4; border-color: #F9A825; }
.btn-nav.rand:hover { background: #FFF176; }

.info-box { min-height: 280px; }
.info-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; color: #aaa; height: 280px; gap: 12px; }
.placeholder-icon { font-size: 2.5rem; }
.info-placeholder p { font-size: 1rem; font-weight: 700; line-height: 1.6; }

.district-info-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
  padding-bottom: 14px; border-bottom: 3px solid #F3F4F6;
}
.district-roman {
  font-size: 1.8rem; font-weight: 900; width: 48px; height: 48px;
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  color: white; flex-shrink: 0;
}
.district-name-block {}
.district-name { font-size: 1.4rem; font-weight: 900; color: #222; }
.district-meta { font-size: 0.85rem; font-weight: 700; color: #888; }

.facts-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.facts-list li {
  background: #F8FAFC; border-radius: 12px; padding: 10px 14px;
  font-size: 0.95rem; font-weight: 700; color: #444; line-height: 1.4;
  border-left: 4px solid var(--dc, #1E88E5);
}
.facts-list li::before { content: '✨ '; }

/* ===== QUIZ SELECT ===== */
.quiz-select-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; padding-bottom: 32px; }

.qs-card {
  background: white; border: 4px solid var(--cd, #aaa);
  border-radius: 24px; padding: 32px 20px; display: flex; flex-direction: column;
  align-items: center; gap: 12px; cursor: pointer; font-family: 'Nunito', sans-serif;
  box-shadow: 0 6px 16px rgba(0,0,0,0.10); transition: transform 0.2s, box-shadow 0.2s;
  position: relative; overflow: hidden;
}
.qs-card::before {
  content: ''; position: absolute; inset: 0;
  background: var(--c); opacity: 0.08; transition: opacity 0.2s;
}
.qs-card:hover { transform: translateY(-6px) scale(1.03); box-shadow: 0 14px 32px rgba(0,0,0,0.16); }
.qs-card:hover::before { opacity: 0.15; }
.qs-icon  { font-size: 3rem; }
.qs-title { font-size: 1.3rem; font-weight: 900; color: #222; }
.qs-desc  { font-size: 0.95rem; font-weight: 700; color: #555; text-align: center; line-height: 1.5; }

/* ===== QUIZ SCREEN ===== */
.quiz-header {
  display: flex; align-items: center; gap: 10px; padding: 14px 0 18px; flex-wrap: wrap;
}
.quiz-meta { flex: 1; display: flex; flex-direction: column; }
.quiz-badge {
  font-size: 0.95rem; font-weight: 900; padding: 3px 12px; border-radius: 20px;
  background: #E3F2FD; color: #1565C0; display: inline-block; margin-bottom: 2px;
}
#quiz-progress { font-size: 0.85rem; font-weight: 700; color: #888; }
.score-row { display: flex; gap: 8px; }
.score-badge { background: #FFF176; border: 2px solid #F9A825; border-radius: 20px; padding: 5px 14px; font-size: 0.95rem; font-weight: 900; }
.hs-badge    { background: #FFE0B2; border: 2px solid #FF8F00; border-radius: 20px; padding: 5px 14px; font-size: 0.95rem; font-weight: 900; }

.quiz-area { display: flex; flex-direction: column; }

/* Quiz A */
.quiz-q { font-size: 1.35rem; font-weight: 900; color: #222; text-align: center; margin-bottom: 14px; line-height: 1.4; }
.quiz-q.small { font-size: 1.05rem; margin-bottom: 10px; }
.quiz-q-sub { font-size: 0.95rem; font-weight: 700; color: #666; text-align: center; margin-bottom: 16px; }
.quiz-progress-sub { text-align: center; font-size: 0.82rem; font-weight: 700; color: #6A1B9A; min-height: 1.2em; margin-bottom: 8px; }

.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.ans-btn {
  background: #F3F4F6; border: 3px solid #E5E7EB; border-radius: 14px;
  padding: 16px 12px; font-size: 1.05rem; font-weight: 800; font-family: 'Nunito', sans-serif;
  cursor: pointer; transition: transform 0.15s, background 0.15s, border-color 0.15s; text-align: center;
}
.ans-btn:hover:not(:disabled) { background: #DBEAFE; border-color: #93C5FD; transform: scale(1.03); }
.ans-btn.correct { background: #DCFCE7; border-color: #22C55E; animation: correct-pop 0.45s ease; }
.ans-btn.wrong   { background: #FEE2E2; border-color: #EF4444; animation: wrong-shake 0.4s ease; }
@keyframes correct-pop  { 0%,100% { transform:scale(1); } 40% { transform:scale(1.07); } }
@keyframes wrong-shake  { 0%,100% { transform:translateX(0); } 25% { transform:translateX(-7px); } 75% { transform:translateX(7px); } }

/* Quiz E: Was ist wo? - Landmarks checkbox grid */
.landmarks-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; margin-bottom: 16px; }
.landmark-checkbox {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  background: #F3F4F6; border: 2px solid #E5E7EB; border-radius: 12px;
  cursor: pointer; font-weight: 700; font-size: 0.95rem; transition: all 0.2s;
  user-select: none;
}
.landmark-checkbox input { cursor: pointer; width: 18px; height: 18px; }
.landmark-checkbox:hover { background: #E0F2FE; border-color: #81D4FA; }
.landmark-checkbox.correct { background: #DCFCE7; border-color: #22C55E; color: #15803D; }
.landmark-checkbox.missing { background: #FEF3C7; border-color: #F59E0B; color: #92400E; }
.landmark-checkbox.wrong { background: #FEE2E2; border-color: #EF4444; color: #991B1B; }
.landmark-checkbox:has(input:disabled) { opacity: 0.85; }

/* Quiz B */
.quiz-b-target {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  background: white; border-radius: 20px; padding: 18px 28px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10); margin-bottom: 14px; flex-wrap: wrap;
}
.b-roman {
  font-size: 2.2rem; font-weight: 900; background: #1E88E5;
  color: white; border-radius: 14px; padding: 6px 18px; min-width: 64px; text-align: center;
}
.b-name { font-size: 1.8rem; font-weight: 900; color: #222; }

/* Shared feedback */
.quiz-feedback {
  border-radius: 14px; padding: 14px 18px; font-size: 1rem; font-weight: 700;
  margin: 12px 0; animation: pop-in 0.3s ease;
}
@keyframes pop-in { from { transform:scale(0.9);opacity:0; } to { transform:scale(1);opacity:1; } }
.quiz-feedback.ok  { background: #DCFCE7; color: #15803D; border: 2px solid #22C55E; }
.quiz-feedback.err { background: #FEE2E2; color: #B91C1C; border: 2px solid #EF4444; }

.quiz-foot { display: flex; justify-content: flex-end; padding: 8px 0; }
.btn-next {
  background: linear-gradient(135deg, #66BB6A, #43A047); color: white; border: none;
  border-radius: 50px; padding: 13px 32px; font-size: 1.1rem; font-weight: 900;
  font-family: 'Nunito', sans-serif; cursor: pointer;
  box-shadow: 0 4px 14px rgba(67,160,71,0.4); transition: transform 0.15s;
}
.btn-next:hover { transform: translateY(-2px); }

/* ===== RESULT ===== */
.result-wrap {
  background: white; border-radius: 28px; padding: 44px 32px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12); text-align: center;
  max-width: 540px; margin: 40px auto;
}
.result-emoji  { font-size: 5rem; animation: bounce-in 0.6s ease; margin-bottom: 12px; }
.result-title  { font-size: 2rem; font-weight: 900; color: #222; margin-bottom: 12px; }
.result-score  { font-size: 1.4rem; font-weight: 800; color: #1E88E5; margin-bottom: 8px; }
.result-hs     { font-size: 1rem; font-weight: 700; color: #888; margin-bottom: 28px; }
.result-btns   { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ===== CONFETTI ===== */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 9999; overflow: hidden; }
.cp {
  position: absolute; top: -20px; border-radius: 3px;
  animation: cf-fall linear forwards;
}
@keyframes cf-fall { 0% { transform: translateY(0) rotate(0deg); opacity:1; } 100% { transform: translateY(110vh) rotate(720deg); opacity:0; } }

/* ===== UTILITY ===== */
.hidden { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 500px) {
  .answer-grid { grid-template-columns: 1fr; }
  .b-name { font-size: 1.4rem; }
  .quiz-select-grid { grid-template-columns: 1fr; }
}
