/* Treonna & Uillinneacha - Stylesheet */
:root {
  --navy: #0f2b48;
  --ocean-blue: #0284c7;
  --sky-blue: #38bdf8;
  --gold: #d97706;
  --amber: #f59e0b;
  --emerald: #059669;
  --coral: #ef4444;
  --bg: #f8fafc;
  --surface: #ffffff;
  --line: #e2e8f0;
  --muted: #64748b;
  --text: #1e293b;
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'Lexend', system-ui, sans-serif;
  --radius-lg: 20px;
  --radius-md: 12px;
  --shadow: 0 10px 25px -5px rgba(15, 43, 72, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: var(--surface);
  border-bottom: 2px solid var(--line);
  padding: 0.8rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.back-link {
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  background: #f1f5f9;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  transition: all 0.2s;
}
.back-link:hover { color: var(--navy); background: #e2e8f0; }
.logo-icon {
  font-size: 2rem;
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand h1 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.1;
}
.subtitle {
  font-size: 0.82rem;
  color: var(--muted);
}

/* Header Stats */
.header-stats {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.stat-pill {
  background: #f1f5f9;
  border: 1px solid var(--line);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.stat-label { color: var(--muted); font-weight: 600; }
.stat-val { color: var(--navy); font-weight: 800; }
.ctrl-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}
.ctrl-btn:hover { background: #f8fafc; border-color: var(--muted); }

/* Main Container */
.main-container {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1.2rem;
  width: 100%;
  flex: 1;
}

/* Mode Navigation Tabs */
.mode-tabs {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.8rem;
  background: #e2e8f0;
  padding: 0.35rem;
  border-radius: 16px;
  overflow-x: auto;
}
.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.1rem;
  border: none;
  background: transparent;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.mode-tab:hover { color: var(--navy); }
.mode-tab.active {
  background: var(--surface);
  color: var(--ocean-blue);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* Views */
.game-view { display: none; }
.game-view.active { display: block; animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.view-intro {
  margin-bottom: 1.5rem;
}
.view-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ocean-blue);
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.4rem;
}
.view-intro h2 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--navy);
}
.view-intro p {
  color: var(--muted);
  font-size: 0.95rem;
}

/* VIEW 1: ANGLE PROTRACTOR LAB */
.angle-lab-layout {
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 900px) {
  .angle-lab-layout { grid-template-columns: 1fr; }
}

.protractor-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.protractor-canvas-wrap {
  width: 100%;
  max-width: 440px;
  height: 320px;
  display: flex;
  justify-content: center;
}

.angle-slider-wrap {
  width: 100%;
  margin-top: 1.5rem;
}
#angle-slider {
  width: 100%;
  accent-color: var(--coral);
  cursor: pointer;
  height: 8px;
}
.quick-angle-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
  justify-content: center;
}
.q-btn {
  background: #f1f5f9;
  border: 1px solid var(--line);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  transition: all 0.2s;
}
.q-btn:hover { background: #e2e8f0; color: var(--ocean-blue); }

.angle-info-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  box-shadow: var(--shadow);
}
.angle-badge {
  font-size: 0.82rem;
  font-weight: 800;
  color: #fff;
  background: var(--ocean-blue);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  display: inline-block;
}
.angle-degree-display {
  font-family: var(--font-display);
  font-size: 4.5rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
  margin: 0.8rem 0;
}
.deg-sym { color: var(--coral); font-size: 3rem; }

.angle-desc-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.2rem;
}
.angle-desc-box h4 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 0.25rem;
}
.angle-desc-box p {
  color: var(--muted);
  font-size: 0.88rem;
}

