/* ============================================
   NEXT
   Global Styles
   ============================================ */

:root {

    --bg: #0d0d0d;

    --surface: #171717;
    --surface-hover: #1d1d1d;

    --border: #292929;

    --text: #f2f2f2;
    --muted: #8e8e8e;
    --subtle: #5f5f5f;

    --accent: #f1c84b;
    --accent-hover: #f6d467;

    --danger: #d95c5c;

    --radius: 14px;
    --radius-small: 10px;

    --max-width: 760px;
}


/* ============================================
   RESET
   ============================================ */

* {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;

    background: var(--bg);
}

body {

    margin: 0;
    padding: 0;

    background: var(--bg);
    color: var(--text);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    font-size: 16px;
    line-height: 1.5;

    -webkit-font-smoothing: antialiased;
}

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

button,
input,
textarea {
    font: inherit;
}

button {
    border: 0;
}

img {
    max-width: 100%;
    display: block;
}


/* ============================================
   APP
   ============================================ */

.app {

    min-height: 100vh;

    padding-bottom: 82px;
}


/* ============================================
   HEADER
   ============================================ */

.top-header {

    height: 64px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 18px;

    border-bottom: 1px solid var(--border);

    position: sticky;
    top: 0;

    z-index: 100;

    background: rgba(13, 13, 13, 0.94);

    backdrop-filter: blur(12px);
}

.logo {

    color: var(--text);

    font-size: 18px;
    font-weight: 800;

    letter-spacing: 3px;
}

