/* 2ch.tw 樣式 - 簡潔實用風格 */

/* ================================================
   Theme Variables (Light Mode - Default)
   ================================================ */
:root {
    --bg-primary: #f5f5f5;
    --bg-secondary: #fff;
    --bg-tertiary: #fafafa;
    --bg-hover: #f0f0f0;
    --bg-code: #f8f8f8;

    --text-primary: #333;
    --text-secondary: #666;
    --text-muted: #999;
    --text-heading: #000;

    --border-primary: #ddd;
    --border-secondary: #e0e0e0;
    --border-dark: #333;

    --accent-color: #333;
    --link-color: #5b8ef4;
    --warning-bg: #fff3cd;
    --warning-border: #ff9800;
    --success-bg: #d4edda;
    --success-text: #155724;
    --error-bg: #f8d7da;
    --error-text: #721c24;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #242424;
    --bg-tertiary: #2a2a2a;
    --bg-hover: #333;
    --bg-code: #2d2d2d;

    --text-primary: #e0e0e0;
    --text-secondary: #aaa;
    --text-muted: #777;
    --text-heading: #fff;

    --border-primary: #444;
    --border-secondary: #3a3a3a;
    --border-dark: #666;

    --accent-color: #888;
    --link-color: #6b9eff;
    --warning-bg: #3d3520;
    --warning-border: #ff9800;
    --success-bg: #1e3a1e;
    --success-text: #7ddf7d;
    --error-bg: #3d1e1e;
    --error-text: #ff8a8a;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", "微軟正黑體", sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: var(--bg-secondary);
    padding: 15px 20px;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--border-dark);
    position: relative;
    overflow: hidden;
}

header h1 {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 2px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95em;
}

/* Header 動態漸層 */
.header-glow {
    position: absolute;
    right: -100px;
    top: 50%;
    transform: translateY(-50%);
    width: 600px;
    height: 180px;
    border-radius: 50%;
    background: linear-gradient(135deg,
        rgba(91, 142, 244, 0.3),
        rgba(147, 112, 219, 0.3),
        rgba(91, 142, 244, 0.3)
    );
    background-size: 200% 200%;
    animation: glowFlow 8s ease-in-out infinite;
    filter: blur(50px);
    pointer-events: none;
}

@keyframes glowFlow {
    0%, 100% { background-position: 0% 50%; opacity: 0.6; }
    50% { background-position: 100% 50%; opacity: 1; }
}

[data-theme="dark"] .header-glow {
    background: linear-gradient(135deg,
        rgba(107, 158, 255, 0.25),
        rgba(167, 139, 250, 0.25),
        rgba(107, 158, 255, 0.25)
    );
    background-size: 200% 200%;
}

@media (max-width: 768px) {
    header {
        padding: 15px 20px;
        margin-bottom: 15px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 0.95em;
    }

    .header-glow {
        display: none;
    }
}

/* Welcome Banner (Homepage only) */
.welcome-banner {
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.welcome-banner img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.welcome-banner:hover img {
    transform: scale(1.02);
}

@media (max-width: 768px) {
    .welcome-banner {
        border-radius: 8px;
        margin: 0 0 20px 0;
        width: 100%;
    }
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 968px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Boards List (左側) */
.boards-list {
    background:
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 10px,
            rgba(0, 0, 0, 0.02) 10px,
            rgba(0, 0, 0, 0.02) 11px
        ),
        var(--bg-secondary);
    padding: 20px;
    border: 1px solid var(--border-primary);
}

[data-theme="dark"] .boards-list {
    background:
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 10px,
            rgba(255, 255, 255, 0.03) 10px,
            rgba(255, 255, 255, 0.03) 11px
        ),
        var(--bg-secondary);
}

.boards-list h2 {
    font-size: 1.3em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-dark);
}

.boards-list nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Sidebar 下方空間 */
.sidebar-fade {
    display: none;
}

/* Mobile: Collapsible boards list */
@media (max-width: 968px) {
    .boards-list {
        padding: 0;
        border: 1px solid var(--border-primary);
        overflow: hidden;
    }

    .boards-list h2 {
        margin: 0;
        padding: 15px 20px;
        border-bottom: none;
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: var(--bg-tertiary);
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }

    .boards-list h2::after {
        content: '▼';
        font-size: 0.7em;
        transition: transform 0.2s;
    }

    .boards-list.expanded h2::after {
        transform: rotate(180deg);
    }

    .boards-list h2:active {
        background: var(--bg-hover);
    }

    .boards-list nav {
        display: none;
        padding: 10px 15px 15px;
        border-top: 1px solid var(--border-primary);
    }

    .boards-list.expanded nav {
        display: flex;
    }

    .sidebar-fade {
        display: none;
    }
}