.real-life-example {
  background: #fffbeb;
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin-bottom: 1.5rem;
}
.ex-label { font-size: 0.76rem; font-weight: 800; color: #b45309; text-transform: uppercase; }
.real-life-example p { font-size: 0.88rem; color: #78350f; margin-top: 0.2rem; }

.angle-target-card {
  border-top: 2px dashed var(--line);
  padding-top: 1.2rem;
}
.target-head { font-size: 0.85rem; font-weight: 800; color: var(--navy); text-transform: uppercase; }
#target-instruction { font-size: 0.95rem; margin: 0.4rem 0 1rem; color: var(--text); }
.action-btn {
  background: var(--navy);
  color: #fff;
  border: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.7rem 1.6rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}
.action-btn:hover { background: var(--ocean-blue); }
.target-feedback {
  margin-top: 0.8rem;
  font-size: 0.95rem;
  font-weight: 700;
  min-height: 24px;
}

/* VIEW 2: COMPASS LAYOUT */
.compass-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 900px) {
  .compass-layout { grid-template-columns: 1fr; }
}

.compass-visual-wrap {
  background: #09131f;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: var(--shadow);
}
.c-label {
  fill: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 11px;
  cursor: pointer;
}
.c-label:hover { fill: var(--amber); }
.c-label-sub {
  fill: #94a3b8;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 9px;
  cursor: pointer;
}
.c-label-sub:hover { fill: #38bdf8; }

.compass-nav-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  box-shadow: var(--shadow);
}
.card-bearing-badge {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--amber);
  background: #fef3c7;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 0.4rem;
}
.compass-nav-card h3 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--navy);
}
#current-bearing-irish { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.2rem; }

.direction-quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.dir-btn {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.4rem;
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  transition: all 0.2s;
}
.dir-btn:hover { background: #f1f5f9; border-color: var(--ocean-blue); }
.dir-btn.active { background: var(--ocean-blue); color: #fff; border-color: var(--ocean-blue); }

.nav-challenge-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 1.2rem;
}
.challenge-tag { font-size: 0.8rem; font-weight: 800; color: #166534; text-transform: uppercase; }
#sailing-order-text { font-size: 1rem; color: #14532d; font-weight: 600; margin: 0.5rem 0 1rem; }
.challenge-choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}
.choice-pill {
  background: #fff;
  border: 1px solid #86efac;
  color: #166534;
  padding: 0.6rem;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.choice-pill:hover { background: #dcfce7; }

/* VIEW 3: COORDINATE GRID */
.grid-game-wrap {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 900px) {
  .grid-game-wrap { grid-template-columns: 1fr; }
}
.grid-canvas-container {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  display: flex;
  justify-content: center;
  box-shadow: var(--shadow);
}
#coord-canvas {
  width: 100%;
  max-width: 480px;
  aspect-ratio: 1 / 1;
  background: #ecfeff;
  border-radius: 12px;
  cursor: pointer;
}
.coord-mission-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.mission-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  box-shadow: var(--shadow);
}
.mission-tag {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ocean-blue);
  background: #e0f2fe;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
}
.mission-card h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
  margin: 0.6rem 0 0.3rem;
}
#mission-clue-text { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.2rem; }

.coord-inputs {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.coord-paren {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.coord-paren input {
  width: 54px;
  height: 48px;
  text-align: center;
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-weight: 800;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.coord-legend {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.coord-legend h4 { font-size: 0.95rem; font-weight: 800; color: var(--navy); margin-bottom: 0.8rem; }
#landmark-legend-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.88rem; }
#landmark-legend-list li { display: flex; align-items: center; justify-content: space-between; }

/* VIEW 4: ANGLE DUEL */
.duel-wrap {
  max-width: 720px;
  margin: 0 auto;
}
.duel-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  box-shadow: var(--shadow);
}
.duel-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}
.duel-badge {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--ocean-blue);
  background: #e0f2fe;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
}
.duel-score { font-size: 0.88rem; font-weight: 700; color: var(--gold); }
.duel-question {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 1.8rem;
  line-height: 1.35;
}
.duel-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}
@media (max-width: 600px) {
  .duel-options { grid-template-columns: 1fr; }
}
.duel-btn {
  background: #f8fafc;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 800;
  color: var(--navy);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.duel-btn:hover { background: #f1f5f9; border-color: var(--navy); }
.duel-btn.correct { background: #ecfdf5; border-color: #10b981; color: #047857; }
.duel-btn.wrong { background: #fef2f2; border-color: #ef4444; color: #b91c1c; }
.duel-feedback {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 1.2rem;
  min-height: 28px;
}
