:root {
    --navy: #1b2a3a;
    --navy-dark: #101c28;
    --gold: #c9a24b;
    --gold-light: #e6cf8f;
    --paper: #f7f4ee;
    --ink: #23262b;
    --ink-soft: #4a5058;
    --muted: #6d7580;
    --border: #e1ddd2;
    --danger: #b3452b;
    --radius: 10px;
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --link: var(--navy);
    --heading: var(--navy);
    --alert-bg: #fbf3e0;
    --alert-border: var(--gold-light);
    --alert-error-bg: #fbe9e4;
    --badge-user-bg: #e6e6e6;
    --shadow: rgba(27, 42, 58, 0.05);
    /* Neutral option identity colors - deliberately not red/green so no option reads
       as "the good one" or "the bad one". */
    --opt-a: #4f7ea3;
    --opt-b: #a3824f;
    --opt-c: #7d6a9e;
    --opt-d: #5a9178;
    --opt-e: #a35a6e;
}

[data-theme="dark"] {
    --opt-a: #7fb0d9;
    --opt-b: #d9b076;
    --opt-c: #b09bd6;
    --opt-d: #7fc4a0;
    --opt-e: #d68a9d;
    --gold: #d9b667;
    --gold-light: #ecd8a3;
    --paper: #10161d;
    --ink: #e7e4db;
    --ink-soft: #c9c5b9;
    --muted: #97a1ab;
    --border: #2c3641;
    --danger: #e08067;
    --card-bg: #1a222b;
    --input-bg: #202a34;
    --link: var(--gold-light);
    --heading: #f1ead7;
    --alert-bg: rgba(201, 162, 75, 0.12);
    --alert-border: rgba(201, 162, 75, 0.4);
    --alert-error-bg: rgba(224, 128, 103, 0.15);
    --badge-user-bg: rgba(255, 255, 255, 0.08);
    --shadow: rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: 'Georgia', 'Iowan Old Style', serif;
    line-height: 1.5;
    transition: background-color 0.2s ease, color 0.2s ease;
}

input, textarea, select {
    background: var(--input-bg);
    color: var(--ink);
}

a { color: var(--link); }

.logo {
    font-family: 'Iowan Old Style', Georgia, serif;
    font-weight: bold;
    font-size: 1.4rem;
    color: var(--link);
    text-decoration: none;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}
.logo .dot { color: var(--gold); }
.logo-text-wrap { display: flex; flex-direction: column; line-height: 1.15; }
.logo-title { font-size: 1.6rem; letter-spacing: 0.06em; color: var(--link); }
.logo-subtitle {
    font-family: sans-serif;
    font-size: 0.68rem;
    font-weight: 400;
    letter-spacing: 0.03em;
    color: var(--muted);
    text-transform: none;
}
.logo-mark { flex-shrink: 0; display: block; width: 80px; height: 80px; transition: transform 0.2s ease; }
.logo:hover .logo-mark { transform: rotate(12deg); }

.site-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 1.25rem 3.5rem 1.25rem 2rem;
    background: var(--navy);
    border-bottom: 3px solid var(--gold);
}
.site-header .logo {
    grid-column: 2;
    justify-self: center;
    color: #fff;
}
.site-header nav {
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
}
.site-header nav a { color: var(--gold-light); text-decoration: none; font-family: sans-serif; font-size: 0.92rem; }

.header-actions { position: relative; }
.header-login-link {
    font-weight: 600;
}
.header-avatar {
    display: block;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    border: 1.5px solid var(--gold-light);
    flex-shrink: 0;
}
.header-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gold);
    color: var(--navy-dark);
    font-family: sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
}
.header-bell {
    position: relative;
    display: flex;
    align-items: center;
    color: var(--gold-light);
}
.bell-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: #ff8a6a;
    color: #10161d;
    font-family: sans-serif;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 999px;
    min-width: 15px;
    text-align: center;
}
.hamburger-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 26px;
    height: 22px;
    padding: 0;
}
.hamburger-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--gold-light);
    border-radius: 2px;
    transition: transform 0.15s ease, opacity 0.15s ease;
}
.hamburger-btn-alert span { background: #ff8a6a; }
.hamburger-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.6rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(16, 28, 40, 0.35);
    min-width: 190px;
    padding: 0.5rem 0;
    z-index: 1200;
}
.hamburger-menu.open { display: block; }
.hamburger-menu a, .hamburger-menu-disabled {
    display: block;
    padding: 0.55rem 1rem;
    font-family: sans-serif;
    font-size: 0.9rem;
    color: var(--ink);
    text-decoration: none;
}
.hamburger-menu a:hover { background: var(--paper); }
.hamburger-menu-disabled {
    color: var(--muted);
    opacity: 0.55;
    cursor: not-allowed;
}
.hamburger-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 0.4rem 0;
}

