:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-header: #0f172a;
    --bg-weather: #0c1425;
    --bg-footer: #0f172a;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #1e293b;
    --border-light: #334155;
    --accent-blue: #2563eb;
    --accent-blue-bg: #1e3a5f;
    --accent-blue-dim: #172554;
    --accent-red: #dc2626;
    --accent-red-bg: #3f1020;
    --accent-red-dim: #450a0a;
    --status-scheduled: #64748b;
    --status-boarding: #f59e0b;
    --status-sailing: #22c55e;
    --status-arrived: #14b8a6;
    --status-cancelled: #ef4444;
    --status-delayed: #f97316;
}

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

html, body {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* ─── Grid Layout ─── */
.board {
    display: grid;
    grid-template-rows: 7vh 10vh 4vh 1fr auto 4vh;
    height: 100vh;
    width: 100vw;
}

/* ─── Header ─── */
.board-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(1rem, 2vw, 3rem);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
}

.board-title {
    font-size: clamp(1.2rem, 2.5vw, 2.2rem);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-primary);
}

.board-title span {
    color: var(--accent-blue);
}

.board-clock {
    text-align: right;
}

.clock-time {
    font-size: clamp(1.4rem, 3vw, 2.6rem);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.clock-date {
    font-size: clamp(0.7rem, 1.2vw, 1rem);
    color: var(--text-secondary);
    margin-top: -0.2vh;
}

/* ─── Weather Strip ─── */
.weather-strip {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--bg-weather);
    border-bottom: 1px solid var(--border);
    padding: 0 clamp(1rem, 2vw, 3rem);
    gap: 0.3vh;
}

.weather-data {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 3vw, 4rem);
    font-size: clamp(0.85rem, 1.5vw, 1.3rem);
    flex-wrap: nowrap;
    overflow: hidden;
}

.weather-item {
    display: flex;
    align-items: center;
    gap: 0.4em;
    white-space: nowrap;
}

.weather-item .icon {
    font-size: 1.1em;
}

.weather-item .value {
    font-weight: 600;
}

.weather-item .unit {
    color: var(--text-secondary);
    font-weight: 400;
}

.notice-bar {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: clamp(0.75rem, 1.3vw, 1.1rem);
    color: var(--status-boarding);
    overflow: hidden;
    white-space: nowrap;
}

.notice-bar .notice-icon {
    flex-shrink: 0;
}

.notice-bar.urgent {
    color: var(--status-cancelled);
    font-weight: 600;
}

/* ─── Column Headers ─── */
.column-headers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 2px solid var(--border-light);
}

.column-header {
    display: flex;
    align-items: center;
    padding: 0 clamp(0.8rem, 1.5vw, 2rem);
    font-size: clamp(0.7rem, 1.3vw, 1.1rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    background: var(--bg-secondary);
}

.column-header:first-child {
    border-right: 1px solid var(--border);
}

.column-header .port-label {
    color: var(--text-primary);
    margin-left: 0.4em;
}

/* ─── Schedule Columns ─── */
.schedule-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
}

