:root {
    --bg: #070b16;
    --bg-soft: #0d1324;
    --card: rgba(15, 23, 42, 0.78);
    --card-solid: #101827;
    --line: rgba(148, 163, 184, 0.18);
    --text: #e5edf8;
    --muted: #93a4ba;
    --accent: #22d3ee;
    --accent-2: #8b5cf6;
    --green: #34d399;
    --danger: #fb7185;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

[data-theme="light"] {
    --bg: #f4f7fb;
    --bg-soft: #ffffff;
    --card: rgba(255, 255, 255, 0.82);
    --card-solid: #ffffff;
    --line: rgba(15, 23, 42, 0.12);
    --text: #0f172a;
    --muted: #64748b;
    --accent: #0891b2;
    --accent-2: #7c3aed;
    --shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

body::selection {
    background: rgba(34, 211, 238, 0.26);
}

.page-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 12% 10%, rgba(34, 211, 238, 0.20), transparent 28%),
        radial-gradient(circle at 88% 16%, rgba(139, 92, 246, 0.24), transparent 32%),
        radial-gradient(circle at 50% 100%, rgba(20, 184, 166, 0.12), transparent 35%);
    z-index: -1;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.hero {
    padding: 24px clamp(16px, 4vw, 54px) 36px;
}

.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1360px;
    margin: 0 auto 56px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    letter-spacing: -0.03em;
    font-size: 1.12rem;
}

.logo-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: #06101d;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 14px 36px rgba(34, 211, 238, 0.25);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle,
.admin-link,
.random-btn,
.favorites-toggle,
.prompt-card button,
.category-chip {
    border: 1px solid var(--line);
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.theme-toggle:hover,
.admin-link:hover,
.random-btn:hover,
.favorites-toggle:hover,
.prompt-card button:hover,
.category-chip:hover {
    transform: translateY(-1px);
    border-color: rgba(34, 211, 238, 0.48);
}

.theme-toggle {
    width: 42px;
    height: 42px;
}

.admin-link {
    padding: 11px 16px;
}

.hero-content {
    max-width: 1120px;
    margin: 0 auto;
    text-align: center;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--accent);
    text-transform: uppercase;
    font-size: 0.76rem;
    letter-spacing: 0.16em;
    font-weight: 800;
}

.hero h1 {
    max-width: 900px;
    margin: 0 auto;
    font-size: clamp(2.5rem, 7vw, 5.9rem);
    line-height: 0.92;
    letter-spacing: -0.08em;
}

.hero-text {
    max-width: 720px;
    margin: 22px auto 32px;
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.6;
}

.search-panel {
    max-width: 920px;
    margin: 0 auto;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 30px;
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

[data-theme="light"] .search-panel {
    background: rgba(255, 255, 255, 0.72);
}

.search-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    min-height: 62px;
    border-radius: 22px;
    background: rgba(2, 6, 23, 0.44);
    border: 1px solid var(--line);
}

[data-theme="light"] .search-input-wrap {
    background: rgba(241, 245, 249, 0.86);
}

.search-input-wrap input {
    width: 100%;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: 1rem;
}

.search-input-wrap input::placeholder {
    color: var(--muted);
}

.toolbar-row {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 12px;
}

.segmented {
    display: flex;
    gap: 6px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
}

.segmented button {
    border: 0;
    padding: 10px 15px;
    border-radius: 999px;
    color: var(--muted);
    background: transparent;
}

.segmented button.active {
    color: #06101d;
    background: linear-gradient(135deg, var(--accent), var(--green));
    font-weight: 800;
}

.random-btn,
.favorites-toggle {
    padding: 11px 16px;
}