.board-link {
    display: block;
    padding: 12px 15px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    border-left: 3px solid var(--accent-color);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
}

.board-link:hover {
    background: var(--bg-hover);
    border-left-color: var(--text-heading);
    transform: translateX(2px);
}

.board-link.search-link {
    margin-top: 10px;
    border-left-color: var(--link-color);
    background: var(--bg-secondary);
}

.board-link.search-link:hover {
    border-left-color: var(--link-color);
}

.board-name {
    display: block;
    font-weight: 600;
    font-size: 1.05em;
    margin-bottom: 3px;
}

.board-desc {
    display: block;
    font-size: 0.85em;
    color: var(--text-secondary);
}

/* Rules Content (右側) */
.rules-content {
    background: var(--bg-secondary);
    padding: 30px;
    border: 1px solid var(--border-primary);
}

.rules h2 {
    font-size: 1.8em;
    margin-bottom: 10px;
}

.rules-subtitle {
    color: var(--text-secondary);
    font-size: 0.95em;
    margin-bottom: 20px;
}

.rules hr {
    border: none;
    border-top: 1px solid var(--border-primary);
    margin: 25px 0;
}

.intro {
    background: var(--bg-tertiary);
    padding: 20px;
    border-left: 4px solid var(--border-dark);
    margin-bottom: 20px;
}

.intro p {
    margin-bottom: 12px;
}

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

.rule-section {
    margin-bottom: 25px;
}

.rule-section h3 {
    font-size: 1.3em;
    margin-bottom: 12px;
    color: var(--text-heading);
}

.rule-section ol,
.rule-section ul {
    margin-left: 25px;
    margin-bottom: 12px;
}

.rule-section li {
    margin-bottom: 8px;
}

.rule-section ul ul {
    margin-top: 8px;
}

.rule-section p {
    margin-bottom: 10px;
}

.warning {
    background: var(--warning-bg);
    padding: 12px 15px;
    border-left: 4px solid var(--warning-border);
    margin-top: 12px;
    font-weight: 500;
}

.rule-section strong {
    font-weight: 600;
}

/* Footer */
footer {
    background: var(--bg-secondary);
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--border-primary);
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header {
        padding: 20px;
    }

    header h1 {
        font-size: 2em;
    }

    .rules-content {
        padding: 20px 15px;
    }

    .rules h2 {
        font-size: 1.5em;
    }

    .rule-section h3 {
        font-size: 1.15em;
    }
}

/* ================================================
   Board Page Styles
   ================================================ */

.board-page {
    /* No max-width needed - it's part of grid layout */
}

/* Board Header */
.board-header {
    background: var(--bg-secondary);
    padding: 12px 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border-primary);
    border-left: 4px solid var(--border-dark);
}

.board-header h2 {
    font-size: 1.4em;
    margin-bottom: 4px;
}

.board-description {
    color: var(--text-secondary);
    font-size: 0.95em;
}

/* Breadcrumb Navigation */
.breadcrumb {
    font-size: 0.9em;
    color: var(--text-muted);
    margin-bottom: 15px;
    padding: 8px 0;
}

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

.breadcrumb a:hover {
    text-decoration: underline;
}

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

/* Board Banner */
.board-banner-container {
    margin-bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-tertiary);
    max-height: 280px;
}

.board-banner-container picture {
    display: block;
    width: 100%;
    height: 100%;
}

.board-banner-container img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    object-position: center;
    display: block;
}

.board-banner-container:empty,
.board-banner-container:has(img[src=""]) {
    display: none;
}

@media (max-width: 768px) {
    .board-banner-container {
        max-height: 180px;
        border-radius: 8px;
        max-width: 100%;
        overflow: hidden;
    }

    .board-banner-container img {
        height: 180px;
        max-width: 100%;
        width: 100%;
    }
}

/* Post Form Container */
.post-form-container {
    background: var(--bg-secondary);
    padding: 25px 30px;
    margin-bottom: 20px;
    border: 1px solid var(--border-primary);
}

.post-form-container h3 {
    font-size: 1.3em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-secondary);
}