.avatar-upload-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.profile-card {
    text-align: center;
}
.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 1rem;
    border: 3px solid var(--gold);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-avatar .avatar-fallback { font-size: 2.2rem; }
.profile-username {
    margin: 0 0 0.25rem;
    color: var(--heading);
}
.profile-stats {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.profile-stat { display: flex; flex-direction: column; align-items: center; }
.profile-stat-number {
    font-family: 'Iowan Old Style', Georgia, serif;
    font-weight: 700;
    font-size: 1.8rem;
    color: var(--gold);
}
.profile-stat-label {
    font-family: sans-serif;
    font-size: 0.78rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.avatar-preview {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--gold);
    flex-shrink: 0;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-preview .avatar-fallback { font-size: 1.5rem; }
.avatar-upload-controls { display: flex; flex-direction: column; gap: 0.4rem; align-items: flex-start; }
.avatar-upload-status { font-size: 0.8rem; margin: 0; min-height: 1.1em; }

.avatar-cropper-card { max-width: 360px; text-align: center; }
.avatar-cropper-viewport {
    width: 280px;
    height: 280px;
    margin: 0.75rem auto;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}
.avatar-cropper-viewport canvas { display: block; cursor: grab; touch-action: none; }
.avatar-cropper-viewport canvas:active { cursor: grabbing; }
.avatar-zoom-label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-family: sans-serif;
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 0.5rem;
}
.avatar-zoom-label input[type="range"] { width: 100%; }
.avatar-cropper-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.notification-row {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
}
.notification-row:last-child { border-bottom: none; }
.notification-row:hover { background: var(--paper); }
.notification-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}
.notification-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.notification-body { min-width: 0; }
.notification-text { margin: 0 0 0.2rem; font-family: sans-serif; font-size: 0.92rem; color: var(--ink); }
.notification-preview {
    margin: 0 0 0.3rem;
    font-size: 0.95rem;
    color: var(--ink-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.notification-meta { margin: 0; font-family: sans-serif; font-size: 0.75rem; }

.board-list {
    background: var(--card-bg);
    border-radius: 14px;
    border: 1px solid var(--border);
    overflow: hidden;
}
.board-row {
    display: block;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
}
.board-row:last-child { border-bottom: none; }
.board-row:hover { background: var(--paper); }
.board-pin {
    display: inline-block;
    background: var(--gold);
    color: var(--navy-dark, var(--navy));
    font-family: sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    margin-bottom: 0.4rem;
}
.board-title {
    margin: 0 0 0.3rem;
    font-family: 'Iowan Old Style', Georgia, serif;
    font-size: 1.1rem;
    color: var(--heading);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.board-meta {
    margin: 0 0 0.5rem;
    font-family: sans-serif;
    font-size: 0.82rem;
}
.board-counts {
    display: flex;
    gap: 1.1rem;
}
.board-count {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: sans-serif;
    font-size: 0.82rem;
    color: var(--muted);
}
.nav-badge {
    display: inline-block;
    color: #ff8a6a;
    font-weight: 900;
    font-size: 1.1em;
}
.site-header nav a:hover { text-decoration: underline; }
.site-header .muted { color: #cfd6dd; font-family: sans-serif; font-size: 0.92rem; }
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px var(--shadow);
}

.page-title { color: var(--heading); font-size: 1.6rem; margin: 0 0 1.25rem; }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(16, 28, 40, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    z-index: 1000;
}
.modal-card {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 2.25rem 2rem;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(16, 28, 40, 0.35);
    animation: modal-pop 0.28s cubic-bezier(0.2, 0.8, 0.3, 1.2);
}
@keyframes modal-pop {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.modal-icon { margin: 0 auto 1rem; width: 56px; height: 56px; color: var(--heading); }
.modal-icon .logo-mark { width: 56px; height: 56px; }
.modal-card h2 { margin: 0 0 0.6rem; color: var(--heading); font-size: 1.45rem; }
.modal-card p { margin: 0 0 1.5rem; }
.modal-card .btn { width: 100%; }
.confirm-actions { display: flex; gap: 0.75rem; }
.confirm-actions .btn { width: auto; flex: 1; }
#confirm-modal-cancel { background: var(--paper); color: var(--ink); border: 1.5px solid var(--border); }

.appearance-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.85rem;
}
.theme-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--input-bg, var(--card-bg));
    color: var(--ink);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-family: sans-serif;
    font-size: 0.9rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%23202830' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 10px 7px;
}
[data-theme="dark"] .theme-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%23f1ead7' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
}
.theme-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    cursor: pointer;
    flex-shrink: 0;
}
.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.theme-switch-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 999px;
    transition: background-color 0.2s ease;
}
.theme-switch-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}
.theme-switch input:checked + .theme-switch-slider {
    background: var(--gold);
}
.theme-switch input:checked + .theme-switch-slider::before {
    transform: translateX(20px);
}
.theme-switch-nav {
    width: 38px;
    height: 22px;
}
.theme-switch-nav .theme-switch-slider::before {
    width: 16px;
    height: 16px;
}
.theme-switch-nav input:checked + .theme-switch-slider::before {
    transform: translateX(16px);
}

