:root {
    color-scheme: light dark;
    --bg: #fefaf5;
    --text: #2b2118;
    --accent: #c3562d;
    --accent-dark: #7a2d12;
    --muted: #6f5c4b;
    --border: #e5d7c9;
    --shadow: 0 24px 60px rgba(43, 33, 24, 0.15);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    width: min(1100px, 92vw);
    margin: 0 auto;
    padding: 3rem 0;
}

.account {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    padding: 1.75rem 2rem;
    box-shadow: var(--shadow);
    margin-top: -3.5rem;
    margin-bottom: 2.5rem;
    position: relative;
    z-index: 3;
}

.account__header h2 {
    margin: 0 0 0.25rem;
    font-size: 1.5rem;
}

.account__header p {
    margin: 0;
    color: var(--muted);
}

.account__status {
    margin-top: 1rem;
    font-weight: 600;
}

.account__controls {
    margin-top: 1.25rem;
    display: grid;
    gap: 1rem;
}

.account__row {
    display: grid;
    gap: 0.5rem;
}

.account__label {
    font-weight: 600;
}

.account__input-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.account__input-group input {
    flex: 1 1 220px;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 1rem;
}

.account__input-group input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(195, 86, 45, 0.15);
}

.account__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.account__hint {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.account__announcement {
    display: block;
    margin-top: 0.5rem;
    color: var(--accent-dark);
    font-weight: 600;
}

@media (max-width: 768px) {
    .account {
        margin-top: -2.5rem;
        padding: 1.5rem;
    }

    .account__input-group {
        flex-direction: column;
    }

    .account__actions {
        flex-direction: column;
        align-items: stretch;
    }
}

.hero {
    position: relative;
    background: url('https://images.unsplash.com/photo-1542737574-4b7052ef05b4?auto=format&fit=crop&w=1600&q=80') center/cover no-repeat;
    min-height: 320px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(195, 86, 45, 0.65), rgba(43, 33, 24, 0.7));
}

.hero__content {
    position: relative;
    z-index: 1;
    padding: 3rem 1rem;
}

.hero h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

.hero p {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
}

.planner {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 18px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
    margin-top: -5rem;
    position: relative;
    z-index: 2;
}

.planner__intro h2 {
    margin-top: 0;
    font-size: 1.8rem;
}

.planner__intro p {
    color: var(--muted);
}

.planner__form {
    display: grid;
    gap: 1.5rem;
    margin-top: 2rem;
}

.generation-status {
    margin-top: 1.5rem;
    padding: 1.5rem 1.75rem;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(24, 78, 142, 0.95), rgba(13, 42, 83, 0.92));
    color: #f2f7ff;
    display: flex;
    gap: 1.25rem;
    align-items: center;
    box-shadow: 0 18px 45px rgba(13, 42, 83, 0.25);
}

.generation-status[hidden] {
    display: none !important;
}

.generation-status__spinner {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #8cc7ff;
    animation: generation-spin 0.9s linear infinite;
    flex-shrink: 0;
}

.generation-status__spinner--paused {
    animation-play-state: paused;
    border-top-color: rgba(255, 255, 255, 0.55);
}

.generation-status__content {
    display: grid;
    gap: 0.65rem;
}

.generation-status__lead {
    margin: 0;
    font-weight: 600;
    letter-spacing: 0.015em;
}

.generation-status__ad {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    display: grid;
    gap: 0.4rem;
}

.generation-status__headline {
    margin: 0;
    font-weight: 700;
    font-size: 1.05rem;
}

.generation-status__body {
    margin: 0;
    line-height: 1.5;
}

.generation-status__link {
    margin: 0;
    font-weight: 600;
}

.generation-status__link a {
    color: #cfe6ff;
    text-decoration: underline;
}

.generation-status__link a:focus,
.generation-status__link a:hover {
    color: #ffffff;
}

.generation-status--error {
    background: linear-gradient(135deg, rgba(33, 69, 117, 0.95), rgba(115, 28, 44, 0.92));
}

@keyframes generation-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.field input,
.field textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field textarea:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(195, 86, 45, 0.15);
}

.field--textarea textarea {
    min-height: 120px;
    resize: vertical;
}

.field__group {
    display: grid;
    gap: 0.75rem;
}

.field__input-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.field__input-row input {
    flex: 1 1 240px;
}

.field__inline-btn {
    padding: 0.75rem 1.4rem;
    white-space: nowrap;
}