#post-form input[type="text"],
#post-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1em;
    margin-bottom: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

#post-form textarea {
    line-height: 1.6;
    resize: vertical;
}

#post-form input[type="text"]:focus,
#post-form textarea:focus {
    outline: none;
    border-color: var(--link-color);
    box-shadow: 0 0 0 3px rgba(91, 142, 244, 0.15);
}

[data-theme="dark"] #post-form input[type="text"]:focus,
[data-theme="dark"] #post-form textarea:focus {
    box-shadow: 0 0 0 3px rgba(107, 158, 255, 0.2);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.char-count {
    color: var(--text-muted);
    font-size: 0.9em;
}

#post-form button {
    background: linear-gradient(135deg, #5b8ef4, #7c6cf4);
    color: #fff;
    border: none;
    padding: 10px 30px;
    font-size: 1em;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(91, 142, 244, 0.3);
}

#post-form button:hover:not(:disabled) {
    background: linear-gradient(135deg, #4a7de3, #6b5be3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(91, 142, 244, 0.4);
}

#post-form button:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.message {
    margin-top: 12px;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 0.95em;
}

.message.success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-text);
}

.message.error {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-text);
}

/* Threads Container */
.threads-container {
    background: var(--bg-secondary);
    padding: 25px 30px;
    border: 1px solid var(--border-primary);
}

.threads-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-secondary);
}

.threads-header h3 {
    font-size: 1.3em;
}

/* Sort Tabs */
.sort-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-hover);
    padding: 3px;
    border-radius: 8px;
}

.sort-btn {
    background: transparent;
    border: none;
    padding: 6px 14px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.9em;
    color: var(--text-secondary);
    transition: all 0.2s;
    font-weight: 500;
}