.schedule-column {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.schedule-column:first-child {
    border-right: 1px solid var(--border);
}

/* ─── Schedule Row ─── */
.schedule-row {
    display: grid;
    grid-template-columns: clamp(1.8rem, 3vw, 2.8rem) minmax(4rem, 8rem) 1fr minmax(3rem, 6rem) minmax(4rem, 7rem);
    align-items: center;
    padding: 0.2vh clamp(0.5rem, 1vw, 1.5rem);
    border-bottom: 1px solid var(--border);
    min-height: 0;
    flex: 1;
    gap: clamp(0.3rem, 0.6vw, 0.8rem);
}

.schedule-row.starhorse {
    border-left: 4px solid var(--accent-blue);
    background: linear-gradient(90deg, var(--accent-blue-bg) 0%, var(--accent-blue-dim) 40%, var(--bg-primary) 100%);
}

.schedule-row.montenegro {
    border-left: 4px solid var(--accent-red);
    background: linear-gradient(90deg, var(--accent-red-bg) 0%, var(--accent-red-dim) 40%, var(--bg-primary) 100%);
}

.schedule-row.empty-row {
    border-left: 4px solid transparent;
    background: var(--bg-primary);
    opacity: 0.3;
}

.row-logo {
    width: clamp(1.5rem, 2.8vw, 2.5rem);
    height: clamp(1.5rem, 2.8vw, 2.5rem);
    object-fit: contain;
    border-radius: 4px;
}

.row-logo-placeholder {
    width: clamp(1.5rem, 2.8vw, 2.5rem);
    height: clamp(1.5rem, 2.8vw, 2.5rem);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-weight: 800;
    font-size: clamp(0.5rem, 0.9vw, 0.8rem);
    text-transform: uppercase;
}

.row-logo-placeholder.starhorse {
    background: var(--accent-blue);
    color: white;
}

.row-logo-placeholder.montenegro {
    background: var(--accent-red);
    color: white;
}

.row-vessel {
    font-size: clamp(0.7rem, 1.2vw, 1rem);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.row-times {
    display: flex;
    flex-direction: column;
    font-size: clamp(0.6rem, 1vw, 0.85rem);
    color: var(--text-secondary);
    white-space: nowrap;
}

.row-times .time-value {
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.row-times .time-updated {
    color: var(--status-boarding);
    text-decoration: line-through;
    text-decoration-color: var(--text-muted);
    font-weight: 600;
}

.row-eta {
    font-size: clamp(0.6rem, 1vw, 0.85rem);
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.row-eta .time-value {
    font-weight: 700;
    color: var(--text-primary);
}

/* ─── Status Badge ─── */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15em 0.5em;
    border-radius: 4px;
    font-size: clamp(0.5rem, 0.85vw, 0.75rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.status-badge.scheduled { background: var(--status-scheduled); color: white; }
.status-badge.boarding { background: var(--status-boarding); color: #1a1a1a; animation: pulse-boarding 2s ease-in-out infinite; }
.status-badge.sailing { background: var(--status-sailing); color: #1a1a1a; }
.status-badge.arrived { background: var(--status-arrived); color: #1a1a1a; }
.status-badge.cancelled { background: var(--status-cancelled); color: white; }
.status-badge.delayed { background: var(--status-delayed); color: #1a1a1a; }

@keyframes pulse-boarding {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ─── Footer ─── */
.board-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(1rem, 2vw, 3rem);
    background: var(--bg-footer);
    border-top: 1px solid var(--border);
    font-size: clamp(0.6rem, 1.1vw, 0.9rem);
}

.legend {
    display: flex;
    align-items: center;
    gap: clamp(0.8rem, 2vw, 2.5rem);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4em;
}

.legend-dot {
    width: clamp(0.5rem, 0.8vw, 0.75rem);
    height: clamp(0.5rem, 0.8vw, 0.75rem);
    border-radius: 2px;
}

.legend-dot.starhorse { background: var(--accent-blue); }
.legend-dot.montenegro { background: var(--accent-red); }

.legend-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.last-updated {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* ─── Empty State ─── */
.empty-schedule {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--text-muted);
    font-size: clamp(0.8rem, 1.3vw, 1.1rem);
    font-style: italic;
}

/* ─── Loading ─── */
.board-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.board-loading .spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--border-light);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 1rem;
}

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

/* ─── Row vessel with notes (tooltip via title) ─── */
.row-vessel[title] {
    cursor: help;
    border-bottom: 1px dotted var(--status-boarding);
}

/* ─── Week Preview Strip ─── */
.week-strip {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: clamp(0.2rem, 0.5vw, 0.5rem);
    padding: clamp(0.3rem, 0.5vh, 0.5rem) clamp(0.5rem, 1vw, 1.5rem);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    overflow: hidden;
}

.week-day {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: clamp(0.2rem, 0.4vh, 0.4rem) clamp(0.3rem, 0.5vw, 0.5rem);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s;
}

.week-day:hover {
    border-color: var(--accent-blue);
}

.week-day.today {
    border-color: var(--accent-blue);
    background: var(--accent-blue-dim);
}

.week-day-header {
    font-size: clamp(0.45rem, 0.8vw, 0.7rem);
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.15vh;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.week-day.today .week-day-header {
    color: var(--accent-blue);
}

.week-day-trips {
    display: flex;
    flex-wrap: wrap;
    gap: 1px 3px;
    max-height: 2.8em;
    overflow: hidden;
}

.week-trip {
    font-size: clamp(0.4rem, 0.7vw, 0.6rem);
    font-variant-numeric: tabular-nums;
    padding: 0 2px;
    border-radius: 2px;
    white-space: nowrap;
    line-height: 1.4;
}

.week-trip.starhorse { color: #60a5fa; }
.week-trip.montenegro { color: #f87171; }

.week-day-empty {
    font-size: clamp(0.4rem, 0.7vw, 0.55rem);
    color: var(--text-muted);
    font-style: italic;
}

/* Schedule link in footer */
.schedule-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
    font-size: clamp(0.55rem, 1vw, 0.85rem);
}
.schedule-link:hover { text-decoration: underline; }
