/* Quicksand 700 auto-alojada: el wordmark idéntico en web, iOS y Android */
@font-face {
    font-family: 'Quicksand';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('quicksand-700.woff2') format('woff2');
}

/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overscroll-behavior-y: contain;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    transition: background 0.5s ease;
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top));
    overflow: hidden;
}

/* ==================== BODY STATES ==================== */
.loading { background: linear-gradient(160deg, #121218 0%, #1a1d2e 100%); }
.good    { background: linear-gradient(160deg, #0f1f1a 0%, #14332a 50%, #1a3d30 100%); }
.warning { background: linear-gradient(160deg, #1a1810 0%, #2a2618 50%, #33301e 100%); }
.bad     { background: linear-gradient(160deg, #1f1214 0%, #2e1a1c 50%, #381e20 100%); }

/* ==================== CONTAINER ==================== */
.container {
    text-align: center;
    color: white;
    max-width: 420px;
    width: 100%;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.content-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

#detailView {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    gap: 7px;                 /* separación mínima aunque no sobre espacio */
}

.app-footer {
    flex-shrink: 0;
    padding-top: 8px;
}

/* ==================== STATUS EMOJI ==================== */
.status-emoji {
    font-size: 1.5rem;
    line-height: 1;
    margin: 0;
    min-height: 1.5rem;
    transition: opacity 0.4s ease;
}

.status-emoji:empty {
    opacity: 0;
}

/* ==================== STATUS PILL ==================== */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 20px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    margin: 0 auto;
    transition: all 0.4s ease;
}

.status-pill.loading-state {
    opacity: 0.6;
}

.status-dot-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transition: background 0.4s ease;
    flex-shrink: 0;
}

.status-dot-indicator.green  { background: #4ade80; box-shadow: 0 0 8px rgba(74,222,128,0.4); }
.status-dot-indicator.yellow { background: #facc15; box-shadow: 0 0 8px rgba(250,204,21,0.4); }
.status-dot-indicator.red    { background: #f87171; box-shadow: 0 0 8px rgba(248,113,113,0.4); }

/* ==================== MESSAGES ==================== */
.message {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: rgba(255,255,255,0.9);
}

.message-sub {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.4);
    margin-bottom: 12px;
}

/* ==================== CONDITIONS GRID ==================== */
.conditions-grid {
    display: flex;
    flex-direction: column;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    overflow: hidden;
    margin-bottom: 10px;
    text-align: left;
}

.condition-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.condition-row:last-child {
    border-bottom: none;
}

.condition-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
}

.condition-label svg {
    opacity: 0.5;
    flex-shrink: 0;
}

.condition-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
}

.condition-value small {
    font-weight: 400;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.4);
    margin-left: 4px;
}

/* ==================== BEACH SELECTOR ==================== */
.beach-selector {
    flex-shrink: 0;
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.fav-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: rgba(255,255,255,0.35);
    transition: color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
}

.fav-toggle.active {
    color: rgba(250,204,21,0.9);
    transform: scale(1.05);
}

.beach-selector select {
    padding: 10px 16px;
    font-size: 0.85rem;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    outline: none;
    min-width: 220px;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='rgba(255,255,255,0.5)' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.beach-selector select option {
    background: #1a1a2e;
    color: white;
}

/* ==================== BUTTONS ==================== */
.buttons {
    display: flex;
    gap: 5px;
    justify-content: center;
    flex-wrap: nowrap;
}

.btn {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 8px;
    font-size: 0.72rem;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
}

.btn svg {
    width: 12px;
    height: 12px;
    opacity: 0.6;
    flex-shrink: 0;
}

.btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.9);
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn.webcam.no-cam {
    opacity: 0.3;
    pointer-events: none;
}

/* ==================== TIMESTAMP & INFO ==================== */
.limits-info {
    margin-top: 3px;
    font-size: 0.6rem;
    color: rgba(255,255,255,0.25);
    line-height: 1.5;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
}

.dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    vertical-align: middle;
}

.dot-green  { background: #4ade80; }
.dot-yellow { background: #facc15; }
.dot-red    { background: #f87171; }

/* ==================== UV BADGE ==================== */
.uv-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.3px;
}
.uv-low       { background: rgba(74,222,128,0.2);  color: #4ade80; }
.uv-moderate  { background: rgba(250,204,21,0.2);  color: #facc15; }
.uv-high      { background: rgba(251,146,60,0.2);  color: #fb923c; }
.uv-very-high { background: rgba(248,113,113,0.2); color: #f87171; }
.uv-extreme   { background: rgba(192,132,252,0.2); color: #c084fc; }

/* ==================== COMPASS ==================== */
.compass-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
}

.compass {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.15);
    position: relative;
    background: rgba(255,255,255,0.03);
}

.compass-labels .cardinal {
    position: absolute;
    font-size: 0.5rem;
    font-weight: 600;
    color: rgba(255,255,255,0.4);
}
.cardinal.n { top: 3px; left: 50%; transform: translateX(-50%); }
.cardinal.s { bottom: 3px; left: 50%; transform: translateX(-50%); }
.cardinal.e { right: 5px; top: 50%; transform: translateY(-50%); }
.cardinal.w { left: 5px; top: 50%; transform: translateY(-50%); }

.compass-ring {
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 50%;
}

.compass-arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3px;
    height: 20px;
    background: linear-gradient(to top, rgba(255,255,255,0.15) 0%, #f87171 100%);
    transform-origin: bottom center;
    transform: translate(-50%, -100%) rotate(0deg);
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 2px;
}

.compass-arrow::after {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid #f87171;
}

.compass-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 5px;
    height: 5px;
    background: rgba(255,255,255,0.8);
    border-radius: 50%;
}

.wind-label {
    margin-top: 4px;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.5);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==================== FORECAST ==================== */
.forecast-section {
    margin: 10px 0;
    width: 100%;
}

.forecast-title {
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.35);
    margin-bottom: 4px;
}

.best-hour {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    padding: 7px 12px;
    margin-top: 10px;
    margin-bottom: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255,255,255,0.7);
}

.best-hour.no-good {
    background: rgba(248,113,113,0.08);
    border-color: rgba(248,113,113,0.15);
    color: rgba(248,113,113,0.7);
}

/* ==================== BEST BEACH BANNER ==================== */
.best-beach-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(74,222,128,0.12);
    border: 1px solid rgba(74,222,128,0.3);
    border-radius: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.best-beach-banner:hover,
.best-beach-banner:active {
    background: rgba(74,222,128,0.18);
}
.best-beach-banner.yellow {
    background: rgba(250,204,21,0.10);
    border-color: rgba(250,204,21,0.28);
}
.best-beach-banner.yellow:hover,
.best-beach-banner.yellow:active {
    background: rgba(250,204,21,0.16);
}
.best-beach-banner.detail {
    margin: 0;
    padding: 8px 12px;
}
.best-beach-banner.is-current {
    cursor: default;
    background: rgba(74,222,128,0.10);
}
.best-beach-banner.neutral {
    cursor: default;
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.12);
}
.best-beach-banner .bb-trophy {
    font-size: 1.1rem;
    line-height: 1;
    flex: 0 0 auto;
}
.best-beach-banner .bb-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1 1 auto;
}
.best-beach-banner .bb-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.45);
}
.best-beach-banner .bb-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.best-beach-banner .bb-data {
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    flex: 0 0 auto;
}
.best-beach-banner .bb-go {
    color: rgba(255,255,255,0.5);
    flex: 0 0 auto;
    display: flex;
}

.overview-row.is-best {
    background: rgba(74,222,128,0.08);
}

.forecast-scroll {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 2px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.forecast-scroll::-webkit-scrollbar {
    height: 2px;
}
.forecast-scroll::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
}

.forecast-card {
    flex: 0 0 64px;
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
    padding: 6px 5px;
    text-align: center;
    scroll-snap-align: start;
    border: 1px solid rgba(255,255,255,0.06);
    transition: border-color 0.3s;
}

.forecast-card.best {
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.07);
}

.forecast-card .hour {
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: rgba(255,255,255,0.85);
}

.forecast-card .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin: 0 auto 4px;
}

