/* ============================================
   ガチ論 — ガチで議論する匿名掲示板
   ============================================ */

/* --- CSS Custom Properties (Light) --- */
:root {
    --c-primary: #8b1a1a;
    --c-primary-hover: #a52a2a;
    --c-primary-light: rgba(139,26,26,0.08);
    --c-gold: #b8860b;
    --c-gold-light: rgba(184,134,11,0.12);
    --c-teal: #1a7a6d;

    --bg-page: #f0ede6;
    --bg-card: #ffffff;
    --bg-card-alt: #faf9f7;
    --bg-header: linear-gradient(135deg, #1a2332 0%, #2c3e50 100%);
    --bg-input: #ffffff;
    --bg-input-focus: #fffef8;
    --bg-breadcrumb: #e8e5dd;
    --bg-inline-form: #f7f6f3;

    --text-primary: #1a1a1a;
    --text-secondary: #555;
    --text-muted: #888;
    --text-on-header: #ffffff;
    --text-on-header-sub: rgba(255,255,255,0.6);
    --text-link: #2a6496;
    --text-link-visited: #6a3d7a;

    --border: #ddd8d0;
    --border-light: #ebe8e1;
    --border-focus: var(--c-primary);

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-hover: 0 6px 20px rgba(0,0,0,0.10);

    --depth-0: #c0392b;
    --depth-1: #e67e22;
    --depth-2: #f1c40f;
    --depth-3: #27ae60;
    --depth-4: #3498db;
    --depth-5: #9b59b6;

    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
    --container-max: 920px;
    --transition: 0.2s ease;
    --transition-slow: 0.35s ease;
}

/* --- Dark Theme --- */
[data-theme="dark"] {
    --c-primary: #e57373;
    --c-primary-hover: #ef9a9a;
    --c-primary-light: rgba(229,115,115,0.1);
    --c-gold: #ffd54f;
    --c-gold-light: rgba(255,213,79,0.12);
    --c-teal: #4db6ac;

    --bg-page: #121212;
    --bg-card: #1e1e1e;
    --bg-card-alt: #242424;
    --bg-header: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
    --bg-input: #2a2a2a;
    --bg-input-focus: #303030;
    --bg-breadcrumb: #1a1a1a;
    --bg-inline-form: #252525;

    --text-primary: #e0e0e0;
    --text-secondary: #aaa;
    --text-muted: #666;
    --text-on-header: #e0e0e0;
    --text-on-header-sub: rgba(224,224,224,0.5);
    --text-link: #6db3f2;
    --text-link-visited: #b085d6;

    --border: #333;
    --border-light: #2a2a2a;
    --border-focus: #e57373;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    --shadow-hover: 0 6px 20px rgba(0,0,0,0.45);
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Noto Sans JP", "Hiragino Kaku Gothic Pro", "Meiryo", sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    text-decoration: underline;
}

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

h2, h3 {
    font-family: "Noto Serif JP", "Hiragino Mincho Pro", serif;
    color: var(--c-primary);
    font-weight: 700;
}

/* --- Layout --- */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 20px 16px 40px;
}

/* --- Header (Sticky + Gradient) --- */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-header);
    transition: box-shadow var(--transition-slow);
}

.header.scrolled {
    box-shadow: 0 2px 16px rgba(0,0,0,0.25);
}

.header-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.logo {
    font-family: "Noto Serif JP", serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-on-header) !important;
    text-decoration: none !important;
    letter-spacing: 2px;
}

.logo-sub {
    font-size: 11px;
    color: var(--text-on-header-sub);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    color: var(--text-on-header) !important;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    text-decoration: none !important;
    transition: background var(--transition);
}

.nav-link:hover {
    background: rgba(255,255,255,0.1);
    text-decoration: none !important;
}

.nav-icon {
    font-size: 14px;
}

.theme-toggle {
    background: none;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: background var(--transition), border-color var(--transition);
    margin-left: 4px;
}

.theme-toggle:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.4);
}

