:root {
    --bg: #0f1720;
    --panel: #16212e;
    --panel-2: #1d2b3a;
    --text: #f1f5f9;
    --muted: #b7c5d3;
    --accent: #38bdf8;
    --border: #2b3d52;
    --radius: 16px;

    --rating-poor: #f87171;
    --rating-fair: #fbbf24;
    --rating-good: #4ade80;
    --rating-great: #22d3ee;
    --rating-none: #64748b;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 20px;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.4;
}

h1,
h2 {
    margin: 0;
}

.icon {
    width: 1.25em;
    height: 1.25em;
    fill: none;
    stroke: currentColor;
    vertical-align: -0.18em;
    flex: none;
}

.icon-lg {
    width: 1.6em;
    height: 1.6em;
}

.icon-xl {
    width: 1.8em;
    height: 1.8em;
}

/* Top bar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 1rem;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 48px;
    min-width: 48px;
    padding: 0.5rem 0.9rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text);
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover,
.btn:focus-visible {
    border-color: var(--accent);
    outline: none;
}

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

.icon-btn {
    padding: 0.5rem;
}

.today-btn {
    font-size: 0.9rem;
}

/* Day / month navigation */
main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem;
}

.day-nav {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.day-nav-center {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.day-label {
    font-size: 1.8rem;
    font-weight: 700;
}

/* Banners */
.banner {
    padding: 0.6rem 1rem;
    margin-bottom: 1rem;
    border-radius: 12px;
    background: #3a2b16;
    border: 1px solid #b45309;
    color: #fde68a;
    font-size: 0.9rem;
}

.loading {
    padding: 2rem 0;
    text-align: center;
    color: var(--muted);
    font-size: 1.1rem;
}

/* Rating */
.rating-block {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.rating-badge {
    --rating-color: var(--rating-none);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: var(--rating-color);
    color: #08121b;
    font-weight: 800;
    font-size: 1.3rem;
}

.rating-badge.rating-poor { --rating-color: var(--rating-poor); }
.rating-badge.rating-fair { --rating-color: var(--rating-fair); }
.rating-badge.rating-good { --rating-color: var(--rating-good); }
.rating-badge.rating-great { --rating-color: var(--rating-great); }
.rating-badge.rating-none { --rating-color: var(--rating-none); color: var(--text); }

.rating-note {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
    flex-basis: 100%;
}

.stars {
    display: inline-flex;
    gap: 0.1rem;
    color: var(--rating-fair);
}

.star {
    width: 1.3em;
    height: 1.3em;
    fill: none;
    stroke: currentColor;
}

.star.filled {
    fill: currentColor;
}

/* Cards */
.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.card h2 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 0.75rem;
}

.weather-now {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 0.75rem;
}

.weather-icon {
    width: 72px;
    height: 72px;
}

.figure {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
}

.muted {
    color: var(--muted);
}

.facts {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.facts li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.facts .value {
    margin-left: auto;
    font-weight: 700;
}

/* Tide */
.tide-body {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.tide-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tide-row .tide-time {
    font-weight: 700;
    font-size: 1.2rem;
}

.tide-row .tide-height {
    margin-left: auto;
    color: var(--muted);
}

.tide-high {
    color: var(--accent);
}

.tide-low {
    color: var(--rating-fair);
}

/* Solunar */
.solunar-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.window-group-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 0.25rem;
}

.window-row {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
}

.window-time {
    font-size: 1.3rem;
    font-weight: 700;
}

.window-group:first-child .window-time {
    color: var(--rating-good);
}

.window-row.is-twilight .window-time {
    font-weight: 800;
}

.twilight-icon {
    color: var(--rating-fair);
    width: 1.1em;
    height: 1.1em;
}

/* Forecast strip */
.forecast-strip {
    margin-top: 1.25rem;
}

.forecast-strip h2 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 0.6rem;
}

.forecast-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.6rem;
}

.forecast-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.7rem 0.4rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
    min-height: 48px;
}

.forecast-item:hover,
.forecast-item:focus-visible {
    border-color: var(--accent);
    outline: none;
}

.forecast-item .fc-day {
    font-weight: 700;
    font-size: 0.85rem;
}

.forecast-item .fc-icon {
    width: 44px;
    height: 44px;
}

.forecast-item .fc-temp {
    font-size: 1rem;
    font-weight: 700;
}

.forecast-item .fc-rating {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.forecast-item .fc-meta {
    font-size: 0.75rem;
    color: var(--muted);
}

.updated-note {
    margin-top: 1rem;
    color: var(--muted);
    font-size: 0.8rem;
    text-align: right;
}

/* Calendar */
.weekdays,
.month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.4rem;
}

.weekdays {
    margin-bottom: 0.4rem;
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
}

.day-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-height: 76px;
    padding: 0.3rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
}

.day-cell:hover,
.day-cell:focus-visible {
    border-color: var(--accent);
    outline: none;
}

.day-cell.is-empty {
    background: transparent;
    border-color: transparent;
    cursor: default;
}

.day-cell.is-today {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.day-cell.is-planning {
    border-style: dashed;
    opacity: 0.82;
}

.planning-dot {
    background: transparent;
    border: 2px dashed var(--muted);
}

.day-cell .cell-date {
    font-weight: 700;
    font-size: 1rem;
}

.day-cell .cell-rating {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dot {
    display: inline-block;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    margin-right: 0.3rem;
    vertical-align: -0.05em;
}

.cell-rating.rating-poor,
.fc-rating.rating-poor { color: var(--rating-poor); }
.cell-rating.rating-fair,
.fc-rating.rating-fair { color: var(--rating-fair); }
.cell-rating.rating-good,
.fc-rating.rating-good { color: var(--rating-good); }
.cell-rating.rating-great,
.fc-rating.rating-great { color: var(--rating-great); }
.cell-rating.rating-none,
.fc-rating.rating-none { color: var(--rating-none); }

.dot.rating-poor { background: var(--rating-poor); }
.dot.rating-fair { background: var(--rating-fair); }
.dot.rating-good { background: var(--rating-good); }
.dot.rating-great { background: var(--rating-great); }
.dot.rating-none { background: var(--rating-none); }

.legend {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    padding: 0;
    margin: 1rem 0 0;
    color: var(--muted);
    font-size: 0.8rem;
}

@media (max-width: 760px) {
    html {
        font-size: 18px;
    }

    .grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .forecast-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .day-label {
        font-size: 1.4rem;
    }
}
