/* ============================================================
   Enyas Kartenreise – Stil
   Warm, romantisch, klar.
   ============================================================ */

:root {
    --bg: #f7efe8;
    --surface: #fffaf5;
    --surface-2: #fbf1ea;
    --ink: #4a3b35;
    --ink-soft: #6f5c53;
    --muted: #a7938686;
    --muted-solid: #a08a7d;
    --rose: #c25b6a;
    --rose-deep: #a8465a;
    --rose-soft: #edc9cd;
    --gold: #c9a24b;
    --line: #e7d7c9;
    --shadow: 0 18px 40px -24px rgba(93, 61, 48, 0.45);
    --shadow-soft: 0 10px 30px -20px rgba(93, 61, 48, 0.4);
    --radius: 18px;
}

* { box-sizing: border-box; }

html {
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: "Nunito Sans", system-ui, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(1100px 600px at 50% -10%, #fff6ef 0%, rgba(255, 246, 239, 0) 60%),
        var(--bg);
    line-height: 1.6;
    min-height: 100vh;
}

/* ---------- Header ---------- */
.site-header {
    max-width: 720px;
    margin: 0 auto;
    padding: 64px 24px 24px;
    text-align: center;
}

.eyebrow {
    font-family: "Caveat", cursive;
    font-size: 1.5rem;
    color: var(--rose);
    margin: 0 0 4px;
    letter-spacing: 0.5px;
}

.title {
    font-family: "Cormorant Garamond", serif;
    font-weight: 600;
    font-size: clamp(2.5rem, 6vw, 3.75rem);
    line-height: 1.05;
    margin: 0 0 16px;
    color: var(--ink);
    text-wrap: balance;
}

.subtitle {
    max-width: 46ch;
    margin: 0 auto;
    color: var(--ink-soft);
    font-size: 1.02rem;
    text-wrap: pretty;
}

/* ---------- Progress ---------- */
.progress {
    margin: 32px auto 0;
    max-width: 420px;
}

.progress-bar {
    height: 10px;
    border-radius: 999px;
    background: var(--surface-2);
    box-shadow: inset 0 1px 3px rgba(93, 61, 48, 0.12);
    overflow: hidden;
    border: 1px solid var(--line);
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--rose-soft), var(--rose));
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.progress-label {
    margin: 10px 0 0;
    font-size: 0.9rem;
    color: var(--muted-solid);
    letter-spacing: 0.3px;
}

.progress-label #progressCount {
    color: var(--rose);
    font-weight: 700;
}

/* ---------- Roadmap ---------- */
.roadmap-wrap {
    max-width: 760px;
    margin: 40px auto 0;
    padding: 0 24px 40px;
    position: relative;
}

.roadmap {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

/* Zentrale Linie */
.roadmap::before {
    content: "";
    position: absolute;
    top: 12px;
    bottom: 12px;
    left: 50%;
    width: 3px;
    transform: translateX(-50%);
    background: repeating-linear-gradient(
        to bottom,
        var(--line) 0 10px,
        transparent 10px 18px
    );
    z-index: 0;
}

.node {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    padding: 14px 0;
}

.node-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: default;
    font: inherit;
    color: inherit;
    width: 50%;
    justify-content: flex-end;
    flex-direction: row-reverse;
    text-align: right;
}

/* Abwechselnd links / rechts */
.node:nth-child(even) .node-btn {
    margin-left: auto;
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
}
.node:nth-child(odd) .node-btn {
    margin-right: auto;
}

.node-dot {
    position: relative;
    flex: 0 0 auto;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--surface);
    border: 2px solid var(--line);
    box-shadow: var(--shadow-soft);
    color: var(--muted-solid);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.node-num {
    font-family: "Cormorant Garamond", serif;
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1;
}

.node-lock {
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    color: var(--muted-solid);
}

.node-heart {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    color: #fff;
}

.node-label {
    font-size: 0.95rem;
    color: var(--muted-solid);
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: color 0.25s ease;
}

/* ---------- Freigeschaltete Nodes ---------- */
.node.unlocked .node-btn { cursor: pointer; }

.node.unlocked .node-dot {
    background: linear-gradient(160deg, var(--rose), var(--rose-deep));
    border-color: var(--rose-deep);
    color: #fff;
    box-shadow: 0 14px 30px -14px rgba(168, 70, 90, 0.75);
}

.node.unlocked .node-num { display: none; }
.node.unlocked .node-lock { display: none; }
.node.unlocked .node-heart { display: grid; }

.node.unlocked .node-label {
    color: var(--ink);
    font-weight: 700;
}

.node.unlocked .node-btn:hover .node-dot,
.node.unlocked .node-btn:focus-visible .node-dot {
    transform: scale(1.08) rotate(-3deg);
}