.field__status {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.field__status--error {
    color: var(--accent-dark);
}

.field__repeatable {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.field__repeatable input[type="text"] {
    flex: 1;
}

.field__action {
    margin-top: 0.75rem;
}

.field__help {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.field__remove {
    padding: 0.5rem 1rem;
    border-radius: 999px;
}

.field__remove[hidden] {
    display: none;
}

.optional {
    color: var(--muted);
    font-size: 0.9rem;
}

.btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.9rem 1.8rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    box-shadow: 0 12px 30px rgba(195, 86, 45, 0.25);
}

.btn:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn--secondary {
    background: #fff;
    color: var(--accent);
    border: 1px solid var(--accent);
    box-shadow: none;
}

.btn--secondary:hover {
    background: var(--accent);
    color: #fff;
}

.btn--ghost {
    background: transparent;
    color: var(--accent);
    border: 1px solid transparent;
    box-shadow: none;
}

.btn--ghost:hover {
    border-color: var(--accent);
    background: rgba(195, 86, 45, 0.08);
}

.results {
    margin-top: 3.5rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.results__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.results__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.results__actions .btn {
    min-width: fit-content;
}

.results__share {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: rgba(195, 86, 45, 0.08);
    color: var(--accent);
    font-weight: 600;
}

.results__share--error {
    background: rgba(175, 32, 32, 0.12);
    color: #7a2d12;
}

.results__content {
    margin-top: 0;
    display: grid;
    gap: 1.5rem;
}

.results__layout {
    display: grid;
    gap: 1.75rem;
    margin-top: 1.5rem;
}

.results__map {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--border);
    min-height: 320px;
}

.map {
    width: 100%;
    height: 100%;
    min-height: 320px;
}

.map__message {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 1rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(254, 250, 245, 0.9));
    color: var(--muted);
    font-weight: 600;
    transition: opacity 0.3s ease;
}

.map__message[hidden] {
    opacity: 0;
    pointer-events: none;
}

.itinerary-stop {
    border-left: 4px solid var(--accent);
    padding-left: 1.5rem;
}

.itinerary-stop h3 {
    margin-top: 0;
}

.itinerary-stop__meta {
    color: var(--muted);
    font-size: 0.9rem;
}

.itinerary-stop__live {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(195, 86, 45, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.85);
}

.tripadvisor-badge {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    background: #ffffff;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    color: #141414;
}

.tripadvisor-badge__brand img {
    display: block;
    height: 24px;
    width: auto;
    min-height: 20px;
}

.tripadvisor-badge__content {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.tripadvisor-badge__rating {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.tripadvisor-badge__rating img {
    display: block;
    min-width: 55px;
    height: auto;
    background: #ffffff;
}

.tripadvisor-badge__rating-score {
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1;
    color: #141414;
}

.tripadvisor-badge__meta {
    margin: 0;
    font-size: 0.85rem;
    color: #242424;
}

.tripadvisor-badge__link {
    font-size: 0.85rem;
    color: #141414;
    text-decoration: underline;
    font-weight: 600;
}

.tripadvisor-badge__link:hover,
.tripadvisor-badge__link:focus {
    color: #0f7253;
}

.itinerary-stop__live-title {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.itinerary-stop__live-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.4rem;
}

.itinerary-stop__live-list li {
    font-size: 0.95rem;
}

.itinerary-stop__live-list a {
    color: var(--accent);
    text-decoration: none;
}

.itinerary-stop__live-list a:hover,
.itinerary-stop__live-list a:focus {
    text-decoration: underline;
}

.itinerary-stop__live-status {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.itinerary-stop__live-status--error {
    color: var(--accent-dark);
}

.history {
    margin-top: 4rem;
}

.history__list {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.editor {
    margin-top: 2rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: inset 0 0 0 1px rgba(195, 86, 45, 0.05);
}

.editor__header h3 {
    margin: 0;
}

.editor__header p {
    margin-top: 0.25rem;
    color: var(--muted);
}

.editor__stops {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.editor__empty {
    color: var(--muted);
    font-style: italic;
}

.editor-stop {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    background: #fff;
}

.editor-stop__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.editor-stop__header h4 {
    margin: 0;
}

.editor-stop__controls {
    display: flex;
    gap: 0.5rem;
}

.editor-stop__controls button {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.editor-stop__controls button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.editor-stop__controls button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    border-color: var(--border);
    color: var(--muted);
}

.editor-stop__field {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.editor-stop__field label {
    font-weight: 600;
    font-size: 0.9rem;
}

.editor-stop__field input,
.editor-stop__field textarea {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.95rem;
}

.editor-stop__field textarea {
    min-height: 80px;
    resize: vertical;
}

.editor__actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.results__share-meta {
    font-size: 0.95rem;
    color: var(--muted);
}

@media (max-width: 768px) {
    .editor-stop__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .editor-stop__controls {
        width: 100%;
        flex-wrap: wrap;
    }
}

.history__item {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 12px 30px rgba(43, 33, 24, 0.08);
    display: grid;
    gap: 0.75rem;
}

.history__item h3 {
    margin: 0;
    font-size: 1.25rem;
}

.history__meta {
    color: var(--muted);
    font-size: 0.9rem;
}

.history__summary {
    margin: 0;
}

@media (max-width: 720px) {
    .planner {
        margin-top: -4rem;
        padding: 2rem;
    }

    .container {
        padding: 2rem 0;
    }

    .results {
        padding: 1.5rem;
    }
}

@media (min-width: 960px) {
    .results__layout {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
        align-items: flex-start;
    }

    .results__map {
        min-height: 420px;
        position: sticky;
        top: 1.5rem;
        box-shadow: var(--shadow);
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #19110b;
        --text: #f4ede6;
        --border: #4e3b2a;
        --muted: #b9a291;
        --shadow: 0 24px 60px rgba(12, 7, 3, 0.6);
    }

    .planner,
    .results,
    .history__item {
        background: rgba(31, 22, 15, 0.92);
    }

    .btn--secondary {
        background: transparent;
    }
}