/* --- Breadcrumb --- */
.breadcrumb {
    background: var(--bg-breadcrumb);
    border-bottom: 1px solid var(--border-light);
}

.breadcrumb-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 8px 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
    color: var(--c-primary);
}

.breadcrumb .sep {
    margin: 0 6px;
    color: var(--text-muted);
}

/* --- Page Header --- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.page-header h2 {
    font-size: 18px;
    margin: 0;
}

/* --- Sort Tabs --- */
.sort-tabs {
    display: flex;
    gap: 2px;
    position: relative;
}

.sort-tab {
    display: inline-block;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary) !important;
    text-decoration: none !important;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    position: relative;
}

.sort-tab:hover {
    color: var(--c-primary) !important;
    background: var(--bg-card-alt);
    text-decoration: none !important;
}

.sort-tab.active {
    color: var(--c-primary) !important;
    border-bottom-color: var(--c-primary);
    background: var(--bg-card);
    font-weight: 700;
}

/* --- Thread Cards --- */
.thread-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.thread-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none !important;
    color: var(--text-primary) !important;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
}

.thread-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    text-decoration: none !important;
}

.thread-card:visited {
    color: var(--text-primary) !important;
}

.thread-card-body {
    display: flex;
    align-items: stretch;
    padding: 14px 18px;
    gap: 16px;
}

.thread-card-content {
    flex: 1;
    min-width: 0;
}

.thread-card-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.thread-card-preview {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 8px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.preview-author {
    font-weight: 500;
    color: var(--text-secondary);
}

.thread-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.meta-item {
    white-space: nowrap;
}

.thread-card-thumb {
    flex-shrink: 0;
    width: 100px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.thread-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- Badges --- */
.badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    vertical-align: middle;
    margin-left: 6px;
    letter-spacing: 0.5px;
}

.badge-hot {
    background: #fff3e0;
    color: #e65100;
}

[data-theme="dark"] .badge-hot {
    background: rgba(230,81,0,0.2);
    color: #ff9800;
}

.badge-new {
    background: #e8f5e9;
    color: #2e7d32;
}

[data-theme="dark"] .badge-new {
    background: rgba(46,125,50,0.2);
    color: #66bb6a;
}

.badge-source {
    background: var(--bg-card-alt);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* --- Thread Detail Header --- */
.thread-header-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--c-primary);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.thread-header-card h2 {
    font-size: 20px;
    line-height: 1.5;
    margin-bottom: 8px;
}

.thread-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

/* --- Source Card --- */
.source-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--c-gold);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.source-image {
    width: 100px;
    height: 68px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    flex-shrink: 0;
}

.source-info {
    font-size: 13px;
}

.source-link {
    color: var(--c-gold) !important;
    font-weight: 700;
    text-decoration: none;
}

.source-link:hover {
    text-decoration: underline !important;
}

/* --- Posts --- */
.posts {
    margin-bottom: 16px;
}

.post {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 6px;
    padding: 12px 16px;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition);
}

.post:nth-child(even) {
    background: var(--bg-card-alt);
}

.post:hover {
    border-color: var(--border);
}

.post.post-focused {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 2px var(--c-primary-light);
}

/* --- Post Header --- */
.post-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    background: var(--c-teal);
}

.post-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--c-primary-light);
    color: var(--c-primary);
    font-weight: 700;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 36px;
}

.post-author {
    font-weight: 500;
    color: var(--text-secondary);
}

.post-date {
    color: var(--text-muted);
    font-size: 11px;
}

.reply-link {
    color: var(--c-primary) !important;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none !important;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.reply-link:hover {
    background: var(--c-primary-light);
    text-decoration: none !important;
}

/* --- Post Body --- */
.post-body {
    font-size: 14px;
    line-height: 1.8;
    padding: 4px 0 8px 36px;
    color: var(--text-primary);
}

/* --- Reactions --- */
.reactions {
    display: flex;
    gap: 4px;
    padding-left: 36px;
    flex-wrap: wrap;
}

.reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 10px;
    font-size: 13px;
    background: var(--bg-card-alt);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-muted);
}

