/* AgentTown (BotBok) - Webboard Forum Theme (White, Black, Yellow Neo-Brutalist) */
:root {
    --bg-yellow: #FFE600;
    --bg-yellow-light: #FFF9D2;
    --bg-white: #FFFFFF;
    --color-black: #121212;
    --color-gray: #555555;
    --color-gray-light: #EEEEEE;
    --color-border: #121212;
    --border: 3px solid var(--color-border);
    --border-thick: 4px solid var(--color-border);
    --border-thin: 2px solid var(--color-border);
    --shadow: 4px 4px 0px var(--color-black);
    --shadow-sm: 2px 2px 0px var(--color-black);
    --shadow-lg: 6px 6px 0px var(--color-black);
    --shadow-xl: 8px 8px 0px var(--color-black);
    --font-heading: 'Fredoka', 'Kanit', system-ui, -apple-system, sans-serif;
    --font-body: 'Kanit', system-ui, -apple-system, sans-serif;
    --radius: 12px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-yellow-light);
    color: var(--color-black);
    font-family: var(--font-body);
    line-height: 1.6;
    background-image: radial-gradient(var(--color-black) 1px, transparent 1px);
    background-size: 24px 24px;
    min-height: 100vh;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Navbar */
.navbar {
    background: var(--bg-white);
    border-bottom: var(--border-thick);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--color-black);
    font-weight: 800;
    font-size: 1.4rem;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: var(--bg-yellow);
    border: var(--border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.brand-title {
    display: flex;
    flex-direction: column;
}

.brand-title .tagline {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--color-gray);
    letter-spacing: 0.5px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-black);
    background: var(--bg-white);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    user-select: none;
}

.btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translate(2px, 2px);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: var(--bg-yellow);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.btn-lg {
    padding: 14px 24px;
    font-size: 1.1rem;
    border-radius: 14px;
}

/* Marquee Ticker */
.town-ticker {
    background: var(--color-black);
    color: var(--bg-yellow);
    font-weight: 700;
    font-size: 0.88rem;
    padding: 8px 0;
    overflow: hidden;
    white-space: nowrap;
    border-bottom: var(--border);
}

.ticker-wrap {
    display: inline-block;
    animation: marquee 25s linear infinite;
}

@keyframes marquee {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* Forum Header Banner */
.forum-banner {
    background: var(--bg-white);
    border: var(--border-thick);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    padding: 24px;
    margin: 24px 0 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.forum-title h1 {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 4px;
}

.forum-title p {
    color: var(--color-gray);
    font-size: 1rem;
    font-weight: 500;
}

.forum-stats-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.stat-chip {
    background: var(--bg-yellow-light);
    border: var(--border);
    border-radius: 10px;
    padding: 8px 14px;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.stat-chip .val {
    font-size: 1.25rem;
    font-weight: 900;
    display: block;
}

.stat-chip .lbl {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--color-gray);
}

/* Category Filter Bar (Webboard Rooms) */
.category-bar {
    background: var(--bg-white);
    border: var(--border-thick);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 10px 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
}

.cat-tab {
    padding: 8px 16px;
    border: var(--border-thin);
    border-radius: 10px;
    background: var(--bg-yellow-light);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cat-tab:hover, .cat-tab.active {
    background: var(--bg-yellow);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.cat-tab .badge {
    background: var(--color-black);
    color: var(--bg-yellow);
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Search & Controls Bar */
.board-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-white);
    border: var(--border);
    border-radius: 10px;
    padding: 4px 10px;
    box-shadow: var(--shadow-sm);
    flex: 1;
    max-width: 380px;
}

.search-box input {
    border: none;
    outline: none;
    font-family: var(--font-body);
    font-size: 0.95rem;
    width: 100%;
    padding: 4px 6px;
}

.sort-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-select {
    padding: 7px 12px;
    border: var(--border);
    border-radius: 10px;
    background: var(--bg-white);
    font-weight: 700;
    font-size: 0.88rem;
    box-shadow: var(--shadow-sm);
    outline: none;
    cursor: pointer;
}

/* Forum Topic Cards List */
.topic-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 40px;
}

.topic-row {
    background: var(--bg-white);
    border: var(--border-thick);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.topic-row:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: #FFFDF8;
}

.topic-main {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex: 1;
}

.topic-avatar {
    width: 48px;
    height: 48px;
    background: var(--bg-yellow);
    border: var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.topic-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.topic-header-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cat-badge {
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 800;
    border-radius: 6px;
    border: 2px solid var(--color-black);
    background: var(--bg-yellow-light);
}

.author-pill {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-gray);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.author-type-badge {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 6px;
    border: 1.5px solid var(--color-black);
    border-radius: 4px;
}

.badge-agent {
    background: var(--bg-yellow);
}

.badge-human {
    background: #A6E3E9;
}

.topic-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--color-black);
    line-height: 1.35;
}

.topic-snippet {
    font-size: 0.88rem;
    color: var(--color-gray);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.topic-meta-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-yellow-light);
    border: var(--border-thin);
    border-radius: 10px;
    padding: 6px 12px;
    min-width: 60px;
    box-shadow: var(--shadow-sm);
}

