:root {
  --bg-main: #0b1320;
  --bg-card: #132238;
  --bg-card-hover: #172a45;
  --bg-card-alt: #0e1b2c;
  --border-color: #1e3556;
  --border-accent: #2c4d7c;
  --text-main: #e8f0fe;
  --text-muted: #8ca3c7;
  --text-dim: #5c7499;
  
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-glow: rgba(2, 132, 199, 0.25);
  --cyan-accent: #38bdf8;
  --emerald: #10b981;
  --emerald-bg: rgba(16, 185, 129, 0.15);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.15);
  --rose: #f43f5e;
  --rose-bg: rgba(244, 63, 94, 0.15);

  --pleamar-color: #38bdf8;
  --bajamar-color: #fb923c;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ========================================================
   CABECERA
   ======================================================== */
.app-header {
  background: linear-gradient(180deg, #101c30 0%, #0b1320 100%);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 0;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 32px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--cyan-accent);
  font-weight: 500;
}

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

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-perpetual {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge-station {
  background: rgba(2, 132, 199, 0.15);
  color: var(--cyan-accent);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* ========================================================
   CONTENIDO PRINCIPAL
   ======================================================== */
.app-content {
  flex: 1;
  padding: 20px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* TARJETAS COMUNES */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.card-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #ffffff;
}

/* ========================================================
   BARRA DE CONTROLES Y FECHA
   ======================================================== */
.controls-card {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.date-navigator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-picker-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.input-date {
  background: #09111c;
  border: 1px solid var(--border-accent);
  color: #ffffff;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
}

.input-date:focus {
  outline: none;
  border-color: var(--cyan-accent);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.date-pill-btn {
  display: none; /* En desktop se muestra el input normal; en móvil se usa el pill táctil */
}

.btn {
  background: #1a2f4d;
  color: var(--text-main);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover {
  background: #233e66;
  border-color: var(--cyan-accent);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
}

.date-display-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-display-info h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: #ffffff;
}

.coeff-pill {
  background: var(--amber-bg);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.meta-pills-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tz-pill {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.tz-summer {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.tz-winter {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.dst-alert-tag {
  font-size: 0.65rem;
  font-weight: 800;
  background: #f43f5e;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

.view-toggles {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.toggle-group {
  display: flex;
  background: #09111c;
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.toggle-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.toggle-btn.active {
  background: var(--primary);
  color: #ffffff;
}

.datum-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.select-sm {
  background: #09111c;
  color: #ffffff;
  border: 1px solid var(--border-accent);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
}

/* ========================================================
   HERO WIDGET ESTILO TUMAREA (VASO, BARCO FLOTANTE Y FLECHA)
   ======================================================== */
.tumarea-hero-card {
  background: linear-gradient(135deg, #10233b 0%, #0d192a 100%);
  border: 1px solid #1e4574;
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: 0 8px 30px rgba(2, 132, 199, 0.16);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.tumarea-status-heading {
  font-size: 1.2rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.tumarea-lead {
  color: var(--text-muted);
}

.tumarea-trend-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.tumarea-trend-badge.trend-up {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.4);
}

.tumarea-trend-badge.trend-down {
  background: rgba(244, 63, 94, 0.2);
  color: #fb7185;
  border: 1px solid rgba(251, 113, 133, 0.4);
}

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

.tumarea-since strong {
  color: #ffffff;
}

/* Fila central del medidor */
.tumarea-gauge-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  margin: 10px 0 20px;
}

/* Flecha gigante direccional */
.tumarea-big-arrow {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s ease, background 0.3s ease;
}

.tumarea-big-arrow.arrow-up {
  background: rgba(16, 185, 129, 0.18);
  color: #10b981;
  border: 2px solid #10b981;
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.35);
  animation: pulseArrowUp 2s infinite ease-in-out;
}

.tumarea-big-arrow.arrow-down {
  background: rgba(244, 63, 94, 0.18);
  color: #f43f5e;
  border: 2px solid #f43f5e;
  box-shadow: 0 0 18px rgba(244, 63, 94, 0.35);
  transform: rotate(180deg);
  animation: pulseArrowDown 2s infinite ease-in-out;
}

.arrow-svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

@keyframes pulseArrowUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes pulseArrowDown {
  0%, 100% { transform: rotate(180deg) translateY(0); }
  50% { transform: rotate(180deg) translateY(-5px); }
}

/* El Vaso TuMarea */
.tumarea-glass {
  width: 74px;
  height: 128px;
  background: #08111e;
  border: 2.5px solid #284c79;
  border-top: 1.5px solid #38bdf8;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6), 0 4px 14px rgba(0, 0, 0, 0.4);
}

.tumarea-water {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 45%, #0c4a6e 100%);
  transition: height 1s cubic-bezier(0.4, 0, 0.2, 1);
  border-top: 2px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 -2px 12px rgba(56, 189, 248, 0.55);
}

/* Barquito que flota en la superficie */
.tumarea-boat {
  position: absolute;
  top: -15px;
  left: calc(50% - 16px);
  width: 32px;
  height: 28px;
  animation: boatFloat 3s ease-in-out infinite;
  transform-origin: bottom center;
}

.boat-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

@keyframes boatFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-3px) rotate(2deg); }
}

.tumarea-glass-reflection {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 50%);
  pointer-events: none;
}

/* Columna de niveles a la derecha del vaso */
.tumarea-levels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 128px;
  text-align: left;
}

.level-item {
  display: flex;
  flex-direction: column;
}

.level-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.level-max .level-tag { color: var(--pleamar-color); }
.level-max strong { color: var(--pleamar-color); font-size: 1.1rem; }

.level-current .level-tag { color: #ffffff; }
.level-current strong {
  font-size: 1.55rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.pulse-level {
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
  animation: pulseGlow 2.5s infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.88; }
}

.level-min .level-tag { color: var(--bajamar-color); }
.level-min strong { color: var(--bajamar-color); font-size: 1.1rem; }

/* Banner de la próxima marea */
.tumarea-next-banner {
  background: rgba(14, 28, 48, 0.75);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tumarea-next-main {
  font-size: 1.05rem;
  color: #ffffff;
}

.text-accent {
  color: var(--cyan-accent);
}

.tumarea-next-sub {
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* ========================================================
   CUADRÍCULA DE LAS 4 MAREAS DEL DÍA (ESTILO TUMAREA)
   ======================================================== */
.tumarea-tides-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.tumarea-events-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.event-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  transition: transform 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.event-card.card-pleamar {
  border-top: 3.5px solid var(--pleamar-color);
}

.event-card.card-bajamar {
  border-top: 3.5px solid var(--bajamar-color);
}

.card-next-highlight {
  border: 1.5px solid var(--cyan-accent) !important;
  border-top: 3.5px solid var(--cyan-accent) !important;
  background: rgba(2, 132, 199, 0.16) !important;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.28);
}

.event-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.event-type-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.card-pleamar .event-type-badge { color: var(--pleamar-color); }
.card-bajamar .event-type-badge { color: var(--bajamar-color); }

.next-pill {
  font-size: 0.64rem;
  font-weight: 800;
  background: var(--cyan-accent);
  color: #0b1320;
  padding: 1px 7px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  animation: pulsePill 2s infinite ease-in-out;
}

@keyframes pulsePill {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.9; }
}

.event-time {
  font-size: 1.55rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
}

.event-meta-right {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.event-height {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--cyan-accent);
}

.event-coeff-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ========================================================
   BARRA RÁPIDA DE ASTRONOMÍA (TUMAREA ASTRO STRIP)
   ======================================================== */
.tumarea-astro-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  gap: 10px;
  align-items: center;
}

.astro-strip-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.astro-strip-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.astro-strip-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.astro-strip-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.astro-strip-val {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
}

/* ========================================================
   CURVA DE MAREA DE 24 HORAS
   ======================================================== */
.chart-section {
  position: relative;
  overflow: hidden;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 260px;
  background: #09121f;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 8px 4px;
  touch-action: pan-y;
}

.tide-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  user-select: none;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(11, 20, 35, 0.95);
  backdrop-filter: blur(4px);
  border: 1px solid var(--cyan-accent);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  display: none;
  transform: translate(-50%, -125%);
  z-index: 10;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-high { background: var(--pleamar-color); }
.dot-low { background: var(--bajamar-color); }
.dot-now { background: #e11d48; box-shadow: 0 0 6px #e11d48; }

/* ========================================================
   PANELES DE ASTRONOMÍA Y SOLUNAR
   ======================================================== */
.astro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.astro-card {
  display: flex;
  flex-direction: column;
}

.astro-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.astro-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.88rem;
}

.astro-item-label {
  color: var(--text-muted);
}

.astro-item-val {
  color: #ffffff;
}

/* LUNA */
.moon-phase-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card-alt);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 6px;
}

.moon-graphic {
  font-size: 2.4rem;
  line-height: 1;
}

/* SOLUNAR */
.solunar-headline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
}

.stars-pill {
  font-size: 0.9rem;
  letter-spacing: 2px;
}

.solunar-periods-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.solunar-period-item {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.solunar-period-type {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--cyan-accent);
}

.solunar-period-time {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
}

/* ========================================================
   TABLA DE LOS PRÓXIMOS 30 DÍAS (UNA MAREA POR LÍNEA)
   ======================================================== */
.next-30-days-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-30-days-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-30-days {
  width: 100%;
  border-collapse: collapse;
}

.table-30-days th {
  background: var(--bg-card-alt);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border-accent);
  text-align: left;
}

.table-30-days .th-meta {
  text-align: right;
}

.table-30-days tr.row-30day {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.15s ease;
  cursor: pointer;
}

.table-30-days tr.row-30day:hover {
  background: rgba(2, 132, 199, 0.1);
}

.table-30-days tr.row-30day.row-today {
  background: rgba(2, 132, 199, 0.16);
  border-left: 3.5px solid var(--cyan-accent);
}

.table-30-days td {
  padding: 12px 14px;
  vertical-align: middle;
}

/* Columna de Fecha */
.col-day {
  width: 80px;
  white-space: nowrap;
}

.day-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  width: 60px;
  text-align: center;
}

.row-today .day-badge {
  border-color: var(--cyan-accent);
  background: rgba(56, 189, 248, 0.15);
}

.day-weekday {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--cyan-accent);
  text-transform: uppercase;
}

.day-num {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
}

.day-month {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Columna de Mareas (Una marea por línea) */
.col-tides {
  min-width: 190px;
}

.day-tides-stack {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tide-line {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  padding: 2px 0;
}

.tide-line-time {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  min-width: 50px;
}

.tide-line-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
}

.tide-p .tide-line-badge {
  background: rgba(56, 189, 248, 0.2);
  color: var(--pleamar-color);
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.tide-b .tide-line-badge {
  background: rgba(251, 146, 60, 0.2);
  color: var(--bajamar-color);
  border: 1px solid rgba(251, 146, 60, 0.4);
}

.tide-line-height {
  font-weight: 700;
  min-width: 58px;
}

.tide-p .tide-line-height {
  color: var(--pleamar-color);
}

.tide-b .tide-line-height {
  color: var(--bajamar-color);
}

/* Columna Meta (Coeficiente y Luna) */
.col-meta {
  width: 100px;
  text-align: right;
  white-space: nowrap;
}

.meta-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.coeff-badge-mini {
  background: var(--amber-bg);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.35);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

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

/* ========================================================
   TABLA MENSUAL (30 DÍAS)
   ======================================================== */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-month {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.table-month th {
  background: var(--bg-card-alt);
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-accent);
}

.table-month td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.table-month tr:hover {
  background: var(--bg-card-hover);
}

.table-month tr.row-today {
  background: rgba(2, 132, 199, 0.15);
  font-weight: 600;
}

.tide-cell {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.tide-cell-pleamar {
  background: rgba(56, 189, 248, 0.15);
  color: var(--pleamar-color);
}

.tide-cell-bajamar {
  background: rgba(251, 146, 60, 0.15);
  color: var(--bajamar-color);
}

/* ========================================================
   PIE DE PÁGINA
   ======================================================== */
.app-footer {
  background: var(--bg-card-alt);
  border-top: 1px solid var(--border-color);
  padding: 20px 0;
  margin-top: auto;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.85rem; }
.text-muted { color: var(--text-muted); }
.hidden { display: none !important; }

/* ========================================================
   OVERLAY CARGA WEBASSEMBLY
   ======================================================== */
.wasm-overlay {
  position: fixed;
  inset: 0;
  background: #0b1320;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease;
}

.wasm-spinner-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 30px;
  border-radius: var(--radius-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  max-width: 340px;
  width: 90%;
}

.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 16px;
}

.progress-bar-fill {
  width: 50%;
  height: 100%;
  background: var(--cyan-accent);
  border-radius: 999px;
  animation: progressAnim 1.2s infinite ease-in-out;
}

@keyframes progressAnim {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
  100% { transform: translateX(250%); }
}

.mb-3 { margin-bottom: 12px; }

/* ========================================================
   BARRA DE PESTAÑAS MÓVIL
   ======================================================== */
.mobile-tab-bar {
  display: none;
}

/* ========================================================
   RESPONSIVE: DISPOSITIVOS MÓVILES (IPHONE / ANDROID)
   ======================================================== */
@media (max-width: 768px) {
  .container {
    padding: 0 12px;
  }

  .app-header {
    padding: 10px 0;
  }

  .header-container {
    justify-content: center;
    text-align: center;
  }

  .brand {
    gap: 8px;
  }

  .brand-icon {
    width: 38px;
    height: 38px;
    font-size: 24px;
  }

  .brand-title {
    font-size: 1.2rem;
  }

  .brand-subtitle {
    display: none;
  }

  .header-badges {
    display: none;
  }

  .app-content {
    padding: 12px 12px calc(80px + env(safe-area-inset-bottom, 0px));
    gap: 14px;
  }

  /* Barra de controles compacta y táctil */
  .controls-card {
    padding: 10px 12px;
    gap: 8px;
    flex-direction: column;
    align-items: stretch;
  }

  .date-navigator {
    width: 100%;
    justify-content: space-between;
  }

  .date-nav-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
  }

  .date-picker-wrap {
    flex: 1;
    justify-content: center;
    position: relative;
  }

  .input-date {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    cursor: pointer;
    z-index: 2;
  }

  .date-pill-btn {
    display: flex;
    background: #09121f;
    border: 1px solid var(--border-accent);
    color: #ffffff;
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 0.88rem;
    font-weight: 700;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  }

  .btn-today {
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 700;
  }

  .date-display-info {
    justify-content: space-between;
    width: 100%;
    padding: 2px 4px;
  }

  .date-display-info h2 {
    font-size: 0.95rem;
  }

  .view-toggles {
    display: none; /* En móvil usamos la barra inferior de pestañas */
  }

  /* Widget TuMarea en móvil */
  .tumarea-hero-card {
    padding: 16px 14px;
  }

  .tumarea-status-heading {
    font-size: 1.05rem;
    margin-bottom: 14px;
  }

  .tumarea-gauge-row {
    gap: 16px;
    margin: 6px 0 16px;
  }

  .tumarea-big-arrow {
    width: 48px;
    height: 48px;
  }

  .arrow-svg {
    width: 28px;
    height: 28px;
  }

  .tumarea-glass {
    width: 66px;
    height: 118px;
  }

  .tumarea-levels {
    height: 118px;
  }

  .level-current strong {
    font-size: 1.35rem;
  }

  .tumarea-next-main {
    font-size: 0.95rem;
  }

  /* 4 Mareas en móvil: 2x2 para ver todas a la vez sin scroll */
  .tumarea-events-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .event-card {
    padding: 10px 12px;
  }

  .event-time {
    font-size: 1.35rem;
  }

  .event-height {
    font-size: 1rem;
  }

  /* Barra astronómica compacta en móvil */
  .tumarea-astro-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 10px 12px;
  }

  /* Barra inferior de pestañas móvil */
  .mobile-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(11, 19, 32, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border-color);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  }

  .mobile-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    min-width: 64px;
    touch-action: manipulation;
  }

  .mobile-tab-btn .tab-icon {
    font-size: 1.3rem;
    line-height: 1;
    transition: transform 0.15s ease;
  }

  .mobile-tab-btn.active {
    color: var(--cyan-accent);
  }

  .mobile-tab-btn.active .tab-icon {
    transform: scale(1.15);
  }

  .mobile-tab-btn:active {
    opacity: 0.7;
  }

  .astro-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}
