:root {
  /* High-Contrast Sunlight Light Mode Theme */
  --bg-dark: #f0f4f9;             /* Crisp sky-marine light backdrop */
  --bg-card: #ffffff;             /* Pure white high-contrast card surface */
  --bg-card-subtle: #e6eef7;      /* Subtle slate ice highlight */
  --bg-canvas: #f6f9fc;           /* Radar and chart background */
  
  --accent-cyan: #0077b6;         /* High-contrast deep azure for text & key indicators */
  --accent-blue: #023e8a;         /* Royal nautical navy */
  --accent-green: #058c42;        /* High-contrast forest emerald (visible under direct sunlight) */
  --accent-orange: #d9480f;       /* Vivid safety amber/orange for look bearings */
  --accent-red: #c92a2a;          /* Crimson click alerts */
  
  --text-white: #0f172a;          /* Deep high-contrast charcoal/black for primary text */
  --text-dim: #475569;            /* Readable dark slate for secondary labels */
  --text-muted: #64748b;          /* Medium slate */
  
  --border-subtle: rgba(15, 23, 42, 0.12);
  --border-highlight: rgba(0, 119, 182, 0.4);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);
  
  --font-display: 'Chakra Petch', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --nav-height: 68px;
}

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

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-dark);
  color: var(--text-white);
  font-family: var(--font-display);
  overflow: hidden; /* App-like feel, no window bouncing */
}

.mobile-first-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh; /* dynamic viewport height for mobile browsers */
  background: var(--bg-dark);
}

/* Audio Banner - high contrast & easy to tap */
.audio-banner {
  background: linear-gradient(90deg, #005f73, #0a9396);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 99;
}

.audio-banner.hidden {
  display: none;
}

.audio-banner-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pulse-ring {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  animation: pulse-ring 1.4s infinite ease-out;
}

@keyframes pulse-ring {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.4); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.audio-banner-info strong {
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  display: block;
}

.audio-banner-info .subtext {
  font-size: 0.72rem;
  opacity: 0.95;
  font-family: var(--font-mono);
}

.banner-btn {
  background: #ffffff;
  color: #005f73;
  border: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Top Mobile Header */
.mobile-header {
  padding: 10px 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.boat-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(5, 140, 66, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(5, 140, 66, 0.3);
  padding: 3px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-pill .blip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
}

.target-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: 0.5px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Big Glanceable Breach ETA Card (Always visible at top) */
.glanceable-eta-card {
  background: #ffffff;
  border-bottom: 2px solid var(--accent-cyan);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.eta-left {
  display: flex;
  flex-direction: column;
}

.eta-headline {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.eta-countdown {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 800;
  color: #0077b6;
  line-height: 1;
}

.eta-right {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tele-row {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.tele-row .t-lbl {
  font-size: 0.68rem;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-weight: 600;
}

.tele-row .t-val {
  font-weight: 700;
  color: #0f172a;
}

.tele-row .t-val.highlight {
  color: var(--accent-green);
  font-size: 1.05rem;
}

.tele-row .t-val.bearing-val {
  color: var(--accent-orange);
  font-size: 1.05rem;
}

.eta-progress-track {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: #e2e8f0;
}

.eta-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #058c42, #0077b6);
  transition: width 0.3s ease;
}

/* Main Viewport Container for Tab Panes */
.mobile-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg-dark);
}

.tab-pane {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--bg-dark);
}

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

/* Desktop & Tablet Side-by-Side Responsive Layout */
@media (min-width: 992px) {
  .mobile-viewport {
    display: grid;
    grid-template-columns: 1.15fr 1.25fr 1fr;
    gap: 16px;
    padding: 16px;
    overflow: hidden;
  }

  .tab-pane {
    position: relative;
    inset: auto;
    display: flex !important;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    overflow: hidden;
  }

  .bottom-nav {
    display: none !important;
  }

  .glanceable-eta-card {
    padding: 14px 28px;
  }

  .direction-hint-box {
    border-radius: 0 0 12px 12px;
  }
}

/* Pane Header & Subtitle */
.pane-header {
  padding: 10px 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.pane-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-dim);
}

.status-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-green);
  background: rgba(5, 140, 66, 0.1);
  border: 1px solid rgba(5, 140, 66, 0.3);
  padding: 3px 8px;
  border-radius: 4px;
}