.eyebrow {
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    color: var(--gold);
    font-family: sans-serif;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.date-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: sans-serif;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
}
.nav-link-future {
    opacity: 0.55;
    cursor: pointer;
}
.next-date-message {
    text-align: right;
    font-size: 0.8rem;
    margin: -0.9rem 0 1rem;
    font-style: italic;
}
.date-nav .nav-link {
    color: var(--link);
    text-decoration: none;
    font-weight: 600;
    padding: 0.3rem 0.1rem;
}

.verified-yes { color: var(--opt-d); }
.verified-no { color: var(--danger); }

.submitted-by {
    font-family: sans-serif;
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0 0 0.75rem;
}
.submitted-by strong { color: var(--ink-soft); }

.submit-scenario-link {
    font-family: sans-serif;
    font-size: 0.85rem;
    text-align: center;
    margin: 0 0 1.25rem;
}
.submit-scenario-link a {
    color: var(--gold);
    text-decoration: none;
    font-weight: 600;
}
.submit-scenario-link a:hover { text-decoration: underline; }
.date-nav .nav-link:hover { text-decoration: underline; }
.date-nav .nav-link-next { margin-left: auto; }

.question-text {
    font-size: 1.224rem;
    margin: 0 0 1.5rem;
    color: var(--heading);
}

.options { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 0.75rem; }

.option-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    text-align: left;
    padding: 0.9rem 1.1rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--paper);
    font-family: sans-serif;
    font-size: 1rem;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s ease;
}
.option-btn.opt-a { --opt-color: var(--opt-a); }
.option-btn.opt-b { --opt-color: var(--opt-b); }
.option-btn.opt-c { --opt-color: var(--opt-c); }
.option-btn.opt-d { --opt-color: var(--opt-d); }
.option-btn.opt-e { --opt-color: var(--opt-e); }
.option-btn:hover:not(:disabled) { border-color: var(--opt-color); }
.option-btn:disabled { cursor: default; opacity: 0.85; }
.option-btn.selected { border-color: var(--opt-color); background: var(--card-bg); }

.option-dot {
    position: relative;
    z-index: 2;
    width: 11px;
    height: 11px;
    min-width: 11px;
    border-radius: 50%;
    background: var(--opt-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--opt-color) 20%, transparent);
}

.option-label { position: relative; z-index: 2; font-weight: 600; flex: 1; color: var(--ink-soft); }
.option-pct { position: relative; z-index: 2; font-family: sans-serif; color: var(--muted); font-size: 0.9rem; min-width: 2.5em; text-align: right; }