.favorites-toggle.active {
    color: #06101d;
    background: linear-gradient(135deg, #fbbf24, #fb7185);
    font-weight: 800;
}

.main-shell {
    display: grid;
    grid-template-columns: minmax(230px, 285px) 1fr;
    gap: 26px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 clamp(16px, 4vw, 54px) 72px;
}

.category-card,
.prompt-card,
.state-card {
    border: 1px solid var(--line);
    background: var(--card);
    backdrop-filter: blur(18px);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.category-card {
    position: sticky;
    top: 22px;
    align-self: start;
    padding: 18px;
}

.card-head,
.section-head,
.prompt-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.card-head h2,
.section-head h2 {
    margin: 0;
    letter-spacing: -0.04em;
}

.card-head span,
.view-note {
    color: var(--muted);
    font-size: 0.9rem;
}

.category-list {
    display: grid;
    gap: 9px;
    margin-top: 18px;
}

.category-chip {
    width: 100%;
    padding: 12px 14px;
    text-align: left;
    border-radius: 18px;
}

.category-chip.active {
    color: #06101d;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    font-weight: 900;
}

.prompt-area {
    min-width: 0;
}

.section-head {
    margin-bottom: 18px;
}

.view-note code {
    color: var(--accent);
}

.prompt-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.prompt-card {
    position: relative;
    padding: 20px;
    overflow: hidden;
}

.prompt-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.category-pill {
    padding: 8px 11px;
    border-radius: 999px;
    background: rgba(34, 211, 238, 0.12);
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 800;
}

.favorite-btn {
    width: 38px;
    height: 38px;
    font-size: 1.15rem;
}

.favorite-btn.active {
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.6);
}

.prompt-card h3 {
    margin: 18px 0 8px;
    font-size: 1.25rem;
    letter-spacing: -0.03em;
}

.description {
    color: var(--muted);
    margin: 0 0 14px;
    line-height: 1.55;
}

.creator-line {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    max-width: 100%;
    min-height: 28px;
    margin: 0 0 12px;
    padding: 6px 10px;
    border: 1px solid rgba(34, 211, 238, 0.24);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(34, 211, 238, 0.07);
    font-size: 0.82rem;
    line-height: 1.2;
}

.creator-line span {
    color: var(--muted);
    font-weight: 800;
}

.creator-line strong,
.creator-line a {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--accent);
    font-weight: 900;
    text-decoration: none;
}

.creator-line a:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 14px;
}

.tag {
    padding: 5px 8px;
    border: 1px solid var(--line);
    color: var(--muted);
    border-radius: 999px;
    font-size: 0.76rem;
}

.prompt-text {
    margin: 12px 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(2, 6, 23, 0.36);
}

[data-theme="light"] .prompt-text {
    background: rgba(241, 245, 249, 0.84);
}

.prompt-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    color: var(--accent);
    font-size: 0.78rem;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 0.1em;
}

.prompt-text pre {
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    color: var(--text);
    line-height: 1.55;
    font-size: 0.93rem;
}

.placeholder-box {
    margin-top: 12px;
    padding: 14px;
    border-radius: 18px;
    border: 1px dashed rgba(34, 211, 238, 0.42);
    background: rgba(34, 211, 238, 0.06);
}

.placeholder-box h4 {
    margin: 0 0 10px;
}

.placeholder-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.placeholder-grid label span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.8rem;
}

.placeholder-grid input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 10px 12px;
    outline: none;
    color: var(--text);
    background: rgba(2, 6, 23, 0.34);
}

