/* ─────────────────────────────────────────
   TOKENS
───────────────────────────────────────── */
:root {
  --blue:  #314fff;
  --beige: #f9f6ef;
  --black: #0a0a0a;
  --white: #ffffff;

  --font: 'Geist Mono', monospace;

  --radius-btn: 12px;
  --radius-card: 16px;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ─────────────────────────────────────────
   RESET
───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: var(--font);
  border: none;
  background: none;
  cursor: pointer;
}

ul { list-style: none; }

/* ─────────────────────────────────────────
   VIEWS — contenedor base
───────────────────────────────────────── */
.view {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease;
  opacity: 0;
  pointer-events: none;
  transform: translateX(20px);
}

.view.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

/* ─────────────────────────────────────────
   VIEW: HOME
───────────────────────────────────────── */
.view--home {
  background: var(--blue);
  color: var(--beige);
  padding: 60px 36px 36px;
  justify-content: space-between;
}

.home__top {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Animación de portada (logo + ilustración) ── */
.home-anim {
  position: relative;
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
}

/* El primer frame establece la altura del contenedor */
.home-anim__frame--1 {
  display: block;
  width: 100%;
  height: auto;
  visibility: hidden;   /* ocupa espacio pero no se ve — los absolutas se ven encima */
}

/* Los 3 frames, apilados */
.home-anim__frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
}

.home-anim__frame--1 {
  position: relative; /* anula el absolute para que establezca altura */
  visibility: visible;
  animation: frame1 0.45s steps(1, end) infinite;
}

.home-anim__frame--2 {
  animation: frame2 0.45s steps(1, end) infinite;
}

.home-anim__frame--3 {
  animation: frame3 0.45s steps(1, end) infinite;
}

@keyframes frame1 {
  0%, 33.33%  { opacity: 1; }
  33.34%, 100%{ opacity: 0; }
}

@keyframes frame2 {
  0%, 33.33%  { opacity: 0; }
  33.34%, 66.66% { opacity: 1; }
  66.67%, 100%{ opacity: 0; }
}

@keyframes frame3 {
  0%, 66.66%  { opacity: 0; }
  66.67%, 100% { opacity: 1; }
}

.illus-placeholder--home {
  width: 200px;
  height: 200px;
  border-radius: 50%;
}

.illus-placeholder--results {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  /* sobre fondo beige: azul */
  background: rgba(49, 79, 255, 0.08);
  border-color: rgba(49, 79, 255, 0.2);
  color: rgba(49, 79, 255, 0.4);
}

.illus-placeholder--offshore {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(49, 79, 255, 0.08);
  border-color: rgba(49, 79, 255, 0.3);
  color: transparent;
}

.illus-placeholder--offshore::after {
  content: '';
}

/* ── Spot list ── */
.home__spots {
  padding: 0 32px;
}

/* Lista de spots — una playa por línea */
.spots-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Fila individual: abbrev + botón (+ opcionalmente el +) */
.spot-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Abbrev fuera del botón, columna izquierda fija */
.spot-abbrev {
  font-size: 9px;
  font-weight: 500;
  color: rgba(249, 246, 239, 0.45);
  letter-spacing: 0.06em;
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

.spot-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 16px;
  flex: 1;
  background: transparent;
  border: 1.5px solid rgba(249, 246, 239, 0.85);
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.spot-item:active {
  background: rgba(249, 246, 239, 0.1);
}

.spot-item__name {
  font-size: 11px;
  font-weight: 600;
  color: var(--beige);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Botón borrar — badge encima */
.spot-item__delete {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--beige);
  color: var(--blue);
  font-size: 10px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.spot-item--delete-mode .spot-item__delete {
  display: flex;
}

/* Botón añadir — círculo outline */
.btn-add-spot {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid rgba(249, 246, 239, 0.85);
  color: rgba(249, 246, 239, 0.85);
  font-size: 26px;
  font-weight: 300;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

.btn-add-spot:active { opacity: 0.3; }

/* ─────────────────────────────────────────
   VIEW: RESULTS
───────────────────────────────────────── */
.view--results {
  background: var(--beige);
  color: var(--black);
}

/* ── Header ── */
.results__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 48px 24px 16px;
  flex-shrink: 0;
}

.btn-back {
  font-size: 20px;
  color: var(--blue);
  padding: 4px;
  line-height: 1;
}

.results__spot-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--blue);
  text-transform: uppercase;
}

/* ── Main (diagnosis + drum) ── */
.results__main {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0 28px 0;
  gap: 20px;
  min-height: 0;
}

/* ── Offshore alert ── */
.offshore-alert {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(49, 79, 255, 0.06);
  border: 1px solid rgba(49, 79, 255, 0.2);
  border-radius: var(--radius-card);
  padding: 16px;
  flex-shrink: 0;
}