.forecast-card .data-row {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.5;
}

.forecast-card .data-row strong {
    color: rgba(255,255,255,0.8);
    font-weight: 600;
}

/* ==================== SUNRISE/SUNSET ==================== */
.sun-info {
    font-size: 0.75rem;
    opacity: 0.65;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

/* ==================== OVERVIEW PANEL ==================== */
#overviewPanel {
    width: 100%;
}

.overview-section-title {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.55);
    height: 34px;
    display: flex;
    align-items: center;          /* centrado vertical en su caja */
    justify-content: center;
    padding: 0 10px;
    margin-bottom: 2px;
    position: static;
    background: none;
}

.overview-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 8px;
}

.overview-row:hover,
.overview-row:active {
    background: rgba(255,255,255,0.06);
}

.fav-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
    color: rgba(255,255,255,0.3);
    transition: color 0.2s;
    display: flex;
    align-items: center;
}

@keyframes favPop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.25); }
    100% { transform: scale(1); }
}
.fav-btn.pop { animation: favPop 280ms cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@media (prefers-reduced-motion: reduce) {
    .fav-btn.pop { animation: none; }
}

.fav-btn.active {
    color: rgba(250,204,21,0.9);
}

.fav-btn svg {
    width: 16px;
    height: 16px;
}

.overview-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.overview-name {
    flex: 1;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: rgba(255,255,255,0.85);
}

.overview-data {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.45);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ==================== PULL TO REFRESH ==================== */
.pull-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    padding-top: calc(14px + env(safe-area-inset-top));
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: rgba(255,255,255,0.8);
    font-size: 0.8rem;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    z-index: 100;
}