.icon-button {

    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: transparent;
    color: var(--muted);

    font-size: 23px;

    border-radius: 50%;

    cursor: pointer;

    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.icon-button:hover {

    background: var(--surface);

    color: var(--text);
}


/* ============================================
   PAGE
   ============================================ */

.page-content {

    width: 100%;
    max-width: var(--max-width);

    margin: 0 auto;

    padding: 0 18px;
}


/* ============================================
   START SECTION
   ============================================ */

.start-section {

    padding: 48px 0 42px;
}

.eyebrow {

    margin-bottom: 8px;

    color: var(--accent);

    font-size: 11px;
    font-weight: 700;

    letter-spacing: 1.8px;

    text-transform: uppercase;
}

.start-section h1 {

    margin: 0 0 24px;

    color: var(--text);

    font-size: 32px;
    line-height: 1.15;

    font-weight: 700;

    letter-spacing: -0.7px;
}


/* ============================================
   INPUT
   ============================================ */

.story-input {

    width: 100%;

    min-height: 58px;

    padding: 16px 17px;

    border: 1px solid var(--border);

    border-radius: var(--radius);

    background: var(--surface);

    color: var(--text);

    outline: none;

    font-size: 16px;

    transition:
        border-color 0.15s ease,
        background 0.15s ease,
        box-shadow 0.15s ease;
}

.story-input::placeholder {
    color: var(--subtle);
}

.story-input:focus {

    border-color: var(--accent);

    background: #191919;

    box-shadow:
        0 0 0 3px rgba(241, 200, 75, 0.08);
}


/* ============================================
   BUTTONS
   ============================================ */

.primary-button {

    width: 100%;

    min-height: 50px;

    margin-top: 12px;

    padding: 13px 18px;

    border-radius: var(--radius-small);

    background: var(--accent);

    color: #111;

    font-size: 13px;
    font-weight: 800;

    letter-spacing: 0.6px;

    cursor: pointer;

    transition:
        background 0.15s ease,
        transform 0.1s ease;
}

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

.primary-button:active {
    transform: scale(0.99);
}


/* ============================================
   SECTIONS
   ============================================ */

.story-section {

    padding: 0 0 38px;
}

.section-header {

    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 14px;
}

.section-header h2 {

    margin: 0;

    font-size: 13px;
    font-weight: 700;

    letter-spacing: 1.1px;

    text-transform: uppercase;
}

.section-header a {

    color: var(--accent);

    font-size: 12px;
    font-weight: 600;
}

.section-header a:hover {
    color: var(--accent-hover);
}


/* ============================================
   STORY LIST
   ============================================ */

.story-list {

    display: flex;
    flex-direction: column;

    gap: 9px;
}

.story-card {

    display: flex;
    align-items: center;

    min-height: 112px;

    padding: 17px;

    border: 1px solid var(--border);

    border-radius: var(--radius);

    background: var(--surface);

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}

.story-card:hover {

    background: var(--surface-hover);

    border-color: #383838;

    transform: translateY(-1px);
}

.story-card-content {

    min-width: 0;

    flex: 1;
}

.story-card h3 {

    margin: 0 0 5px;

    color: var(--text);

    font-size: 16px;
    line-height: 1.3;

    font-weight: 650;

    overflow: hidden;

    text-overflow: ellipsis;
}

.story-author {

    margin: 0 0 11px;

    color: var(--muted);

    font-size: 12px;
}

.story-meta {

    display: flex;
    align-items: center;

    gap: 12px;

    color: var(--subtle);

    font-size: 12px;
}

.story-arrow {

    flex-shrink: 0;

    margin-left: 12px;

    color: var(--subtle);

    font-size: 27px;

    line-height: 1;

    transition: color 0.15s ease;
}

.story-card:hover .story-arrow {
    color: var(--accent);
}


/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {

    padding: 28px 18px;

    border: 1px dashed var(--border);

    border-radius: var(--radius);

    text-align: center;
}

.empty-state p {

    margin: 0 0 4px;

    color: var(--text);

    font-size: 14px;
}

.empty-state span {

    color: var(--muted);

    font-size: 12px;
}


/* ============================================
   BOTTOM NAV
   ============================================ */

.bottom-nav {

    position: fixed;

    left: 0;
    right: 0;
    bottom: 0;

    z-index: 100;

    height: 70px;

    display: flex;
    align-items: stretch;
    justify-content: center;

    background: rgba(17, 17, 17, 0.97);

    border-top: 1px solid var(--border);

    backdrop-filter: blur(14px);
}

.nav-item {

    width: 25%;
    max-width: 120px;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 3px;

    color: var(--subtle);

    font-size: 10px;
    font-weight: 600;

    transition: color 0.15s ease;
}

.nav-item:hover {
    color: var(--text);
}

.nav-item.active {
    color: var(--accent);
}

.nav-icon {

    font-size: 19px;

    line-height: 1;
}


/* ============================================
   DESKTOP
   ============================================ */

@media (min-width: 700px) {

    .page-content {

        padding-left: 24px;
        padding-right: 24px;
    }


    .top-header {

        padding-left:
            calc((100% - var(--max-width)) / 2);

        padding-right:
            calc((100% - var(--max-width)) / 2);
    }


    .start-section {

        padding-top: 72px;
        padding-bottom: 58px;
    }


    .start-section h1 {

        font-size: 40px;
    }


    .bottom-nav {

        width: 420px;

        left: 50%;
        right: auto;

        transform: translateX(-50%);

        bottom: 14px;

        border: 1px solid var(--border);

        border-radius: 18px;

        overflow: hidden;
    }


    .app {

        padding-bottom: 100px;
    }

}


/* ============================================
   ACCESSIBILITY
   ============================================ */

:focus-visible {

    outline: 2px solid var(--accent);

    outline-offset: 3px;
}


/* ============================================
   SELECTION
   ============================================ */

::selection {

    background: var(--accent);

    color: #111;
}

/* ============================================
   ADD NEXT PAGE
   ============================================ */

.add-page {
    padding-top: 18px;
    padding-bottom: 110px;
}

.add-header {
    padding: 20px 0 25px;
}

.add-header h1 {

    margin: 5px 0 10px;

    font-size: 28px;
    line-height: 1.2;

    letter-spacing: -0.5px;
}

.add-header p {

    margin: 0;

    color: var(--muted);

    font-size: 14px;
}


/* ============================================
   PARENT PREVIEW
   ============================================ */

.parent-preview {

    margin-bottom: 22px;

    padding: 17px;

    border-left: 2px solid var(--accent);

    background: var(--surface);
}

.preview-label {

    margin-bottom: 9px;

    color: var(--accent);

    font-size: 9px;
    font-weight: 800;

    letter-spacing: 1.2px;
}

.parent-preview p {

    margin: 0;

    color: var(--text);

    font-size: 15px;

    line-height: 1.5;
}


/* ============================================
   ADD FORM
   ============================================ */

.add-form {
    display: flex;
    flex-direction: column;
}

.story-textarea {

    width: 100%;

    min-height: 180px;

    padding: 16px;

    box-sizing: border-box;

    resize: vertical;

    border: 1px solid var(--border);

    border-radius: var(--radius);

    background: var(--surface);

    color: var(--text);

    font-family: inherit;

    font-size: 16px;

    line-height: 1.5;

    outline: none;
}

.story-textarea:focus {

    border-color: var(--accent);
}

.story-textarea::placeholder {

    color: var(--subtle);
}

.character-count {

    margin: 8px 2px 15px;

    color: var(--subtle);

    font-size: 10px;
}


/* ============================================
   ERROR
   ============================================ */

.form-error {

    margin-bottom: 15px;

    padding: 12px 14px;

    border: 1px solid #522727;

    border-radius: var(--radius);

    background: #211313;

    color: #e58b8b;

    font-size: 13px;

    line-height: 1.4;
}


/* ============================================
   ADD NOTE
   ============================================ */

.add-note {

    margin: 18px 8px 0;

    color: var(--subtle);

    font-size: 11px;

    line-height: 1.5;

    text-align: center;
}

/* ============================================
   WAITING MESSAGE
   ============================================ */

.waiting-message {

    margin-top: 14px;

    padding: 18px;

    border: 1px solid var(--border);

    border-radius: var(--radius);

    background: var(--surface);

    text-align: center;
}

.waiting-title {

    color: var(--accent);

    font-size: 12px;

    font-weight: 700;

    margin-bottom: 6px;
}

.waiting-text {

    color: var(--muted);

    font-size: 11px;

    line-height: 1.5;
}

/* ============================================
   STORY BRANCH HINT
   ============================================ */

.branch-hint {

    margin: 14px 8px 40px;

    color: var(--subtle);

    font-size: 11px;

    line-height: 1.5;

    text-align: center;
}

/* ============================================
   ADD NEXT MODAL
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;

    display: flex;
    align-items: flex-end;
    justify-content: center;

    padding: 18px;

    background: rgba(0, 0, 0, 0.78);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease;
}

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


.next-modal {
    position: relative;

    width: 100%;
    max-width: 680px;

    max-height: 90vh;
    overflow-y: auto;

    padding: 26px 20px 24px;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    background: var(--surface);

    transform: translateY(30px);

    transition:
        transform 0.2s ease;
}

.modal-visible .next-modal {
    transform: translateY(0);
}


.modal-close {
    position: absolute;

    top: 10px;
    right: 12px;

    width: 36px;
    height: 36px;

    padding: 0;

    background: transparent;

    color: var(--muted);

    font-size: 27px;
    line-height: 1;

    cursor: pointer;
}

.modal-close:hover {
    color: var(--text);
}


.next-modal h2 {
    margin: 0 0 20px;

    color: var(--text);

    font-size: 24px;
    line-height: 1.2;
}


/* ============================================
   MODAL PARENT STORY LINE
   ============================================ */

.modal-parent {
    margin-bottom: 18px;

    padding: 15px;

    border-left: 2px solid var(--accent);

    background: #101010;
}

.modal-parent p {
    margin: 0;

    color: var(--text);

    font-size: 14px;
    line-height: 1.5;
}


/* ============================================
   MODAL TEXTAREA
   ============================================ */

.modal-parent + .add-form .story-textarea {
    min-height: 150px;
}


/* ============================================
   PREVENT PAGE SCROLL
   ============================================ */

body.modal-open {
    overflow: hidden;
}

/* ============================================
   MY STORIES
   ============================================ */

.page-header {
    padding: 30px 0 25px;
}

.page-header h1 {
    margin: 0 0 10px;
    font-size: 30px;
}

.page-header p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}