[data-theme="light"] .placeholder-grid input {
    background: rgba(255, 255, 255, 0.86);
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.card-actions button {
    padding: 10px 12px;
    font-size: 0.88rem;
}

.card-actions .copy-current {
    color: #06101d;
    background: linear-gradient(135deg, var(--accent), var(--green));
    border: 0;
    font-weight: 800;
}

.state-card {
    padding: 28px;
    text-align: center;
    color: var(--muted);
}

.hidden {
    display: none !important;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translate(-50%, 22px);
    opacity: 0;
    pointer-events: none;
    padding: 13px 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #06101d;
    background: linear-gradient(135deg, var(--accent), var(--green));
    font-weight: 900;
    box-shadow: var(--shadow);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (max-width: 1100px) {
    .main-shell {
        grid-template-columns: 1fr;
    }

    .category-card {
        position: static;
    }

    .category-list {
        display: flex;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .category-chip {
        width: auto;
        white-space: nowrap;
    }
}

@media (max-width: 760px) {
    .hero {
        padding-top: 16px;
    }

    .top-nav {
        margin-bottom: 34px;
    }

    .admin-link {
        display: none;
    }

    .hero h1 {
        font-size: clamp(2.35rem, 13vw, 4rem);
    }

    .toolbar-row,
    .section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .segmented {
        width: 100%;
        justify-content: space-between;
    }

    .segmented button {
        flex: 1;
    }

    .prompt-grid {
        grid-template-columns: 1fr;
    }

    .placeholder-grid {
        grid-template-columns: 1fr;
    }

    .card-actions button {
        flex: 1 1 calc(50% - 8px);
    }
}

/* Gleich hohe Prompt-Karten + scrollbare Promptfelder */
.prompt-grid {
    align-items: stretch;
}

.prompt-card {
    display: flex;
    flex-direction: column;
    height: 560px;
    min-height: 560px;
    max-height: 560px;
}

.prompt-card-top,
.prompt-card h3,
.description,
.creator-line,
.tag-row,
.placeholder-box,
.card-actions {
    flex-shrink: 0;
}

.prompt-card h3 {
    line-height: 1.25;
}

.prompt-title-btn {
    border: 0 !important;
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    color: var(--text) !important;
    font: inherit;
    font-weight: 900;
    letter-spacing: inherit;
    text-align: left;
    box-shadow: none !important;
    transform: none !important;
}

.prompt-title-btn:hover,
.prompt-title-btn:focus-visible {
    color: var(--accent) !important;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 5px;
    outline: none;
}

.description {
    min-height: 4.65em;
    max-height: 4.65em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.creator-line {
    max-height: 32px;
    overflow: hidden;
}

.tag-row {
    min-height: 28px;
    max-height: 64px;
    overflow: hidden;
}

.prompt-blocks {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

.prompt-text {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
}

.prompt-text pre {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding-right: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(34, 211, 238, 0.72) rgba(148, 163, 184, 0.12);
}

.prompt-text pre::-webkit-scrollbar,
.placeholder-box::-webkit-scrollbar,
.prompt-modal-body::-webkit-scrollbar {
    width: 8px;
}

.prompt-text pre::-webkit-scrollbar-thumb,
.placeholder-box::-webkit-scrollbar-thumb,
.prompt-modal-body::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(34, 211, 238, 0.72);
}

.prompt-text pre::-webkit-scrollbar-track,
.placeholder-box::-webkit-scrollbar-track,
.prompt-modal-body::-webkit-scrollbar-track {
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
}

.placeholder-box {
    max-height: 150px;
    overflow: auto;
}

.card-actions {
    margin-top: 14px;
}

/* Großes Prompt-Popup */
.prompt-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 18px;
}

.prompt-modal.hidden {
    display: none !important;
}

.prompt-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(12px);
}

.prompt-modal-card {
    position: relative;
    width: min(1120px, 100%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 30px;
    background: var(--card-solid);
    box-shadow: 0 34px 120px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

.prompt-modal-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--green));
}

.prompt-modal-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 24px 24px 14px;
    border-bottom: 1px solid var(--line);
}

.prompt-modal-head h2 {
    margin: 14px 0 8px;
    font-size: clamp(1.45rem, 3vw, 2.25rem);
    letter-spacing: -0.05em;
}

.prompt-modal-head p {
    margin: 0 0 12px;
    color: var(--muted);
    line-height: 1.6;
}

.creator-line-modal {
    margin-bottom: 12px;
}

