/* ==========================================================
   ShoutBox styles
   Used by: index.html (right-hand column) + js/shoutbox.js

   Sections:
   1. Card + colours      4. Message list
   2. Form + inputs       5. Emotes + [move] text
   3. Buttons             6. eMotes popup
   ========================================================== */

/* ---------- 1. Card + colours ---------- */
.sb { container-type: inline-size; height: 100%; }

.sb-info {
    align-self: center;
    display: flex;
    flex-direction: column;     /* stacks the two lines */
    font-size: 12px;
    line-height: 1.0;
    color: var(--dim);
}

.sb-card {
    --bg: #c0c0c0;
    --panel: #e0e0e0;
    --line: #000000;
    --ink: #000000;
    --dim: #333333;
    --accent: #ff0000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.9);
    box-sizing: border-box;
    height: 520px;              /* fixed height so the list scrolls inside */
    display: flex;
    flex-direction: column;
    padding: 12px;
    border-radius: 16px;
    background: var(--bg);
    color: var(--ink);
    border: 1px solid var(--line);
    font: 14px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.sb-card *, .sb-card *::before, .sb-card *::after { box-sizing: border-box; }
.sb-card :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sb-card input, .sb-card button { font: inherit; font-size: 16px; }

.sb-status { flex: none; min-height: 1.3em; margin: 8px 2px 0; color: var(--dim); font-size: 13px; }
.sb-status.err { color: var(--accent); }
.sb-card { opacity: 0.95; }

/* ---------- 2. Form + inputs ---------- */
.sb-form { display: grid; gap: 8px; flex: none; }

.sb-card input[type=text] {
    min-width: 0;
    height: 44px;
    padding: 0 12px;
    border-radius: 10px;
    background: #e8e8e8 !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
}
.sb-card input::placeholder { color: #555555 !important; }

/* Hidden spam-trap field, leave as is */
.sb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- 3. Buttons ---------- */
.sb-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.sb-btns .go { margin-left: auto; }

.sb-btn {
    height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px !important;
    background: none;
    color: var(--dim);
    border: 1px solid var(--line);
}
.sb-btn:hover { color: var(--ink); background: var(--panel); }

/* The big red "Shout It Out!" button */
.sb-btn.go {
    background: #dc0000 !important;
    border-color: #dc0000 !important;
    color: #ffffff !important;
    font-weight: 650;
    text-shadow: 1px 1px 1px #000;
}
.sb-btn.go:hover { background: #ff0000 !important; filter: brightness(1.2); }

.sb-btn:disabled { opacity: .5; cursor: default; filter: none; }

/* ---------- 4. Message list ---------- */
.sb-list {
    flex: 1 1 auto;
    min-height: 0;
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
}
.sb-list li {
    background: #d0d0d0;
    color: #000000 !important;
    border-radius: 6px;
    margin-bottom: 4px;
    border: 1px solid #000;
    padding: 10px 8px;
}
.sb-list li:nth-child(odd)  { background: #404040; }   /* row colours */
.sb-list li:nth-child(even) { background: #505050; }

.sb-who { display: flex; align-items: baseline; gap: 8px; }
.sb-who b {                                            /* poster's name */
    color: #dc0000 !important;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sb-who time { flex: none; color: #191919; font-size: 12px; }   /* timestamp colour */
.sb-text { margin: 2px 0 0; overflow-wrap: anywhere; line-height: 1.4; }
.sb-empty { color: var(--dim); }

/* ---------- 5. Emotes + [move] text ---------- */
.sb-emo,
p img.sb-emo {
    float: none !important;
    margin: 0 2px !important;
    padding: 0 !important;
    height: 18px !important;
    width: auto !important;
    max-width: 24px;
    vertical-align: -3px !important;
    display: inline-block !important;
}

/* [move]scrolling text[/move] */
.sb-move { display: block; overflow: hidden; white-space: nowrap; }
.sb-move > span { display: inline-block; padding-left: 100%; animation: sb-scroll 9s linear infinite; }
@keyframes sb-scroll { to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .sb-move > span { animation: none; padding-left: 0; } }

/* ---------- 6. eMotes popup ---------- */
.sb-dlg { width: min(92vw, 420px); max-height: 90vh; padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); color: var(--ink); font: 14px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif; }
.sb-dlg::backdrop { background: rgba(0, 0, 0, .6); }
.sb-dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 700; }
.sb-dlg-head button { background: none; border: 0; color: var(--dim); font-size: 24px; line-height: 1; cursor: pointer; }
.sb-dlg-body { padding: 8px 16px 16px; max-height: calc(90vh - 56px); overflow-y: auto; }
.sb-dlg h3 { margin: 14px 0 6px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.sb-emotes { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.sb-emotes button { display: flex; align-items: center; justify-content: center; gap: 6px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
.sb-emotes button img { height: 18px; width: auto; max-width: 24px; vertical-align: middle; }
.sb-emotes button small { font-size: 11px; color: var(--dim); }
.sb-emotes button:hover { border-color: var(--accent); }
.sb-codes { margin: 0; padding: 0; list-style: none; color: var(--dim); }
.sb-codes li { padding: 5px 0; border-top: 1px solid var(--line); }
.sb-codes li:first-child { border: 0; }
.sb-codes code { color: var(--ink); }
