* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Parkinsans', system-ui, sans-serif;
    background: #e8e8f0;
    color: #1a3a5c;
    line-height: 1.5;
    min-height: 100svh;
    overflow-x: hidden;
}
.bg-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.bg-grad-bluepurple {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(circle at 100% 100%, rgba(140,70,200,0.55) 0%, rgba(140,70,200,0) 60%);
    pointer-events: none;
    z-index: 0;
}
.bg-grad-green {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(circle at 0% 0%, rgba(60,160,100,0.75) 0%, rgba(60,160,100,0) 90%);
    pointer-events: none;
    z-index: 0;
}
.bg-pattern .dandelion {
    position: absolute;
    pointer-events: none;
    will-change: transform, opacity;
}
@keyframes dandelionDrift { 0% {} 100% {} }
.hero {
    text-align: center;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    padding: 20px;
}
.hero-logo {
    width: 150px;
    height: auto;
    aspect-ratio: 165 / 204;
    margin: 0 auto 24px;
    display: block;
    animation: logoWobble 13s ease-in-out infinite;
    transform-origin: center center;
    fill: #1a3a5c;
}
@keyframes logoWobble {
    0%   { transform: scale(1)    rotate(-4deg)  translateY(0px); }
    25%  { transform: scale(1.04) rotate(-14deg) translateY(-9px); }
    50%  { transform: scale(1)    rotate(-4deg)  translateY(0px); }
    75%  { transform: scale(1.04) rotate(-14deg) translateY(-9px); }
    100% { transform: scale(1)    rotate(-4deg)  translateY(0px); }
}
.hero h1 { font-size: 2.4em; font-weight: 700; }

.container { max-width: 600px; margin: 0 auto; padding: 20px 16px; width: 100%; position: relative; z-index: 1; }

/* Legend */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    justify-content: center;
    margin: 0 0 24px;
}
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 0.75em; color: #1a3a5c; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }

/* Day columns wrapper */
.days-col {
    display: flex;
    flex-direction: column;
    gap: 36px;
    padding-right: 42px;
}

/* Single day */
.day-block { width: 100%; transition: opacity 0.3s; }
.days-col.has-open-card .day-block { opacity: 1; }
.days-col.has-open-card .day-block.day-active { opacity: 1; }
.day-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}
.day-header-text { text-align: center; }
.day-title {
    font-size: 0.9em;
    font-weight: 700;
    margin-bottom: 2px;
}
.day-subtitle {
    font-size: 0.75em;
}
.day-route-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(26,58,92,0.1);
    border: none;
    cursor: pointer;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    text-decoration: none;
    color: #1a3a5c;
    opacity: 0.65;
    flex-shrink: 0;
    padding: 0;
}
.day-route-btn:hover { opacity: 1; background: rgba(26,58,92,0.18); }
.day-route-btn svg { width: 22px; height: 22px; fill: currentColor; }

/* Timeline = list of segment rows */
.timeline { display: flex; flex-direction: column; gap: 5px; position: relative; }

/* Each segment row */
.seg-row {
    display: flex;
    align-items: stretch;
    position: relative;
    transition: opacity 0.3s;
}
/* When a card is open, fade non-selected activity rows */
.timeline.has-open .seg-row.seg-activity { opacity: 1; }
.timeline.has-open .seg-row.seg-activity.seg-active { opacity: 1; }
/* Gap rows always stay full opacity */
.timeline.has-open .seg-row.seg-gap { opacity: 1; }

/* Time label column */
.seg-time {
    width: 38px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 6px;
    font-size: 0.7em;
    font-variant-numeric: tabular-nums;
}

/* The vertical bar */
.seg-bar {
    width: 10px;
    flex-shrink: 0;
    border-radius: 3px;
    align-self: stretch;
    position: relative;
    opacity: 0.8;
    margin-left: 4px;
}
.seg-activity .seg-bar { cursor: pointer; }
.seg-activity .seg-bar:hover { opacity: 0.6; }

/* Card */
.card {
    flex: 1;
    min-width: 0;
    margin: 3px 0 3px 6px;
    cursor: pointer;
    background: var(--c-bg);
    border: none;
    border-radius: 10px;
    overflow: visible;
    transition: opacity 0.3s;
    position: sticky;
    top: 10px;
    z-index: 1;
    color: var(--c-text);
    align-self: flex-start;
}
.card.open {
    overflow: visible;
}