.option-bar {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: block;
}
.option-bar-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, color-mix(in srgb, var(--opt-color) 35%, transparent), transparent);
    transition: width 0.4s ease;
}

.total-votes { font-family: sans-serif; font-size: 0.85rem; margin: 0; }
.post-vote-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0;
}
.post-vote-info-left .total-votes { margin-top: 0; }
.share-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}
.share-confirm {
    display: inline-block;
    margin-left: 0.6rem;
    font-family: sans-serif;
    font-size: 0.85rem;
    color: var(--opt-d);
    font-weight: 600;
}

.discussion-card h2 { margin-top: 0; color: var(--heading); font-size: 1.3rem; }

.comment-form { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.5rem; }
.reply-form { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.6rem; }
.reply-form textarea {
    width: 100%;
    min-height: 60px;
    padding: 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: sans-serif;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
}
.reply-form textarea:disabled { background: var(--paper); color: var(--muted); cursor: not-allowed; }
.comment-form textarea {
    width: 100%;
    min-height: 90px;
    padding: 1rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    resize: vertical;
    background: var(--input-bg);
    color: var(--ink);
}
.comment-form textarea:disabled { background: var(--paper); color: var(--muted); cursor: not-allowed; }

.edit-form textarea {
    width: 100%;
    min-height: 90px;
    padding: 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    resize: vertical;
    background: var(--input-bg);
    color: var(--ink);
}

.composer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}
.composer-actions-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-left: auto;
}
.send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: var(--gold);
    color: var(--navy-dark);
    cursor: pointer;
    flex-shrink: 0;
    margin-left: auto;
    transition: opacity 0.15s ease, transform 0.1s ease;
}
.send-btn:hover:not(:disabled) { transform: scale(1.06); }
.send-btn:disabled {
    background: var(--border);
    color: var(--muted);
    cursor: not-allowed;
    opacity: 0.7;
}
.composer-gif-btn {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.8rem;
    font-family: sans-serif;
    font-size: 0.85rem;
    color: var(--muted);
    cursor: pointer;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
.composer-gif-btn:hover { border-color: var(--gold); color: var(--ink); }

.gif-attachment {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--paper);
}
.gif-attachment img { max-height: 90px; max-width: 140px; border-radius: 6px; display: block; }
.remove-gif-btn {
    background: none;
    border: none;
    color: var(--danger);
    font-family: sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
}

.comment-gif { max-width: 220px; max-height: 220px; border-radius: 8px; display: block; }

.comment-list { display: flex; flex-direction: column; gap: 0; }

.chat-message-wrap {
    border-top: 1px solid var(--border);
    padding: 0.5rem 0 0.3rem;
}

.chat-row {
    padding: 0.85rem 0.625rem;
    border-radius: 6px;
    transition: background-color 0.1s ease;
}
.chat-message-wrap > .chat-row:hover { background: var(--paper); }

.thread-block {
    border-top: 1px solid var(--border);
    padding: 0.5rem 0 0.3rem;
}
.comment-list > .thread-block:first-child { border-top: none; }
.thread-block > .chat-row:hover { background: var(--paper); }

.thread-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.6rem;
    margin-left: 0.625rem;
    background: none;
    border: none;
    color: var(--link);
    font-family: sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.3rem 0;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
.thread-toggle:hover { text-decoration: underline; }
.thread-toggle-arrow { font-size: 0.6rem; }

.thread-replies {
    margin-top: 0.6rem;
    margin-left: 0.625rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border);
    display: flex;
    flex-direction: column;
}
.thread-reply-item .chat-row {
    border-top: 1px solid var(--border);
    padding: 0.7rem 0.625rem;
    border-radius: 6px;
}
.thread-reply-item .chat-row:hover { background: var(--paper); }
.thread-replies > .thread-reply-item:first-child > .chat-row { border-top: none; }
.thread-reply-item .thread-reply-item {
    margin-top: 0.5rem;
    margin-left: 0.75rem;
    padding-left: 0.75rem;
    border-left: 2px solid var(--border);
}