.offshore-alert p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--black);
}

.offshore-alert strong {
  color: var(--blue);
}

/* ── Diagnosis ── */
.diagnosis {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  flex-shrink: 0;
}

.diagnosis__title {
  font-size: 22px;
  font-weight: 600;
  color: var(--blue);
  line-height: 1.2;
}

.diagnosis__desc {
  font-size: 13px;
  line-height: 1.7;
  color: rgba(49, 79, 255, 0.6);
  max-width: 280px;
}

/* ── Metrics drum — contenedor del WheelPicker ── */
.metrics-drum {
  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: grab;
  min-height: 0;
  /* Fade progresivo en bordes — da la sensación de profundidad del cilindro */
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 22%,
    black 78%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 22%,
    black 78%,
    transparent 100%
  );
}

.metrics-drum:active { cursor: grabbing; }

/* ── Slot (generado por WheelPicker) ── */
.drum-slot {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 64px;          /* debe coincidir con WheelPicker.ITEM_H */
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  transform-origin: center center;
  will-change: transform, opacity;
  pointer-events: none;
  box-sizing: border-box;
}

/* Icono en círculo */
.drum-slot__icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(49, 79, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--blue);
  transition: background 0.2s ease;
}

.drum-slot.active .drum-slot__icon {
  background: rgba(49, 79, 255, 0.13);
}

.drum-slot__icon svg {
  width: 17px;
  height: 17px;
}

/* Cuerpo del slot */
.drum-slot__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.drum-slot__main {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.drum-slot__name {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(10, 10, 10, 0.38);
  flex-shrink: 0;
}

.drum-slot__value {
  font-size: 20px;
  font-weight: 600;
  color: var(--black);
  line-height: 1;
  transition: color 0.2s ease;
}

.drum-slot.active .drum-slot__value {
  color: var(--blue);
}

.drum-slot__label {
  font-size: 11px;
  color: rgba(10, 10, 10, 0.35);
}

/* Frase — solo visible en el slot activo */
.drum-slot__phrase {
  font-size: 11px;
  color: rgba(10, 10, 10, 0.4);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.drum-slot.active .drum-slot__phrase {
  opacity: 1;
}

/* ─────────────────────────────────────────
   TIME BAR
───────────────────────────────────────── */
.time-bar {
  flex-shrink: 0;
  padding: 16px 24px calc(16px + var(--safe-bottom));
  border-top: 1px solid rgba(10, 10, 10, 0.08);
  background: var(--beige);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.time-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(49, 79, 255, 0.15);
  outline: none;
}

.time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--blue);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(49, 79, 255, 0.3);
}

.time-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--blue);
  cursor: pointer;
  border: none;
}

.time-bar__label {
  font-size: 12px;
  color: rgba(10, 10, 10, 0.5);
  text-align: center;
  letter-spacing: 0.05em;
}

/* ─────────────────────────────────────────
   OVERLAY: Añadir playa
───────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.5);
  display: flex;
  align-items: flex-end;
  z-index: 100;
  transition: opacity 0.25s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay__panel {
  width: 100%;
  background: var(--beige);
  border-radius: 20px 20px 0 0;
  padding: 24px 24px calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 70vh;
}

.overlay__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--black);
}

.btn-close-overlay {
  font-size: 16px;
  color: rgba(10, 10, 10, 0.4);
}

.search-input {
  font-family: var(--font);
  font-size: 15px;
  background: rgba(10, 10, 10, 0.05);
  border: 1px solid rgba(10, 10, 10, 0.1);
  border-radius: var(--radius-btn);
  padding: 14px 16px;
  width: 100%;
  outline: none;
  color: var(--black);
}

.search-input:focus {
  border-color: var(--blue);
}

.search-results {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-result-item {
  padding: 14px 16px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  color: var(--black);
  cursor: pointer;
  transition: background 0.1s ease;
}

.search-result-item:active {
  background: rgba(49, 79, 255, 0.08);
}

.search-result-item__country {
  font-size: 11px;
  color: rgba(10, 10, 10, 0.4);
  margin-left: 6px;
}

.add-spot-confirm {
  display: flex;
  gap: 10px;
}

.add-spot-confirm.hidden { display: none; }

.btn-save-spot {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  background: var(--blue);
  color: var(--beige);
  padding: 14px 20px;
  border-radius: var(--radius-btn);
  white-space: nowrap;
  transition: opacity 0.15s ease;
}

.btn-save-spot:active { opacity: 0.75; }

/* ─────────────────────────────────────────
   UTILS
───────────────────────────────────────── */
.hidden { display: none !important; }