.pull-indicator.visible {
    transform: translateY(0);
}

.pull-indicator .pull-arrow {
    display: flex;
    align-items: center;
}

.pull-indicator .pull-arrow svg {
    width: 16px;
    height: 16px;
}

.pull-indicator.refreshing .pull-arrow {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==================== WEBCAM MODAL ==================== */
/* Entrada: nace desde un 97% con fundido; salida simétrica y más rápida.
   Con "reducir movimiento": solo fundido, sin escala. */
@keyframes wmIn  { from { opacity: 0; transform: scale(0.97); } }
@keyframes wmOut { to   { opacity: 0; transform: scale(0.98); } }
@keyframes wmFadeIn  { from { opacity: 0; } }
@keyframes wmFadeOut { to   { opacity: 0; } }

.webcam-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,0.95);
    display: none;
    flex-direction: column;
}

.webcam-modal.open {
    display: flex;
    animation: wmIn 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.webcam-modal.closing {
    animation: wmOut 160ms ease-in forwards;
}

@media (prefers-reduced-motion: reduce) {
    .webcam-modal.open    { animation-name: wmFadeIn; animation-duration: 150ms; }
    .webcam-modal.closing { animation-name: wmFadeOut; animation-duration: 120ms; }
}

.webcam-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top));
    color: white;
}

.webcam-modal-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
}

.webcam-modal-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.webcam-ext-link {
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    display: flex;
    align-items: center;
}

.webcam-ext-link:hover {
    color: rgba(255,255,255,0.8);
}

.webcam-ext-link svg,
.webcam-close svg {
    width: 18px;
    height: 18px;
}

.webcam-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
}

.webcam-close:hover {
    color: rgba(255,255,255,0.8);
}

.webcam-modal-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px 16px;
    min-height: 0;
}

.webcam-modal-body iframe {
    /* 16:9 garantizado: crece hasta toparse con el ancho O con el alto disponible */
    aspect-ratio: 16 / 9;
    width: min(100%, calc((100dvh - 140px) * 16 / 9));
    height: auto;
    max-height: 100%;
    border: none;
    border-radius: 10px;
    background: #0a0a0a;
}

/* ==================== MODO SEGURIDAD ==================== */
.safety-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: rgba(255,255,255,0.35);
    transition: color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
}
.safety-toggle.active {
    color: #4ade80;
    transform: scale(1.05);
}

.safety-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.safety-modal.open { opacity: 1; pointer-events: auto; }

.safety-sheet {
    width: 100%;
    max-width: 480px;
    background: #143229;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    border: 1px solid rgba(255,255,255,0.08);
    border-bottom: none;
    max-height: 90vh;
    overflow-y: auto;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    transform: translateY(20px);
    transition: transform 0.25s;
}
.safety-modal.open .safety-sheet { transform: translateY(0); }

.safety-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 10px;
}
.safety-title { font-size: 0.95rem; font-weight: 600; color: rgba(255,255,255,0.9); }
.safety-close {
    background: none; border: none; cursor: pointer;
    color: rgba(255,255,255,0.6); display: flex; padding: 4px;
}
.safety-body { padding: 4px 18px 18px; }

.saf-lead {
    font-size: 0.95rem; font-weight: 600; color: rgba(255,255,255,0.9);
    display: flex; align-items: center; gap: 8px; margin: 0 0 14px;
}
.saf-lead svg { color: #4ade80; }
.saf-label {
    display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px;
    color: rgba(255,255,255,0.4); margin: 12px 0 6px;
}
.saf-input {
    width: 100%; box-sizing: border-box;
    padding: 11px 12px; margin-bottom: 8px;
    font-size: 0.9rem;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.9);
    outline: none;
}
.saf-input::placeholder { color: rgba(255,255,255,0.3); }
.saf-input:focus { border-color: rgba(74,222,128,0.5); }

.saf-pick {
    width: 100%; box-sizing: border-box;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px; margin: 2px 0 4px;
    font-size: 0.82rem; font-weight: 500;
    border: 1px dashed rgba(255,255,255,0.22);
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.7); cursor: pointer;
}
.saf-pick:active { background: rgba(255,255,255,0.1); }

