/* Blue Screen — Fix Chat + Fix Hub styles. Reuses the app's existing CSS variables/design system (see app.css :root). */

/* ---------------- Topbar hamburger ---------------- */
.blsc-topbar-menu {
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 50%; color: var(--blsc-text);
    flex: 0 0 auto; margin-right: 4px; transition: background .15s;
}
.blsc-topbar-menu:hover { background: var(--blsc-bg-hover); }

.blsc-hub-menu-overlay {
    position: fixed; inset: 0; z-index: 1000; background: var(--blsc-overlay);
    display: flex; justify-content: flex-end; padding: 60px 14px 0; animation: blsc-fade .15s;
}
.blsc-hub-menu {
    background: var(--blsc-card); border: 1px solid var(--blsc-border); border-radius: 16px;
    box-shadow: var(--blsc-shadow); width: 220px; max-width: 80vw; overflow: hidden;
    -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
    animation: blsc-pop .15s;
}
.blsc-hub-menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: right; padding: 13px 16px; font-size: 15px; font-weight: 600;
    color: var(--blsc-text); transition: background .12s; border-bottom: 1px solid var(--blsc-border);
}
.blsc-hub-menu-icon { display: inline-flex; flex-shrink: 0; color: var(--blsc-text-soft); }
.blsc-hub-menu-icon svg { width: 19px; height: 19px; }
.blsc-hub-menu-item:last-child { border-bottom: none; }
.blsc-hub-menu-item:hover { background: var(--blsc-bg-hover); }

