/* Czat na stronie głównej */
.chat [hidden] { display: none !important; }
.chat { margin-top: 52px; }
.chat-head-r { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.chat-online { display: inline-flex; align-items: center; gap: 7px; font-size: .9rem; color: var(--text-muted); }
.chat-dot { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; }
.chat-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-flag { font: inherit; font-size: .85rem; padding: 4px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg-raised); color: var(--text-main); cursor: pointer; }
.chat-flag:hover { background: var(--bg-hover); }
.chat-flag[aria-pressed="true"] { border-color: var(--primary); color: var(--primary-hover); background: #f9731622; }

.chat-panel { position: relative; display: flex; flex-direction: column; padding: 0; overflow: hidden; border-top: 2px solid var(--primary); background: radial-gradient(120% 90% at 0% 0%, #f9731614, #f9731600 55%), linear-gradient(180deg, #131316, #0c0c0e); }
.chat-readonly { padding: 8px 14px; background: #f9731622; border-bottom: 1px solid var(--border-accent); color: var(--primary-hover); font-size: .9rem; text-align: center; }
.chat-list-wrap { position: relative; }
.chat-list { height: 28rem; max-height: 60vh; overflow-y: auto; overflow-anchor: none; padding: 8px 6px 8px 10px; display: flex; flex-direction: column; gap: 1px; scrollbar-width: thin; scrollbar-color: #f9731699 #ffffff0a; overscroll-behavior: contain; }
.chat-empty, .chat-loading { margin: auto; padding: 12px; color: var(--text-muted); font-size: .9rem; text-align: center; }
.chat-loading { margin: 0 auto; padding: 4px; }
.chat-newbtn { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); padding: 6px 14px; border: 0; border-radius: 999px; background: var(--primary); color: #1a0d03; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; box-shadow: 0 2px 10px #000a; }
.chat-newbtn:hover { background: var(--primary-hover); }

.chat-msg { position: relative; display: flex; gap: 9px; padding: 5px 8px; border-radius: var(--radius-md); }
.chat-msg:hover, .chat-msg:focus-within, .chat-msg.show-actions { background: #ffffff0a; }
.chat-msg.is-mention { background: #f9731620; box-shadow: inset 2px 0 0 var(--primary); }
.chat-msg.is-flash { background: #f9731640; }
.chat-av { flex-shrink: 0; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #1b1b1f; color: #ffffff80; font-family: var(--font-heading); font-weight: 700; font-size: 1rem; overflow: hidden; }
.chat-av img { width: 32px; height: 32px; object-fit: cover; display: block; }
.chat-main { min-width: 0; flex: 1; }
.chat-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; line-height: 1.3; }
.chat-nick { font-weight: 600; font-size: .95rem; color: #f8fafc; overflow-wrap: anywhere; }
.chat-badge { padding: 0 6px; border-radius: var(--radius-sm); font-family: var(--font-heading); font-size: .85rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.chat-badge-mod { background: #22c55e26; color: #4ade80; }
.chat-badge-admin { background: #f9731633; color: var(--primary-hover); }
.chat-badge-root { background: #facc1526; color: #fde047; }
.chat-time { font-size: .85rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.chat-body { margin: 0; font-size: .95rem; line-height: 1.45; color: var(--text-main); white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.chat-body a { color: var(--primary-hover); text-decoration: underline; }
.chat-mention { color: var(--primary-hover); font-weight: 600; }
.chat-deleted .chat-body { font-style: italic; color: var(--text-muted); }
.chat-reply { display: block; max-width: 100%; margin: 2px 0 3px; padding: 2px 8px; border: 0; border-left: 2px solid var(--border-accent); background: #ffffff08; color: var(--text-muted); font: inherit; font-size: .85rem; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-reply:hover { color: var(--text-main); }
.chat-reply b { color: #e2e8f0; font-weight: 600; }
.chat-reply i { font-style: italic; }

.chat-actions { position: absolute; right: 6px; top: -12px; display: none; flex-wrap: wrap; justify-content: flex-end; gap: 3px; max-width: 90%; padding: 3px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg-raised); z-index: 2; }
.chat-msg:hover .chat-actions, .chat-msg:focus-within .chat-actions, .chat-msg.show-actions .chat-actions { display: flex; }
.chat-act { font: inherit; font-size: .85rem; padding: 2px 8px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-main); cursor: pointer; white-space: nowrap; }
.chat-act:hover { background: var(--bg-hover); color: var(--primary-hover); }
.chat-act-danger { color: #f87171; }
.chat-act-danger:hover { color: #fca5a5; }

.chat-compose { position: relative; padding: 10px 12px 8px; border-top: 1px solid var(--border); background: #0a0a0bb3; }
.chat-inputrow { display: flex; gap: 8px; align-items: flex-end; }
.chat-inputrow textarea { flex: 1; min-width: 0; resize: none; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg-card); color: var(--text-strong); font: inherit; font-size: 1rem; line-height: 1.4; max-height: 7.6rem; }
.chat-inputrow textarea:focus { outline: none; border-color: var(--primary); }
.chat-send { flex-shrink: 0; min-height: 40px; }
.chat-emoji-btn { flex-shrink: 0; width: 40px; min-height: 40px; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg-card); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.chat-emoji-btn:hover, .chat-emoji-btn[aria-expanded="true"] { border-color: var(--primary); background: #f9731622; }
.chat-emoji-pop { position: absolute; left: 12px; right: 12px; bottom: 100%; z-index: 6; display: flex; flex-direction: column; max-height: 45vh; margin-bottom: -4px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg-raised); box-shadow: 0 4px 16px #000a; overflow: hidden; }
@media (min-width: 640px) { .chat-emoji-pop { left: auto; width: 27rem; } }
.chat-emoji-tabs { display: flex; flex-shrink: 0; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.chat-emoji-tabs::-webkit-scrollbar { display: none; }
.chat-emoji-tab { flex: 1 0 auto; min-width: 36px; min-height: 40px; padding: 0 4px; border: 0; border-bottom: 2px solid transparent; background: transparent; font-size: 1.15rem; line-height: 1; cursor: pointer; }
.chat-emoji-tab:hover { background: var(--bg-hover); }
.chat-emoji-tab.is-on { border-bottom-color: var(--primary); background: #f9731619; }
.chat-emoji-search { flex-shrink: 0; width: calc(100% - 16px); margin: 8px; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg-card); color: var(--text-strong); font: inherit; font-size: 1rem; }
.chat-emoji-search:focus { outline: none; border-color: var(--primary); }
.chat-emoji-grid { flex: 1; min-height: 0; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 2px; padding: 0 8px 8px; overflow-y: auto; overscroll-behavior: contain; }
.chat-emoji-item { width: 38px; height: 38px; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.chat-emoji-item:hover, .chat-emoji-item:focus-visible { background: #f9731626; outline: none; }
.chat-emoji-empty { margin: 8px 4px; font-size: .9rem; color: var(--text-muted); }
.chat-compose.is-locked .chat-emoji-pop { display: none; }
.chat-body-emoji { font-size: 1.9rem; line-height: 1.25; }
.chat-under { display: flex; justify-content: space-between; gap: 10px; min-height: 1.3rem; font-size: .85rem; }
.chat-err { color: #f87171; }
.chat-count { margin-left: auto; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.chat-count.is-over { color: #f87171; }
.chat-replybar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; padding: 5px 10px; border-left: 2px solid var(--primary); background: #ffffff0a; font-size: .9rem; color: var(--text-muted); }
.chat-replybar button { border: 0; background: transparent; color: var(--text-main); font: inherit; cursor: pointer; padding: 0 4px; }
.chat-suggest { position: absolute; left: 12px; bottom: 100%; z-index: 5; min-width: 12rem; max-width: calc(100% - 24px); margin-bottom: -4px; padding: 4px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg-raised); box-shadow: 0 4px 16px #000a; }
.chat-sug { display: block; width: 100%; padding: 5px 10px; border: 0; background: transparent; color: var(--text-main); font: inherit; font-size: .95rem; text-align: left; cursor: pointer; }
.chat-sug.is-on, .chat-sug:hover { background: #f9731626; color: var(--primary-hover); }
.chat-notice { padding: 12px 14px; border-top: 1px solid var(--border); font-size: .95rem; text-align: center; color: var(--text-main); }
.chat-notice-ban { background: #ef44441a; color: #fca5a5; }
.chat-notice-mute { margin: 0 0 8px; padding: 8px 12px; border: 1px solid #facc1544; border-radius: var(--radius-md); background: #facc151a; color: #fde047; }
.chat-compose.is-locked .chat-inputrow, .chat-compose.is-locked .chat-under { display: none; }
.chat-login { padding: 14px; border-top: 1px solid var(--border); background: #0a0a0bb3; text-align: center; }
.chat-login p { margin: 0 0 10px; font-size: 1rem; color: var(--text-main); }
.chat-login-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chat-lbtn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font-size: 1rem; }
.chat-discord:hover { border-color: #5865f2; }
.chat-steam:hover { border-color: #66c0f4; }

.chat-dialog { max-width: min(26rem, calc(100vw - 24px)); padding: 18px; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--bg-raised); color: var(--text-main); }
.chat-dialog::backdrop { background: #000a; }
.chat-dialog h3 { margin: 0 0 10px; font-family: var(--font-heading); font-size: 1.3rem; letter-spacing: .04em; text-transform: uppercase; }
.chat-dialog label { display: block; margin: 8px 0 3px; font-size: .9rem; color: var(--text-muted); }
.chat-dialog select, .chat-dialog input { width: 100%; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg-card); color: var(--text-strong); font: inherit; font-size: 1rem; }
.chat-dialog-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

@media (max-width: 600px) {
  .chat { margin-top: 36px; }
  .chat-list { height: 26rem; }
  .chat-msg { padding: 5px 4px; }
  .chat-actions { right: 2px; }
}
.chat-list > :first-child { margin-top: auto; }

/* akceptacja regulaminu przed pierwszą wiadomością */
.chat-terms-gate { display: grid; gap: 8px; padding: 14px 16px; border-top: 1px solid var(--border); background: linear-gradient(135deg, #f9731614, transparent 60%); }
.chat-tg-title { margin: 0; color: #f8fafc; font-family: var(--font-heading); font-size: 1.2rem; font-weight: 700; letter-spacing: .04em; }
.chat-tg-text { margin: 0; color: #e2e8f0cc; font-size: .92rem; line-height: 1.5; }
.chat-tg-text a { color: var(--primary); }
.chat-tg-check { display: flex; align-items: flex-start; gap: 10px; color: #e2e8f0; font-size: .9rem; line-height: 1.45; cursor: pointer; }
.chat-tg-check input { flex-shrink: 0; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); }
.chat-terms-gate .btn { justify-self: start; }
@media (max-width: 560px) { .chat-terms-gate .btn { justify-self: stretch; } }
.chat-dialog textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg-card); color: var(--text-strong); font: inherit; font-size: 1rem; resize: vertical; box-sizing: border-box; }
.chat-dialog-info { margin: 8px 0 0; color: var(--text-muted); font-size: .85rem; line-height: 1.45; }