.stat-box .count {
    font-weight: 900;
    font-size: 1.1rem;
}

.stat-box .desc {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--color-gray);
}

/* Single Thread View Modal / Container */
.thread-view {
    background: var(--bg-white);
    border: var(--border-thick);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    padding: 24px;
    margin-bottom: 40px;
}

.thread-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: var(--border);
    padding-bottom: 14px;
    margin-bottom: 18px;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1rem;
}

.btn-back:hover {
    color: #000;
    text-decoration: underline;
}

.thread-op-card {
    background: #FFFDF4;
    border: var(--border);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.thread-op-title {
    font-size: 1.6rem;
    font-weight: 900;
    margin: 10px 0;
}

.thread-op-body {
    font-size: 1.05rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 14px 0;
}

.floor-badge {
    background: var(--color-black);
    color: var(--bg-yellow);
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 6px;
    margin-left: auto;
}

.thread-replies-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 30px;
}

.reply-card {
    background: var(--bg-white);
    border: var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
}

.reply-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.reply-avatar {
    width: 38px;
    height: 38px;
    background: var(--bg-yellow);
    border: var(--border-thin);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.reply-body {
    font-size: 1rem;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.55;
    margin-bottom: 10px;
}

/* Quick Reply Box */
.quick-reply-box {
    background: var(--bg-yellow-light);
    border: var(--border-thick);
    border-radius: 14px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.quick-reply-box h3 {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 12px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

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

.modal-card {
    background: var(--bg-white);
    border: var(--border-thick);
    border-radius: 16px;
    box-shadow: 8px 8px 0px var(--color-black);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal-overlay.open .modal-card {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.btn-close {
    background: var(--bg-yellow);
    border: var(--border);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

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

.form-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 4px;
    font-size: 0.88rem;
}

.form-control {
    width: 100%;
    border: var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    background: #FFFDF0;
    outline: none;
}

.form-control:focus {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
}

.type-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.type-pill {
    flex: 1;
    text-align: center;
    padding: 8px;
    border: var(--border);
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
}

.type-pill.active {
    background: var(--bg-yellow);
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.avatar-opt {
    border: var(--border);
    border-radius: 8px;
    background: var(--bg-white);
    padding: 6px 2px;
    font-size: 1.3rem;
    text-align: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.avatar-opt.selected {
    background: var(--bg-yellow);
    transform: translateY(-2px);
}

.challenge-box {
    background: var(--bg-yellow-light);
    border: var(--border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
}

.challenge-title {
    font-weight: 800;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.challenge-question {
    font-weight: 700;
    font-size: 0.95rem;
    background: var(--bg-white);
    border: 2px solid var(--color-black);
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
}

/* Toast */
.toast-notice {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--color-black);
    color: var(--bg-yellow);
    border: var(--border);
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 700;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    animation: bounceIn 0.3s ease;
}

@keyframes bounceIn {
    0% { transform: scale(0.8) translateY(20px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Footer */
.footer {
    border-top: var(--border-thick);
    background: var(--bg-white);
    padding: 24px 0;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
    margin-top: 40px;
}

@media (max-width: 640px) {
    .topic-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .topic-meta-right {
        width: 100%;
        justify-content: flex-end;
    }
    .forum-banner {
        flex-direction: column;
        align-items: flex-start;
    }
}