.sort-btn:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .sort-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sort-btn.active {
    background: var(--bg-secondary);
    color: var(--link-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-weight: 600;
    border-bottom: 2px solid var(--link-color);
}

[data-theme="dark"] .sort-btn.active {
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.refresh-btn {
    background: var(--bg-hover);
    border: 1px solid var(--border-primary);
    padding: 6px 16px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.9em;
    transition: all 0.2s;
    color: var(--text-primary);
}

.refresh-btn:hover {
    background: var(--border-secondary);
}

/* Threads List */
.threads-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.thread-item {
    border: 1px solid var(--border-secondary);
    border-left: 3px solid var(--text-muted);
    padding: 15px;
    background: var(--bg-tertiary);
    transition: all 0.2s ease;
    overflow: hidden;
}

.thread-item:hover {
    background: var(--bg-hover);
    border-left-color: var(--link-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .thread-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.thread-content {
    margin-bottom: 10px;
    word-break: break-all;
    overflow-wrap: anywhere;
}

.thread-title {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 5px;
    word-break: break-all;
    overflow-wrap: anywhere;
}

.thread-author,
.post-author,
.reply-author {
    font-size: 0.9em;
    color: var(--text-secondary);
    font-weight: 500;
}

.thread-content p {
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.thread-meta {
    display: flex;
    gap: 15px;
    align-items: center;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.thread-id {
    font-weight: 600;
    color: var(--text-muted);
}

.thread-time {
    color: var(--text-muted);
}

.thread-replies {
    color: var(--text-secondary);
}

.thread-link {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    margin-left: auto;
    padding: 4px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    transition: all 0.2s;
}

.thread-link:hover {
    background: var(--accent-color);
    color: var(--bg-secondary);
    border-color: var(--accent-color);
}

/* Empty/Loading/Error States */
.loading,
.empty,
.error {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 1.05em;
}

.error {
    color: var(--error-text);
}

/* Responsive */
@media (max-width: 768px) {
    .board-page {
        max-width: 100%;
    }

    .board-header,
    .post-form-container,
    .threads-container {
        padding: 20px 15px;
    }

    .board-header h2 {
        font-size: 1.5em;
    }

    .thread-meta {
        flex-wrap: wrap;
        gap: 10px;
    }

    .thread-link {
        margin-left: 0;
        flex-basis: 100%;
        text-align: center;
    }
}

/* ================================================
   Syntax Help Tooltip
   ================================================ */

/* Textarea wrapper for positioning help icon */
.textarea-wrapper {
    position: relative;
}

.textarea-wrapper textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1em;
    margin-bottom: 10px;
    line-height: 1.6;
    resize: vertical;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.textarea-wrapper textarea:focus {
    outline: none;
    border-color: var(--border-dark);
}

/* Help icon */
.syntax-help {
    position: absolute;
    top: 8px;
    right: 8px;
    cursor: help;
}

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--border-secondary);
    color: var(--text-secondary);
    border-radius: 50%;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.syntax-help:hover .help-icon,
.syntax-help:focus .help-icon {
    background: var(--accent-color);
    color: var(--bg-secondary);
}

/* Help tooltip */
.help-tooltip {
    display: none;
    position: absolute;
    top: 28px;
    right: 0;
    width: 420px;
    max-width: 90vw;
    background: var(--bg-secondary);
    border: 1px solid var(--border-dark);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    padding: 16px;
    font-size: 0.9em;
    line-height: 1.5;
}

.syntax-help:hover .help-tooltip,
.syntax-help:focus .help-tooltip,
.syntax-help.active .help-tooltip {
    display: block;
}

.help-title {
    font-weight: 600;
    font-size: 1em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-secondary);
}

.help-section {
    margin-bottom: 12px;
}

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

.help-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.help-tooltip code {
    display: block;
    background: var(--bg-tertiary);
    padding: 6px 8px;
    border: 1px solid var(--border-primary);
    font-family: "SF Mono", "Consolas", "Monaco", monospace;
    font-size: 0.9em;
    color: var(--text-primary);
    margin: 4px 0;
    white-space: pre-wrap;
    word-break: break-all;
}

.help-note {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin: 2px 0;
    padding-left: 4px;
}

.help-footer {
    padding-top: 8px;
    border-top: 1px solid var(--border-secondary);
}

/* Mobile: tap to toggle */
@media (max-width: 768px) {
    .help-tooltip {
        right: -8px;
        width: calc(100vw - 60px);
        max-width: 360px;
    }
}

/* Ensure textarea doesn't overlap with form styles */
#post-form .textarea-wrapper textarea,
#reply-form .textarea-wrapper textarea {
    margin-bottom: 10px;
}

/* ================================================
   Thread Detail Page Styles
   ================================================ */

/* Navigation */
.thread-navigation {
    margin-bottom: 20px;
}

.back-btn {
    background: var(--bg-hover);
    border: 1px solid var(--border-primary);
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.95em;
    transition: all 0.2s;
    color: var(--text-primary);
}

.back-btn:hover {
    background: var(--border-secondary);
}

/* Thread Detail Container */
.thread-detail {
    background: var(--bg-secondary);
    padding: 25px 30px;
    margin-bottom: 20px;
    border: 1px solid var(--border-primary);
}

/* Original Post */
.op-post {
    border-left: 4px solid var(--border-dark);
    padding-left: 20px;
}

.op-post .thread-title {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 12px;
    word-break: break-all;
    overflow-wrap: anywhere;
}

.post-header,
.reply-header {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.post-id,
.reply-id {
    font-weight: 600;
    color: var(--text-heading);
}

/* Share ID - clickable for copying link */
.share-id {
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    padding: 2px 6px;
    border-radius: 4px;
    margin: 0 2px;
}

.share-id:hover {
    background: var(--accent-color);
    color: var(--bg-secondary);
}

/* Copy toast notification */
.copy-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--text-heading);
    color: var(--bg-secondary);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.copy-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.post-time,
.reply-time {
    color: var(--text-muted);
}

.post-board {
    background: var(--bg-hover);
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 500;
}

.post-content,
.reply-content {
    margin-bottom: 12px;
    word-break: break-all;
    overflow-wrap: anywhere;
}

.post-content p,
.reply-content p {
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
}

.post-content a,
.reply-content a {
    color: var(--link-color);
    text-decoration: none;
    word-break: break-all;
}

.post-content a:hover,
.reply-content a:hover {
    text-decoration: underline;
}

.post-meta {
    padding-top: 10px;
    border-top: 1px solid var(--border-secondary);
    font-size: 0.9em;
    color: var(--text-secondary);
}

.reply-count {
    font-weight: 500;
}

/* Archived Thread Styles */
.archived-badge {
    display: inline-block;
    background: var(--text-muted);
    color: var(--bg-secondary);
    font-size: 0.6em;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 10px;
    vertical-align: middle;
    font-weight: 500;
}

.archived-notice {
    display: block;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.9em;
    font-style: italic;
}

.op-post.archived {
    border-left: 4px solid var(--text-muted);
}

/* Reply Form */
.reply-form-container {
    background: var(--bg-secondary);
    padding: 25px 30px;
    margin-bottom: 20px;
    border: 1px solid var(--border-primary);
}

.reply-form-container h3 {
    font-size: 1.3em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-secondary);
}

#reply-form input[type="text"],
#reply-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1em;
    margin-bottom: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

#reply-form textarea {
    line-height: 1.6;
    resize: vertical;
}

#reply-form input[type="text"]:focus,
#reply-form textarea:focus {
    outline: none;
    border-color: var(--link-color);
    box-shadow: 0 0 0 3px rgba(91, 142, 244, 0.15);
}

