/* Commonboard — dark editorial night-board */

:root {
    --bg: #0e0f13;
    --bg-panel: #15171e;
    --bg-raised: #1c1f28;
    --line: #262a35;
    --ink: #ece9e2;
    --ink-dim: #8b8fa0;
    --accent: #ffb43a;
    --accent-ink: #1a1200;
    --danger: #ff5c5c;
    --radius: 14px;
}

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

html, body { height: 100%; }

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Space Grotesk', system-ui, sans-serif;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* subtle grain / atmosphere */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(60% 40% at 85% -5%, rgba(255, 180, 58, 0.07), transparent 70%),
        radial-gradient(50% 35% at 0% 110%, rgba(90, 120, 255, 0.05), transparent 70%);
}

/* ---------- topbar ---------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
    width: 14px; height: 14px;
    background: var(--accent);
    border-radius: 3px;
    transform: rotate(45deg);
    box-shadow: 0 0 18px rgba(255, 180, 58, 0.55);
}

.brand h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.topbar-right { display: flex; align-items: center; gap: 18px; }

.conn-status {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--ink-dim);
    display: flex;
    align-items: center;
    gap: 6px;
}
.conn-status::before {
    content: '';
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--danger);
}
.conn-status.online::before { background: #4ade80; box-shadow: 0 0 8px rgba(74, 222, 128, 0.7); }
.conn-status.online { color: #4ade80; }

.who {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--ink-dim);
}
.who input {
    background: var(--bg-raised);
    border: 1px solid var(--line);
    color: var(--accent);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    width: 130px;
    outline: none;
}
.who input:focus { border-color: var(--accent); }

/* ---------- layout ---------- */

.layout {
    flex: 1;
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 18px;
    padding: 18px 22px;
    min-height: 0;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.panel-head h2 {
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-dim);
}

.count-badge {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    background: var(--bg-raised);
    border: 1px solid var(--line);
    padding: 3px 9px;
    border-radius: 20px;
    color: var(--accent);
}

.live-dot-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: #4ade80;
}
.live-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #4ade80;
    animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5); }
    50% { opacity: 0.6; box-shadow: 0 0 0 5px rgba(74, 222, 128, 0); }
}

/* ---------- todos ---------- */

.todo-form {
    display: flex;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.todo-form input {
    flex: 1;
    background: var(--bg-raised);
    border: 1px solid var(--line);
    color: var(--ink);
    font-family: inherit;
    font-size: 14px;
    padding: 10px 13px;
    border-radius: 10px;
    outline: none;
}
.todo-form input:focus { border-color: var(--accent); }

.todo-form button {
    background: var(--accent);
    color: var(--accent-ink);
    border: none;
    border-radius: 10px;
    width: 42px;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform 0.15s;
}
.todo-form button:hover { transform: scale(1.06); }

.todo-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    padding: 8px;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 10px;
    border-radius: 10px;
    animation: slide-in 0.25s ease;
}
.todo-item:hover { background: var(--bg-raised); }
.todo-item:hover .todo-del { opacity: 1; }