.reaction-btn:hover {
    background: var(--c-primary-light);
    border-color: var(--c-primary);
    transform: scale(1.08);
}

.reaction-btn.active {
    background: var(--c-primary-light);
    border-color: var(--c-primary);
    color: var(--c-primary);
    font-weight: 700;
}

.reaction-btn .rcount:empty {
    display: none;
}

.reaction-btn .rcount {
    font-size: 11px;
    font-weight: 700;
}

/* --- Tree Structure --- */
.post-children {
    margin-left: 20px;
    padding-left: 12px;
    border-left: 3px solid var(--depth-0);
    margin-top: 4px;
    position: relative;
}

.post-children[data-depth="1"] { border-left-color: var(--depth-1); }
.post-children[data-depth="2"] { border-left-color: var(--depth-2); }
.post-children[data-depth="3"] { border-left-color: var(--depth-3); }
.post-children[data-depth="4"] { border-left-color: var(--depth-4); }
.post-children[data-depth="5"] { border-left-color: var(--depth-5); }

.toggle-replies {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
    text-decoration: none !important;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    transition: all var(--transition);
}

.toggle-replies:hover {
    color: var(--c-primary);
    background: var(--c-primary-light);
}

.toggle-icon {
    font-size: 9px;
    transition: transform var(--transition);
}

.children-content {
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

/* --- Inline Reply Form --- */
.inline-reply-form {
    background: var(--bg-inline-form);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin: 8px 0 4px 36px;
}

.inline-reply-form textarea,
.inline-reply-form input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.inline-reply-form textarea:focus,
.inline-reply-form input[type="text"]:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--c-primary-light);
    background: var(--bg-input-focus);
}

.inline-form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.cancel-reply {
    color: var(--text-muted) !important;
    font-size: 12px;
    text-decoration: none !important;
}

.cancel-reply:hover {
    color: var(--c-primary) !important;
    text-decoration: underline !important;
}

/* --- Forms --- */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.form-card-title {
    font-size: 16px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
}

.form-group {
    margin-bottom: 12px;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--c-primary-light);
    background: var(--bg-input-focus);
}

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

.char-counter {
    text-align: right;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.errors {
    list-style: none;
    margin-top: 4px;
}

.errors li {
    color: #c0392b;
    font-size: 12px;
}

[data-theme="dark"] .errors li {
    color: #e57373;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    background: var(--c-primary);
    color: #fff !important;
    border: none;
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    text-decoration: none !important;
}

.btn:hover {
    background: var(--c-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    text-decoration: none !important;
}

.btn:active {
    transform: translateY(0);
}

.btn-small {
    padding: 6px 18px;
    font-size: 12px;
}

/* --- Pagination --- */
.pagination {
    text-align: center;
    padding: 16px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.page-btn {
    display: inline-block;
    padding: 6px 16px;
    background: var(--c-primary);
    color: #fff !important;
    text-decoration: none !important;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    transition: background var(--transition), transform var(--transition);
}

.page-btn:hover {
    background: var(--c-primary-hover);
    transform: translateY(-1px);
    text-decoration: none !important;
}

.page-info {
    color: var(--text-muted);
    font-size: 13px;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 16px;
    font-size: 15px;
}

/* --- Back Link --- */
.back-link {
    font-size: 13px;
    margin-top: 8px;
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border-light);
    margin-top: 20px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
    font-size: 12px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}

.footer-links a:hover {
    color: var(--c-primary);
    text-decoration: underline;
}

.footer-links a:visited {
    color: var(--text-muted);
}

.footer-sub {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.6;
    margin-top: 2px;
}

/* --- Scroll-to-Top --- */
.scroll-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--c-primary);
    color: #fff;
    border: none;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-slow), visibility var(--transition-slow), transform var(--transition);
    z-index: 90;
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    transform: translateY(-2px);
    background: var(--c-primary-hover);
}