/* Icon on card */
.card-icon-wrap {
    position: absolute;
    right: -16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    z-index: 2;
}
.card-icon-bg {
    height: 49px;
    width: 49px;
    opacity: 1;
    transition: opacity 0.38s cubic-bezier(0.4,0,0.2,1);
}
.card-icon-bg svg {
    width: 100%;
    height: 100%;
    display: block;
}
.card.open .card-icon-bg {
    opacity: 1;
}
.card-icon-time { display: none; }
.card-title-time {
    font-size: 0.72em;
    font-weight: 400;
    opacity: 0.55;
    flex-shrink: 0;
    white-space: nowrap;
    transition: opacity 0.25s ease, max-width 0.3s ease;
    max-width: 60px;
    overflow: hidden;
}
.card.open .card-title-time {
    opacity: 0;
    max-width: 0;
    pointer-events: none;
}

.card-header {
    padding: 7px 12px;
    display: flex;
    flex-direction: column;
    min-height: 18px;
    position: relative;
    z-index: 1;
    transition: padding 0.38s cubic-bezier(0.4,0,0.2,1);
}
.card.open .card-header {
    padding-top: 8px;
    padding-right: 60px;
}
.card-header-top {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
}
/* Title visible when closed; fades out when open */
.card-title {
    font-size: 0.8em;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    transition: max-height 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.25s ease;
    max-height: 2em;
    opacity: 1;
}
.card.open .card-title {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}
.card-time {
    font-size: 0.7em;
    opacity: 0;
    flex-shrink: 0;
    white-space: nowrap;
    pointer-events: none;
    max-width: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-width 0.3s ease;
}
.card.open .card-time { opacity: 0.6; pointer-events: auto; max-width: 100px; }
/* Meta row: visible when CLOSED as summary; hidden when open */
.card-header-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--c-text);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.25s ease, max-height 0.3s ease;
    flex-wrap: wrap;
}
.card.open .card-header-meta {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}
/* Show meta only when card has data loaded (set via JS) and is closed */
.card.has-meta:not(.open) .card-header-meta {
    opacity: 0.65;
    max-height: 40px;
    margin-top: 2px;
}
.card-header-chip {
    background: rgba(0,0,0,0.08);
    border-radius: 8px;
    padding: 1px 7px;
    white-space: nowrap;
    font-size: 1em;
}
.card-header-sep { opacity: 0.4; }
/* Location box */
.card-location {
    background: rgba(255,255,255,0.55);
    border-radius: 8px;
    padding: 7px 10px;
    margin: 6px 0;
}
.card-location-name {
    font-size: 0.86em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
    line-height: 1.3;
    color: var(--c-text);
}
.card-location-label {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}
.card-location-dwell {
    font-size: 0.78em;
    font-weight: 400;
    opacity: 0.55;
    white-space: nowrap;
}
.card-nav-btn {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--c);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    margin-left: 6px;
}
.card-nav-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.card-nav-btn svg {
    width: 14px;
    height: 14px;
    fill: #fff;
    transform: rotate(0deg);
    flex-shrink: 0;
}
.card-location-desc a {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    color: var(--c-text);
    opacity: 0.85;
}
.card-location-desc a svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
    flex-shrink: 0;
    opacity: 0.7;
}
.card-nav-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 8px;
    font-size: 0.82em;
    font-weight: 600;
    color: var(--c-text);
}
.card-nav-row-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.card-nav-row .card-nav-btn {
    margin-left: 0;
}
.card-location-name .card-nav-btn svg {
    width: 14px;
    height: 14px;
    fill: #fff;
    opacity: 1;
    margin-top: 0;
}
.card-location-name svg {
    width: 13px; height: 13px;
    flex-shrink: 0;
    margin-top: 2px;
    fill: var(--c);
    opacity: 0.9;
}
.card-location-meta {
    font-size: 0.75em;
    opacity: 0.5;
    margin-top: 2px;
}
.card-location-desc {
    font-size: 0.8em;
    line-height: 1.5;
    opacity: 0.65;
    margin-top: 3px;
}
.card-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.38s cubic-bezier(0.4,0,0.2,1), padding 0.38s cubic-bezier(0.4,0,0.2,1);
    padding: 0 12px;
    font-size: 0.8em;
    position: relative;
    z-index: 1;
    overflow: hidden;
}
.card-body-inner {
    overflow: hidden;
    min-height: 0;
    word-break: break-word;
    overflow-wrap: break-word;
}
.card.open .card-body {
    grid-template-rows: 1fr;
    padding: 8px 60px 12px 12px;
}
.card-notes a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(0,0,0,0.07);
    border-radius: 20px;
    padding: 1px 8px 1px 4px;
    text-decoration: none;
    color: var(--c-text);
    font-size: 0.88em;
    opacity: 0.8;
    white-space: normal;
    word-break: break-word;
}
.card-notes a:hover { opacity: 1; background: rgba(0,0,0,0.13); }
.card-notes a svg { width: 14px; height: 14px; flex-shrink: 0; fill: currentColor; }
.card-notes {
    background: transparent;
    padding: 6px 10px;
    border-radius: 6px;
    line-height: 1.7;
    margin-top: 4px;
}
.card-notes a {
    color: var(--c-text);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    opacity: 0.7;
}
.card-notes a:hover { opacity: 1; }