/* ---------------- Chat list ---------------- */
.blsc-chat-list-wrap { position: relative; padding-bottom: 20px; }
.blsc-chat-new-btn {
    position: absolute; top: 14px; left: 16px; width: 40px; height: 40px; border-radius: 50%;
    background: var(--blsc-accent); color: var(--blsc-on-accent); display: flex; align-items: center;
    justify-content: center; box-shadow: var(--blsc-shadow); z-index: 2;
}
.blsc-chat-new-btn svg { width: 20px; height: 20px; }
.blsc-chat-new-btn:hover { background: var(--blsc-accent-hover); }
.blsc-chat-list { display: flex; flex-direction: column; }
.blsc-chat-row { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--blsc-border); cursor: pointer; transition: background .12s; }
.blsc-chat-row:hover { background: var(--blsc-bg-hover); }
.blsc-chat-row-avatar { flex: 0 0 auto; }
.blsc-chat-row-body { flex: 1; min-width: 0; }
.blsc-chat-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.blsc-chat-row-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blsc-chat-type-icon { display: inline-flex; vertical-align: -2px; margin-inline-end: 4px; color: var(--blsc-text-soft); }
.blsc-chat-type-icon svg { width: 14px; height: 14px; }
.blsc-chat-row-time { font-size: 12px; color: var(--blsc-text-soft); flex-shrink: 0; }
.blsc-chat-row-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 2px; }
.blsc-chat-row-preview { font-size: 13px; color: var(--blsc-text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blsc-chat-row-badge {
    background: var(--blsc-primary); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px;
    border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; flex-shrink: 0;
}

/* ---------------- New chat / group modal ---------------- */
.blsc-new-chat-results { max-height: 260px; overflow-y: auto; margin-top: 8px; }
.blsc-user-pick-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-radius: 10px; cursor: pointer; transition: background .12s; }
.blsc-user-pick-row:hover { background: var(--blsc-bg-hover); }
.blsc-user-pick-row span { display: flex; flex-direction: column; font-weight: 700; font-size: 14px; flex: 1; min-width: 0; }
.blsc-user-pick-row small { color: var(--blsc-text-soft); font-weight: 400; font-size: 12px; }
.blsc-new-chat-actions { margin-top: 14px; display: flex; gap: 10px; }
.blsc-member-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.blsc-chip { background: var(--blsc-bg-soft); border-radius: 999px; padding: 6px 10px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.blsc-chip b { cursor: pointer; color: var(--blsc-text-soft); font-weight: 800; }
.blsc-empty-mini { padding: 14px; text-align: center; color: var(--blsc-text-soft); font-size: 13px; }

/* ---------------- Chat screen ---------------- */
.blsc-chat-screen { display: flex; flex-direction: column; height: 100vh; }
.blsc-chat-head { justify-content: flex-start; gap: 10px; }
.blsc-chat-head-info { flex: 1; min-width: 0; }
.blsc-chat-head-title { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blsc-chat-head-sub { font-size: 12px; color: var(--blsc-text-soft); }
.blsc-chat-head-menu { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--blsc-text-soft); }
.blsc-chat-head-menu:hover { background: var(--blsc-bg-hover); }
.blsc-chat-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.blsc-chat-messages { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.blsc-msg-row { display: flex; justify-content: flex-start; }
.blsc-msg-row.mine { justify-content: flex-end; }
.blsc-msg-bubble { max-width: 75%; padding: 9px 13px; border-radius: 16px; background: var(--blsc-bg-soft); margin: 3px 0; }
.blsc-msg-row.mine .blsc-msg-bubble { background: var(--blsc-accent); color: var(--blsc-on-accent); border-bottom-left-radius: 4px; }
.blsc-msg-row:not(.mine) .blsc-msg-bubble { border-bottom-right-radius: 4px; }
.blsc-msg-bubble.deleted { opacity: .6; font-style: italic; }
.blsc-msg-sender { font-size: 12px; font-weight: 700; color: var(--blsc-accent-bright); margin-bottom: 2px; }
.blsc-msg-content { font-size: 14.5px; line-height: 1.5; word-break: break-word; white-space: pre-wrap; }
.blsc-msg-time { font-size: 10.5px; opacity: .7; margin-top: 3px; text-align: left; }
.blsc-chat-composer {
    display: flex; align-items: flex-end; gap: 10px; padding: 10px 14px;
    border-top: 1px solid var(--blsc-border); background: var(--blsc-bg);
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.blsc-chat-input {
    flex: 1; resize: none; border: 1px solid var(--blsc-border); border-radius: 18px; padding: 10px 16px;
    background: var(--blsc-bg-soft); color: var(--blsc-text); font-size: 14.5px; max-height: 120px; outline: none; font-family: inherit;
}
.blsc-chat-input:focus { border-color: var(--blsc-primary); }
.blsc-chat-send {
    width: 40px; height: 40px; border-radius: 50%; background: var(--blsc-accent); color: var(--blsc-on-accent);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .15s, opacity .15s;
}
.blsc-chat-send:disabled { opacity: .45; }
.blsc-chat-send:not(:disabled):hover { background: var(--blsc-accent-hover); }
.blsc-chat-readonly { padding: 14px; text-align: center; color: var(--blsc-text-soft); font-size: 13px; background: var(--blsc-bg-soft); }

/* ---------------- Conversation info modal ---------------- */
.blsc-conv-info-title { font-weight: 800; font-size: 17px; margin-bottom: 4px; }
.blsc-conv-info-desc { color: var(--blsc-text-soft); font-size: 13px; margin-bottom: 12px; }
.blsc-conv-members { max-height: 320px; overflow-y: auto; }
.blsc-conv-members .blsc-user-pick-row { position: relative; padding-left: 30px; }
.blsc-mini-x { position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--blsc-text-soft); }
.blsc-mini-x:hover { background: var(--blsc-bg-hover); color: #f4212e; }

/* ---------------- Generic hub page ---------------- */
.blsc-hub-page { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.blsc-hub-source { text-align: center; font-size: 12px; color: var(--blsc-text-soft); margin-top: 4px; }

/* Market */
.blsc-market-widget { background: var(--blsc-bg-soft); border-radius: 14px; padding: 12px; overflow-x: auto; }

/* News */
.blsc-news-card { display: flex; gap: 12px; border: 1px solid var(--blsc-border); border-radius: 14px; overflow: hidden; transition: background .12s; }
.blsc-news-card:hover { background: var(--blsc-bg-hover); }
.blsc-news-thumb { width: 96px; height: 96px; object-fit: cover; flex-shrink: 0; }
.blsc-news-body { padding: 10px 12px 10px 4px; min-width: 0; }
.blsc-news-title { font-weight: 700; font-size: 14.5px; margin-bottom: 4px; }
.blsc-news-excerpt { font-size: 13px; color: var(--blsc-text-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.blsc-news-meta { font-size: 11.5px; color: var(--blsc-text-soft); margin-top: 6px; }

/* Weather */
.blsc-weather-search { display: flex; }
.blsc-weather-card { background: linear-gradient(135deg, var(--blsc-accent), var(--blsc-accent-hover)); color: #fff; border-radius: 20px; padding: 24px; text-align: center; }
.blsc-weather-city { font-size: 16px; font-weight: 700; opacity: .9; }
.blsc-weather-temp { font-size: 52px; font-weight: 800; line-height: 1.1; margin: 6px 0; }
.blsc-weather-cond { font-size: 15px; opacity: .95; margin-bottom: 16px; }
.blsc-weather-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.blsc-weather-grid div { background: rgba(255,255,255,.15); border-radius: 10px; padding: 8px 4px; font-size: 12px; }
.blsc-weather-grid b { display: block; font-size: 14px; margin-top: 2px; }

/* Games */
.blsc-games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.blsc-game-card { border: 1px solid var(--blsc-border); border-radius: 14px; overflow: hidden; text-align: center; padding-bottom: 10px; transition: background .12s; }
.blsc-game-card:hover { background: var(--blsc-bg-hover); }
.blsc-game-card img { width: 100%; height: 90px; object-fit: cover; display: block; }
.blsc-game-thumb-fallback { width: 100%; height: 90px; display: flex; align-items: center; justify-content: center; background: var(--blsc-bg-soft); color: var(--blsc-text-soft); }
.blsc-game-title { font-size: 13px; font-weight: 700; margin-top: 8px; }
.blsc-game-screen { display: flex; flex-direction: column; height: 100vh; }
.blsc-game-stage { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; align-items: center; }
.blsc-game-iframe-wrap { position: relative; width: 100%; max-width: 480px; aspect-ratio: 4/3; background: #000; border-radius: 14px; overflow: hidden; }
.blsc-game-iframe { width: 100%; height: 100%; border: 0; display: block; }
.blsc-game-fullscreen { margin-top: 12px; padding: 8px 16px; border-radius: 999px; background: var(--blsc-bg-soft); font-size: 13px; font-weight: 600; }
.blsc-game-score { font-weight: 700; margin-bottom: 10px; }

/* Snake */
.blsc-snake-canvas { border-radius: 10px; box-shadow: var(--blsc-shadow); }

/* Tic-tac-toe */
.blsc-ttt-board { display: grid; grid-template-columns: repeat(3, 84px); grid-template-rows: repeat(3, 84px); gap: 6px; }
.blsc-ttt-cell { background: var(--blsc-bg-soft); border-radius: 10px; font-size: 32px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.blsc-ttt-cell.x { color: var(--blsc-accent-bright); }
.blsc-ttt-cell.o { color: #f4212e; }

/* Quiz */
.blsc-quiz { width: 100%; max-width: 420px; }
.blsc-quiz-progress { font-size: 12px; color: var(--blsc-text-soft); margin-bottom: 10px; text-align: center; }
.blsc-quiz-q { font-size: 17px; font-weight: 700; text-align: center; margin-bottom: 16px; }
.blsc-quiz-opts { display: flex; flex-direction: column; gap: 10px; }
.blsc-quiz-opt { padding: 12px; border-radius: 12px; background: var(--blsc-bg-soft); font-weight: 600; text-align: center; transition: background .15s; }
.blsc-quiz-opt:disabled { opacity: .8; }
.blsc-quiz-opt.correct { background: #00ba7c; color: #fff; }
.blsc-quiz-opt.wrong { background: #f4212e; color: #fff; }
.blsc-quiz-done { text-align: center; font-size: 20px; font-weight: 800; padding: 30px 0; }

/* Mobile */
@media (max-width: 680px) {
    .blsc-chat-screen { padding-bottom: 0; }
    .blsc-ttt-board { grid-template-columns: repeat(3, 74px); grid-template-rows: repeat(3, 74px); }
    .blsc-weather-grid { grid-template-columns: repeat(2, 1fr); }
}