.story-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}


.story-card {
    display: flex;
    align-items: center;
    gap: 15px;

    padding: 17px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--surface);

    color: inherit;
    text-decoration: none;

    transition:
        background .15s ease,
        border-color .15s ease,
        transform .15s ease;
}

.story-card:hover {
    background: #191919;
    border-color: #3a3a3a;
    transform: translateX(2px);
}


.story-card-main {
    flex: 1;
    min-width: 0;
}


.story-card h2 {
    margin: 5px 0 12px;

    font-size: 17px;
    line-height: 1.3;

    color: var(--text);
}


.story-card-stats {
    display: flex;
    gap: 14px;

    color: var(--subtle);

    font-size: 9px;
    font-weight: 700;
}


.story-card-arrow {
    color: var(--subtle);
    font-size: 23px;
}


.empty-state {
    padding: 50px 25px;

    border: 1px dashed var(--border);
    border-radius: 10px;

    text-align: center;
}


.empty-icon {
    margin-bottom: 15px;

    color: var(--accent);

    font-size: 32px;
}


.empty-state h2 {
    margin: 0 0 9px;

    font-size: 20px;
}


.empty-state p {
    max-width: 280px;
    margin: 0 auto 22px;

    color: var(--muted);

    font-size: 12px;
    line-height: 1.5;
}

