:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --secondary: #059669;
  --accent: #f59e0b;
  --bg-dark: #0b1329;
  --card-bg: #152238;
  --card-border: #233554;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-heading: 'Bricolage Grotesque', sans-serif;
  --font-body: 'Lexend', sans-serif;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background-color: #152238;
  border-bottom: 2px solid var(--card-border);
  padding: 0.75rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  font-size: 2rem;
  background: rgba(2, 132, 199, 0.2);
  border: 2px solid var(--primary);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

.brand h1 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
}

.brand p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

.tab-pills {
  display: flex;
  background: #091322;
  padding: 4px;
  border-radius: 999px;
  gap: 4px;
  border: 1px solid var(--card-border);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.tab-btn:hover:not(.active) {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.btn-header {
  background: #233554;
  color: #fff;
  border: none;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: 0.2s;
}

.btn-header:hover {
  background: #33496e;
}

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

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

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

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

.mode-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  background: var(--card-bg);
  padding: 1rem 1.25rem;
  border-radius: 14px;
  border: 1px solid var(--card-border);
}

.section-intro h2 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  color: #fff;
}

.section-intro p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 2px;
}

.styled-select {
  background: #091322;
  border: 1px solid var(--card-border);
  color: #fff;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
}

.action-btn {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s;
}

.action-btn.primary {
  background: var(--primary);
  color: white;
}

.action-btn.primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.action-btn.secondary {
  background: #233554;
  color: white;
}

.action-btn.secondary:hover:not(:disabled) {
  background: #33496e;
}

/* ================= TAB 1: WEATHER RIG ================= */
.rig-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.25rem;
}

.rig-viewport-wrap {
  background: #091322;
  border: 2px solid var(--card-border);
  border-radius: 14px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
}

#env-canvas {
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: #1e3a5f;
}

.env-status-bar {
  margin-top: 0.75rem;
  background: #152238;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: #7dd3fc;
  text-align: center;
  border: 1px solid var(--card-border);
}

.instruments-panel {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.instrument-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}

.instrument-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.inst-icon {
  font-size: 1.5rem;
}

.instrument-header h4 {
  font-size: 0.95rem;
  color: #fff;
  font-family: var(--font-heading);
}

.inst-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.gauge-slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.gauge-slider-row input[type="range"] {
  flex: 1;
  cursor: pointer;
}

.gauge-val {
  min-width: 80px;
  text-align: right;
  font-weight: 700;
  font-size: 1rem;
  color: #38bdf8;
}

/* ================= TAB 2: CLOUD ATLAS ================= */
.cloud-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.25rem;
}

.cloud-menu {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1.25rem;
}

.cloud-level-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.level-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #7dd3fc;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.cloud-btn {
  background: #091322;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.cloud-btn strong {
  font-size: 0.85rem;
  color: #fff;
}

.cloud-btn span {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.cloud-btn:hover {
  border-color: #38bdf8;
  background: #111f38;
}

.cloud-btn.active {
  border-color: var(--primary);
  background: rgba(2, 132, 199, 0.25);
}

.cloud-btn.active strong {
  color: #38bdf8;
}

.cloud-display-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cloud-visual-box {
  background: #091322;
  padding: 1rem;
  display: flex;
  justify-content: center;
  border-bottom: 1px solid var(--card-border);
}

#cloud-canvas {
  width: 100%;
  max-width: 580px;
  height: auto;
  border-radius: 8px;
  background: #0d1e3a;
}

.cloud-info-body {
  padding: 1.25rem;
}

.cloud-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.cloud-title-row h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: #fff;
}

.cloud-badge {
  background: rgba(2, 132, 199, 0.2);
  border: 1px solid var(--primary);
  color: #38bdf8;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.cloud-desc {
  font-size: 0.9rem;
  color: #cbd5e1;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.cloud-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.cloud-stat {
  background: #091322;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
}

.cs-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cloud-stat strong {
  display: block;
  font-size: 0.9rem;
  color: #7dd3fc;
  margin-top: 2px;
}

/* ================= TAB 3: IRISH WEATHER MAP ================= */
.map-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.25rem;
}

.map-view-box {
  background: #091322;
  border: 2px solid var(--card-border);
  border-radius: 14px;
  padding: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

#ireland-map-svg {
  max-width: 480px;
  height: auto;
}

.province-path {
  cursor: pointer;
  transition: all 0.2s ease;
}

.province-path:hover {
  filter: brightness(1.25);
  stroke-width: 3;
}

.province-label {
  font-family: 'Lexend', sans-serif;
  font-size: 13px;
  font-weight: 800;
  fill: #ffffff;
  pointer-events: none;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.map-controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.palette-card, .bulletin-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1.1rem;
}

.palette-card h4, .bulletin-card h4 {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: #fff;
  margin-bottom: 0.75rem;
}

.symbol-palette {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.symbol-btn {
  background: #091322;
  border: 1px solid var(--card-border);
  color: #cbd5e1;
  padding: 0.6rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  transition: 0.2s;
}

.symbol-btn:hover {
  background: #111f38;
  border-color: #38bdf8;
}

.symbol-btn.active {
  background: var(--primary);
  border-color: #38bdf8;
  color: #fff;
}

.symbol-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  font-style: italic;
}

.bulletin-text {
  background: #091322;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.85rem;
  color: #e2e8f0;
  line-height: 1.5;
  min-height: 120px;
}

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

.quiz-card {
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: 16px;
  padding: 1.5rem;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 0.75rem;
}

.quiz-badge {
  background: rgba(2, 132, 199, 0.2);
  color: #38bdf8;
  border: 1px solid var(--primary);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.quiz-count {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.quiz-body h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  line-height: 1.4;
  margin-bottom: 1.25rem;
}

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

.quiz-opt-btn {
  background: #091322;
  border: 1px solid var(--card-border);
  color: #f8fafc;
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quiz-opt-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: #152238;
}

.quiz-opt-btn.correct {
  background: rgba(16, 185, 129, 0.25);
  border-color: #10b981;
  color: #a7f3d0;
}

.quiz-opt-btn.wrong {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #fca5a5;
}

.quiz-feedback {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.4;
}

.quiz-feedback.correct {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid #10b981;
  color: #6ee7b7;
}

.quiz-feedback.wrong {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #fca5a5;
}

.quiz-feedback.hidden {
  display: none;
}

.quiz-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.score-display {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.score-display strong {
  color: #fff;
  font-size: 1.1rem;
}

@media (max-width: 900px) {
  .rig-layout,
  .cloud-layout,
  .map-layout {
    grid-template-columns: 1fr;
  }
  .options-grid {
    grid-template-columns: 1fr;
  }
}