.comment-meta { font-family: sans-serif; font-size: 0.85rem; margin-bottom: 0.25rem; display: flex; align-items: center; gap: 0.4rem; }
.commenter-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    color: inherit;
}
.commenter-link:hover .voter-name { text-decoration: underline; }
.comment-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.comment-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gold);
    color: var(--navy-dark);
    font-weight: 700;
    font-size: 0.65rem;
}
.comment-body { font-size: 1rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }

.reply-context {
    font-family: sans-serif;
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 0.2rem;
}
.reply-context strong { color: var(--ink-soft); }

.quote-box {
    border-left: 3px solid var(--gold);
    background: var(--paper);
    padding: 0.5rem 0.7rem;
    margin-bottom: 0.75rem;
    border-radius: 0 6px 6px 0;
    font-family: sans-serif;
    font-size: 0.82rem;
    line-height: 1.4;
}
.quote-author {
    display: inline;
    font-weight: 700;
    color: var(--ink-soft);
    text-decoration: none;
}
.quote-author:hover { text-decoration: underline; }
.quote-text-wrap { margin-top: 0.15rem; }
.quote-text { color: var(--muted); font-style: italic; }
.quote-missing { font-style: italic; }
.quote-show-more {
    background: none;
    border: none;
    padding: 0;
    margin-left: 0.35rem;
    color: var(--link);
    font-family: sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}
.quote-show-more:hover { text-decoration: underline; }
.quote-jump {
    display: inline-block;
    margin-top: 0.3rem;
    color: var(--link);
    font-family: sans-serif;
    font-size: 0.76rem;
    font-weight: 600;
    text-decoration: none;
}
.quote-jump:hover { text-decoration: underline; }

@keyframes flash-highlight {
    0%, 100% { background: transparent; }
    30% { background: rgba(201, 162, 75, 0.25); }
}
.flash-highlight { animation: flash-highlight 1.6s ease; border-radius: 6px; }

.comment-actions {
    display: flex;
    gap: 0.9rem;
    margin-top: 0.5rem;
    font-family: sans-serif;
}

.reply-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    background: var(--alert-bg);
    border: 1px solid var(--alert-border);
    border-radius: 8px;
    font-family: sans-serif;
    font-size: 0.85rem;
    color: var(--ink);
}
.reply-chip-name { font-weight: 700; color: var(--gold); }
.reply-chip-clear {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 0 0.25rem;
}
.reply-chip-clear:hover { color: var(--danger); }

.voter-name.opt-a { --opt-color: var(--opt-a); }
.voter-name.opt-b { --opt-color: var(--opt-b); }
.voter-name.opt-c { --opt-color: var(--opt-c); }
.voter-name.opt-d { --opt-color: var(--opt-d); }
.voter-name.opt-e { --opt-color: var(--opt-e); }
.voter-name { color: var(--opt-color, var(--ink)); }
.voter-name-neutral { color: #fff !important; }
.voter-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--opt-color, var(--muted));
    margin-right: 5px;
    vertical-align: middle;
}

.cv-marker {
    color: inherit;
    font: inherit;
    cursor: default;
}

.reaction-tooltip {
    position: fixed;
    z-index: 1300;
    background: var(--navy-dark);
    color: #fff;
    padding: 0.4rem 0.65rem;
    border-radius: 6px;
    font-family: sans-serif;
    font-size: 0.78rem;
    line-height: 1.35;
    max-width: 220px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.reaction-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.6rem;
}
.reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    font-family: sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    line-height: 1.2;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.reaction-pill img { width: 20px; height: 20px; border-radius: 4px; object-fit: cover; display: block; }
.reaction-pill .reaction-count { color: var(--muted); font-size: 0.78rem; }
.reaction-pill.mine { border-color: var(--gold); background: rgba(201, 162, 75, 0.14); }
.reaction-pill:hover { border-color: var(--gold); }