.modal-close {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    font-size: 1.8rem;
    line-height: 1;
}

.modal-close:hover {
    border-color: rgba(251, 113, 133, 0.7);
    color: var(--danger);
}

.prompt-modal-body {
    padding: 18px 24px;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(34, 211, 238, 0.72) rgba(148, 163, 184, 0.12);
}


.prompt-modal-customizer {
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid rgba(34, 211, 238, 0.34);
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.11), rgba(139, 92, 246, 0.10));
}

.prompt-modal-customizer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.prompt-modal-customizer-head h3 {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: -0.03em;
}

.prompt-modal-customizer-head span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.78rem;
    font-weight: 800;
}

.prompt-modal-customizer p {
    margin: 0 0 14px;
    color: var(--muted);
    line-height: 1.55;
    font-size: 0.92rem;
}

.prompt-modal-customizer-empty p {
    margin-bottom: 0;
}

.modal-placeholder-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    max-height: 230px;
    overflow: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(34, 211, 238, 0.72) rgba(148, 163, 184, 0.12);
}

.modal-placeholder-grid::-webkit-scrollbar {
    width: 8px;
}

.modal-placeholder-grid::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(34, 211, 238, 0.72);
}

.modal-placeholder-grid::-webkit-scrollbar-track {
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
}

[data-theme="light"] .prompt-modal-customizer {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.10), rgba(139, 92, 246, 0.08));
}

.prompt-modal-block {
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(2, 6, 23, 0.34);
}

[data-theme="light"] .prompt-modal-block {
    background: rgba(241, 245, 249, 0.86);
}

.prompt-modal-block:last-child {
    margin-bottom: 0;
}

.prompt-modal-block pre {
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    color: var(--text);
    line-height: 1.65;
    font-size: 0.98rem;
}

.prompt-modal-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px 24px 24px;
    border-top: 1px solid var(--line);
}

.prompt-modal-actions button {
    border: 0;
    padding: 12px 16px;
    border-radius: 999px;
    color: #06101d;
    background: linear-gradient(135deg, var(--accent), var(--green));
    font-weight: 900;
}


body.modal-open {
    overflow: hidden;
}

@media (max-width: 760px) {
    .prompt-card {
        height: 620px;
        min-height: 620px;
        max-height: 620px;
    }

    .prompt-modal {
        padding: 10px;
    }

    .prompt-modal-card {
        max-height: 94vh;
        border-radius: 24px;
    }

    .prompt-modal-head {
        padding: 20px 16px 12px;
    }

    .prompt-modal-body {
        padding: 14px 16px;
    }

    .prompt-modal-actions {
        padding: 14px 16px 18px;
    }

    .prompt-modal-actions button {
        flex: 1 1 100%;
    }
}

/* Live-Anpassung im Popup deutlicher sichtbar machen */
.prompt-modal-customizer .placeholder-grid input.has-value {
    border-color: rgba(251, 191, 36, 0.85);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.16), rgba(34, 211, 238, 0.10));
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.10);
}

.prompt-modal-block.has-adjustments {
    border-color: rgba(251, 191, 36, 0.58);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.075), rgba(34, 211, 238, 0.055));
}

.prompt-modal-block.has-adjustments .prompt-label span:first-child::after {
    content: " · " attr(data-adjusted-label);
    color: #fbbf24;
}

.prompt-adjusted-value {
    display: inline;
    padding: 2px 6px;
    border-radius: 8px;
    color: #06101d;
    background: linear-gradient(135deg, #fbbf24, #22d3ee);
    font-weight: 900;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.prompt-placeholder-token {
    display: inline;
    padding: 1px 4px;
    border-radius: 7px;
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.10);
    border: 1px solid rgba(251, 191, 36, 0.24);
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

[data-theme="light"] .prompt-modal-customizer .placeholder-grid input.has-value {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.20), rgba(14, 165, 233, 0.12));
}
