/* ------------------------------------------------------------------
   Message board — style.css
   ------------------------------------------------------------------ */

:root {
    --bg:            #f4f6fb;
    --card:          #ffffff;
    --ink:           #1d2333;
    --ink-soft:      #6b7386;
    --line:          #e4e8f2;
    --accent:        #3d5afe;
    --accent-dark:   #2a41d6;
    --danger:        #d64545;
    --danger-bg:     #fdecec;
    --ok:            #1f8a5b;
    --ok-bg:         #e8f7f0;
    --radius:        14px;
    --shadow:        0 6px 20px rgba(29, 35, 51, .07);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    line-height: 1.55;
}

.page {
    max-width: 760px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

/* ---------- Header ---------- */

.masthead { margin-bottom: 28px; }

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

.logo {
    display: block;
    flex: none;
    width: 46px;
    height: 46px;
    filter: drop-shadow(0 3px 8px rgba(61, 90, 254, .25));
}

.masthead h1 {
    margin: 0;
    font-size: 2rem;
    letter-spacing: -.02em;
}

.tagline {
    margin: 6px 0 0;
    color: var(--ink-soft);
}

/* ---------- Notice banner ---------- */

.notice {
    padding: 11px 15px;
    margin-bottom: 18px;
    border-radius: 10px;
    font-size: .93rem;
    border: 1px solid transparent;
}

.notice.is-error { background: var(--danger-bg); color: var(--danger); border-color: #f6c9c9; }
.notice.is-ok    { background: var(--ok-bg);     color: var(--ok);     border-color: #c6ecd9; }

/* ---------- Cards ---------- */

.card,
.post {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.composer {
    padding: 22px;
    margin-bottom: 34px;
}

.composer h2,
.board-title {
    margin: 0 0 16px;
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--ink-soft);
}

/* ---------- Form controls ---------- */

label {
    display: block;
    margin: 14px 0 6px;
    font-size: .87rem;
    font-weight: 600;
}

.optional { color: var(--ink-soft); font-weight: 400; }

input,
textarea {
    width: 100%;
    padding: 10px 12px;
    font: inherit;
    color: var(--ink);
    background: #fbfcfe;
    border: 1px solid var(--line);
    border-radius: 9px;
    resize: vertical;
    transition: border-color .15s, box-shadow .15s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(61, 90, 254, .16);
}

.form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 16px;
}

.counter { font-size: .82rem; color: var(--ink-soft); }
.counter.is-over { color: var(--danger); font-weight: 600; }

button {
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    border-radius: 9px;
    border: 1px solid transparent;
    transition: background .15s, transform .05s, opacity .15s;
}

button:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: not-allowed; }

#post-submit {
    padding: 10px 22px;
    background: var(--accent);
    color: #fff;
}

#post-submit:hover:not(:disabled) { background: var(--accent-dark); }

/* ---------- Icon picker ---------- */

.icon-picker {
    margin: 16px 0 4px;
    padding: 0;
    border: none;
}

.icon-picker legend {
    padding: 0;
    margin-bottom: 9px;
    font-size: .87rem;
    font-weight: 600;
}

.icon-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.icon-option {
    position: relative;
    display: block;
    margin: 0;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
}

/* Keep the real radio in the DOM for keyboard + screen-reader users. */
.icon-option input {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
}

.icon-option img {
    display: block;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid transparent;
    box-shadow: 0 2px 6px rgba(29, 35, 51, .10);
    transition: transform .12s, border-color .12s, box-shadow .12s;
}

.icon-option:hover img { transform: translateY(-2px); }

.icon-option input:checked + img {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(61, 90, 254, .25);
    transform: translateY(-2px);
}

.icon-option input:focus + img {
    outline: 2px solid var(--accent-dark);
    outline-offset: 3px;
}

/* Compact variant inside the reply form */
.reply-form .icon-picker { margin-top: 0; }

.reply-form .icon-picker legend {
    font-size: .8rem;
    font-weight: 600;
    color: var(--ink-soft);
}

.reply-form .icon-options { gap: 8px; }

.reply-form .icon-option img { width: 32px; height: 32px; }

/* ---------- Board ---------- */

.board-title .count {
    font-size: .8rem;
    background: var(--line);
    color: var(--ink-soft);
    padding: 2px 9px;
    border-radius: 999px;
    vertical-align: middle;
}

.empty {
    padding: 34px;
    text-align: center;
    color: var(--ink-soft);
    background: var(--card);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
}

.empty-cat {
    display: block;
    margin: 0 auto 12px;
    width: 72px;
    height: 72px;
    opacity: .9;
}

.posts { display: flex; flex-direction: column; gap: 18px; }

/* ---------- Post ---------- */

.post { padding: 18px 20px; }

.post-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.avatar {
    width: 34px;
    height: 34px;
    flex: none;
    display: block;
    overflow: hidden;
    border-radius: 50%;
    background: var(--accent);
}

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

.author { font-weight: 650; }

.stamp { margin-left: auto; font-size: .8rem; color: var(--ink-soft); }

.body {
    margin: 0 0 12px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.post-actions { display: flex; gap: 8px; }

.reply-toggle {
    padding: 5px 13px;
    font-size: .85rem;
    background: transparent;
    color: var(--accent);
    border-color: var(--line);
}

.reply-toggle:hover { background: #eef1ff; }

/* ---------- Replies ---------- */

.replies {
    list-style: none;
    margin: 14px 0 0;
    padding: 0 0 0 16px;
    border-left: 2px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.replies:empty { display: none; }

.reply {
    padding-left: 4px;
}

.reply .post-head { margin-bottom: 4px; }
.reply .avatar { width: 26px; height: 26px; }
.reply .body { margin-bottom: 4px; font-size: .95rem; }

.reply-form { margin-top: 14px; }

.reply-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.reply-row .reply-author { flex: 0 0 150px; }
.reply-row .reply-body   { flex: 1 1 220px; }

.reply-submit {
    padding: 9px 18px;
    background: #eef1ff;
    color: var(--accent);
}

.reply-submit:hover:not(:disabled) { background: #dfe4ff; }

/* ---------- Loading ---------- */

.loading {
    padding: 30px;
    text-align: center;
    color: var(--ink-soft);
}

/* ---------- Responsive ---------- */

@media (max-width: 560px) {
    .page { padding-top: 26px; }
    .masthead h1 { font-size: 1.6rem; }
    .form-footer { flex-direction: column-reverse; align-items: stretch; }
    #post-submit { width: 100%; }
    .reply-row .reply-author { flex: 1 1 100%; }
}