.reaction-add {
    background: none;
    border: 1.5px dashed var(--border);
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font-family: sans-serif;
    font-size: 0.8rem;
    color: var(--muted);
    cursor: pointer;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.reaction-add:hover { border-color: var(--gold); color: var(--ink); }

.scenario-calendar {
    z-index: 1400;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(16, 28, 40, 0.3);
    padding: 0.85rem;
    width: 260px;
    font-family: sans-serif;
}
.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
    font-weight: 700;
    color: var(--heading);
}
.cal-nav {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    color: var(--ink);
    font-size: 0.9rem;
}
.cal-nav:hover { border-color: var(--gold); }
.cal-month-label { font-size: 0.9rem; }
.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.7rem;
    color: var(--muted);
    margin-bottom: 0.25rem;
}
.cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.2rem;
}
.cal-day {
    aspect-ratio: 1;
    border: none;
    border-radius: 5px;
    font-size: 0.78rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cal-day-empty { visibility: hidden; cursor: default; }
.cal-day-available {
    background: rgba(90, 145, 120, 0.18);
    color: var(--ink);
}
.cal-day-available:hover { background: rgba(90, 145, 120, 0.4); }
.cal-day-taken {
    background: rgba(179, 69, 43, 0.15);
    color: var(--muted);
    cursor: not-allowed;
}
.cal-day-current {
    background: var(--gold);
    color: var(--navy-dark);
    font-weight: 700;
}
.cal-legend {
    display: flex;
    justify-content: space-between;
    margin-top: 0.6rem;
    font-size: 0.68rem;
    color: var(--muted);
}
.cal-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.3rem;
    vertical-align: middle;
}
.cal-dot-available { background: rgba(90, 145, 120, 0.6); }
.cal-dot-taken { background: rgba(179, 69, 43, 0.5); }

.picker-panel {
    z-index: 1200;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(16, 28, 40, 0.25);
    padding: 0.6rem;
    max-width: min(320px, 90vw);
}
#emoji-picker-panel {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.15rem;
}
.emoji-option {
    background: none;
    border: none;
    font-size: 1.25rem;
    padding: 0.35rem;
    border-radius: 6px;
    cursor: pointer;
    line-height: 1;
}
.emoji-option:hover { background: var(--paper); }

.gif-picker-panel { width: 300px; }
#gif-search-input {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-family: sans-serif;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    background: var(--input-bg);
    color: var(--ink);
}
.gif-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    max-height: 260px;
    overflow-y: auto;
}
.gif-results p { grid-column: 1 / -1; margin: 0.5rem 0; }
.gif-option {
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    line-height: 0;
}
.gif-option img { width: 100%; height: 60px; object-fit: cover; display: block; border-radius: 6px; }
.gif-option:hover img { outline: 2px solid var(--gold); }

.delete-toggle {
    background: none;
    border: none;
    padding: 0;
    font-family: sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
}
.delete-toggle:hover { color: var(--danger); text-decoration: underline; }

.comment-deleted {
    color: var(--muted);
    font-style: italic;
}

.reply-toggle {
    background: none;
    border: none;
    padding: 0;
    font-family: sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
}
.reply-toggle:hover { color: var(--link); text-decoration: underline; }

.edit-toggle {
    background: none;
    border: none;
    padding: 0;
    font-family: sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
}
.edit-toggle:hover { color: var(--link); text-decoration: underline; }

.edited-marker {
    font-family: sans-serif;
    font-size: 0.78rem;
    color: var(--muted);
    font-style: italic;
}

.quote-toggle-btn {
    background: none;
    border: none;
    padding: 0;
    font-family: sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
}
.quote-toggle-btn:hover { color: var(--gold); text-decoration: underline; }

.lock-note { text-align: center; font-family: sans-serif; font-size: 0.9rem; }

.muted { color: var(--muted); font-family: sans-serif; font-size: 0.9rem; }

.btn {
    display: inline-block;
    font-family: sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.65rem 1.4rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-dark); }
.btn-small { padding: 0.4rem 0.9rem; font-size: 0.85rem; background: var(--gold); color: var(--navy-dark); }

.alert { font-family: sans-serif; font-size: 0.9rem; padding: 0.85rem 1rem; border-radius: 8px; background: var(--alert-bg); border: 1px solid var(--alert-border); margin-bottom: 1rem; }
.alert-error { background: var(--alert-error-bg); border-color: var(--danger); color: var(--danger); }

.empty-state { text-align: center; }