/* ============================================
   SECTION HEADING
   ============================================ */

.section-heading {
    margin: 28px 0 12px;

    color: var(--subtle);

    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1px;
}


/* ============================================
   RECENT HISTORY
   ============================================ */

.recent-history {
    margin-top: 34px;
    padding-bottom: 30px;
}

/* ============================================
   EXPLORE
   ============================================ */

.explore-section {
    margin-top: 32px;
}


.random-story {
    margin-top: 20px;
    padding: 22px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: var(--surface);
}


.random-story h2 {
    margin: 7px 0 8px;

    font-size: 21px;
}


.random-story p {
    margin: 0 0 18px;

    color: var(--muted);

    font-size: 12px;
}


.random-button {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 13px 15px;

    border-radius: 7px;

    background: #ba5b0d;

    color: #fff;

    text-decoration: none;

    font-size: 10px;
    font-weight: 800;
    letter-spacing: .5px;
}


.random-button span {
    font-size: 16px;
}


.story-preview {
    margin: 0 0 12px;

    color: var(--muted);

    font-size: 11px;
    line-height: 1.5;
}


.explore-section .story-card {
    align-items: center;
}

.moderation-error {
    margin: 0 0 20px;
    padding: 16px 18px;
    border: 1px solid #8f3028;
    border-radius: 10px;
    background: #241514;
}

.moderation-error-title {
    color: #ff8b7d;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 7px;
}

.moderation-error-text {
    color: #f0d7d4;
    font-size: 14px;
    line-height: 1.5;
}

.moderation-error-help {
    margin-top: 8px;
    color: #a99592;
    font-size: 13px;
}

/* ============================================
   GUIDELINES PAGE
   ============================================ */

.guidelines-page {
    padding-bottom: 110px;
}

.guidelines-intro {
    padding: 18px 0 35px;
}

.guidelines-intro h1 {
    margin: 8px 0 18px;
    font-size: 32px;
    line-height: 1.12;
}

.guidelines-lead {
    margin: 0 0 12px;
    color: #b8b8b8;
    font-size: 16px;
    line-height: 1.65;
}

.guidelines-section {
    padding: 30px 0;
    border-top: 1px solid #292929;
}

.guidelines-label {
    margin-bottom: 8px;
    color: #ba5b0d;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.guidelines-section h2 {
    margin: 0 0 14px;
    font-size: 23px;
    line-height: 1.2;
}

.guidelines-section p {
    margin: 0 0 14px;
    color: #b8b8b8;
    font-size: 15px;
    line-height: 1.65;
}