.todo-check {
    appearance: none;
    width: 19px; height: 19px;
    border: 2px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: all 0.15s;
}
.todo-check:checked {
    background: var(--accent);
    border-color: var(--accent);
}
.todo-check:checked::after {
    content: '';
    position: absolute;
    left: 5px; top: 2px;
    width: 4px; height: 9px;
    border: solid var(--accent-ink);
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

.todo-body { flex: 1; min-width: 0; }

.todo-text {
    font-size: 14.5px;
    overflow-wrap: anywhere;
}
.todo-item.done .todo-text {
    text-decoration: line-through;
    color: var(--ink-dim);
}

.todo-meta {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: var(--ink-dim);
    margin-top: 2px;
}

.todo-del {
    opacity: 0;
    background: none;
    border: none;
    color: var(--ink-dim);
    font-size: 17px;
    cursor: pointer;
    padding: 4px 7px;
    border-radius: 6px;
    transition: all 0.15s;
}
.todo-del:hover { color: var(--danger); background: rgba(255, 92, 92, 0.1); }

/* ---------- wall ---------- */

.wall-feed {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.wall-empty {
    margin: auto;
    color: var(--ink-dim);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    text-align: center;
    line-height: 1.8;
}

.post {
    display: flex;
    gap: 11px;
    max-width: 640px;
    animation: slide-in 0.3s ease;
}
.post.own { align-self: flex-end; flex-direction: row-reverse; }

.avatar {
    width: 34px; height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    color: var(--accent-ink);
}

.post-bubble {
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: 4px 14px 14px 14px;
    padding: 10px 13px;
    min-width: 0;
}
.post.own .post-bubble {
    border-radius: 14px 4px 14px 14px;
    border-color: rgba(255, 180, 58, 0.35);
    background: rgba(255, 180, 58, 0.07);
}

.post-meta {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10.5px;
    color: var(--ink-dim);
    margin-bottom: 5px;
}
.post-meta .post-author { color: var(--accent); }

.post-text {
    font-size: 14.5px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.post-image {
    display: block;
    max-width: 340px;
    max-height: 280px;
    border-radius: 10px;
    margin-top: 8px;
    cursor: zoom-in;
    border: 1px solid var(--line);
}

.post-audio {
    display: block;
    margin-top: 8px;
    width: 260px;
    height: 36px;
    outline: none;
}
.post-audio::-webkit-media-controls-panel { background: var(--bg-panel); }

/* like button */

.post-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 7px;
}

.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: var(--ink-dim);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11.5px;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 8px;
    transition: all 0.15s;
}
.like-btn:hover { color: var(--danger); background: rgba(255, 92, 92, 0.08); }
.like-btn svg { transition: transform 0.2s; }
.like-btn:active svg { transform: scale(1.35); }
.like-btn.liked { color: var(--danger); }
.like-btn.liked svg { fill: var(--danger); }

/* recording bar */

.recording-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 9px 13px;
    background: rgba(255, 92, 92, 0.08);
    border: 1px solid rgba(255, 92, 92, 0.35);
    border-radius: 10px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: var(--danger);
    animation: slide-in 0.2s ease;
}
.rec-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--danger);
    animation: pulse 1.2s ease-in-out infinite;
}
.rec-label { color: var(--ink-dim); flex: 1; font-size: 11px; }
#recCancel {
    background: none;
    border: none;
    color: var(--ink-dim);
    font-size: 17px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
}
#recCancel:hover { color: var(--danger); }

.icon-btn.recording {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(255, 92, 92, 0.12);
    animation: pulse 1.2s ease-in-out infinite;
}

/* ---------- composer ---------- */

.post-form {
    border-top: 1px solid var(--line);
    padding: 12px 14px;
}

.image-preview-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: 10px;
}
.image-preview-wrap img {
    max-height: 90px;
    border-radius: 10px;
    border: 1px solid var(--accent);
}
.image-preview-wrap button {
    position: absolute;
    top: -8px; right: -8px;
    width: 22px; height: 22px;
    border-radius: 50%;
    border: none;
    background: var(--danger);
    color: white;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}
.hidden { display: none; }

.post-input-row {
    display: flex;
    gap: 9px;
    align-items: center;
}

.icon-btn, .send-btn {
    background: var(--bg-raised);
    border: 1px solid var(--line);
    color: var(--ink-dim);
    border-radius: 10px;
    width: 42px; height: 42px;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }

.send-btn {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}
.send-btn:hover { transform: scale(1.06); }
.send-btn:disabled { opacity: 0.5; cursor: wait; transform: none; }

#postInput {
    flex: 1;
    background: var(--bg-raised);
    border: 1px solid var(--line);
    color: var(--ink);
    font-family: inherit;
    font-size: 14px;
    padding: 11px 14px;
    border-radius: 10px;
    outline: none;
}
#postInput:focus { border-color: var(--accent); }

/* ---------- misc ---------- */

@keyframes slide-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #333948; }

@media (max-width: 860px) {
    body { overflow: auto; }
    .layout {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(300px, 45vh) minmax(400px, 1fr);
    }
}
