:root {
    --paper: #fbf7f1;
    --card: #ffffff;
    --ink: #2a211b;
    --soft: #6f6258;
    --line: #e8dfd3;
    --accent: #c2410c;
    --accent-dark: #9a3412;
    --ok: #0f766e;
    --bad: #b91c1c;
    --day1: #c2410c;
    --day2: #0f766e;
    --day3: #7c3aed;
    --day4: #b45309;
    --day5: #be123c;
    --day6: #1d4ed8;
}

* {
    box-sizing: border-box;
}

/* A hidden element stays hidden, whatever display its class gives it. */
[hidden] {
    display: none !important;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px 16px 48px;
}

h1, h2, h3, h4, p {
    margin: 0;
}

h1 {
    font: 700 28px/1.1 Georgia, "Times New Roman", serif;
    color: var(--accent-dark);
}

h2 {
    font: 700 21px/1.25 Georgia, "Times New Roman", serif;
}

a {
    color: var(--accent-dark);
}

.top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    padding: 8px 0 4px;
    margin-bottom: 8px;
}

p.tagline {
    margin-bottom: 16px;
}

.tagline, .hint {
    color: var(--soft);
    font-size: 14px;
}

.hint.small {
    font-size: 13px;
    margin-top: 16px;
}

.card, .how {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.how {
    background: transparent;
}

.how ol {
    margin: 0;
    padding-left: 20px;
    color: var(--soft);
    font-size: 15px;
}

.how li + li {
    margin-top: 6px;
}

textarea, input, select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

textarea {
    resize: vertical;
}

textarea:focus, input:focus, select:focus, button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--soft);
}

button {
    font: inherit;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid transparent;
    padding: 11px 16px;
    min-height: 44px;
    cursor: pointer;
}

button.primary {
    background: var(--accent);
    color: #fff;
}

button.primary:hover {
    background: var(--accent-dark);
}

button.ghost {
    background: transparent;
    border-color: var(--line);
    color: var(--ink);
}

button.ghost:hover {
    border-color: var(--soft);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

button.chip {
    min-height: 0;
    padding: 6px 10px;
    border-radius: 999px;
    border-color: var(--line);
    background: var(--paper);
    color: var(--soft);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
}

/* A run */

.steps, .feed {
    list-style: none;
    margin: 0;
    padding: 0;
}

.step {
    display: flex;
    gap: 12px;
    padding: 9px 0;
    border-top: 1px solid var(--line);
}

.step:first-child {
    border-top: none;
}

.dot {
    flex: none;
    width: 12px;
    height: 12px;
    margin-top: 6px;
    border-radius: 50%;
    border: 2px solid var(--line);
}

.step.running .dot {
    border-color: var(--accent);
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

.step.done .dot {
    background: var(--ok);
    border-color: var(--ok);
}

.step.skipped .dot {
    border-style: dashed;
}

.step.waiting .step-title, .step.skipped .step-title {
    color: var(--soft);
}

.step-text {
    min-width: 0;
    flex: 1;
}

.step-title {
    font-weight: 600;
}

.step-detail {
    color: var(--soft);
    font-size: 14px;
    overflow-wrap: anywhere;
}

/* The food of the trip, while the agent chooses the restaurants */

.tidbit {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--paper);
    border: 1px solid var(--line);
}

.tidbit.fresh {
    animation: fade-in 0.5s ease-out;
}

.tidbit p {
    margin: 0 0 6px;
}

.tidbit-label {
    color: var(--soft);
    font-size: 13px;
}

.tidbit-name {
    font-weight: 600;
    color: var(--accent-dark);
}

.story {
    font-style: italic;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tidbit.fresh {
        animation: none;
    }
}

/* How to get a Google key */

.how-to {
    margin-bottom: 12px;
    font-size: 14px;
}

.how-to summary {
    cursor: pointer;
    color: var(--accent-dark);
}

.how-to ol {
    padding-left: 20px;
}

.how-to li {
    margin-bottom: 6px;
    overflow-wrap: anywhere;
}

.feed {
    margin-top: 6px;
    font-size: 14px;
    color: var(--soft);
}

.feed li::before {
    content: "· ";
}

.writing {
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--paper);
    border-radius: 10px;
    font-size: 14px;
    white-space: pre-wrap;
}

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