[data-theme="dark"] #reply-form input[type="text"]:focus,
[data-theme="dark"] #reply-form textarea:focus {
    box-shadow: 0 0 0 3px rgba(107, 158, 255, 0.2);
}

#reply-form button {
    background: linear-gradient(135deg, #5b8ef4, #7c6cf4);
    color: #fff;
    border: none;
    padding: 10px 30px;
    font-size: 1em;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(91, 142, 244, 0.3);
}

#reply-form button:hover:not(:disabled) {
    background: linear-gradient(135deg, #4a7de3, #6b5be3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(91, 142, 244, 0.4);
}

#reply-form button:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Replies Container */
.replies-container {
    background: var(--bg-secondary);
    padding: 25px 30px;
    border: 1px solid var(--border-primary);
}

.replies-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-secondary);
}

.replies-header h3 {
    font-size: 1.3em;
}

.reply-hint {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-left: 12px;
}

@media (max-width: 768px) {
    .reply-hint {
        display: none;
    }
}

/* Replies List */
.replies-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.reply-item {
    border: 1px solid var(--border-secondary);
    border-left: 3px solid var(--text-muted);
    padding: 15px;
    background: var(--bg-tertiary);
}

.reply-number {
    background: var(--border-secondary);
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 0.85em;
    cursor: pointer;
    transition: background 0.2s;
}

.reply-number:hover {
    background: var(--accent-color);
    color: var(--bg-secondary);
}

/* Reply reference links >>N */
.reply-ref {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 500;
}

.reply-ref:hover {
    text-decoration: underline;
}

/* Thread Detail Responsive */
@media (max-width: 768px) {
    .thread-detail,
    .reply-form-container,
    .replies-container {
        padding: 20px 15px;
    }

    .post-header,
    .reply-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .op-post {
        padding-left: 15px;
    }
}

/* ================================================
   Embedded Content Styles (YouTube, Images, Code)
   ================================================ */

/* YouTube embed - responsive wrapper technique */
.embed-youtube {
    margin: 12px 0;
    position: relative;
    width: 100%;
    max-width: 560px;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.embed-youtube iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 4px;
}

/* Image embed */
.embed-image {
    margin: 12px 0;
}

.embed-image img {
    max-width: 100%;
    max-height: 500px;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    cursor: pointer;
}

.embed-image img:hover {
    border-color: var(--text-muted);
}

.image-error {
    display: inline-block;
    padding: 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.9em;
}

.image-fallback-link {
    display: inline-block;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95em;
    transition: all 0.2s;
}

.image-fallback-link:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

/* Code block */
.code-block {
    margin: 12px 0;
    padding: 12px 15px;
    background: var(--bg-code);
    border: 1px solid var(--border-primary);
    border-left: 3px solid var(--accent-color);
    border-radius: 4px;
    overflow-x: auto;
}

.code-block code {
    font-family: "SF Mono", "Consolas", "Monaco", "Menlo", monospace;
    font-size: 0.9em;
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre;
}

/* Link Preview Card */
.link-preview {
    display: flex;
    margin: 12px 0;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-tertiary);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    max-width: 500px;
}

.link-preview:hover {
    border-color: var(--text-muted);
    background: var(--bg-hover);
}

.link-preview-image {
    flex-shrink: 0;
    width: 120px;
    height: 90px;
    object-fit: cover;
    background: var(--border-secondary);
}

