:root {
    --bg-color: #0f172a;
    --text-color: #e2e8f0;
    --accent-color: #38bdf8;
    --accent-hover: #7dd3fc;
    --header-bg: rgba(15, 23, 42, 0.8);
    --footer-bg: #1e293b;
    --border-color: #334155;
    --font-family: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}

/* Header */
.site-header {
    background-color: var(--header-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 0;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
}

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

.logo a:visited,
.logo a:active,
.logo a:hover {
    color: inherit;
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.main-nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--accent-color);
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--accent-color);
}

/* Hamburger Menu Button */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 101;
    padding: 0;
}

.menu-toggle span {
    width: 100%;
    height: 3px;
    background-color: var(--text-color);
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* Prompt Stats */
.prompt-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
    padding: 0 2rem;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #94a3b8;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-color);
}

/* Categories Nav */
/* Announcement Bar */
.announcement-bar {
    background-color: var(--accent-color);
    color: #0f172a;
    text-align: center;
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    position: sticky;
    top: var(--header-height, 73px);
    /* Below header */
    z-index: 95;
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Categories Nav */
.categories-nav {
    background-color: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(5px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
    position: sticky;
    top: calc(var(--header-height, 73px) + var(--announcement-height, 35px));
    /* Header + Announcement height approx */
    z-index: 90;
}

.nav-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.categories-nav ul {
    list-style: none;
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding: 0 1rem;
    scrollbar-width: none;
    /* Firefox */
    scroll-behavior: smooth;
    flex: 1;
    white-space: nowrap;
}

.categories-nav ul::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari/Opera */
}

/* Nav Buttons */
.nav-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
    flex-shrink: 0;
    z-index: 10;
}

.nav-btn:hover {
    background-color: var(--accent-color);
    color: #0f172a;
    border-color: var(--accent-color);
}

.categories-nav a {
    text-decoration: none;
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    background-color: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    display: inline-block;
}

.categories-nav a:hover,
.categories-nav a.active {
    background-color: var(--accent-color);
    color: #0f172a;
}


/* Prompts Grid */
.prompts-grid {
    display: grid;
    /* 1-column layout for all screens */
    grid-template-columns: 1fr;
    gap: 1.5rem;
    width: 100%;
    max-width: 800px;
    /* Limit line length for readability */
    margin: 0 auto;
    /* Center the column */
    padding-top: 3rem;
    /* Add breathing room as requested */
    opacity: 1;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.prompts-grid.fade-out {
    opacity: 0;
    transform: translateY(10px);
}

.prompts-grid.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.prompt-card {
    background-color: #1e293b;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: auto;
    /* Allow height to fit content in 1 col */
    min-height: auto;
    position: relative;
}

.prompt-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
}

.prompt-text {
    white-space: pre-line;
    overflow-wrap: anywhere;
    font-size: 1.1rem;
    /* Slightly larger for readability */
    color: #f1f5f9;
    /* Lighter text */
    margin-bottom: 1.5rem;

    /* Lighter box styling */
    background-color: #334155;
    /* Slate 700 - Lighter than card bg */
    padding: 1.25rem;
    border-radius: 8px;
    line-height: 1.7;
    border: 1px solid rgba(255, 255, 255, 0.05);

    /* Scroll for long content */
    max-height: 400px;
    /* Approx 12-16 lines */
    overflow-y: auto;

    /* Scrollbar Styling */
    scrollbar-width: thin;
    scrollbar-color: #64748b #334155;
}

.prompt-text::-webkit-scrollbar {
    width: 6px;
}

.prompt-text::-webkit-scrollbar-track {
    background: #334155;
    border-radius: 4px;
}

.prompt-text::-webkit-scrollbar-thumb {
    background-color: #64748b;
    border-radius: 4px;
}

.copy-icon-card {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: #94a3b8;
    opacity: 0.5;
}

.card-comment {
    font-size: 0.8rem;
    color: #94a3b8;
    /* Muted text color */
    margin-bottom: 4px;
    text-align: right;
    /* Match footer alignment */
}

.hashtag {
    cursor: pointer;
    transition: color 0.2s;
}

.hashtag:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.card-footer {
    font-size: 0.8rem;
    color: #94a3b8;
    text-align: right;
    margin-top: auto;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background-color: #1e293b;
    border: 1px solid var(--border-color);
    border-radius: 16px;

    /* Compact Sizing */
    width: auto;
    max-width: 760px;
    max-height: 90vh;
    overflow-y: auto;
    /* Reduced from 800px */

    padding: 2rem;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    display: flex;
    gap: 2rem;
}

.modal-left {
    flex: 1;
    max-width: 200px;
}

