* {
    box-sizing: border-box;
}

:root {
    --bg: #f5f5f7;
    --card: #ffffff;
    --text: #131313;
    --muted: #666666;
    --line: #e7e7ec;

    --accent: #e53935;
    --accent-dark: #c62828;
    --accent-soft: #fff1ef;
    --accent-glow: rgba(229, 57, 53, 0.14);

    --shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
    --radius: 22px;
}

/* =========================
   BASE
========================= */

html,
body {
    overflow-x: hidden;
}

.page-shell,
.feed-list,
.post-card,
.card {
    width: 100%;
    max-width: 100%;
}

a,
button,
input,
select,
textarea {
    font: inherit;
    font-family: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

.page-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px;
}

/* =========================
   HEADER
========================= */

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 8px 0 12px;
    min-height: 110px;
}

.brand-wrap {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.brand-logo-link {
    display: inline-flex;
    align-items: center;
}

.brand-full-logo {
    display: block;
    height: 110px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.main-nav {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.main-nav a {
    padding: 11px 17px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1;
    transition: all 0.18s ease;
}

.main-nav a:hover {
    border-color: var(--accent);
    color: var(--accent-dark);
    box-shadow: 0 6px 16px var(--accent-glow);
}

/* =========================
   HERO
========================= */

.hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 28px;
    align-items: start;
    margin-bottom: 28px;
}

.hero-copy {
    padding: 28px 8px;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 14px;
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.hero-copy h1 {
    font-size: clamp(2.8rem, 5vw, 4.8rem);
    line-height: 0.95;
    margin: 0 0 20px;
    letter-spacing: -0.05em;
}

.hero-copy h1::after {
    content: "";
    display: block;
    width: 92px;
    height: 6px;
    background: var(--accent);
    border-radius: 999px;
    margin-top: 14px;
}

.hero-copy p {
    font-size: 1.12rem;
    color: var(--muted);
    max-width: 40ch;
    line-height: 1.45;
}

/* =========================
   CARDS / FORM
========================= */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.card:hover {
    box-shadow: 0 16px 40px var(--accent-glow);
}

.form-card {
    padding: 20px 22px;
}

.prompt-label {
    display: block;
    font-weight: 800;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

textarea,
input[type="password"] {
    width: 100%;
    border: 1px solid #d8d8df;
    background: #fbfbfd;
    border-radius: 18px;
    padding: 16px;
    resize: vertical;
    min-height: 160px;
    line-height: 1.4;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input[type="password"] {
    min-height: auto;
}

textarea:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(229, 57, 53, 0.08);
}

.form-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin: 10px 0 18px;
    flex-wrap: wrap;
}

.helper-text {
    max-width: 28ch;
    line-height: 1.35;
},
.char-count,
.post-meta,
.stat-sub,
.site-footer {
    color: var(--muted);
    font-size: 0.95rem;
}

.btn {
    border: 0;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    border-radius: 16px;
    padding: 13px 20px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(180deg, var(--accent), var(--accent-dark));
    color: #ffffff;
    border: none;
    box-shadow: 0 10px 20px var(--accent-glow);
}

.btn-primary:hover {
    opacity: 0.96;
}

.btn-danger {
    background: #222222;
    color: #ffffff;
    border: none;
    margin-top: 8px;
}

/* =========================
   WINNER
========================= */

.winner-section {
    margin-bottom: 24px;
}

.winner-card {
    padding: 26px;
    background: linear-gradient(180deg, var(--accent-soft), #ffffff);
    border: 1px solid #ffb3ad;
}

.winner-label {
    font-size: 0.9rem;
    font-weight: 900;
    color: var(--accent-dark);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}

.winner-card h2 {
    font-size: 2rem;
    margin: 0 0 12px;
    letter-spacing: -0.04em;
}

.winner-text {
    font-size: 1.25rem;
    line-height: 1.45;
    margin: 0 0 14px;
}

.winner-votes {
    font-weight: 900;
    color: var(--accent-dark);
    font-size: 1.08rem;
}

/* =========================
   STATS
========================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    padding: 20px;
}

.stat-label {
    color: var(--muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 900;
    margin: 10px 0;
}

/* =========================
   FEED
========================= */

.feed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin: 22px 0 16px;
    flex-wrap: wrap;
}

.feed-header h1,
.feed-header h2 {
    font-size: 2rem;
    margin: 0;
    letter-spacing: -0.04em;
}

.feed-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.feed-links a {
    background: #ffffff;
    border: 1px solid var(--line);
    padding: 10px 14px;
    border-radius: 999px;
    transition: all 0.18s ease;
}

.feed-links a:hover {
    border-color: var(--accent);
    color: var(--accent-dark);
}

.feed-links a.active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

.feed-list {
    display: grid;
    gap: 16px;
}

.post-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    padding: 20px;
    align-items: center;
}

.post-main h3 {
    font-size: 1.7rem;
    line-height: 1;
    margin: 6px 0 12px;
    letter-spacing: -0.04em;
}

.post-content {
    font-size: 1.25rem;
    margin: 0 0 12px;
    line-height: 1.45;
}

.badge {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 999px;
    background: #111111;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.vote-panel {
    min-width: 140px;
    display: flex;
    justify-content: flex-end;
}

.vote-btn {
    border: 0;
    background: linear-gradient(180deg, var(--accent), var(--accent-dark));
    color: #ffffff;
    font-weight: 900;
    font-size: 1.15rem;
    border-radius: 18px;
    padding: 18px 20px;
    cursor: pointer;
    box-shadow: 0 10px 24px var(--accent-glow);
    min-width: 120px;
}

.vote-btn:hover {
    opacity: 0.96;
}

.post-actions {
    margin-top: 10px;
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
}

.post-actions a,
.share-btn {
    color: var(--accent);
    font-weight: 700;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.share-btn {
    background: #fff1ef;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid #ffd2cc;
}

.share-btn:hover {
    border-color: var(--accent);
    background: #fff5f4;
}

/* =========================
   SIMPLE PAGES
========================= */

.simple-page h1 {
    font-size: 2.5rem;
    letter-spacing: -0.04em;
    margin-bottom: 8px;
}

.prose-card {
    padding: 24px;
}

.badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.badge-card {
    padding: 20px;
}

.rules-list {
    margin: 0;
    padding-left: 20px;
    line-height: 1.8;
}

.success {
    background: #e8f5e9;
    color: #1b5e20;
    border-radius: 14px;
    padding: 10px 12px;
    margin-top: 0;
}

.error-banner {
    background: #fff1ef;
    color: var(--accent-dark);
    border: 1px solid #ffd2cc;
    border-radius: 14px;
    padding: 10px 12px;
    margin: 0 0 14px;
    font-weight: 700;
}

.site-footer {
    text-align: center;
    padding: 28px 0 10px;
}

/* =========================
   ADMIN
========================= */

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.admin-kicker {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-dark);
    font-size: 0.85rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.admin-top-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-toolbar {
    padding: 16px 18px;
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.admin-filter-label {
    color: var(--muted);
    font-weight: 700;
}

.admin-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-filter {
    background: #ffffff;
    border: 1px solid var(--line);
    padding: 10px 14px;
    border-radius: 999px;
    transition: all 0.18s ease;
}

.admin-filter:hover {
    border-color: var(--accent);
    color: var(--accent-dark);
}

.admin-filter.active {
    background: #111111;
    color: #ffffff;
    border-color: #111111;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.admin-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.admin-reason {
    color: var(--muted);
    font-size: 0.95rem;
}

.admin-row-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 10px;
}

.admin-inline-form {
    display: inline-block;
}

.admin-link {
    color: var(--accent-dark);
    font-weight: 700;
}

.admin-bottom-nav {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
}

/* =========================
   TOAST / HIGHLIGHT
========================= */

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #111111;
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 14px;
    box-shadow: var(--shadow);
    z-index: 9999;
}

.highlight {
    border: 2px solid var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.highlight-pulse {
    animation: ticPulse 1.2s ease;
}

@keyframes ticPulse {
    0% {
        transform: translateY(0);
        box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.28);
    }
    30% {
        transform: translateY(-2px);
        box-shadow: 0 0 0 8px rgba(229, 57, 53, 0.12);
    }
    100% {
        transform: translateY(0);
        box-shadow: 0 0 0 4px var(--accent-glow);
    }
}

/* =========================
   RESPONSIVE / MOBILE
========================= */

@media (max-width: 900px) {
    html,
    body {
        overflow-x: hidden;
    }

    body {
        padding-bottom: 90px; /* room for bottom nav */
    }

    .page-shell {
        padding: 16px;
    }

    /* Header */
    .site-header {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        min-height: auto;
        padding: 10px 0;
    }

    .brand-wrap {
        justify-content: center;
    }

    .brand-full-logo {
        height: 82px;
    }

    /* Hide desktop nav */
    .main-nav {
        display: none;
    }

    /* Hero */
    .hero {
        display: grid;
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .hero-copy {
        text-align: center;
        padding: 6px 0;
    }

    .hero-copy h1 {
        font-size: 3rem;
    }

    .hero-copy h1::after {
        margin: 0 auto;
    }

    .hero-copy p {
        margin: 0 auto;
        max-width: 34ch;
    }

    /* Cards */
    .form-card,
    .winner-card,
    .stat-card,
    .post-card,
    .prose-card,
    .badge-card {
        width: 100%;
        max-width: 100%;
        padding: 18px;
    }

    textarea {
        width: 100%;
        min-height: 150px;
    }

    .form-row {
        align-items: flex-start;
    }

    .helper-text {
        max-width: 28ch;
        line-height: 1.3;
    }

    .form-card .btn-primary {
        margin-top: 10px;
    }

    /* Stats */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    /* Feed */
    .feed-header {
        gap: 12px;
        align-items: flex-start;
    }

    .feed-links {
        width: 100%;
        gap: 8px;
        flex-wrap: wrap;
    }

    /* Post cards */
    .post-card {
        display: flex;
        flex-direction: column;
        gap: 14px;
        overflow: hidden;
    }

    .post-main,
    .vote-panel {
        width: 100%;
        min-width: 0;
    }

    .post-main h3,
    .post-content,
    .post-meta {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    /* Vote button below */
    .vote-panel {
        order: 2;
        justify-content: flex-start;
    }

    .vote-panel form {
        width: 100%;
    }

    .vote-btn {
        min-width: 110px;
        padding: 16px 18px;
    }

    .post-actions {
        gap: 12px;
    }
}


/* =========================
   SMALL MOBILE
========================= */

@media (max-width: 640px) {

    .page-shell {
        padding: 14px;
    }

    .brand-full-logo {
        height: 72px;
    }

    .hero-copy h1 {
        font-size: 2.4rem;
    }

    .hero-copy p {
        font-size: 1.05rem;
        max-width: 30ch;
    }

    .winner-card h2,
    .feed-header h1,
    .feed-header h2,
    .simple-page h1 {
        font-size: 2rem;
    }

    .winner-text,
    .post-content {
        font-size: 1.1rem;
    }

    .post-main h3 {
        font-size: 1.4rem;
    }

    /* =========================
       MOBILE BOTTOM NAV (FINAL)
    ========================== */

    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9998;

        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;

        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));

        background: rgba(245, 245, 247, 0.96);
        backdrop-filter: blur(10px);

        border-top: 1px solid var(--line);
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.06);
    }

    /* Slider */
    .mobile-bottom-nav-slider {
        position: absolute;
        top: 8px;
        bottom: 8px;
        left: 12px;

        width: calc(25% - 8px);
        border-radius: 14px;

        background: var(--accent);
        transition: transform 0.3s ease;

        z-index: 0;
    }

    /* Nav buttons */
    .mobile-bottom-nav a {
        display: flex;
        align-items: center;
        justify-content: center;

        min-height: 44px;
        padding: 10px 8px;

        border-radius: 14px;

        font-size: 0.9rem;
        font-weight: 700;

        position: relative;
        z-index: 1;

        color: var(--text);
    }

    .mobile-bottom-nav a.active {
        color: #ffffff;
    }
}
/* vote bump */
.vote-btn.bump {
    animation: votePop 0.25s ease;
}

@keyframes votePop {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* =========================
   VOTE ANIMATIONS
========================= */

/* button pop */
.vote-btn.bump {
    animation: votePop 0.25s ease;
}

@keyframes votePop {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* floating +1 */
.vote-float {
    position: fixed;
    color: var(--accent);
    font-weight: 900;
    font-size: 1rem;
    pointer-events: none;
    animation: floatUp 0.8s ease forwards;
    z-index: 9999;
}

@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}
/* Hide mobile nav on desktop */
@media (min-width: 641px) {
    .mobile-bottom-nav {
        display: none;
    }
}