.click-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-red);
  background: rgba(201, 42, 42, 0.1);
  border: 1px solid rgba(201, 42, 42, 0.3);
  padding: 3px 8px;
  border-radius: 4px;
  transition: all 0.1s ease;
}

.click-tag.flash {
  background: var(--accent-red);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(201, 42, 42, 0.4);
}

/* Canvas Containers */
.canvas-container {
  flex: 1;
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--bg-canvas);
}

.canvas-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Radar Center Marker & Labels */
.radar-container {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f6fa;
}

.center-boat-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}

.rhib-boat-svg {
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.25));
  transition: transform 0.3s ease;
}

.boat-txt {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: #ffffff;
  background: #1e293b;
  padding: 2px 6px;
  border-radius: 3px;
  margin-top: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.compass-label {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
  pointer-events: none;
}
.compass-label.north { top: 8px; left: 50%; transform: translateX(-50%); color: #0077b6; font-weight: 800; }
.compass-label.east { right: 8px; top: 50%; transform: translateY(-50%); }
.compass-label.south { bottom: 8px; left: 50%; transform: translateX(-50%); }
.compass-label.west { left: 8px; top: 50%; transform: translateY(-50%); }

/* Look Direction Guidance Banner */
.direction-hint-box {
  background: #ffffff;
  border-top: 1px solid var(--border-subtle);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-shrink: 0;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.03);
}

.dir-arrow {
  font-size: 1.6rem;
  color: var(--accent-orange);
  font-weight: 800;
  animation: bounce-arrow 1.2s infinite ease-in-out;
}

@keyframes bounce-arrow {
  0% { transform: translateY(0); }
  50% { transform: translateY(-4px) scale(1.1); }
  100% { transform: translateY(0); }
}

.dir-text {
  font-size: 0.95rem;
  color: #0f172a;
}

.dir-text strong {
  color: var(--accent-orange);
  font-weight: 800;
}

/* Depth Stats Strip */
.depth-stats-bar, .click-stats-bar {
  background: #ffffff;
  border-top: 1px solid var(--border-subtle);
  padding: 10px 14px;
  display: flex;
  justify-content: space-around;
  flex-shrink: 0;
  box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.03);
}

.d-stat, .c-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.d-lbl, .c-lbl {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-weight: 700;
}

.d-val, .c-val {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 800;
  color: #0077b6;
  margin-top: 2px;
}

/* Clicks tab layout */
.hydro-container {
  height: 55%;
  min-height: 150px;
  background: #f8fafc;
}

.waterfall-label {
  position: absolute;
  bottom: 8px;
  left: 10px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.85);
  padding: 2px 6px;
  border-radius: 4px;
}

.oscilloscope-card {
  height: 30%;
  padding: 8px 14px;
  background: #ffffff;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.osc-title {
  font-size: 0.68rem;
  color: var(--text-dim);
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.osc-container {
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
}

/* Presets / Demo Scenarios */
.presets-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.preset-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-card);
}

.preset-btn:active, .preset-btn.active {
  border-color: #0077b6;
  background: #eef7fc;
  box-shadow: 0 0 0 2px rgba(0, 119, 182, 0.2);
}

.preset-btn .p-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.preset-btn .p-desc {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* Bottom Tab Navigation Bar */
.bottom-nav {
  height: var(--nav-height);
  background: #ffffff;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  padding: 4px 6px;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  flex-shrink: 0;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.nav-tab {
  flex: 1;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #64748b;
  cursor: pointer;
  border-radius: 8px;
  padding: 4px 0;
  transition: all 0.15s ease;
}

.nav-tab:active {
  background: #f1f5f9;
}

.nav-tab.active {
  color: #0077b6;
  background: #e0f2fe;
}

.nav-tab .nav-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.nav-tab .nav-text {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
