/* BigPool UI refresh — messages. Uses the shared design language from app.css (Oct 2026). */

/* ---------- Shared: avatar with presence dot ---------- */
.msg-avatar { position: relative; flex: none; display: inline-grid; }
.msg-avatar .avatar { width: 46px; height: 46px; font-size: 14px; }
.msg-avatar > i { position: absolute; right: 0; bottom: 1px; width: 12px; height: 12px; display: none; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 2.5px #0d120e, 0 0 10px rgba(104,211,145,0.7); }
.msg-avatar.is-online > i { display: block; }

/* ---------- Inbox ---------- */
.msg-page { max-width: 1080px; }
.msg-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.msg-eyebrow { color: var(--green); font: 800 10px var(--font-heading); letter-spacing: 1.8px; text-transform: uppercase; }
.msg-header h1 { margin: 6px 0 8px; font: 900 clamp(32px, 4vw, 44px)/1 BigPoolDisplay, var(--font-heading); letter-spacing: -0.01em; }
.msg-header p { margin: 0; color: var(--muted); line-height: 1.5; }
.msg-count { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; margin-right: 8px; border-radius: 999px; background: rgba(104,211,145,0.14); color: var(--green-bright); font: 800 12px var(--font-heading); }

.msg-layout { grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.8fr); gap: 22px; align-items: start; }
.msg-section-head { min-height: 22px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 6px 10px; }
.msg-section-head h2 { margin: 0; color: var(--muted); font: 800 11px var(--font-heading); letter-spacing: 1.6px; text-transform: uppercase; }
.msg-section-head span { height: 20px; display: inline-grid; place-items: center; padding: 0 8px; border-radius: 999px; background: rgba(255,255,255,0.06); color: var(--text-soft); font: 800 11px var(--font-heading); font-variant-numeric: tabular-nums; }