.node.unlocked .node-btn:focus-visible {
    outline: none;
}
.node.unlocked .node-btn:focus-visible .node-dot {
    outline: 3px solid var(--rose-soft);
    outline-offset: 3px;
}

/* Frisch freigeschaltet – kleine Feier-Animation */
.node.just-unlocked .node-dot {
    animation: pop 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes pop {
    0%   { transform: scale(0.6); }
    45%  { transform: scale(1.18); }
    70%  { transform: scale(0.96); }
    100% { transform: scale(1); }
}

/* ---------- Hinweis, wenn nichts freigeschaltet ---------- */
.empty-hint {
    text-align: center;
    max-width: 40ch;
    margin: 8px auto 0;
    color: var(--muted-solid);
    font-family: "Caveat", cursive;
    font-size: 1.4rem;
    line-height: 1.4;
}

/* ---------- Footer ---------- */
.site-footer {
    text-align: center;
    padding: 24px;
    color: var(--muted-solid);
    font-size: 0.85rem;
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(74, 59, 53, 0.5);
    backdrop-filter: blur(4px);
    display: grid;
    place-items: center;
    padding: 24px;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.modal-overlay.open { opacity: 1; }
.modal-overlay[hidden] { display: none; }

.modal {
    position: relative;
    width: min(540px, 100%);
    max-height: 85vh;
    overflow-y: auto;
    background:
        linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 40px 36px 32px;
    box-shadow: var(--shadow);
    text-align: center;
    transform: translateY(14px) scale(0.98);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    background: var(--surface-2);
    color: var(--ink-soft);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.2s ease, color 0.2s ease;
}
.modal-close:hover { background: var(--rose-soft); color: var(--rose-deep); }

.modal-eyebrow {
    font-family: "Caveat", cursive;
    font-size: 1.3rem;
    color: var(--rose);
    margin: 0 0 2px;
}

.modal-title {
    font-family: "Cormorant Garamond", serif;
    font-weight: 600;
    font-size: 2rem;
    margin: 0 0 20px;
    color: var(--ink);
}

.modal-body {
    font-family: "Caveat", cursive;
    font-size: 1.55rem;
    line-height: 1.5;
    color: var(--ink);
    white-space: pre-wrap;
    text-wrap: pretty;
    min-height: 60px;
}

.modal-body.loading {
    font-family: "Nunito Sans", sans-serif;
    font-size: 1rem;
    color: var(--muted-solid);
}

.modal-image {
    display: block;
    width: 100%;
    max-height: 360px;
    margin: 20px auto 0;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
}

.modal-riddle {
    margin: 22px 0 0;
    padding: 14px 16px;
    border: 1px dashed var(--rose-soft);
    border-radius: 14px;
    background: rgba(255, 250, 245, 0.65);
    color: var(--rose-deep);
    font-size: 1.25rem;
    line-height: 1.4;
}

.modal-riddle p { margin: 0; }

.modal-riddle-form {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.modal-riddle-form input {
    min-width: 0;
    flex: 1;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 12px;
    color: var(--ink);
    font: 0.95rem "Nunito Sans", sans-serif;
}

.modal-riddle-form button {
    border: 0;
    border-radius: 999px;
    padding: 8px 14px;
    background: var(--rose);
    color: #fff;
    cursor: pointer;
    font: 700 0.9rem "Nunito Sans", sans-serif;
}

.modal-riddle-form button:disabled { opacity: 0.65; cursor: wait; }

.modal-riddle-result {
    margin-top: 10px !important;
    color: var(--rose-deep);
    font-size: 1rem;
}

.modal-riddle-result.correct { color: #4f7a54; }
}

.modal-flourish {
    margin-top: 22px;
    color: var(--rose-soft);
    display: grid;
    place-items: center;
}

/* ---------- Scan-Zwischenseite ---------- */
.scan-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
}
.scan-wrap { padding: 24px; width: 100%; }
.scan-card {
    max-width: 420px;
    margin: 0 auto;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 44px 32px;
    box-shadow: var(--shadow);
}
.scan-heart {
    color: var(--rose);
    display: grid;
    place-items: center;
    margin-bottom: 8px;
    animation: pop 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.scan-card h1 {
    font-family: "Cormorant Garamond", serif;
    font-weight: 600;
    font-size: 2rem;
    margin: 0 0 8px;
    color: var(--ink);
}
.scan-card p {
    margin: 0;
    color: var(--ink-soft);
}
.scan-link {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 22px;
    border-radius: 999px;
    background: var(--rose);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
}
.scan-link:hover { background: var(--rose-deep); }

/* ---------- Links-Übersicht (Admin) ---------- */
.links-page { max-width: 820px; margin: 0 auto; padding: 48px 24px; }
.links-page h1 {
    font-family: "Cormorant Garamond", serif;
    font-size: 2.4rem;
    margin: 0 0 6px;
}
.links-page .hint { color: var(--ink-soft); margin: 0 0 24px; max-width: 60ch; }
.links-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.92rem;
}
.links-table th, .links-table td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
}
.links-table th { background: var(--surface-2); font-weight: 700; }
.links-table tr:last-child td { border-bottom: 0; }
.links-table code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--rose-deep);
    word-break: break-all;
}