.guidelines-section p:last-child {
    margin-bottom: 0;
}

.guidelines-list {
    margin: 15px 0 18px;
    padding-left: 22px;
}

.guidelines-list li {
    margin-bottom: 10px;
    color: #c8c8c8;
    font-size: 15px;
    line-height: 1.5;
}

.guidelines-prohibited {
    border-top-color: #49302b;
}

.guidelines-prohibited .guidelines-label {
    color: #d06a5b;
}

.guidelines-footer {
    margin-top: 10px;
    padding: 28px 0 20px;
    border-top: 1px solid #292929;
}

.guidelines-footer p {
    margin: 0 0 18px;
    color: #777;
    font-size: 13px;
}

.guidelines-links {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.guidelines-links a {
    color: #ba5b0d;
    font-size: 14px;
    text-decoration: none;
}

.guidelines-links a:hover {
    text-decoration: underline;
}

/* ============================================
   LEGAL PAGES
   ============================================ */

.legal-page {
    padding-bottom: 110px;
}

.legal-intro {
    padding: 18px 0 35px;
}

.legal-intro h1 {
    margin: 8px 0 10px;
    font-size: 32px;
    line-height: 1.12;
}

.legal-updated {
    margin: 0 0 20px;
    color: #666;
    font-size: 12px;
}

.legal-lead {
    margin: 0;
    color: #b8b8b8;
    font-size: 16px;
    line-height: 1.65;
}

.legal-section {
    padding: 30px 0;
    border-top: 1px solid #292929;
}

.legal-label {
    margin-bottom: 8px;
    color: #ba5b0d;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.legal-section h2 {
    margin: 0 0 14px;
    font-size: 22px;
    line-height: 1.2;
}

.legal-section p {
    margin: 0 0 14px;
    color: #b8b8b8;
    font-size: 15px;
    line-height: 1.65;
}

.legal-section p:last-child {
    margin-bottom: 0;
}

.legal-list {
    margin: 15px 0 18px;
    padding-left: 22px;
}

.legal-list li {
    margin-bottom: 10px;
    color: #c8c8c8;
    font-size: 15px;
    line-height: 1.5;
}

.legal-footer {
    padding: 28px 0 20px;
    border-top: 1px solid #292929;
}

.legal-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.legal-footer-links a {
    color: #ba5b0d;
    font-size: 14px;
    text-decoration: none;
}

.legal-footer-links a:hover {
    text-decoration: underline;
}

.vote-button {

    border: 0;

    padding: 0;

    margin: 0;

    background: transparent;

    color: var(--subtle);

    font: inherit;

    font-size: 15px;

    font-weight: 700;

    line-height: 1;

    cursor: pointer;

}


.vote-button:hover {

    color: var(--text);

}


.vote-button.vote-active {

    color: var(--accent);

}


.vote-score {

    min-width: 14px;

    text-align: center;

    color: var(--text);

}


.vote-button:disabled {

    cursor: default;

}

.vote-control {
    display: inline-flex;
    align-items: center;

    height: 30px;
    padding: 0 5px;

    background: #171717;
    border: 1px solid #333;
    border-radius: 16px;
}


.vote-button {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 24px;
    height: 24px;

    padding: 0;
    margin: 0;

    border: none;
    border-radius: 50%;

    background: transparent;

    color: #888;

    font-size: 17px;
    font-weight: 700;
    line-height: 1;

    cursor: pointer;
}


.vote-button:hover {
    background: #292929;
    color: #fff;
}


.vote-button.vote-active {
    color: #ba5b0d;
}


.vote-score {
    min-width: 22px;

    text-align: center;

    color: #ddd;

    font-size: 13px;
    font-weight: 700;
}


/* ============================================
   DESKTOP
   ============================================ */

@media (min-width: 700px) {

    .modal-overlay {
        align-items: center;
    }

    .next-modal {
        max-width: 560px;

        border-radius: var(--radius);

        transform: translateY(20px);
    }

}