.saf-chips { display: flex; gap: 8px; }
.saf-chip {
    flex: 1; padding: 12px 4px; font-size: 0.85rem; font-weight: 600;
    border: 1px solid rgba(74,222,128,0.3);
    border-radius: 10px;
    background: rgba(74,222,128,0.1);
    color: #4ade80; cursor: pointer; transition: background 0.15s;
}
.saf-chip:active { background: rgba(74,222,128,0.22); }

.saf-meta { font-size: 0.78rem; color: rgba(255,255,255,0.55); margin: 12px 0 0; display: flex; align-items: center; gap: 6px; justify-content: center; }
.saf-meta svg { color: #4ade80; }
.saf-note { font-size: 0.75rem; color: rgba(255,255,255,0.4); margin: 8px 0 0; text-align: center; }
.saf-disclaimer {
    font-size: 0.72rem; line-height: 1.5; color: rgba(255,255,255,0.4);
    margin: 16px 0 0; padding: 10px 12px;
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
}

.saf-active { text-align: center; padding: 8px 0 0; }
.saf-active-label { font-size: 0.8rem; color: rgba(255,255,255,0.55); margin: 0 0 4px; }
.saf-timer { font-size: 2.2rem; font-weight: 600; letter-spacing: 1px; color: rgba(255,255,255,0.95); margin: 0 0 6px; }
.saf-active.overdue .saf-timer { font-size: 1.3rem; color: #facc15; }
.saf-active.overdue .saf-active-label { color: #facc15; font-weight: 600; }
.saf-overdue-note { font-size: 0.8rem; color: rgba(255,255,255,0.6); line-height: 1.5; margin: 10px 0 4px; }

.saf-btn {
    width: 100%; box-sizing: border-box; margin-top: 10px;
    padding: 13px; font-size: 0.9rem; font-weight: 600;
    border-radius: 10px; cursor: pointer; border: none;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.saf-btn.ok { background: #4ade80; color: #06281a; }
.saf-btn.neutral { background: transparent; color: rgba(255,255,255,0.85); border: 1px solid rgba(255,255,255,0.25); }
.saf-btn.danger { background: rgba(248,113,113,0.15); color: #f87171; border: 1px solid rgba(248,113,113,0.4); }
.saf-call {
    display: block; text-align: center; margin-top: 12px;
    font-size: 0.85rem; font-weight: 600; color: #f87171; text-decoration: none;
}

/* ==================== LOADING SPINNER ==================== */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.15);
    border-top-color: rgba(255,255,255,0.6);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}


/* ==================== TIPS TICKER (estilo telediario) ==================== */
.tips-ticker {
    height: 24px;
    overflow: hidden;
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.05);
    border-top: 1px solid rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin: 0 -16px 6px;        /* a sangre: de borde a borde de la pantalla */
}
.tips-track {
    display: inline-block;
    white-space: nowrap;
    padding-left: 100%;         /* entra desde la derecha */
    font-size: 0.7rem;
    color: rgba(255,255,255,0.55);
    will-change: transform;
    animation: tips-scroll var(--tips-dur, 28s) linear infinite;
}
@keyframes tips-scroll {
    to { transform: translateX(-100%); }
}
/* El ticker se mueve siempre: sin animación el texto queda cortado e ilegible.
   (Las animaciones decorativas -veleta, tour- sí respetan reduced-motion.) */

.saf-origin { cursor: pointer; }
.saf-origin b { color: rgba(255,255,255,0.85); font-weight: 600; }


/* ==================== REDISEÑO PANEL TODAS (v1.0.1) ==================== */
.overview-search { padding: 4px 0 10px; }
.overview-search input {
    width: 100%; box-sizing: border-box;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px; padding: 11px 14px;
    color: var(--text, rgba(255,255,255,0.92));
    font-size: 0.9rem; outline: none;
    -webkit-appearance: none;
}
.overview-search input::placeholder { color: rgba(255,255,255,0.3); }
.overview-search input:focus { border-color: rgba(74,222,128,0.5); }

.prov-header {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 8px; cursor: pointer; user-select: none;
    -webkit-tap-highlight-color: transparent;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.prov-header .prov-name {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1.5px; opacity: 0.85;
}
.prov-header .prov-sum {
    margin-left: auto; display: flex; align-items: center; gap: 7px;
    font-size: 0.68rem; opacity: 0.75; font-variant-numeric: tabular-nums;
}
.prov-header .prov-sum .dot { margin-right: 2px; }
.prov-header .prov-chev { opacity: 0.4; transition: transform 0.18s ease; display: flex; }
.prov-header.open .prov-chev { transform: rotate(180deg); }
.prov-body { display: none; }
.prov-body.open { display: block; }

.overview-dist { font-size: 0.68rem; opacity: 0.5; margin-left: 6px; white-space: nowrap; }
.overview-empty { opacity: 0.5; padding: 18px 8px; font-size: 0.8rem; }

/* ==================== TARJETAS DE FAVORITAS (v39) ==================== */
.fav-cards { display: grid; gap: 10px; margin: 2px 0 10px; }
.fav-card {
    display: flex; justify-content: space-between; align-items: stretch; gap: 12px;
    border-radius: 16px; padding: 13px 15px; cursor: pointer;
    border: 1px solid; -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s ease;
}
.fav-card:active { transform: scale(0.985); }
.fav-green   { background: rgba(74,222,128,0.10);  border-color: rgba(74,222,128,0.28); }
.fav-yellow  { background: rgba(250,204,21,0.09);  border-color: rgba(250,204,21,0.25); }
.fav-red     { background: rgba(248,113,113,0.09); border-color: rgba(248,113,113,0.25); }
.fav-unknown { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.12); }
.fav-left { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; flex: 1 1 auto; }
.fav-name { font-weight: 700; font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; margin: 0; text-align: left; }
.fav-sub { font-size: 0.7rem; opacity: 0.55; margin: 0; padding: 0; text-align: left; }
.fav-verdict { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 600; margin-top: auto; padding-top: 4px; }
.fav-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.fav-water { display: flex; align-items: center; gap: 4px; font-size: 1.75rem; font-weight: 700; line-height: 1.05; letter-spacing: -0.5px; }
.fav-water svg { opacity: 0.6; }
.fav-air { display: flex; align-items: center; gap: 4px; font-size: 0.68rem; opacity: 0.55; }
.fav-data { display: flex; align-items: center; gap: 4px; font-size: 0.72rem; opacity: 0.75; margin-top: auto; padding-top: 4px; white-space: nowrap; }
.fav-data svg { opacity: 0.7; }


/* Panel de favoritas y ajuste fino para móviles estrechos (<=400px, iPhone 13 mini) */
#favPanel { padding-top: 4px; }
.fav-card { box-sizing: border-box; max-width: 100%; }
@media (max-width: 400px) {
    .fav-card { padding: 12px 12px; gap: 8px; }
    .fav-name { font-size: 0.88rem; }
    .fav-sub { font-size: 0.66rem; }
    .fav-verdict { font-size: 0.72rem; }
    .fav-water { font-size: 1.45rem; }
    .fav-air { font-size: 0.63rem; }
    .fav-data { font-size: 0.65rem; gap: 3px; }
}

/* En el panel de favoritas, el título va limpio: sin banda oscura ni blur */
#favPanel .overview-section-title {
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    position: static;
    height: auto;
    padding: 10px 8px 12px;
}

/* ==================== AVISOS SANITARIOS (cierres de playa) ==================== */
.beach-notice {
    display: flex; align-items: flex-start; gap: 10px;
    margin: 10px 0 2px; padding: 12px 14px;
    background: rgba(248,113,113,0.12);
    border: 1px solid rgba(248,113,113,0.45);
    border-radius: 12px;
    font-size: 0.78rem; line-height: 1.45;
    color: rgba(255,220,220,0.95);
}
.beach-notice svg { flex-shrink: 0; margin-top: 1px; color: #f87171; }
.notice-chip {
    display: inline-block; margin-left: 7px; padding: 2px 7px;
    background: rgba(248,113,113,0.18);
    border: 1px solid rgba(248,113,113,0.5);
    border-radius: 7px;
    font-size: 0.56rem; font-weight: 800; letter-spacing: 0.8px;
    color: #fca5a5; vertical-align: 2px;
}

/* ==================== VELETA ANIMADA (v53) ==================== */
/* El envoltorio oscila alrededor del centro de la brújula (mismo eje que el
   pivote de la flecha) y se compone con la rotación del rumbo sin tocarla.
   Amplitud y ritmo los fija el JS según las rachas. */
.vane-sway {
    position: absolute;
    inset: 0;
    transform-origin: 50% 50%;
    animation: vane-sway var(--sway-dur, 3.2s) ease-in-out infinite;
    pointer-events: none;
}
@keyframes vane-sway {
    0%   { transform: rotate(calc(var(--sway-amp, 3deg) * -1)); }
    55%  { transform: rotate(var(--sway-amp, 3deg)); }
    75%  { transform: rotate(calc(var(--sway-amp, 3deg) * 0.35)); }
    100% { transform: rotate(calc(var(--sway-amp, 3deg) * -1)); }
}
@media (prefers-reduced-motion: reduce) {
    .vane-sway { animation: none; }
}


/* ==================== WORDMARK SEMÁFORO (Brand System 02) ==================== */
.brand-bar { display: flex; justify-content: center; padding: 0 0 8px; }
.pg-wordmark {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Quicksand', ui-rounded, -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 700; font-size: 19px; letter-spacing: -0.02em;
    color: #F5F7F2; line-height: 1;
    user-select: none; -webkit-user-select: none;
}
.pg-o { color: #40E081; transition: color 1.2s ease; }
.pg-o.yellow { color: #F5B840; }   /* Signal Amber */
.pg-o.red { color: #E24B4A; }      /* Signal Red */
.pg-o.loading { color: #7d8a85; }  /* neutro mientras carga */

/* ==================== ONBOARDING TOUR (v56) ==================== */
.tour-welcome, .tour-final {
    position: fixed; inset: 0; z-index: 9500;
    background: rgba(8,22,14,0.96);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px; padding: 24px;
    padding-top: calc(24px + env(safe-area-inset-top));
}
.tour-wm { font-size: 2.1rem !important; }
.tour-tagline { color: rgba(255,255,255,0.55); font-size: 0.9rem; margin-bottom: 26px; }
.tour-cta {
    border: none; background: #1fb567; color: #fff;
    font-size: 0.9rem; font-weight: 600; font-family: inherit;
    padding: 13px 34px; border-radius: 13px; cursor: pointer;
}
.tour-ghost {
    border: 1px solid rgba(255,255,255,0.25); background: none; color: rgba(255,255,255,0.6);
    font-size: 0.8rem; font-family: inherit; padding: 9px 18px; border-radius: 11px;
    cursor: pointer; margin-top: 4px;
}
.tour-welcome .tour-ghost { border: none; margin-top: 2px; color: rgba(255,255,255,0.45); }
.tour-meta { position: absolute; bottom: calc(20px + env(safe-area-inset-bottom)); color: rgba(255,255,255,0.3); font-size: 0.7rem; }
.tour-final-msg { font-size: 1.1rem; color: rgba(255,255,255,0.85); margin: 4px 0 14px; }
.tour-x {
    position: absolute; top: calc(16px + env(safe-area-inset-top)); right: 16px;
    width: 34px; height: 34px; border: 1px solid rgba(255,255,255,0.25); background: none;
    color: rgba(255,255,255,0.7); border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

.tour-dim { position: fixed; inset: 0; z-index: 9000; background: transparent; }
.tour-ring {
    position: fixed; z-index: 9002; pointer-events: none;
    border: 2px solid #40E081; border-radius: 15px;
    box-shadow: 0 0 0 200vmax rgba(3,10,6,0.72);
    transition: all 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.tour-tip {
    position: fixed; left: 50%; transform: translateX(-50%);
    width: min(calc(100% - 32px), 388px); z-index: 9003;
    background: #ffffff; border-radius: 18px;
    padding: 16px 18px 18px; overflow: hidden;
    transition: top 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.tour-tip-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.tour-tip-title { font-size: 1rem; font-weight: 700; color: #0d2416; font-family: 'Quicksand', ui-rounded, ui-sans-serif, system-ui, sans-serif; letter-spacing: -0.2px; transition: opacity 0.25s; }
.tour-tip-count { font-size: 0.68rem; color: #9aa8a1; font-weight: 500; }
.tour-tip-body { font-size: 0.8rem; line-height: 1.6; color: #3d5248; min-height: 60px; transition: opacity 0.25s; }
.tour-tip-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.tour-skip { border: none; background: none; color: #9aa8a1; font-size: 0.78rem; font-family: inherit; padding: 6px 0; cursor: pointer; }
.tour-next {
    border: none; background: #0d2416; color: #fff;
    font-size: 0.8rem; font-weight: 600; font-family: inherit;
    padding: 9px 22px; border-radius: 11px; cursor: pointer;
}
.tour-bar { position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: #e8efe9; }
.tour-bar-fill { height: 100%; width: 0%; background: #1fb567; transition: width 0.45s ease; }

@media (prefers-reduced-motion: reduce) {
    .tour-ring, .tour-tip, .tour-bar-fill, .tour-tip-body, .tour-tip-title { transition: none !important; }
}

/* La o del wordmark en las pantallas del tour cicla como en la landing */
@keyframes pg-semaforo-tour {
    0%, 26%  { color: #40E081; }
    33%, 59% { color: #F5B840; }
    66%, 92% { color: #E24B4A; }
    100%     { color: #40E081; }
}
.tour-welcome .pg-o, .tour-final .pg-o {
    animation: pg-semaforo-tour 9s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
    .tour-welcome .pg-o, .tour-final .pg-o { animation: none; color: #40E081; }
}

/* Botón de webcam deshabilitado cuando la playa no tiene cámara verificada */
.btn.no-cam, .btn:disabled {
    opacity: 0.32;
    pointer-events: none;
}

/* Acciones de la pantalla final del tour: Cerrar como CTA principal */
.tour-final-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.tour-final-actions .tour-ghost { margin-top: 0; }
.tour-final-actions .tour-cta { padding: 11px 26px; }

/* ==================== SEGURIDAD v2 (v65) ==================== */
/* Aviso de viento de tierra en la hoja de armado */
.saf2-terral {
    display: flex; gap: 9px; align-items: flex-start;
    background: rgba(240,110,100,0.12); border: 1px solid rgba(240,110,100,0.4);
    border-radius: 12px; padding: 10px 13px; margin-bottom: 14px;
    font-size: 0.74rem; line-height: 1.45; color: rgba(255,220,215,0.9); text-align: left;
}
.saf2-terral svg { flex-shrink: 0; margin-top: 2px; color: #f08a80; }

/* Contacto como chip */
.saf2-chipcard {
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);
    border-radius: 13px; padding: 10px 13px; margin-bottom: 4px;
}
.saf2-chipleft { display: flex; align-items: center; gap: 10px; text-align: left; }
.saf2-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(74,222,128,0.15); color: #4ade80;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.8rem;
}
.saf2-chipname { color: #fff; font-size: 0.82rem; font-weight: 600; }
.saf2-chiptel { color: rgba(255,255,255,0.45); font-size: 0.7rem; }
.saf2-chipedit {
    border: none; background: none; color: #4ade80;
    font-size: 0.74rem; font-weight: 600; font-family: inherit; cursor: pointer; padding: 6px;
}

/* Chips de duración: selección, no envío */
.saf2-dur.sel { background: #1fb567 !important; color: #fff !important; border-color: #1fb567 !important; }

/* Resumen dinámico */
.saf2-summary {
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 13px; padding: 11px 13px; margin: 12px 0 8px;
    display: flex; flex-direction: column; gap: 6px; text-align: left;
}
.saf2-sumline {
    display: flex; gap: 8px; align-items: center;
    color: rgba(255,255,255,0.75); font-size: 0.74rem; line-height: 1.4;
}
.saf2-sumline b { color: #fff; }
.saf2-sumline svg { flex-shrink: 0; color: #4ade80; }
.saf2-sumline.saf-origin { cursor: pointer; }
.saf2-sunwarn { color: #f5b840; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 7px; }
.saf2-sunwarn svg { color: #f5b840; }
.saf2-sunwarn b { color: #f5b840; }
.saf2-includes { color: rgba(255,255,255,0.4); font-size: 0.66rem; margin: 0 2px 10px; text-align: left; }

/* Puntos de estado */
.saf2-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.saf2-dot.green { background: #4ade80; box-shadow: 0 0 8px rgba(74,222,128,0.6); }
.saf2-dot.yellow { background: #facc15; }
.saf2-dot.red { background: #f08a80; box-shadow: 0 0 8px rgba(240,110,100,0.6); }
.saf2-dot.pulse { animation: saf2-pulse 1.5s ease-in-out infinite; }
@keyframes saf2-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.saf2-dot.gray { background: #9ca3af; }

/* CTA principal */
.saf2-send {
    width: 100%; padding: 13px; border: none; border-radius: 13px;
    background: #1fb567; color: #fff; font-size: 0.86rem; font-weight: 700;
    font-family: inherit; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-bottom: 9px;
}
.saf2-send:disabled { background: rgba(74,222,128,0.22); color: rgba(255,255,255,0.4); cursor: default; }

/* Disclaimer comprimido + desplegable */
.saf2-disc { color: rgba(255,255,255,0.38); font-size: 0.64rem; line-height: 1.5; margin: 8px 0 0; }
.saf2-disc-more { color: rgba(255,255,255,0.55); text-decoration: underline; cursor: pointer; }
.saf2-disc-full { display: none; color: rgba(255,255,255,0.4); font-size: 0.64rem; line-height: 1.5; margin-top: 6px; }
.saf2-disc-full.open { display: block; }

/* ===== Plan activo ===== */
.saf2-active { text-align: left; }
.saf2-statechip {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.66rem; font-weight: 700; letter-spacing: 1.8px; color: #4ade80;
    margin-bottom: 3px;
}
.saf2-active.overdue .saf2-statechip { color: #f08a80; }
.saf2-context { color: rgba(255,255,255,0.65); font-size: 0.78rem; margin: 0 0 14px; }
.saf2-context b { color: #fff; }
.saf2-timecard {
    text-align: center; background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 15px;
    padding: 15px 12px 13px; margin-bottom: 12px;
}
.saf2-active.overdue .saf2-timecard { background: rgba(240,110,100,0.1); border-color: rgba(240,110,100,0.4); }
.saf2-timelabel { font-size: 0.62rem; font-weight: 700; letter-spacing: 1.6px; color: rgba(255,255,255,0.45); margin-bottom: 5px; }
.saf2-active.overdue .saf2-timelabel { color: rgba(255,220,215,0.6); }
.saf2-bigtime { font-size: 2.4rem; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; line-height: 1; }
.saf2-active.overdue .saf2-bigtime { color: #f08a80; }
.saf2-timesub { font-size: 0.78rem; color: #4ade80; margin-top: 6px; font-variant-numeric: tabular-nums; }
.saf2-active.overdue .saf2-timesub { color: #f08a80; }
.saf2-timemargin { font-size: 0.66rem; color: rgba(255,255,255,0.4); margin-top: 4px; }
.saf2-row { display: flex; gap: 8px; }
.saf2-half {
    flex: 1; padding: 10px; border-radius: 12px; font-family: inherit;
    font-size: 0.74rem; font-weight: 600; cursor: pointer;
}
.saf2-half.neutral { border: 1px solid rgba(255,255,255,0.2); background: none; color: rgba(255,255,255,0.8); }
.saf2-half.danger { border: 1px solid rgba(240,110,100,0.45); background: rgba(240,110,100,0.08); color: #f08a80; font-weight: 700; }
.saf2-half.danger.solid { border: none; background: #e24b4a; color: #fff; }
.saf2-cancel {
    text-align: center; color: rgba(255,255,255,0.35); font-size: 0.68rem;
    margin: 11px 0 0; cursor: pointer;
}

/* ===== Pantalla de emergencia ===== */
.saf2-em { text-align: center; background: #1a0f0e; border: 1px solid rgba(240,110,100,0.45); border-radius: 18px; padding: 18px 14px 14px; margin: -4px; }
.saf2-em-head {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 0.7rem; font-weight: 800; letter-spacing: 2.2px; color: #f08a80;
}
.saf2-em-sub { color: rgba(255,255,255,0.6); font-size: 0.74rem; margin: 4px 0 16px; }
.saf2-em-call {
    display: block; width: 100%; padding: 16px; border: none; border-radius: 16px;
    background: #e24b4a; color: #fff; text-decoration: none; margin-bottom: 9px; box-sizing: border-box;
}
.saf2-em-call-big { display: block; font-size: 1.15rem; font-weight: 800; }
.saf2-em-call-sub { display: block; font-size: 0.66rem; opacity: 0.85; margin-top: 2px; }
.saf2-em-sos {
    width: 100%; padding: 12px; border: 1px solid rgba(240,110,100,0.5); border-radius: 14px;
    background: rgba(240,110,100,0.1); color: #fff; font-family: inherit; cursor: pointer; margin-bottom: 14px;
}
.saf2-em-sos-big { display: block; font-size: 0.84rem; font-weight: 700; }
.saf2-em-sos-sub { display: block; font-size: 0.64rem; color: rgba(255,255,255,0.55); margin-top: 2px; }
.saf2-em-pos {
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12);
    border-radius: 13px; padding: 11px 13px; margin-bottom: 14px; text-align: left;
}
.saf2-em-pos-label { font-size: 0.6rem; font-weight: 700; letter-spacing: 1.6px; color: rgba(255,255,255,0.45); margin-bottom: 5px; }
.saf2-em-pos-beach { font-size: 0.88rem; font-weight: 700; color: #fff; margin-bottom: 2px; }
.saf2-em-pos-coords { font-size: 0.95rem; color: #f5f7f2; font-variant-numeric: tabular-nums; letter-spacing: 0.5px; }
.saf2-em-pos-fresh { font-size: 0.62rem; color: rgba(255,255,255,0.4); margin-top: 3px; }
.saf2-em-back {
    border: 1px solid rgba(255,255,255,0.2); background: none; color: rgba(255,255,255,0.65);
    font-size: 0.74rem; font-family: inherit; padding: 8px 22px; border-radius: 11px; cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
    .saf2-dot.pulse { animation: none; }
}