.link-preview-content {
    flex: 1;
    padding: 10px 12px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.link-preview-title {
    font-weight: 600;
    font-size: 0.95em;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.link-preview-description {
    font-size: 0.85em;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.link-preview-site {
    font-size: 0.8em;
    color: var(--text-muted);
    margin-top: 4px;
}

@media (max-width: 480px) {
    .link-preview {
        flex-direction: column;
    }

    .link-preview-image {
        width: 100%;
        height: 150px;
    }
}

/* ================================================
   Theme Toggle Button
   ================================================ */
.theme-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--border-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
    z-index: 1000;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* Show sun icon in dark mode, moon icon in light mode */
.theme-toggle .icon-sun {
    display: none;
}

.theme-toggle .icon-moon {
    display: block;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

/* Mobile: smaller and higher position */
@media (max-width: 768px) {
    .theme-toggle {
        width: 42px;
        height: 42px;
        bottom: 15px;
        right: 15px;
        font-size: 18px;
    }
}

/* ================================================
   Bookmark Feature Styles
   ================================================ */

/* Bookmark button in thread title */
.bookmark-container {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 10px;
    vertical-align: middle;
}

.bookmark-btn {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
}

.bookmark-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.bookmark-btn.bookmarked {
    color: #f5a623;
}

.bookmark-btn.bookmarked:hover {
    color: #e09000;
}

/* Bookmark help tooltip */
.bookmark-help {
    position: relative;
    font-size: 0.7em;
    color: var(--text-muted);
    cursor: help;
    padding: 2px 4px;
}

.bookmark-help:hover {
    color: var(--text-secondary);
}

.bookmark-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-dark);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.5;
    white-space: nowrap;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bookmark-help:hover .bookmark-tooltip,
.bookmark-help:focus .bookmark-tooltip {
    display: block;
}

.bookmark-tooltip strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text-heading);
}

/* Bookmark toast notification */
.bookmark-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--text-heading);
    color: var(--bg-secondary);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.bookmark-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Bookmark link in sidebar */
.board-link.bookmark-link {
    margin-top: 5px;
    border-left-color: #f5a623;
}

.board-link.bookmark-link:hover {
    border-left-color: #e09000;
}

.board-link.bookmark-link.active {
    background: var(--bg-hover);
    border-left-color: #f5a623;
}

/* Bookmarks page */
.bookmark-count {
    font-size: 0.9em;
    color: var(--text-muted);
}

.bookmark-notice {
    position: relative;
    font-size: 0.85em;
    color: var(--text-muted);
    cursor: help;
    margin-left: 5px;
}

.bookmark-notice-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-dark);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.5;
    white-space: nowrap;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bookmark-notice:hover .bookmark-notice-tooltip {
    display: block;
}

.bookmark-notice-tooltip strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text-heading);
}

/* Remove bookmark button */
.remove-bookmark-btn {
    background: none;
    border: 1px solid var(--border-primary);
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s;
}

.remove-bookmark-btn:hover {
    background: var(--error-bg);
    border-color: var(--error-text);
    color: var(--error-text);
}

.thread-board {
    background: var(--bg-hover);
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 500;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .bookmark-container {
        display: flex;
        margin-left: 0;
        margin-top: 8px;
    }

    .bookmark-tooltip {
        left: 0;
        transform: none;
        white-space: normal;
        width: 200px;
    }
}

/* ================================================
   Bookmark Floating Sidebar
   ================================================ */

/* Floating Action Button */
.bookmark-fab {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #f5a623;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 12px rgba(245, 166, 35, 0.4);
    transition: all 0.2s;
    z-index: 999;
}

.bookmark-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(245, 166, 35, 0.5);
}

.bookmark-fab:active {
    transform: scale(0.95);
}

/* Badge on FAB */
.bookmark-fab-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #e74c3c;
    color: white;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Overlay */
.bookmark-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
}

.bookmark-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Sidebar */
.bookmark-sidebar {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    max-width: 90vw;
    height: 100%;
    background: var(--bg-secondary);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
    z-index: 1001;
    display: flex;
    flex-direction: column;
}

.bookmark-sidebar.open {
    right: 0;
}

/* Sidebar Header */
.bookmark-sidebar-header {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-tertiary);
}

.bookmark-sidebar-header h3 {
    font-size: 1.2em;
    margin: 0;
    flex: 1;
}

.bookmark-help-inline {
    position: relative;
    font-size: 0.75em;
    color: var(--text-muted);
    cursor: help;
    margin-right: 10px;
}

.bookmark-help-inline:hover .bookmark-tooltip {
    display: block;
}

.bookmark-help-inline .bookmark-tooltip {
    top: 100%;
    left: auto;
    right: 0;
    transform: none;
    margin-top: 8px;
}