.question {
    font-size: 18px;
}

.failure {
    color: var(--bad);
    overflow-wrap: anywhere;
}

/* The route */

.route {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.summary {
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: 10px;
    padding: 12px 14px;
    white-space: pre-wrap;
}

/* Closed, the agent's words are two lines. */
.summary:not(.open) .summary-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

button.summary-toggle {
    min-height: 28px;
    margin-top: 2px;
}

button.summary-toggle::after {
    content: " ▾";
}

.summary.open button.summary-toggle::after {
    content: " ▴";
}

@media print {
    .summary .summary-text {
        display: block;
    }

    .summary-toggle {
        display: none;
    }
}

.map {
    /* Short on a phone, so that the day's meals start on the same screen. */
    height: 34vh;
    min-height: 200px;
    max-height: 320px;
    scroll-margin-top: 72px;
    border-radius: 14px;
    border: 1px solid var(--line);
    z-index: 0;
}

h3.day {
    font: 700 17px/1.3 Georgia, "Times New Roman", serif;
    margin-top: 10px;
    padding-left: 10px;
    border-left: 4px solid var(--soft);
}

.meal {
    display: flex;
    gap: 12px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
}

.meal-text {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meal-time {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--soft);
}

.meal h4 {
    font-size: 18px;
    line-height: 1.25;
}

.rating {
    font-size: 14px;
    color: var(--day4);
    font-weight: 600;
}

.what, .facts {
    color: var(--soft);
}

/* Whether to book, and the number to call. */
.booking {
    font-size: 14px;
    font-weight: 600;
}

/* A number broken over two lines is hard to read out on the phone. */
.booking a {
    white-space: nowrap;
}

.why {
    font-style: italic;
}

.facts {
    font-size: 14px;
    overflow-wrap: anywhere;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: #ecfdf5;
    color: var(--ok);
}

/* A place known for a dish of its stop: what the planner looks for first. */
.badge.speciality {
    background: #fff7ed;
    color: var(--accent-dark);
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-size: 14px;
}

.walk {
    color: var(--soft);
    font-size: 13px;
    padding-left: 22px;
}

/* The places to save one by one in Google Maps: an opened one is ticked off. */
.save-list {
    padding-left: 0;
    list-style: none;
}

.save-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 2px 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}

.save-list .save-name::before {
    content: "○ ";
    color: var(--soft);
}

.save-list li.opened .save-name::before {
    content: "✓ ";
    color: var(--ok);
}

.save-list li.opened .save-name {
    color: var(--soft);
}

.one-by-one .count {
    font-size: 14px;
    font-weight: 600;
}

.save-link {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.pin {
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--soft);
    color: #fff;
    font: 700 13px/28px system-ui, sans-serif;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.day1 { --day: var(--day1); }
.day2 { --day: var(--day2); }
.day3 { --day: var(--day3); }
.day4 { --day: var(--day4); }
.day5 { --day: var(--day5); }
.day6 { --day: var(--day6); }

.pin[class*="day"] {
    background: var(--day);
}

button.chip[class*="day"] {
    color: var(--day);
    border-color: var(--day);
}

h3.day1 { border-color: var(--day1); }
h3.day2 { border-color: var(--day2); }
h3.day3 { border-color: var(--day3); }
h3.day4 { border-color: var(--day4); }
h3.day5 { border-color: var(--day5); }
h3.day6 { border-color: var(--day6); }

.known {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 14px;
}

.known summary {
    cursor: pointer;
    font-weight: 600;
}

.known ul {
    margin: 8px 0 0;
    padding-left: 20px;
    font-size: 15px;
}

.credits {
    color: var(--soft);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 8px;
}

@media print {
    .top button, .card, .chips, .credits, .how, .days, .day-steps {
        display: none;
    }

    body {
        background: #fff;
    }

    .meal {
        break-inside: avoid;
    }
}

/* The two tabs */

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

button.tab {
    min-height: 40px;
    padding: 8px 14px;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--soft);
}

button.tab.current {
    border-bottom-color: var(--accent);
    color: var(--ink);
}

/* The conversation */

