:root {
  --ink: #19212d;
  --bg: #f5f4ef;
  --surface: #ffffff;
  --line: #ded8cb;
  --viking-gold: #c28828;
  --viking-dark: #223249;
  --norman-crimson: #a62b2b;
  --norman-stone: #475569;
  --monk-green: #2a6a4e;
  --teal: #1f8a7e;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Lexend", system-ui, sans-serif;
  --shadow: 0 8px 24px rgba(34, 50, 73, 0.08);
  --shadow-hover: 0 14px 32px rgba(34, 50, 73, 0.16);
  --radius-lg: 18px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: #1e2837;
  color: #fff;
  padding: 0.9rem 1.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 3px solid var(--viking-gold);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  color: #fff;
}

.brand-icon {
  font-size: 2.2rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.4rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand h1 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: #fce8a6;
  letter-spacing: -0.01em;
}

.brand p {
  font-size: 0.8rem;
  color: #c9d5e4;
}

.controls-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.tab-pills {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.25rem;
  border-radius: 999px;
  gap: 0.3rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: #fff;
}

.tab-btn.active {
  background: var(--viking-gold);
  color: #1e2837;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-header {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.2s;
}

.btn-header:hover {
  background: rgba(255, 255, 255, 0.25);
}

.game-container {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1.2rem;
  width: 100%;
  flex: 1;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-pane.active {
  display: block;
}

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

.section-desc {
  color: #556272;
  font-size: 0.95rem;
  margin-top: 0.4rem;
}

/* ================== TAB 1: EXPLORER ================== */
.explorer-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.view-toggle {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.toggle-btn {
  background: var(--surface);
  border: 2px solid var(--line);
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--ink);
  transition: all 0.2s;
}

.toggle-btn.active {
  background: var(--viking-dark);
  color: #fff;
  border-color: var(--viking-dark);
  box-shadow: 0 4px 14px rgba(34, 50, 73, 0.2);
}

.explorer-stage {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.diagram-wrap {
  background: #ffffff;
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  box-shadow: var(--shadow);
  position: relative;
  min-height: 440px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.diagram-wrap svg {
  width: 100%;
  max-height: 480px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.06));
}

.hotspot-node {
  cursor: pointer;
  transition: transform 0.2s;
}

.hotspot-node:hover circle {
  fill: #ffeb3b;
  transform: scale(1.15);
  transform-origin: center;
}

.hotspot-pulse {
  animation: pulseRing 1.8s infinite;
}

@keyframes pulseRing {
  0% { r: 12; opacity: 0.8; }
  50% { r: 22; opacity: 0; }
  100% { r: 12; opacity: 0; }
}

.detail-card {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-badge {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
}

.detail-badge.norman {
  background: #fee2e2;
  color: var(--norman-crimson);
}

.detail-card h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--viking-dark);
}

.detail-irish {
  font-size: 1.05rem;
  font-style: italic;
  color: var(--teal);
  font-weight: 600;
  border-left: 3px solid var(--teal);
  padding-left: 0.8rem;
}

.fact-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.9rem;
  color: #334155;
  margin-top: 0.5rem;
}

/* ================== TAB 2: SEANDÁLAÍOCHT ================== */
.detective-header {
  margin-bottom: 1.2rem;
}

.dig-hud {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  background: var(--surface);
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.hud-stat {
  font-weight: 700;
  color: var(--viking-dark);
}

.hud-stat span {
  color: var(--viking-gold);
  font-size: 1.2rem;
}

.btn-action {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 800;
  background: var(--viking-dark);
  color: #fff;
  border: none;
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.btn-action:hover {
  background: #111a26;
  transform: translateY(-2px);
}

.btn-secondary {
  background: #fff;
  color: var(--viking-dark);
  border: 1.5px solid var(--line);
}

.btn-secondary:hover {
  background: #f1f5f9;
}

.dig-board {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1.5rem;
}

.dig-pit {
  background: #e8dcc4;
  border: 3px dashed #b8a688;
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  min-height: 480px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1rem;
  align-content: start;
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.08);
}

.artefact-token {
  background: #fff;
  border: 2px solid #cfc2aa;
  border-radius: var(--radius-md);
  padding: 0.8rem 0.6rem;
  text-align: center;
  cursor: grab;
  user-select: none;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.artefact-token:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 8px 18px rgba(0,0,0,0.12);
  border-color: var(--viking-gold);
}

.artefact-token.selected {
  outline: 3px solid var(--viking-gold);
  background: #fefce8;
}

.artefact-icon {
  font-size: 2.2rem;
}

.artefact-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.artefact-name-ga {
  font-size: 0.72rem;
  color: #64748b;
  font-style: italic;
}

.dig-bins {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dig-bin {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem;
  transition: border-color 0.2s;
}

.dig-bin.drag-over {
  border-color: var(--viking-gold);
  background: #fffdf5;
}

.bin-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.bin-icon {
  font-size: 1.8rem;
}

.bin-header h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--viking-dark);
}

