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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f4f8;
    color: #1a2840;
    min-height: 100vh;
    padding: 2rem 2rem 3rem;
}

h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #1a2840;
    text-align: center;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

select {
    background: #ffffff;
    color: #1a2840;
    border: 1px solid #c0ccd8;
    border-radius: 7px;
    padding: 0.45rem 1rem;
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

select:focus {
    outline: none;
    border-color: #4477aa;
    box-shadow: 0 0 0 3px rgba(68, 119, 170, 0.18);
}

.chart-container {
    background: #ffffff;
    border-radius: 14px;
    padding: 1.5rem 1.5rem 1rem;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.10);
    /* Height lives here, not on the canvas, so Chart.js reads the container
       on every resize and picks up the updated vw value correctly. */
    height: 80vw;
}

/* The canvas fills its container; Chart.js controls the pixel dimensions. */
#tideChart {
    width: 100%;
    height: 100%;
}

.status {
    min-height: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.error {
    color: #cc2222;
    background: rgba(200, 30, 30, 0.07);
    border: 1px solid rgba(200, 30, 30, 0.25);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: none;
}

.loading {
    color: #667788;
    display: none;
}

.credits {
    margin-top: 0.9rem;
    font-size: 0.82rem;
    color: #778899;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.credits a {
    color: #4477aa;
    text-decoration: none;
}

.credits a:hover {
    text-decoration: underline;
}

.disclaimer,
.version-info {
    display: block;
    font-size: 0.72rem;
    line-height: 1.4;
    color: #aabbcc;
    margin-top: 0;
}

/* ── Tablet ────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    body {
        padding: 1.25rem 1.25rem 2rem;
    }

    h1 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

}


/* ── Mobile portrait — double height so the chart fills the screen ─────────── */
@media (max-width: 480px) and (orientation: portrait) {
    .chart-container {
        height: 160vw;
    }
}

/* ── Mobile ────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    body {
        padding: 1rem 0.75rem 1.5rem;
    }

    h1 {
        font-size: 1.05rem;
        margin-bottom: 0.75rem;
    }

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

    .chart-container {
        padding: 0.75rem 0.5rem 0.5rem;
        border-radius: 10px;
    }

    .credits {
        font-size: 0.75rem;
    }
}