/* App pill buttons (Bolt, FreeNow, etc.) */
.card-notes a.pill-app,
.card-location-desc a.pill-app {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 14px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.78em;
    letter-spacing: 0.08em;
    text-decoration: none;
    color: #fff;
    opacity: 1;
    margin: 4px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card-notes a.pill-app:hover,
.card-location-desc a.pill-app:hover {
    transform: scale(1.04);
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    background: inherit;
}
a.pill-bolt { background: #34d186; }
a.pill-freenow { background: #ffd000; color: #1a1a1a; }
a.pill-airbnb {
    background: #ff5a5f;
    gap: 6px;
}
a.pill-airbnb::before {
    content: '';
    width: 14px;
    height: 14px;
    background: #fff;
    -webkit-mask: url('rome_icons/airbnb.svg') center/contain no-repeat;
    mask: url('rome_icons/airbnb.svg') center/contain no-repeat;
    display: inline-block;
}
a.pill-app svg { display: none; }

/* Flight status */
.card-flight-host { margin: 4px 0 8px; }
.card-flight-status {
    background: rgba(255,255,255,0.55);
    border-radius: 8px;
    padding: 8px 10px;
    color: var(--c-text);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.card-flight-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.card-flight-status-badge {
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--c);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
}
.card-flight-status.is-cancelled .card-flight-status-badge,
.card-flight-status.is-incident  .card-flight-status-badge { background: #c25555; }
.card-flight-status.is-landed    .card-flight-status-badge { background: #5a9478; }
.card-flight-status.is-active    .card-flight-status-badge { background: #56b4ef; }
.card-flight-iata {
    font-size: 0.85em;
    font-weight: 600;
    opacity: 0.7;
}
.card-flight-leg {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 0.85em;
}
.card-flight-airport {
    font-weight: 700;
    width: 38px;
    flex-shrink: 0;
}
.card-flight-times { opacity: 0.85; }
.card-flight-times .t-sched { font-weight: 600; }
.card-flight-times .t-actual { color: #5a9478; font-weight: 600; }
.card-flight-times .t-est { opacity: 0.6; }
.card-flight-delay { color: #c25555; font-weight: 600; font-size: 0.92em; }
.card-flight-status-msg { font-size: 0.85em; opacity: 0.7; }
.card-dur { display: none; }
.card-route-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.07);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    text-decoration: none;
    color: var(--c-text);
    opacity: 0.75;
    margin-top: 6px;
    margin-left: 4px;
    flex-shrink: 0;
}
.card-route-btn:hover { opacity: 1; background: rgba(0,0,0,0.13); }
.card-route-btn svg { width: 22px; height: 22px; flex-shrink: 0; fill: currentColor; }

/* Food option tabs */
.food-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 9px;
}
.food-tab {
    padding: 3px 11px;
    border-radius: 20px;
    border: 1px solid rgba(0,0,0,0.15);
    background: rgba(255,255,255,0.45);
    font-size: 11.5px;
    font-family: 'Parkinsans', system-ui, sans-serif;
    cursor: pointer;
    color: var(--c-text, #1a3a5c);
    transition: background 0.15s, border-color 0.15s;
    line-height: 1.7;
}
.food-tab:hover { background: rgba(255,255,255,0.75); }
.food-tab.active {
    background: var(--c, #5a9478);
    color: #fff;
    border-color: var(--c, #5a9478);
    font-weight: 600;
}

/* Transit directions */
.card-transit {
    margin-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.07);
    padding-top: 8px;
}
.card-transit-loading {
    font-size: 0.75em;
    opacity: 0.5;
    padding: 2px 0;
}
.card-transit-wrap {
    display: flex;
    flex-direction: column;
}
.card-transit-place {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 14px;
    margin: 4px 0 4px 14px;
    font-weight: 400;
    font-size: 0.86em;
    line-height: 1.3;
}
.card-transit-place-dot {
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.45;
}
.card-transit-connector {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 3px 0 3px 14px;
}
.card-transit-spine {
    flex-shrink: 0;
    width: 10px;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.card-transit-spine-line {
    width: 1.5px;
    flex: 1;
    min-height: 14px;
    background: var(--step-c, rgba(0,0,0,0.25));
    opacity: 0.55;
    border-radius: 1px;
}
.card-transit-step {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 1px 0;
    line-height: 1.3;
}
/* Transit step icon colour: set via --step-c on the connector */
.card-transit-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95em;
}
.card-transit-icon svg {
    width: 13px; height: 13px;
    fill: var(--step-c, currentColor);
}
.card-transit-icon-mask {
    width: 14px;
    height: 14px;
    display: block;
    -webkit-mask-size: contain;
    mask-size: contain;
}
.card-transit-step-text { font-size: 0.86em; }
.card-transit-step-text strong { font-weight: 600; }
.card-transit-step-meta { opacity: 0.55; font-size: 0.88em; }
.card-transit-summary {
    font-size: 0.72em;
    opacity: 0.55;
    margin-bottom: 6px;
}
/* Budget */
.armastan {
    width: 100%;
    text-align: center;
    font-size: 1em;
    font-weight: 400;
    color: #1a3a5c;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) scale(0.8);
    transition: opacity 0.05s ease-out, transform 0.05s ease-out;
}
.budget-header {
    background: linear-gradient(90deg, #2c3e50, #4a6fa5);
    color: white;
    padding: 14px 20px;
    border-radius: 14px 14px 0 0;
}
.budget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    background: white;
    padding: 16px;
    border-radius: 0 0 14px 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.budget-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f8f6f2;
    border-radius: 10px;
    border-left: 4px solid #4a6fa5;
}
.budget-item .label { font-size: 0.85em; color: #1a3a5c; }
.budget-item .price { font-weight: 700; color: #1a3a5c; font-size: 0.9em; }

/* PIN screen */
.pin-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.pin-boxes {
    display: flex;
    gap: 10px;
}
.pin-box {
    width: 48px;
    height: 58px;
    border: 2px solid rgba(26,58,92,0.2);
    border-radius: 12px;
    background: rgba(255,255,255,0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-family: 'Parkinsans', system-ui, sans-serif;
    font-size: 1.5em;
    font-weight: 700;
    color: #1a3a5c;
    text-align: center;
    outline: none;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    caret-color: transparent;
}
.pin-box:focus {
    border-color: rgba(26,58,92,0.5);
    box-shadow: 0 0 0 3px rgba(26,58,92,0.08);
    transform: scale(1.05);
}
.pin-box.shake {
    animation: pinShake 0.4s ease;
}
.pin-box.correct {
    border-color: #1a3a5c;
    background: rgba(26,58,92,0.08);
}
@keyframes pinShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}
.pin-hint {
    font-size: 0.7em;
    opacity: 0.35;
    letter-spacing: 0.05em;
}
.container.locked { display: none; }
.hero.unlocked .pin-wrapper { display: none; }
.hero.unlocked h1 {
    display: block;
    animation: fadeInUp 0.6s ease;
}
.hero h1 { display: none; }
.scroll-hint {
    margin-top: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}
.hero.unlocked .scroll-hint {
    opacity: 1;
    pointer-events: auto;
    animation: scrollBob 13s ease-in-out infinite;
}
@keyframes scrollBob {
    0%   { transform: translateY(0px); }
    25%  { transform: translateY(-9px); }
    50%  { transform: translateY(0px); }
    75%  { transform: translateY(-9px); }
    100% { transform: translateY(0px); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 500px) {
    .hero h1 { font-size: 2.1em; }
    .container { padding: 12px 8px; }
    .days-col { padding-right: 34px; }
    .seg-time { width: 30px; font-size: 0.65em; }
    .card { top: 8px; }
    .card-header { padding: 5px 8px; min-height: 16px; gap: 3px; }
    .card.open .card-header { padding-right: 50px; }
    .card.open .card-body { padding: 8px 50px 12px 8px; }
    .pin-box { width: 42px; height: 50px; font-size: 1.3em; }
}