/* ---------- Kartenverwaltung ---------- */
.admin-page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 48px 24px 64px;
}

.admin-header {
    max-width: 620px;
    margin: 0 auto 32px;
    text-align: center;
}

.admin-header h1 {
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(2.4rem, 5vw, 3.4rem);
    line-height: 1;
    margin: 0 0 12px;
}

.admin-header p {
    color: var(--ink-soft);
    margin: 0 0 16px;
}

.admin-back {
    color: var(--rose-deep);
    font-weight: 700;
    text-decoration: none;
}

.admin-logout {
    margin-top: 14px;
}

.admin-logout button {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--muted-solid);
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
    text-decoration: underline;
}

.admin-notice {
    max-width: 760px;
    margin: 0 auto 20px;
    padding: 10px 16px;
    border: 1px solid var(--rose-soft);
    border-radius: 12px;
    background: var(--surface);
    color: var(--rose-deep);
    text-align: center;
}

.admin-layout {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.admin-card-nav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.admin-card-nav a {
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

.admin-card-nav a[aria-current="page"] {
    border-color: var(--rose-deep);
    background: var(--rose);
    color: #fff;
}

.admin-card-nav a.is-unlocked:not([aria-current="page"]) {
    border-color: var(--rose-soft);
    color: var(--rose-deep);
}

.admin-editor {
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.admin-editor h2,
.admin-editor h3 {
    font-family: "Cormorant Garamond", serif;
    margin: 0 0 16px;
}

.admin-editor h2 { font-size: 2rem; }
.admin-editor h3 { font-size: 1.6rem; }

.admin-form {
    display: grid;
    gap: 14px;
}

.admin-form label {
    display: grid;
    gap: 6px;
    color: var(--ink-soft);
    font-size: 0.9rem;
    font-weight: 700;
}

.admin-form label span {
    color: var(--muted-solid);
    font-weight: 400;
}

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

.admin-form textarea { resize: vertical; }

.admin-button,
.admin-delete {
    justify-self: start;
    border: 0;
    border-radius: 999px;
    padding: 10px 18px;
    background: var(--rose);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.admin-button:hover { background: var(--rose-deep); }

.admin-section {
    margin-top: 32px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
}

.admin-unlock-section {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.admin-unlock-section p {
    margin: -8px 0 14px;
    color: var(--ink-soft);
}

.admin-media-list {
    display: grid;
    gap: 12px;
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
}

.admin-media-list li {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.admin-media-list img {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    object-fit: cover;
}

.admin-media-list strong,
.admin-media-list code {
    display: block;
    overflow-wrap: anywhere;
}

.admin-media-list code {
    margin-top: 3px;
    color: var(--muted-solid);
    font-size: 0.75rem;
}

.admin-delete {
    background: transparent;
    color: var(--rose-deep);
    padding: 6px 8px;
}

.admin-delete:hover { text-decoration: underline; }

.admin-login-overlay {
    opacity: 1;
}

.admin-login-modal {
    max-width: 420px;
    text-align: left;
}

.admin-login-modal .modal-eyebrow,
.admin-login-modal .modal-title {
    text-align: center;
}

.admin-login-form {
    margin-top: 20px;
}

.admin-login-form .admin-button {
    justify-self: stretch;
}

.admin-login-error {
    margin: 0;
    padding: 9px 12px;
    border: 1px solid var(--rose-soft);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--rose-deep);
    text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 620px) {
    .site-header { padding-top: 44px; }

    .roadmap::before {
        left: 29px;
        transform: none;
    }
    .node { justify-content: flex-start; }
    .node-btn,
    .node:nth-child(even) .node-btn,
    .node:nth-child(odd) .node-btn {
        width: 100%;
        margin: 0;
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
    }
    .modal { padding: 40px 24px 28px; }
    .modal-body { font-size: 1.4rem; }
    .admin-page { padding: 32px 16px 48px; }
    .admin-layout { grid-template-columns: 1fr; }
    .admin-card-nav { grid-template-columns: repeat(4, 1fr); }
    .admin-editor { padding: 24px 18px; }
    .admin-media-list li { grid-template-columns: 60px minmax(0, 1fr); }
    .admin-media-list img { width: 60px; height: 60px; }
    .admin-media-list form { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