/* Auth pages */
.auth-wrap { max-width: 420px; margin: 4rem auto; padding: 0 1.5rem; text-align: center; }
.auth-wrap .logo { display: inline-flex; justify-content: center; margin: 0 auto 1.5rem; font-size: 2rem; }
.auth-wrap .card { text-align: left; }
.auth-wrap .logo-mark { width: 46px; height: 46px; }
.auth-wrap form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.auth-wrap label { font-family: sans-serif; font-size: 0.9rem; color: var(--muted); display: flex; flex-direction: column; gap: 0.35rem; }
.auth-wrap input {
    padding: 0.65rem 0.8rem;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-family: sans-serif;
    font-size: 1rem;
}

.option-fields { display: flex; gap: 1rem; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 640px) {
    .comment-body {
        font-size: 0.9rem;
    }
    .chat-row {
        padding: 0.75rem;
    }
    .site-header {
        grid-template-columns: auto 1fr;
        grid-template-rows: auto;
        row-gap: 0;
        padding: 0.75rem 1rem;
    }
    .site-header .logo {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
        gap: 0.4rem;
    }
    .site-header .logo-mark {
        width: 48.4px;
        height: 48.4px;
    }
    .site-header .logo-title {
        font-size: 1.4641rem;
    }
    .site-header .logo-subtitle {
        font-size: 0.524rem;
    }
    .site-header nav {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 0.6rem;
        row-gap: 0.4rem;
    }
    .header-avatar {
        width: 28.9px;
        height: 28.9px;
    }
    .header-bell svg {
        width: 17px;
        height: 17px;
    }
    .hamburger-btn {
        width: 22.1px;
        height: 18.7px;
    }
    .container {
        padding: 1.5rem 1rem 3rem;
    }
    .card {
        padding: 1.25rem;
    }
    .discussion-card {
        padding: 0.625rem;
    }
    .options {
        margin-left: -0.625rem;
        margin-right: -0.625rem;
    }
    .question-text {
        font-size: 0.972rem;
    }
    .option-fields {
        flex-direction: column;
        gap: 0.75rem;
    }
    .auth-wrap {
        margin: 2rem auto;
        padding: 0 1rem;
    }
    .admin-table {
        font-size: 0.82rem;
    }
    .admin-table th, .admin-table td {
        padding: 0.5rem 0.4rem;
    }
}
.admin-table { width: 100%; border-collapse: collapse; font-family: sans-serif; font-size: 0.9rem; }
.admin-table th, .admin-table td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); }
.admin-table th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; }
.text-center { text-align: center; }

.sortable-col {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.sortable-col:hover { color: var(--gold); }
.sortable-col::after {
    content: '\2195';
    margin-left: 0.3rem;
    opacity: 0.4;
    font-size: 0.85em;
}
.sortable-col.sorted-asc::after { content: '\2191'; opacity: 1; color: var(--gold); }
.sortable-col.sorted-desc::after { content: '\2193'; opacity: 1; color: var(--gold); }
.admin-form { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem; }
.admin-form label { font-family: sans-serif; font-size: 0.9rem; color: var(--muted); display: flex; flex-direction: column; gap: 0.35rem; }
.char-count-display {
    align-self: flex-end;
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: -0.15rem;
}
.composer-actions .char-count-display {
    align-self: center;
    margin-top: 0;
}
.char-count-warning { color: var(--danger); font-weight: 600; }
.admin-form input, .admin-form textarea { padding: 0.6rem 0.75rem; border: 1.5px solid var(--border); border-radius: 6px; font-family: sans-serif; font-size: 0.95rem; }
.admin-nav { display: flex; gap: 1rem; margin-bottom: 1.5rem; font-family: sans-serif; }
.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-family: sans-serif; }
.role-form { display: flex; gap: 0.5rem; align-items: center; }
.role-form select {
    padding: 0.35rem 0.5rem;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-family: sans-serif;
    font-size: 0.85rem;
    background: var(--input-bg);
    color: var(--ink);
}

.badge-admin { background: var(--gold-light); color: var(--navy-dark); }
.badge-moderator { background: var(--opt-a); color: #fff; }
.badge-user { background: var(--badge-user-bg); color: var(--muted); }