.bin-header small {
  color: #64748b;
}

.bin-dropzone {
  min-height: 90px;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  padding: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.bin-dropzone .artefact-token {
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  flex-direction: row;
  min-width: 130px;
  gap: 0.5rem;
}

.bin-dropzone .artefact-icon {
  font-size: 1.4rem;
}

/* ================== TAB 3: TIMELINE ================== */
.timeline-header {
  margin-bottom: 1.5rem;
}

.timeline-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.feedback-msg {
  font-weight: 700;
  font-size: 0.95rem;
}

.timeline-slots-wrap {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.timeline-axis-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #64748b;
  text-align: center;
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.timeline-track {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.8rem;
}

.timeline-slot {
  border: 2px dashed #94a3b8;
  border-radius: var(--radius-md);
  min-height: 180px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0.6rem;
  text-align: center;
  position: relative;
  transition: all 0.2s;
}

.timeline-slot.drag-over {
  background: #fefce8;
  border-color: var(--viking-gold);
}

.slot-num {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  color: #94a3b8;
}

.timeline-card {
  background: #ffffff;
  border: 2px solid var(--viking-dark);
  border-radius: 10px;
  padding: 0.8rem 0.6rem;
  cursor: grab;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.4rem;
  text-align: center;
  transition: transform 0.2s;
}

.timeline-card:hover {
  transform: translateY(-2px);
}

.timeline-card .card-year {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--viking-gold);
}

.timeline-card .card-text {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}

.timeline-card .card-ga {
  font-size: 0.7rem;
  color: #64748b;
  font-style: italic;
}

.timeline-deck {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  padding: 1.2rem;
  background: #e2e8f0;
  border-radius: var(--radius-lg);
  min-height: 140px;
}

/* ================== TAB 4: QUIZ ================== */
.quiz-wrap {
  max-width: 760px;
  margin: 0 auto;
}

.quiz-hud {
  display: flex;
  justify-content: space-between;
  background: var(--surface);
  padding: 0.8rem 1.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  margin-bottom: 1.2rem;
}

.quiz-card {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  box-shadow: var(--shadow);
}

.quiz-topic {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.quiz-question {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--viking-dark);
  line-height: 1.25;
}

.quiz-irish-sub {
  color: #64748b;
  font-style: italic;
  font-size: 0.95rem;
  margin-top: 0.3rem;
  margin-bottom: 1.5rem;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.quiz-opt-btn {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.quiz-opt-btn:hover {
  background: #f1f5f9;
  border-color: var(--viking-dark);
  transform: translateY(-2px);
}

.quiz-opt-btn.correct {
  background: #dcfce7 !important;
  border-color: #16a34a !important;
  color: #14532d !important;
}

.quiz-opt-btn.wrong {
  background: #fee2e2 !important;
  border-color: #dc2626 !important;
  color: #7f1d1d !important;
}

.quiz-explanation {
  background: #fefce8;
  border: 1.5px solid #fef08a;
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 1.2rem;
  font-size: 0.92rem;
  color: #854d0e;
  line-height: 1.4;
}

.quiz-footer {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 900px) {
  .explorer-stage, .dig-board {
    grid-template-columns: 1fr;
  }
  .timeline-track {
    grid-template-columns: repeat(3, 1fr);
  }
  .quiz-options {
    grid-template-columns: 1fr;
  }
}
