/* Airwright CMS – module Chat. Uses the colours of the template (--aw-…) with a fallback. */
.page.chat-page .mod-head { max-width: none; margin: 0 0 22px; text-align: left; }
.page.chat-page .mod-head h1 { font-size: clamp(32px, 5.5vw, 60px); font-weight: 800; letter-spacing: -.03em; }
.chat-lead { font-size: 18px; color: var(--aw-muted, #8a90a2); margin: 8px 0 0; max-width: 60ch; }
.chat-cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }

/* ---- the box ---- */
.chat-box { position: relative; display: flex; flex-direction: column; height: min(72vh, 760px); min-height: 440px; background: var(--aw-surface, #151a26); color: var(--aw-text, inherit); border: 1px solid var(--aw-line, rgba(128, 128, 128, .25)); border-radius: var(--aw-radius, 14px); overflow: hidden; box-shadow: 0 18px 50px rgba(0, 0, 0, .12); }
.chat-box [hidden] { display: none !important; }
.chat-box button { font: inherit; cursor: pointer; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--aw-line, rgba(128, 128, 128, .25)); background: linear-gradient(90deg, color-mix(in srgb, var(--aw-accent, #ff3d6e) 14%, transparent), transparent 70%); }
.chat-head b { font-size: 16px; font-weight: 800; }
.chat-live { width: 9px; height: 9px; border-radius: 50%; background: #30a46c; box-shadow: 0 0 0 0 rgba(48, 164, 108, .6); animation: chat-pulse 2s infinite; flex: none; }
@keyframes chat-pulse { 70% { box-shadow: 0 0 0 8px rgba(48, 164, 108, 0); } 100% { box-shadow: 0 0 0 0 rgba(48, 164, 108, 0); } }
.chat-online { font-size: 13px; color: var(--aw-muted, #8a90a2); }
.chat-who { margin-left: auto; font-size: 13px; color: var(--aw-muted, #8a90a2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chat-leave { border: 1px solid var(--aw-line, rgba(128, 128, 128, .35)); background: none; color: inherit; font-size: 12px !important; padding: 5px 10px; border-radius: 999px; flex: none; }
.chat-leave:hover { border-color: var(--aw-accent, #ff3d6e); color: var(--aw-accent, #ff3d6e); }
.chat-pin { margin: 0; padding: 9px 16px 9px 40px; font-size: 14px; font-weight: 600; background: color-mix(in srgb, var(--aw-accent, #ff3d6e) 12%, transparent); border-bottom: 1px solid var(--aw-line, rgba(128, 128, 128, .25)); position: relative; }
.chat-pin::before { content: "📌"; position: absolute; left: 14px; top: 8px; }

/* keep what you tap clear of a sticky header and of the player bar at the bottom */
.chat-box, .chat-join, .chat-input, .chat-task-img, .chat-step input { scroll-margin: 96px 0 calc(var(--aw-player-h, 64px) + 24px); }

/* ---- messages ---- */
.chat-list { flex: 1; overflow-y: auto; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; scroll-behavior: smooth; overscroll-behavior: contain; outline: 0; }
.chat-empty { margin: auto; color: var(--aw-muted, #8a90a2); text-align: center; padding: 20px; }
.chat-day { align-self: center; margin: 10px 0 6px; padding: 3px 12px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--aw-muted, #8a90a2); background: var(--aw-surface-2, rgba(128, 128, 128, .12)); }
.chat-msg { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 7px 8px; border-radius: 10px; }
.chat-msg:hover { background: rgba(128, 128, 128, .08); }
.chat-av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; background: var(--aw-accent, #ff3d6e); }
.chat-top { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; font-size: 13px; line-height: 1.3; }
.chat-top b { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.chat-top time { color: var(--aw-muted, #8a90a2); font-size: 11px; font-variant-numeric: tabular-nums; }
.chat-badge { padding: 1px 7px; border-radius: 4px; background: var(--aw-accent, #ff3d6e); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.chat-you { font-size: 11px; color: var(--aw-muted, #8a90a2); }
.chat-body { margin: 2px 0 0; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.chat-msg.is-staff { background: color-mix(in srgb, var(--aw-accent, #ff3d6e) 9%, transparent); box-shadow: inset 3px 0 0 var(--aw-accent, #ff3d6e); }
.chat-msg.is-staff .chat-top b { color: var(--aw-accent, #ff3d6e); }
.chat-msg.is-mine .chat-top b { text-decoration: underline; text-decoration-color: var(--aw-accent, #ff3d6e); text-underline-offset: 3px; }
.chat-msg.is-mention { background: rgba(245, 165, 36, .14); }
.chat-body mark { background: rgba(245, 165, 36, .45); color: inherit; border-radius: 3px; padding: 0 2px; }
.chat-tools { position: absolute; right: 8px; top: 6px; display: none; gap: 2px; padding: 2px; border-radius: 8px; background: var(--aw-surface, #151a26); border: 1px solid var(--aw-line, rgba(128, 128, 128, .3)); box-shadow: 0 4px 14px rgba(0, 0, 0, .2); }
.chat-msg:hover .chat-tools, .chat-msg:focus-within .chat-tools { display: flex; }
.chat-tools button { width: 30px; height: 28px; border: 0; background: none; border-radius: 6px; font-size: 14px !important; padding: 0; }
.chat-tools button:hover { background: rgba(128, 128, 128, .2); }
.chat-fresh { position: absolute; left: 50%; bottom: 82px; transform: translateX(-50%); z-index: 2; padding: 7px 14px; border: 0; border-radius: 999px; background: var(--aw-accent, #ff3d6e); color: #fff; font-size: 13px !important; font-weight: 700; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); }
.chat-note { margin: 0; padding: 8px 16px; font-size: 13px; text-align: center; background: rgba(245, 165, 36, .16); border-top: 1px solid var(--aw-line, rgba(128, 128, 128, .25)); }

/* ---- under the messages ---- */
.chat-foot { padding: 12px; border-top: 1px solid var(--aw-line, rgba(128, 128, 128, .25)); }
.chat-closed { margin: 0; padding: 8px; text-align: center; color: var(--aw-muted, #8a90a2); }
.chat-join { display: block; width: 100%; padding: 13px 18px; border: 0; border-radius: 999px; background: var(--aw-accent, #ff3d6e); color: #fff; font-weight: 800; font-size: 15px !important; transition: filter .15s, transform .15s; }
.chat-join:hover { filter: brightness(1.08); transform: translateY(-1px); }
.chat-form { position: relative; display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 6px; border-radius: 999px; background: var(--aw-bg, rgba(128, 128, 128, .1)); border: 1.5px solid var(--aw-line, rgba(128, 128, 128, .3)); }
.chat-form:focus-within { border-color: var(--aw-accent, #ff3d6e); }
.chat-emoji-btn { width: 36px; height: 36px; border: 0; background: none; border-radius: 50%; font-size: 19px !important; padding: 0; flex: none; filter: grayscale(.3); }
.chat-emoji-btn:hover { background: rgba(128, 128, 128, .18); filter: none; }
.chat-box .chat-form .chat-input { flex: 1; min-width: 0; width: auto; margin: 0; border: 0 !important; border-radius: 0; background: none !important; box-shadow: none !important; color: inherit; font: inherit; font-size: 16px; padding: 9px 2px; outline: 0 !important; }
.chat-input:disabled { opacity: .6; }
.chat-count { font-size: 12px; color: var(--aw-muted, #8a90a2); font-variant-numeric: tabular-nums; }
.chat-send { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--aw-accent, #ff3d6e); color: #fff; display: grid; place-items: center; flex: none; padding: 0; }
.chat-send:disabled { opacity: .45; cursor: default; }
.chat-emoji { position: absolute; left: 0; bottom: calc(100% + 10px); z-index: 3; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; border-radius: 14px; background: var(--aw-surface, #151a26); border: 1px solid var(--aw-line, rgba(128, 128, 128, .3)); box-shadow: 0 14px 40px rgba(0, 0, 0, .3); }
.chat-emoji button { width: 36px; height: 36px; border: 0; background: none; border-radius: 8px; font-size: 20px !important; padding: 0; }
.chat-emoji button:hover { background: rgba(128, 128, 128, .2); }

/* ---- joining: name and the human check ---- */
.chat-panel { position: absolute; inset: 0; z-index: 5; display: flex; padding: 16px; background: rgba(0, 0, 0, .55); backdrop-filter: blur(5px); overflow-y: auto; }
.chat-card-in { position: relative; width: min(420px, 100%); margin: auto; padding: 24px; border-radius: var(--aw-radius, 14px); background: var(--aw-surface, #151a26); color: var(--aw-text, inherit); border: 1px solid var(--aw-line, rgba(128, 128, 128, .3)); box-shadow: 0 24px 70px rgba(0, 0, 0, .45); }
.chat-card-in h2 { margin: 0 30px 6px 0; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.chat-panel-text { margin: 0 0 14px; font-size: 14px; color: var(--aw-muted, #8a90a2); }
.chat-x { position: absolute; right: 12px; top: 12px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(128, 128, 128, .16); color: inherit; font-size: 20px !important; line-height: 1; padding: 0 0 2px; }
.chat-step { display: grid; gap: 12px; margin-top: 12px; }
.chat-step label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.chat-step input[type="text"] { width: 100%; box-sizing: border-box; padding: 12px 14px; border-radius: 10px; border: 1.5px solid var(--aw-line, rgba(128, 128, 128, .35)); background: var(--aw-bg, transparent); color: inherit; font: inherit; font-size: 16px; }
.chat-step input[type="text"]:focus { outline: 0; border-color: var(--aw-accent, #ff3d6e); }
.chat-step .chat-agree { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.chat-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.chat-err { margin: 10px 0 0; padding: 9px 12px; border-radius: 8px; background: rgba(229, 72, 77, .14); color: inherit; font-size: 14px; border-left: 3px solid #e5484d; }
.chat-prompt { margin: 0 0 10px; font-size: 16px; font-weight: 700; }
.chat-task-img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1.5px solid var(--aw-line, rgba(128, 128, 128, .35)); cursor: crosshair; user-select: none; -webkit-user-drag: none; }
.chat-task.is-busy { opacity: .55; pointer-events: none; }
.chat-working { margin: 10px 0 0; font-size: 13px; color: var(--aw-muted, #8a90a2); }
.chat-task-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 14px 0 0; }
.chat-task-links button { border: 0; background: none; padding: 0; color: var(--aw-muted, #8a90a2); font-size: 13px !important; text-decoration: underline; }
.chat-task-links button:hover { color: var(--aw-accent, #ff3d6e); }
.chat-turnstile { margin-top: 12px; }

/* ---- next to the box ---- */
.chat-side { display: grid; gap: 12px; }
.chat-side .btn { width: 100%; }
.chat-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--aw-radius, 14px); background: var(--aw-surface, #151a26); border: 1px solid var(--aw-line, rgba(128, 128, 128, .22)); color: inherit; text-decoration: none; min-width: 0; }
a.chat-card:hover { border-color: var(--aw-accent, #ff3d6e); }
.chat-card img { width: 60px; height: 60px; border-radius: 10px; object-fit: cover; flex: none; }
.chat-card img[hidden] { display: none; }
.chat-card > span { display: grid; gap: 2px; min-width: 0; }
.chat-card small { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--aw-accent, #ff3d6e); }
.chat-card b { font-size: 16px; line-height: 1.2; overflow-wrap: anywhere; }
.chat-card em { font-style: normal; font-size: 13px; color: var(--aw-muted, #8a90a2); }
.chat-rules { display: block; }
.chat-rules ul { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--aw-muted, #8a90a2); display: grid; gap: 5px; }

@media (max-width: 900px) {
    .chat-cols { grid-template-columns: 1fr; }
    .chat-box { height: calc(100svh - var(--aw-player-h, 64px) - 120px); min-height: 400px; max-height: 640px; }
}
@media (max-width: 480px) {
    .chat-card-in { padding: 18px; }
    .chat-panel { padding: 10px; }
    .chat-emoji { grid-template-columns: repeat(6, 1fr); }
    .chat-who { display: none; }
    .chat-leave { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) { .chat-live { animation: none; } .chat-list { scroll-behavior: auto; } .chat-join { transition: none; } }

/* the chat next to a video (Watch live, Live TV): {{ chat_box() }} inside <aside class="chat-beside"> */
.chat-beside { display: flex; min-width: 0; }
.chat-beside .chat-box { flex: 1; height: auto; min-height: 460px; max-height: 78vh; }
.chat-beside-row { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: stretch; }
@media (max-width: 1000px) {
    .chat-beside-row { grid-template-columns: minmax(0, 1fr); }
    .chat-beside .chat-box { height: 70svh; min-height: 400px; max-height: 600px; }
}