.modal-left img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.modal-right {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.source-label {
    font-size: 1.5rem;
    /* Larger font */
    color: var(--accent-color);
    /* Highlight color */
    margin-bottom: 2rem;
    font-weight: 700;
    /* Bold */
    text-align: center;
    /* Center alignment */
    width: 100%;
    margin-top: 1rem;
    /* Add some top space */
}

/* Toast Notification - In-flow Position */
.copy-message {
    color: #4ade80;
    /* Green */
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(-5px);
}

.copy-message.active {
    opacity: 1;
    transform: translateY(0);
    animation: blink 2s infinite ease-in-out;
}

.copy-message.error {
    color: #fca5a5;
    animation: none;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

#modal-title {
    font-size: 1.8rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

#modal-author {
    font-size: 1.2rem;
    color: var(--accent-color);
    margin-bottom: 0.25rem;
}

#modal-year,
#modal-publisher {
    color: #94a3b8;
    margin-bottom: 0.25rem;
}

.store-links {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.store-icon { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; padding: 8px; border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-color); text-decoration: none; }
.store-icon:hover { border-color: var(--accent-color); }
[hidden] { display: none !important; }
.source-page { color: #94a3b8; font-size: 0.85rem; }
.modal-context { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border-color); font-size: 0.9rem; line-height: 1.6; }
.modal-context summary { cursor: pointer; color: var(--accent-color); margin-top: 1rem; }
.modal-context ol { padding-left: 1.5rem; }
.modal-context li { margin: 1rem 0; }
.modal-context li p { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow-y: auto; }
.modal-context button { background: #334155; color: var(--text-color); border: 1px solid var(--border-color); border-radius: 6px; padding: 0.4rem 0.7rem; cursor: pointer; }
.prompt-card:focus-visible, .store-icon:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 4px; }