.bookmark-sidebar-close {
    background: none;
    border: none;
    font-size: 1.3em;
    cursor: pointer;
    color: var(--text-muted);
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}

.bookmark-sidebar-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Sidebar Content */
.bookmark-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

/* Bookmark List */
.bookmark-sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Bookmark Item */
.bookmark-item {
    display: block;
    position: relative;
    padding: 12px 35px 12px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    border-left: 3px solid #f5a623;
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
}

.bookmark-item:hover {
    background: var(--bg-hover);
    border-left-color: #e09000;
}

.bookmark-item-title {
    font-weight: 500;
    margin-bottom: 5px;
    word-break: break-word;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.bookmark-item-meta {
    font-size: 0.85em;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
}

.bookmark-item-id {
    font-weight: 600;
}

.bookmark-item-board {
    background: var(--bg-hover);
    padding: 1px 6px;
    border-radius: 3px;
}

/* Remove button */
.bookmark-item-remove {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    opacity: 0;
    transition: all 0.2s;
}

.bookmark-item:hover .bookmark-item-remove {
    opacity: 1;
}

.bookmark-item-remove:hover {
    background: var(--error-bg);
    color: var(--error-text);
}

/* New replies badge */
.bookmark-new-badge {
    background: #e74c3c;
    color: white;
    font-size: 0.75em;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* Empty state */
.bookmark-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.bookmark-empty-hint {
    font-size: 0.9em;
    margin-top: 10px;
}

/* Mobile adjustments for sidebar */
@media (max-width: 768px) {
    .bookmark-fab {
        width: 44px;
        height: 44px;
        bottom: 70px;
        right: 15px;
        font-size: 18px;
    }

    .bookmark-sidebar {
        width: 100%;
        max-width: 100%;
        right: -100%;
    }
}

/* ================================================
   Pagination
   ================================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-secondary);
    flex-wrap: wrap;
}

.pagination-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover:not(:disabled):not(.active) {
    background: var(--bg-hover);
    border-color: var(--link-color);
    color: var(--link-color);
}

.pagination-btn.active {
    background: linear-gradient(135deg, #5b8ef4, #7c6cf4);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 8px rgba(91, 142, 244, 0.3);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-ellipsis {
    color: var(--text-muted);
    padding: 0 4px;
    user-select: none;
}

.pagination-info {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-left: 12px;
}

@media (max-width: 768px) {
    .pagination {
        gap: 6px;
    }

    .pagination-btn {
        min-width: 36px;
        height: 36px;
        padding: 0 10px;
        font-size: 0.9em;
    }

    .pagination-info {
        flex-basis: 100%;
        text-align: center;
        margin: 8px 0 0 0;
    }
}

/* ================================================
   Skeleton Loading Animation
   ================================================ */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 25%,
        var(--bg-hover) 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-item {
    border: 1px solid var(--border-secondary);
    border-left: 3px solid var(--bg-hover);
    padding: 15px;
    background: var(--bg-tertiary);
}

.skeleton-title {
    height: 20px;
    width: 70%;
    margin-bottom: 12px;
}

.skeleton-meta {
    display: flex;
    gap: 10px;
    align-items: center;
}

.skeleton-author {
    height: 14px;
    width: 80px;
}

.skeleton-time {
    height: 14px;
    width: 60px;
}

.skeleton-replies {
    height: 14px;
    width: 50px;
    margin-left: auto;
}

/* ================================================
   Back to Top Button
   ================================================ */
.back-to-top {
    position: fixed;
    bottom: 160px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--bg-hover);
    border-color: var(--link-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(91, 142, 244, 0.2);
}

[data-theme="dark"] .back-to-top {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .back-to-top:hover {
    box-shadow: 0 4px 12px rgba(107, 158, 255, 0.3);
}

@media (max-width: 768px) {
    .back-to-top {
        width: 40px;
        height: 40px;
        bottom: 130px;
        right: 15px;
        font-size: 16px;
    }
}

/* ================================================
   Custom Scrollbar
   ================================================ */
/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #5b8ef4, #7c6cf4);
    border-radius: 5px;
    border: 2px solid var(--bg-tertiary);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #4a7de3, #6b5be3);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #5b8ef4 var(--bg-tertiary);
}

/* Dark mode scrollbar adjustments */
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    border-color: var(--bg-primary);
}

[data-theme="dark"] * {
    scrollbar-color: #6b9eff var(--bg-primary);
}