.msg-page .conversation-list,
.msg-page .msg-people { padding: 6px; border: 1px solid rgba(255,255,255,0.07); border-radius: 20px; background: linear-gradient(180deg, #111712, #0b0f0c); box-shadow: 0 30px 70px -40px rgba(0,0,0,0.9); }
.msg-page .conversation-row { position: relative; min-height: 72px; grid-template-columns: auto minmax(0, 1fr) auto; gap: 13px; padding: 11px 12px; border: 1px solid transparent; border-radius: 14px; color: var(--text); transition: background .18s, border-color .18s; }
.msg-page .conversation-row + .conversation-row::before { content: ""; position: absolute; top: -1px; left: 71px; right: 12px; height: 1px; background: rgba(255,255,255,0.06); }
.msg-page .conversation-row:hover { background: rgba(255,255,255,0.035); border-color: rgba(104,211,145,0.22); }
.msg-page .conversation-row:hover::before, .msg-page .conversation-row:hover + .conversation-row::before { opacity: 0; }
.msg-page .conversation-row:focus-visible { outline: 2px solid var(--green-bright); outline-offset: -2px; }
.msg-page .conversation-unread { background: linear-gradient(90deg, rgba(104,211,145,0.10), rgba(104,211,145,0.02) 70%); }
.msg-page .conversation-row .player-name { min-width: 0; display: grid; gap: 3px; }
.msg-row-top { min-width: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.msg-page .msg-row-top strong { min-width: 0; color: var(--text); font: 800 15px var(--font-heading); }
.msg-page .msg-row-top time { flex: none; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.msg-page .conversation-unread .msg-row-top time { color: var(--green-bright); font-weight: 700; }
.msg-page .msg-row-preview { display: block; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.msg-page .conversation-unread .msg-row-preview { color: var(--text-soft); font-weight: 600; }
.msg-row-preview em { color: #6f7a74; font-style: normal; font-weight: 600; }
.msg-page .conversation-row > b { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: linear-gradient(180deg, #86e6a9, var(--green)); color: #07120b; font: 900 11px var(--font-heading); font-variant-numeric: tabular-nums; box-shadow: 0 0 14px rgba(104,211,145,0.45); }
.msg-row-chevron { color: #4c5750; font-size: 22px; line-height: 1; transition: color .18s, transform .18s; }
.conversation-row:hover .msg-row-chevron { color: var(--green-bright); transform: translateX(2px); }

.msg-empty { min-height: 230px; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 30px 20px; text-align: center; }
.msg-empty-icon { width: 56px; height: 56px; display: grid; place-items: center; margin-bottom: 8px; border: 1px solid rgba(104,211,145,0.25); border-radius: 18px; background: rgba(104,211,145,0.1); color: var(--green-bright); box-shadow: 0 0 30px rgba(104,211,145,0.12); }
.msg-empty-icon .sidebar-nav-icon { width: 24px; height: 24px; flex-basis: 24px; opacity: 1; }
.msg-empty strong { font: 800 16px var(--font-heading); }
.msg-empty > span:last-child { max-width: 32ch; color: var(--muted); font-size: 13px; line-height: 1.5; }

/* Start a conversation: a quiet directory on desktop, a story-style strip on phones. */
.msg-start { position: sticky; top: 96px; }
.msg-page .msg-people { overflow: hidden; }
.msg-page .chat-directory-row { min-height: 60px; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; padding: 9px 10px; border: 1px solid transparent; border-radius: 14px; background: transparent; cursor: pointer; transition: background .18s, border-color .18s; }
.msg-page .chat-directory-row:hover { background: rgba(255,255,255,0.035); border-color: rgba(104,211,145,0.2); }
.msg-page .chat-directory-row .msg-avatar .avatar { width: 38px; height: 38px; font-size: 12px; }
.msg-page .chat-directory-row > span:not(.msg-avatar) { min-width: 0; gap: 2px; }
.msg-page .chat-directory-row strong { overflow: hidden; font: 800 13px var(--font-heading); text-overflow: ellipsis; white-space: nowrap; }
.msg-page .chat-directory-row small { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.msg-page .chat-directory-row small b { color: var(--gold); }
.msg-page .chat-directory-row > b { height: 28px; display: inline-grid; place-items: center; padding: 0 11px; border: 1px solid rgba(104,211,145,0.3); border-radius: 999px; background: rgba(104,211,145,0.08); color: var(--green-bright); font: 800 11px var(--font-heading); transition: background .18s, color .18s; }
.msg-page .chat-directory-row:hover > b { background: var(--green); color: #07120b; }

/* ---------- DM thread ---------- */
.dm-page { max-width: 880px; height: calc(100dvh - 76px); min-height: 520px; display: grid; grid-template-rows: auto minmax(0, 1fr); padding-top: 22px; padding-bottom: 22px; }
.dm-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid rgba(255,255,255,0.07); border-radius: 20px; background: radial-gradient(120% 140% at 0% 0%, rgba(104,211,145,0.08), transparent 55%), linear-gradient(180deg, #111712, #0b0f0c); box-shadow: 0 20px 50px -34px rgba(0,0,0,0.9); }
.dm-back { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; background: rgba(255,255,255,0.03); color: var(--text-soft); transition: border-color .18s, color .18s, transform .18s; }
.dm-back:hover { border-color: rgba(104,211,145,0.45); color: var(--text); transform: translateX(-1px); }
.dm-back svg { width: 18px; height: 18px; }
.dm-header .msg-avatar .avatar { width: 46px; height: 46px; }
.dm-who { min-width: 0; flex: 1; display: grid; gap: 3px; }
.dm-page .dm-who h1 { margin: 0; overflow: hidden; font: 800 18px/1.15 var(--font-heading); letter-spacing: -0.01em; text-overflow: ellipsis; white-space: nowrap; }
.dm-page .dm-who > span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.dm-who b { color: var(--gold); font-weight: 800; }
.dm-page .dm-actions { width: auto; flex: none; flex-wrap: nowrap; gap: 8px; margin: 0; }
.dm-page .dm-actions .btn { flex: none; }
.dm-actions .btn { min-height: 38px; gap: 7px; padding: 0 14px; border-radius: 999px; font-size: 13px; }
.dm-header .dm-actions .btn span { color: inherit; font-size: inherit; }
.dm-actions .sidebar-nav-icon { width: 16px; height: 16px; flex-basis: 16px; opacity: 1; }
.dm-action-profile { border-color: rgba(255,255,255,0.1); background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)); }
.dm-action-profile:hover { border-color: rgba(104,211,145,0.45); background: rgba(255,255,255,0.06); }
.dm-action-challenge { background: linear-gradient(180deg, #86e6a9, var(--green)); box-shadow: 0 10px 24px -12px rgba(104,211,145,0.8), inset 0 1px 0 rgba(255,255,255,0.4); }

.dm-page .dm-shell { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; border: 1px solid rgba(255,255,255,0.07); border-radius: 22px; background: radial-gradient(100% 60% at 50% 100%, rgba(104,211,145,0.05), transparent 70%), linear-gradient(180deg, #0f1511, #0a0d0b); box-shadow: 0 30px 70px -40px rgba(0,0,0,0.9); }
.dm-page .dm-thread { height: auto; min-height: 0; gap: 0; padding: 14px 18px 12px; scrollbar-color: #2c3630 transparent; }
.dm-day { justify-self: center; margin: 14px 0 6px; }
.dm-day:first-child { margin-top: 2px; }
.dm-day span { display: inline-flex; height: 22px; align-items: center; padding: 0 10px; border: 1px solid rgba(255,255,255,0.06); border-radius: 999px; background: rgba(255,255,255,0.03); color: var(--muted); font: 800 10px var(--font-heading); letter-spacing: 1.2px; text-transform: uppercase; }
.dm-page .dm-message { margin-top: 2px; animation: dm-bubble-in .22s ease-out both; }
.dm-page .dm-message.dm-first { margin-top: 10px; }
.dm-page .dm-day + .dm-message { margin-top: 4px; }
.dm-page .dm-message > div { max-width: min(74%, 520px); padding: 8px 13px 7px; border: 1px solid rgba(255,255,255,0.07); border-radius: 18px 18px 18px 6px; background: linear-gradient(180deg, #19211c, #151b17); box-shadow: 0 6px 16px -10px rgba(0,0,0,0.7); }
.dm-page .dm-message.dm-cont > div { border-top-left-radius: 6px; }
.dm-page .dm-message p { color: #e3e9e5; font-size: 14.5px; line-height: 1.45; }
.dm-page .dm-message time { max-width: none; margin-top: 3px; color: #6b766f; font-size: 10px; text-align: right; font-variant-numeric: tabular-nums; }
.dm-page .dm-message:not(.dm-last) time { display: none; }
.dm-page .dm-own > div { border-color: rgba(104,211,145,0.3); border-radius: 18px 18px 6px 18px; background: linear-gradient(180deg, rgba(104,211,145,0.26), rgba(104,211,145,0.15)); box-shadow: 0 8px 20px -12px rgba(104,211,145,0.45); }
.dm-page .dm-own.dm-cont > div { border-top-right-radius: 6px; }
.dm-page .dm-own p { color: #effcf3; }
.dm-page .dm-own time { color: rgba(205,240,218,0.62); }
@keyframes dm-bubble-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.dm-page .chat-empty { min-height: 100%; }
.dm-empty { display: grid; justify-items: center; gap: 6px; padding: 24px; }
.dm-empty .avatar { width: 64px; height: 64px; margin-bottom: 6px; font-size: 20px; box-shadow: 0 0 0 2px rgba(104,211,145,0.45), 0 0 26px rgba(104,211,145,0.2); }
.dm-empty strong { color: var(--text); font: 800 16px var(--font-heading); }
.dm-empty span { color: var(--muted); font-size: 13px; }

.dm-page .chat-composer { position: sticky; bottom: 0; min-height: 0; gap: 8px; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,0.06); background: rgba(10,14,11,0.9); backdrop-filter: blur(12px); }
.dm-page .chat-composer .input { min-height: 46px; padding: 0 18px; border: 1px solid rgba(255,255,255,0.1); border-radius: 999px; background: rgba(255,255,255,0.04); transition: border-color .18s, box-shadow .18s, background .18s; }
.dm-page .chat-composer .input:focus { border-color: rgba(104,211,145,0.55); background: rgba(255,255,255,0.05); box-shadow: 0 0 0 3px rgba(104,211,145,0.14); outline: none; }
.dm-page .dm-send { width: 46px; height: 46px; min-height: 46px; min-width: 0; padding: 0; border-radius: 50%; background: linear-gradient(180deg, #86e6a9, var(--green)); box-shadow: 0 10px 24px -10px rgba(104,211,145,0.85), inset 0 1px 0 rgba(255,255,255,0.4); }
.dm-page .dm-send:hover { transform: translateY(-1px) scale(1.03); }
.dm-send svg { width: 20px; height: 20px; }
.dm-send span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 720px) {
  .msg-header { margin-bottom: 16px; }
  .msg-header h1 { font-size: 34px; }
  .msg-header p { font-size: 13px; }
  .msg-layout { display: flex; flex-direction: column; gap: 18px; }
  .msg-start { position: static; order: -1; min-width: 0; }
  .msg-page .msg-people { display: flex; gap: 4px; margin: 0 -15px; padding: 2px 15px 4px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none; border: 0; border-radius: 0; background: none; box-shadow: none; }
  .msg-page .msg-people::-webkit-scrollbar { display: none; }
  .msg-page .chat-directory-row { width: 70px; min-height: 0; flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 2px; border: 0; scroll-snap-align: start; }
  .msg-page .chat-directory-row:hover { background: none; }
  .msg-page .chat-directory-row .msg-avatar .avatar { width: 54px; height: 54px; font-size: 15px; box-shadow: 0 0 0 2px #0b0f0c, 0 0 0 3.5px rgba(104,211,145,0.35); }
  .msg-page .chat-directory-row > span:not(.msg-avatar) { width: 100%; text-align: center; }
  .msg-page .chat-directory-row strong { font-size: 11px; font-weight: 700; color: var(--text-soft); }
  .msg-page .chat-directory-row small, .msg-page .chat-directory-row > b { display: none; }
  .msg-page .conversation-list { padding: 4px; border-radius: 18px; }
  .msg-page .conversation-row { min-height: 68px; gap: 12px; padding: 10px; }
  .msg-page .conversation-row + .conversation-row::before { left: 68px; }

  .dm-page { height: 100%; min-height: 0; padding: 10px 10px 8px; }
  .dm-header { gap: 7px; margin-bottom: 8px; padding: 8px; border-radius: 18px; }
  .dm-page .dm-actions { gap: 6px; }
  .dm-back { width: 34px; height: 34px; border-radius: 11px; }
  .dm-header .msg-avatar .avatar { width: 40px; height: 40px; font-size: 13px; }
  .dm-page .dm-who h1 { font-size: 15px; }
  .dm-page .dm-who > span { font-size: 11px; }
  .dm-actions .btn { min-height: 36px; gap: 6px; padding: 0 11px; font-size: 12px; }
  .dm-action-profile { width: 36px; padding: 0 !important; }
  .dm-action-profile span:not(.sidebar-nav-icon) { display: none; }
  .dm-page .dm-shell { border-radius: 18px; }
  .dm-page .dm-thread { padding: 10px 10px 8px; }
  .dm-page .dm-message > div { max-width: 82%; }
  .dm-page .chat-composer { padding: 8px; }
  .dm-page .chat-composer .btn { min-width: 0; padding: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dm-page .dm-message { animation: none; }
  .msg-page .conversation-row, .msg-row-chevron, .dm-back, .dm-page .dm-send { transition: none; }
}