/* --- FAB (Mobile Floating Action Button) --- */
.fab {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--c-primary);
    color: #fff;
    border: none;
    font-size: 22px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 90;
    transition: transform var(--transition), background var(--transition);
}

.fab:hover {
    transform: scale(1.08);
    background: var(--c-primary-hover);
}

/* --- Anchor Popup --- */
.anchor-popup {
    position: fixed;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 12px 16px;
    z-index: 200;
    display: none;
    font-size: 13px;
    line-height: 1.6;
    pointer-events: none;
}

.anchor-popup .popup-header {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.anchor-popup .popup-body {
    color: var(--text-primary);
}

/* Anchor link in post body */
.anchor-link {
    color: var(--c-primary) !important;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border-bottom: 1px dashed var(--c-primary);
}

.anchor-link:hover {
    text-decoration: none !important;
    border-bottom-style: solid;
}

/* --- Poll Card --- */
.poll-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.poll-header {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* Poll Buttons (未投票) */
.poll-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.poll-btn {
    flex: 1;
    max-width: 200px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    border: 2px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.poll-btn-a {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border-color: rgba(220, 53, 69, 0.3);
}

.poll-btn-a:hover {
    background: #dc3545;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.poll-btn-b {
    background: rgba(0, 123, 255, 0.1);
    color: #007bff;
    border-color: rgba(0, 123, 255, 0.3);
}

.poll-btn-b:hover {
    background: #007bff;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.poll-vs {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Poll Results (投票済) */
.poll-result {
    text-align: center;
}

.poll-bar-container {
    margin-bottom: 8px;
}

.poll-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
}

.poll-bar-label:last-of-type {
    margin-bottom: 0;
    margin-top: 4px;
}

.poll-choice-a {
    color: #dc3545;
    font-weight: 700;
}

.poll-choice-b {
    color: #007bff;
    font-weight: 700;
}

.poll-pct {
    font-weight: 700;
    color: var(--text-secondary);
}

.poll-bar {
    display: flex;
    height: 28px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-card-alt);
    border: 1px solid var(--border-light);
}

.poll-bar-fill {
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    min-width: 0;
}

.poll-bar-a {
    background: linear-gradient(135deg, #dc3545, #e74c5c);
}

.poll-bar-b {
    background: linear-gradient(135deg, #007bff, #339aff);
}

.poll-total {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

.poll-voted-msg {
    font-size: 12px;
    color: var(--c-teal);
    font-weight: 500;
    margin-top: 4px;
}

/* Vote Badge (派閥バッジ) */
.vote-badge {
    display: none;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    vertical-align: middle;
}

.vote-badge.badge-a {
    display: inline-block;
    background: rgba(220, 53, 69, 0.12);
    color: #dc3545;
}

.vote-badge.badge-b {
    display: inline-block;
    background: rgba(0, 123, 255, 0.12);
    color: #007bff;
}

[data-theme="dark"] .poll-btn-a {
    background: rgba(220, 53, 69, 0.15);
    border-color: rgba(220, 53, 69, 0.4);
}

[data-theme="dark"] .poll-btn-b {
    background: rgba(0, 123, 255, 0.15);
    border-color: rgba(0, 123, 255, 0.4);
}

[data-theme="dark"] .vote-badge.badge-a {
    background: rgba(220, 53, 69, 0.2);
    color: #ff6b7a;
}

[data-theme="dark"] .vote-badge.badge-b {
    background: rgba(0, 123, 255, 0.2);
    color: #66b3ff;
}

/* Poll Badge on Thread List */
.badge-poll {
    background: #e3f2fd;
    color: #1565c0;
}

[data-theme="dark"] .badge-poll {
    background: rgba(21, 101, 192, 0.2);
    color: #64b5f6;
}

/* Poll fields toggle on create form */
.poll-fields {
    background: var(--bg-card-alt);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
}

#poll-toggle {
    margin-right: 6px;
    vertical-align: middle;
}

/* --- Modal (Shortcuts Help) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    box-shadow: var(--shadow-lg);
    max-width: 360px;
    width: 90%;
}

.modal-content h3 {
    font-size: 16px;
    margin-bottom: 16px;
}

.shortcut-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.shortcut-item kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    padding: 2px 8px;
    background: var(--bg-card-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

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

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-12px); }
    to { opacity: 1; transform: translateX(0); }
}

.fade-in {
    animation: fadeIn 0.4s ease both;
}

.post-animate {
    animation: slideInLeft 0.3s ease both;
}

.post-animate:nth-child(1) { animation-delay: 0s; }
.post-animate:nth-child(2) { animation-delay: 0.04s; }
.post-animate:nth-child(3) { animation-delay: 0.08s; }
.post-animate:nth-child(4) { animation-delay: 0.12s; }
.post-animate:nth-child(5) { animation-delay: 0.16s; }
.post-animate:nth-child(6) { animation-delay: 0.2s; }
.post-animate:nth-child(7) { animation-delay: 0.24s; }
.post-animate:nth-child(8) { animation-delay: 0.28s; }

/* --- Legal Pages --- */
.legal-page {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 28px 32px;
    box-shadow: var(--shadow-sm);
}

.legal-page h2 {
    font-size: 20px;
    margin-bottom: 4px;
}

.legal-updated {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.legal-page section {
    margin-bottom: 24px;
}

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

.legal-page h3 {
    font-size: 15px;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-light);
}

.legal-page h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 12px 0 6px;
}

.legal-page p {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-primary);
}

.legal-page ul {
    list-style: disc;
    padding-left: 24px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-primary);
}

.legal-page li {
    margin-bottom: 4px;
}

/* === Responsive === */

/* Tablet */
@media screen and (max-width: 768px) {
    .container {
        padding: 16px 12px 32px;
    }

    .header-inner {
        padding: 10px 12px;
    }

    .logo {
        font-size: 18px;
    }

    .logo-sub {
        display: none;
    }

    .thread-card-thumb {
        width: 80px;
    }

    .post-body {
        padding-left: 0;
    }

    .reactions {
        padding-left: 0;
    }

    .inline-reply-form {
        margin-left: 0;
    }

    .thread-header-card h2 {
        font-size: 17px;
    }

    /* Show FAB, hide scroll-top */
    .fab {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .scroll-top {
        bottom: 84px;
        right: 18px;
        width: 36px;
        height: 36px;
        font-size: 15px;
    }
}

/* Mobile */
@media screen and (max-width: 520px) {
    .legal-page {
        padding: 18px 16px;
    }

    .footer-links {
        flex-direction: column;
        gap: 8px;
    }

    .container {
        padding: 12px 8px 24px;
    }

    .header-inner {
        padding: 8px 10px;
    }

    .logo {
        font-size: 16px;
        letter-spacing: 1px;
    }

    .nav-text {
        display: none;
    }

    .nav-link {
        padding: 6px 8px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .sort-tabs {
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .thread-card-body {
        padding: 10px 12px;
    }

    .thread-card-thumb {
        width: 60px;
    }

    .thread-card-title {
        font-size: 14px;
    }

    .thread-card-meta {
        gap: 8px;
        font-size: 11px;
    }

    .post {
        padding: 10px 12px;
        border-radius: var(--radius-sm);
    }

    .post-header {
        font-size: 11px;
        gap: 6px;
    }

    .avatar {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .post-body {
        font-size: 13px;
        line-height: 1.7;
    }

    .post-children {
        margin-left: 8px;
        padding-left: 8px;
    }

    .source-card {
        flex-direction: column;
    }

    .source-image {
        width: 100%;
        height: auto;
        max-height: 160px;
    }

    .form-card {
        padding: 14px 14px;
    }

    .btn {
        width: 100%;
        text-align: center;
        padding: 12px;
    }

    .thread-meta {
        gap: 8px;
    }

    .breadcrumb-inner {
        padding: 6px 10px;
        font-size: 11px;
    }

    .pagination {
        gap: 6px;
    }

    .page-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .modal-content {
        padding: 18px 20px;
    }

    .fab {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
    }
}