.store-icon img {
    height: 24px;
    width: 100%;
    object-fit: contain;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.store-icon:hover img {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-body {
        flex-direction: column;
        gap: 1rem;
    }

    .modal-left {
        max-width: 100%;
        text-align: center;
    }

    .modal-left img {
        max-height: 180px;
        width: auto;
    }

    .modal-content {
        width: calc(100vw - 2rem);
        max-width: 420px;
        padding: 1.25rem;
    }

    .modal-left img {
        display: block;
        margin: 0 auto;
        max-height: 140px;
        width: auto;
        max-width: 100%;
    }

    .modal-right {
        text-align: center;
        align-items: center;
    }

    .store-links {
        justify-content: center;
        gap: 0.5rem;
    }

    .source-label { font-size: 1.15rem; margin-top: 0; margin-bottom: 1rem; }
    #modal-title { font-size: 1.35rem; line-height: 1.4; }
    #modal-author { font-size: 1rem; }
    .copy-message { font-size: 0.85rem; }
    .modal-context { margin-top: 1rem; }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .main-nav {
        position: fixed;
        visibility: hidden;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: rgba(15, 23, 42, 0.98);
        backdrop-filter: blur(10px);
        display: flex;
        align-items: center;
        justify-content: center;
        transform: translateY(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 99;
    }

    .main-nav.active {
        transform: translateY(0);
        visibility: visible;
    }

    .main-nav ul {
        flex-direction: column;
        align-items: center;
        gap: 2.5rem;
    }

    .main-nav a {
        font-size: 1.5rem;
    }
}

/* Footer */
.site-footer {
    background-color: var(--footer-bg);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 100px;
    text-align: center;
    color: #94a3b8;
}

.site-footer a {
    color: var(--accent-color);
    text-decoration: none;
}

.site-footer a:visited,
.site-footer a:active,
.site-footer a:hover {
    color: var(--accent-color);
}

/* Screenshot Styling */
.card-screenshot {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 1rem;
    object-fit: cover;
    max-height: 300px;
    display: block;
    background-color: #0f172a;
}

/* Contact Page Section */
#contact-section {
    width: 100%;
    min-height: 80vh;
    /* Fill vertical space roughly */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Top align slightly */
    padding-top: 4rem;
}

.contact-content {
    background-color: #1e293b;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 600px;
    /* Slightly wider */
    padding: 2rem;
    border-radius: 12px;
}

.contact-title {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.5rem;
    color: var(--text-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #94a3b8;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    background-color: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    font-family: inherit;
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.submit-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--accent-color);
    color: #000;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.submit-btn:hover {
    background-color: var(--accent-hover);
}

/* Initial Contact Description */
.contact-desc {
    text-align: center;
    color: #94a3b8;
    margin-bottom: 2rem;
    font-size: 1rem;
}

/* Form Reveal Animation */
.form-reveal {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.5s ease-in-out;
    margin-bottom: 0;
}

.form-reveal.active {
    max-height: 150px;
    /* Approximate height for input group */
    opacity: 1;
    margin-bottom: 1.5rem;
}

/* Phone Input Group */
.phone-input-group {
    display: flex;
    gap: 10px;
}

.custom-select-wrapper {
    position: relative;
    user-select: none;
    width: 140px;
    flex-shrink: 0;
}

.custom-select {
    position: relative;
    width: 100%;
}

.select-selected {
    background-color: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    padding: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.select-selected:after {
    position: absolute;
    content: "";
    top: 50%;
    right: 15px;
    width: 0;
    height: 0;
    border: 6px solid transparent;
    border-color: #fff transparent transparent transparent;
    transform: translateY(-25%);
}

.select-selected.select-arrow-active:after {
    border-color: transparent transparent #fff transparent;
    transform: translateY(-75%);
}

.select-items {
    position: absolute;
    background-color: #1e293b;
    border: 1px solid var(--border-color);
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99;
    border-radius: 6px;
    margin-top: 5px;
    max-height: 200px;
    overflow-y: auto;
}

.select-hide {
    display: none;
}

.select-items div {
    color: var(--text-color);
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.select-items div:hover,
.same-as-selected {
    background-color: var(--accent-color);
    color: #000;
}

/* Static catalog, detail pages and search share the existing portal palette. */
body.modal-open { overflow: hidden; }
.site-content { padding: 2rem 0; }
.site-content a, .sitemap-link a { color: var(--accent-color); }
.page-intro, .breadcrumbs, .search-form, .pagination, .book-panel,
.book-list, .related-prompts, .search-results { max-width: 800px; margin: 0 auto; }
.page-intro { padding: 1.5rem 0 0; overflow-wrap: anywhere; }
.page-intro h1 { font-size: 1.7rem; line-height: 1.5; margin-bottom: .75rem; }
.page-intro p, .breadcrumbs { color: #94a3b8; font-size: .95rem; }
.breadcrumbs { margin-bottom: 1rem; overflow-wrap: anywhere; }
.search-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.search-form label { width: 100%; font-size: .9rem; }
.search-form input { flex: 1; min-width: 0; height: 44px; border: 1px solid var(--border-color); background: #1e293b; color: var(--text-color); border-radius: 6px; padding: .7rem; font: inherit; }
.search-form button, .source-button { min-height: 44px; border: 1px solid var(--accent-color); background: transparent; color: var(--accent-color); padding: .5rem .9rem; border-radius: 6px; cursor: pointer; font: inherit; }
.prompt-title { font-size: 1.05rem; line-height: 1.6; margin-bottom: 1rem; overflow-wrap: anywhere; }
.prompt-title a { text-decoration: none; }
.prompt-title a, .search-result h2 a { display: block; }
.prompt-tags { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; font-size: .85rem; }
.card-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; font-size: .9rem; }
.card-actions a { padding: .5rem 0; }
.card-screenshot { max-width: 100%; height: auto; margin-bottom: 1rem; border-radius: 6px; }
.book-panel { display: flex; align-items: center; gap: 1.5rem; padding: 1.5rem; background: #1e293b; border: 1px solid var(--border-color); border-radius: 12px; margin-top: 2rem; }
.book-panel > div { min-width: 0; overflow-wrap: anywhere; }
.book-panel h2 { font-size: 1.15rem; margin-bottom: .75rem; }
.book-panel p { color: #94a3b8; font-size: .9rem; }
.book-panel-cover { width: 110px; height: auto; flex-shrink: 0; border-radius: 5px; }
.book-list-card > p { margin-top: .5rem; color: #94a3b8; text-align: right; }
.pagination { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; padding-top: 2rem; }
.pagination a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: .4rem .7rem; border: 1px solid var(--border-color); border-radius: 6px; text-decoration: none; }
.pagination a[aria-current] { background: var(--accent-color); color: var(--bg-color); }
.related-prompts { padding-top: 2rem; }
.related-prompts h2 { font-size: 1.1rem; margin-bottom: .75rem; }
.related-prompts ul { padding-left: 1.25rem; }
.related-prompts li { margin: .7rem 0; overflow-wrap: anywhere; }
.search-result { padding: 1.5rem; margin-top: 1.5rem; background: #1e293b; border: 1px solid var(--border-color); border-radius: 12px; overflow-wrap: anywhere; }
.search-result h2 { font-size: 1.1rem; margin-bottom: .5rem; }
.search-result p { color: #94a3b8; margin-top: .5rem; white-space: pre-line; }
.sitemap-link { margin-top: 1rem; }
.close-btn { min-width: 44px; min-height: 44px; }
.modal-context button { min-height: 44px; }
:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 3px; }
.detail-page .prompt-text { max-height: none; }
@media (max-width: 600px) {
    .site-content > .container { padding: 0 1rem; }
    .page-intro h1 { font-size: 1.35rem; }
    .prompt-card { padding: 1rem; }
    .prompt-text { padding: 1rem; font-size: 1rem; }
    .book-panel { padding: 1rem; gap: 1rem; align-items: flex-start; }
    .book-panel-cover { width: 76px; }
    .book-panel h2 { font-size: 1rem; }
    .book-panel .store-links { justify-content: flex-start; }
}