.thread, .turn {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.turn {
    gap: 10px;
}

.bubble {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 15px;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.bubble.them {
    align-self: flex-start;
    background: var(--card);
    border: 1px solid var(--line);
    border-bottom-left-radius: 6px;
}

.bubble.me {
    align-self: flex-end;
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 6px;
}

.bubble.me.skipped {
    background: transparent;
    border: 1px dashed var(--line);
    color: var(--soft);
}

.bubble p + p {
    margin-top: 6px;
}

.thread .note {
    align-self: center;
    color: var(--soft);
    font-size: 13px;
}

.turn .bubble.them {
    max-width: 100%;
    white-space: normal;
}

.turn > .hint {
    margin: 0;
}

ul.understood {
    margin: 6px 0;
    padding-left: 18px;
}

ul.understood li + li {
    margin-top: 2px;
}

.quiet-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
}

button.link {
    min-height: 32px;
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    font-size: 14px;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
}

p.saved {
    color: var(--ok);
    font-weight: 600;
}

/* The interview */

.ask {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ask .question {
    font-size: 17px;
    margin: 0;
}

button.chip.answer {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 15px;
    color: var(--ink);
}

button.chip.answer.picked {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.profile {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 14px;
    margin: 0;
}

.profile dt {
    color: var(--soft);
    font-weight: 600;
}

.profile dd {
    margin: 0;
    overflow-wrap: anywhere;
}

/* Editing the profile */

.editor {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 8px;
}

.edit-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.edit-row > .hint {
    margin: 0;
}

.edit-row > button.chip {
    align-self: flex-start;
}

.edit-line {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.edit-line input[type="text"], .edit-line textarea {
    flex: 1;
    min-width: 0;
}

.edit-line textarea {
    resize: none;
    overflow: hidden;
}


label.check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    font-size: 15px;
    cursor: pointer;
}

label.check input {
    width: 20px;
    height: 20px;
    margin: 0;
    padding: 0;
    accent-color: var(--accent);
}

button.erase {
    min-width: 44px;
    padding: 0;
    background: transparent;
    border-color: var(--line);
    color: var(--soft);
    font-size: 20px;
    line-height: 1;
}

button.danger {
    color: var(--bad);
}

.caution {
    margin: 0;
    padding: 8px 10px;
    border-radius: 8px;
    background: #fef2f2;
    color: var(--bad);
    font-size: 14px;
}

/* Speaking instead of typing */

.speak-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.speak-row .hint {
    margin: 0;
}

button.speak {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 14px;
}

button.speak.listening {
    background: var(--bad);
    border-color: var(--bad);
    color: #fff;
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    50% {
        opacity: 0.7;
    }
}

.told {
    margin: 0;
    padding: 8px 10px;
    border-left: 3px solid var(--ok);
    background: var(--paper);
}

.top-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

select.language {
    width: auto;
    min-height: 44px;
    padding: 8px 10px;
    font-weight: 600;
}

button.settings-button {
    min-width: 44px;
    padding: 8px 10px;
    font-size: 20px;
    line-height: 1;
}

button.settings-button.current {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.step-detail.quiet {
    font-style: italic;
}

/* Changing one place of the route: the questions open inside its card. */
.swap {
    margin-top: 8px;
}

.swap .field-label {
    margin: 10px 0 4px;
}

.swap input {
    width: 100%;
    margin-top: 6px;
}

.swap .actions {
    margin-top: 10px;
}

.sleeping {
    margin: -4px 0 6px;
}

/* The places the agent offered for a meal: the recommended one is always marked. */
.badge.recommended {
    background: var(--accent);
    color: #fff;
}

.badge.chosen {
    background: #ecfdf5;
    color: #065f46;
}

.recommendation {
    font-size: 14px;
    font-style: italic;
    color: var(--accent-dark);
}

.options {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 10px;
}

.option-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

/* The questions of the start page that the traveller can answer before the interview. */
.up-front {
    margin: 12px 0;
}

.up-front summary {
    font-weight: 600;
    cursor: pointer;
}

.up-front-question {
    margin-top: 12px;
}

.up-front-question input {
    width: 100%;
    margin-top: 6px;
}

/* The days of the route, as tabs that stay at the top of the screen. */
.days {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    gap: 6px;
    margin: 0 -16px;
    padding: 8px 16px;
    overflow-x: auto;
    scrollbar-width: none;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}

.days::-webkit-scrollbar {
    display: none;
}

button.day-tab {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-height: 44px;
    padding: 4px 12px;
    border-radius: 12px;
    border-color: var(--day, var(--line));
    background: var(--card);
    color: var(--day, var(--soft));
    font-size: 14px;
    line-height: 1.2;
}

button.day-tab.current {
    background: var(--day, var(--ink));
    border-color: var(--day, var(--ink));
    color: #fff;
}

.day-tab-label {
    font-weight: 700;
}

.day-tab-place {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.85;
}

.day-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* The whole trip: a line for each day, which opens it. */
.overview {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.overview-day {
    cursor: pointer;
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 4px solid var(--day, var(--soft));
    border-radius: 10px;
    padding: 10px 14px;
}

.overview-title {
    font-weight: 700;
}

.overview-places {
    font-size: 14px;
    color: var(--soft);
}

.day-steps {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.day-steps .next {
    margin-left: auto;
}

/* The number of a meal is the pin's, and shows it on the map. */
button.pin {
    min-height: 0;
    padding: 0;
    border: 0;
    cursor: pointer;
}

/* The meal whose pin was tapped, and the pin of the meal shown. */
article.meal.marked {
    border-color: var(--day, var(--ink));
    box-shadow: 0 0 0 2px var(--day, var(--ink));
    scroll-margin-top: 72px;
}

.leaflet-marker-icon.marked {
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--day, var(--ink));
    z-index: 1000 !important;
}

/* The questions about changing a place, in a sheet over the route. */
.sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(42, 33, 27, 0.4);
}

.sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    max-width: 720px;
    max-height: 85vh;
    margin: 0 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    background: var(--card);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
}

body.sheet-open {
    overflow: hidden;
}

.sheet-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.sheet-head h3 {
    font: 700 19px/1.25 Georgia, "Times New Roman", serif;
}

button.sheet-close {
    min-height: 40px;
    padding: 0 14px;
    font-size: 22px;
    line-height: 1;
}

.sheet input {
    width: 100%;
}

.marked-swap {
    margin-top: 6px;
    padding: 8px 10px;
    border: 1px dashed var(--accent);
    border-radius: 10px;
}

/* The bars at the bottom of the screen: sending the marked places, and the planner at work. */
.bottom-bar, .working {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--card);
    border-top: 1px solid var(--line);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
}

/* The day in Google Maps, or sending the marked places, takes the room the menu leaves. */
.bottom-bar > :first-child:not(.menu-button) {
    flex: 1;
}

a.bar-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}

button.menu-button {
    flex: none;
}

.bottom-bar > button.menu-button:only-child {
    flex: 1;
}

.menu-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.menu-items > button {
    width: 100%;
    text-align: left;
}

.menu-items > .hint {
    margin: -4px 0 4px;
}

body:has(.bottom-bar) main, body:has(.working) main {
    padding-bottom: 96px;
}

.working-text {
    flex: 1;
    min-width: 0;
}

.working-title {
    font-weight: 700;
    font-size: 15px;
}

.working-detail {
    font-size: 13px;
    color: var(--soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spinner {
    flex: none;
    width: 18px;
    height: 18px;
    border: 3px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

article.meal.changing {
    border-style: dashed;
}

article.meal.changing .meal-text > :not(.changing-note) {
    opacity: 0.5;
}

.changing-note {
    color: var(--accent-dark);
    font-weight: 700;
}

@media print {
    .bottom-bar, .working, .sheet, .sheet-backdrop {
        display: none;
    }
}

/* A meal's card: closed, where, what to order and what to watch out for; open, everything. */
.meal-summary {
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
}

.meal:not(.open) .meal-more {
    display: none;
}

.meal-more {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--line);
}

.meal-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0 16px;
}

.meal-actions > .marked-swap {
    flex-basis: 100%;
}

button.meal-toggle::after {
    content: " ▾";
}

.meal.open button.meal-toggle::after {
    content: " ▴";
}

@media print {
    .meal .meal-more {
        display: flex;
    }

    .meal-actions {
        display: none;
    }
}
