:root {
    --bg: #0b1d33;
    --panel: #12294a;
    --panel2: #1a3660;
    --text: #e8f0fb;
    --muted: #8fa6c4;
    --good: #2ecc71;
    --ok: #f1c40f;
    --bad: #e74c3c;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    padding-bottom: env(safe-area-inset-bottom);
}
header {
    position: sticky; top: 0; z-index: 1000;
    display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between; align-items: center;
    padding: calc(.6rem + env(safe-area-inset-top)) 1rem .6rem;
    background: rgba(11, 29, 51, .95);
    backdrop-filter: blur(6px);
}
h1 { margin: 0; font-size: 1.3rem; }
h2 { margin: 0 0 .6rem; font-size: 1rem; }
.muted { color: var(--muted); font-size: .8rem; }
main { max-width: 1100px; margin: 0 auto; padding: .5rem .75rem 2rem; }
.mode { display: flex; gap: .3rem; }
button {
    background: var(--panel2); color: var(--text); border: 0; border-radius: 999px;
    padding: .45rem .8rem; font-size: .85rem; cursor: pointer;
}
button.active { background: #3b82f6; }
a { color: #7cc4ff; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .5rem; margin-bottom: .75rem; }
.card { background: var(--panel); border-radius: 14px; padding: .7rem; }
.card .label { color: var(--muted); font-size: .75rem; }
.card .value { font-size: 1.5rem; font-weight: 600; }
.card .sub { font-size: .8rem; color: var(--muted); }
.card.tile { text-align: center; border: 2px solid transparent; }
.card.tile .icon { font-size: 2.2rem; line-height: 1.1; }
.card.tile .tval { font-size: 1.15rem; font-weight: 700; margin-top: .2rem; }
.card.tile .tval small { font-weight: 400; font-size: .75rem; }
.card.big { grid-column: span 2; grid-row: span 2; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.card.big .value { font-size: clamp(6rem, 22vw, 10rem); line-height: .9; font-weight: 800; }
.card.big .label, .card.big .sub { font-size: .95rem; }
.axis-row { padding: 0 0 .1rem; }
.axis { position: relative; height: 1rem; font-size: .7rem; color: var(--muted); }
.axis span { position: absolute; transform: translateX(-50%); }
.axis span:first-child { transform: none; }
.axis span:last-child { transform: translateX(-100%); }

.panel { background: var(--panel); border-radius: 14px; padding: .8rem; margin-bottom: .75rem; }

.day { display: grid; grid-template-columns: 4.2rem 1fr 3rem; gap: .6rem; align-items: center; padding: .5rem 0; border-top: 1px solid var(--panel2); }
.day:first-child { border-top: 0; }
.day .name { font-weight: 600; }
.day .name small { display: block; color: var(--muted); font-weight: 400; }
.day .detail { font-size: .85rem; }
.day .wxicon { font-size: 1.8rem; vertical-align: middle; line-height: 1; }
.bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin-top: .35rem; background: #0006; }
.bar span { flex: 1; }
.score { font-size: 1.4rem; font-weight: 700; text-align: center; border-radius: 10px; padding: .2rem 0; }

.walkday { display: grid; grid-template-columns: 4.2rem 1fr 1fr; gap: .5rem; align-items: center; padding: .4rem 0; border-top: 1px solid var(--panel2); }
.walkday:first-child { border-top: 0; }
.walkday .name { font-weight: 600; }
.walkday .name small { display: block; color: var(--muted); font-weight: 400; }
.walk { display: grid; grid-template-columns: auto 2.4rem; grid-template-rows: auto auto; column-gap: .5rem; align-items: center; background: var(--panel2); border-radius: 10px; padding: .4rem .6rem; font-size: .85rem; }
.walk b { grid-row: span 2; grid-column: 2; text-align: center; font-size: 1.3rem; color: #0b1d33; border-radius: 8px; padding: .1rem 0; }
.walk b { position: relative; }
.walk .rainicon { position: absolute; top: -.7rem; right: -.6rem; font-size: 1.1rem; font-style: normal; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.walk.empty { color: var(--muted); text-align: center; display: block; }

.tides { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .3rem; }
.tide { flex: 0 0 auto; background: var(--panel2); border-radius: 10px; padding: .4rem .6rem; font-size: .8rem; text-align: center; }
.tide.high { border-left: 4px solid #3b82f6; }
.tide.low { border-left: 4px solid #64748b; }

#radar { height: 340px; border-radius: 10px; }
.radar-ctrl { display: flex; justify-content: space-between; align-items: center; margin-top: .5rem; }

.hourly { overflow-x: auto; }
.hourly table { border-collapse: collapse; font-size: .78rem; white-space: nowrap; }
.hourly th, .hourly td { padding: .25rem .4rem; text-align: center; }
.hourly th { position: sticky; left: 0; background: var(--panel); text-align: left; color: var(--muted); font-weight: 500; }
.hourly td.daystart { border-left: 2px solid var(--muted); }
.arrow { display: inline-block; }

.links { display: flex; gap: 1rem; flex-wrap: wrap; }

@media (min-width: 900px) {
    main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; align-items: start; }
    main > * { min-width: 0; margin-bottom: 0; }
    #now, .panel:has(#hourly), .links, #warnings { grid-column: 1 / -1; }
    .tides { flex-direction: column; overflow-x: visible; }
    .tide { display: flex; justify-content: space-between; text-align: left; padding: .5rem .8rem; font-size: .9rem; }
    .tide br { display: none; }
    #radar { height: 420px; }
}
