/* ClassySweeps — plain CSS, no build step needed */
/* Same navy + cyan palette as the landing page (public/css/landing.css) */
:root {
  color-scheme: dark;
  --bg: #061327; --surface: #0d2240; --surface-2: #11294b; --input: #081a31; --text: #eef7ff; --muted: #8ea6c6;
  --line: rgba(56, 189, 248, .16); --line-2: rgba(56, 189, 248, .32);
  --primary: #22d3ee; --primary-dark: #0ea5e9; --primary-soft: rgba(34, 211, 238, .14); --on-primary: #04202b;
  --primary-grad: linear-gradient(180deg, #67e8f9, #0ea5e9);
  --gold: #fbbf24; --orange: #f97316;
  --purple: #7c3aed; --green: #22c55e; --amber: #f59e0b; --red: #ef4444; --slate: #94a3b8;
  --radius: 16px; --shadow: 0 1px 3px rgba(0,0,0,.35), 0 10px 28px rgba(0,0,0,.3);
}
* { box-sizing: border-box; }
/* Classes like .btn set display, which would otherwise override the hidden attribute */
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.55 "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text);
  background: radial-gradient(ellipse at 60% -10%, rgba(34,211,238,.14), transparent 50%),
              radial-gradient(circle at 95% 100%, rgba(124,58,237,.18), transparent 40%), var(--bg) fixed; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Top bar */
.topbar { background: rgba(8, 24, 46, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar .container { display: flex; align-items: center; gap: 20px; height: 72px; max-width: 1240px; }
.brand { display: flex; align-items: center; color: var(--text); font-size: 24px; font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.logo-a { background: linear-gradient(180deg, #fde68a, var(--gold) 45%, var(--orange)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo-b { color: #fff; }
.logo-spark { margin-left: 4px; font-style: normal; font-size: .8em; color: #fff; text-shadow: 0 0 10px rgba(34, 211, 238, .8); }
.logo-img { height: 40px; width: auto; display: block; }
.brand-dot { width: 26px; height: 26px; border-radius: 8px; background: var(--primary-grad); color: #fff; display: grid; place-items: center; font-size: 14px; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; font-weight: 500; }
.nav a:hover, .nav a.active { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.nav-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.inline { display: inline; }

/* Sidebar layout (logged-in users and admins) */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 280px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 22px 16px 18px; background: linear-gradient(180deg, #0a1d38, #071429); border-right: 1px solid var(--line); overflow-y: auto; z-index: 30; }
.sidebar > .brand { padding: 0 10px 18px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.side-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .14em; color: var(--primary); padding: 10px 14px 6px; }
.side-nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-radius: 14px; color: var(--text); font-size: 16px; font-weight: 700;
  border: 1.5px solid transparent; transition: background .15s, border-color .15s; }
.side-nav a:hover { background: rgba(34, 211, 238, .07); text-decoration: none; }
.side-nav a.active { background: linear-gradient(90deg, #22c7e6, #0f6ea6); border-color: rgba(165, 243, 252, .55); color: #fff;
  box-shadow: 0 6px 24px rgba(14, 165, 233, .3); }
.side-nav .badge-count { margin-left: auto; }
.side-icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; font-size: 17px;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line); }
.side-nav a.active .side-icon { background: rgba(4, 32, 43, .28); border-color: rgba(255, 255, 255, .25); }
.side-user { display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: center; padding: 14px 8px 0; border-top: 1px solid var(--line); }
.side-avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800;
  background: var(--primary-grad); color: var(--on-primary); }
.side-user-info { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.side-user-info strong, .side-user-info span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-info span { font-size: 12px; color: var(--muted); }
.side-user form { grid-column: 1 / -1; }
.side-user form .btn { width: 100%; }
.shell-main { flex: 1; min-width: 0; }
.mobilebar { display: none; }
.side-backdrop { display: none; }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1.5px solid transparent; background: var(--primary-grad); color: var(--on-primary);
  padding: 10px 20px; border-radius: 10px; font: inherit; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; cursor: pointer;
  box-shadow: 0 0 0 1px rgba(103, 232, 249, .45) inset, 0 6px 20px rgba(14, 165, 233, .28); transition: transform .15s, box-shadow .15s, background .15s; }
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(103, 232, 249, .7) inset, 0 8px 28px rgba(14, 165, 233, .5); }
.btn:disabled { opacity: .6; cursor: default; transform: none; }
.btn-light { background: rgba(6, 19, 39, .6); color: var(--text); border-color: var(--line-2); box-shadow: none; }
.btn-light:hover { background: var(--surface-2); border-color: var(--primary); box-shadow: none; }
.btn-danger { background: linear-gradient(180deg, #f87171, #dc2626); color: #fff; box-shadow: 0 6px 20px rgba(220, 38, 38, .25); }
.btn-danger:hover { box-shadow: 0 8px 26px rgba(220, 38, 38, .45); }
.btn-sm { padding: 6px 12px; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.btn-block { width: 100%; padding: 13px 18px; }
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=search], textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 12px; font: inherit; background: var(--input); color: var(--text); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
::placeholder { color: #5f7a9c; }
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 13px; }
.error { color: var(--red); font-size: 13px; margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
/* Show / hide password (the wrapper and button are added by the script in layouts/app) */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; border-radius: 7px; background: none; color: var(--muted); cursor: pointer; padding: 0; }
.pw-toggle:hover { color: var(--text); background: var(--surface-2); }
.pw-toggle:focus-visible { outline: 2px solid var(--primary); }
.pw-toggle svg { width: 18px; height: 18px; }
input::-ms-reveal { display: none; }

/* Cards, alerts, tables */
.card { background: linear-gradient(160deg, var(--surface-2), var(--surface)); border: 1.5px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.page { padding-top: 28px; padding-bottom: 48px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }
h3 { font-weight: 700; }
.alert { padding: 11px 14px; border-radius: 9px; margin-bottom: 16px; }
.alert-success { background: rgba(34,197,94,.12); color: #86efac; border: 1px solid rgba(34,197,94,.35); }
.alert-error { background: rgba(239,68,68,.12); color: #fca5a5; border: 1px solid rgba(239,68,68,.35); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--primary); font-weight: 700; }
tbody tr:hover td, table tr:hover td { background: rgba(34, 211, 238, .03); }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.muted { color: var(--muted); }
.truncate { max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--slate); }
.badge-new { background: rgba(124,58,237,.18); color: #c4b5fd; }
.badge-waiting { background: rgba(245,158,11,.16); color: #fcd34d; }
.badge-open { background: rgba(34,197,94,.16); color: #86efac; }
.badge-closed { background: rgba(148,163,184,.12); color: var(--slate); }
.badge-admin { background: var(--primary-soft); color: var(--primary); }
.badge-agent { background: rgba(236,72,153,.16); color: #f9a8d4; }
.presence { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--slate); margin-right: 6px; vertical-align: middle; }
.presence.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.badge-count { background: var(--red); color: #fff; min-width: 20px; text-align: center; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--primary-grad); }
.stat .num { font-size: 36px; font-weight: 900; line-height: 1.1; }
.stat .lbl { color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 8px 16px; border-radius: 12px; background: var(--surface); border: 1.5px solid var(--line); color: var(--muted); font-weight: 700; font-size: 14px; }
.tabs a:hover { color: var(--text); border-color: var(--line-2); }
.tabs a.active { background: var(--primary-grad); border-color: transparent; color: var(--on-primary); }
.tabs a:hover { text-decoration: none; }
dl.info { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; margin: 0; }
dl.info dt { color: var(--muted); } dl.info dd { margin: 0; font-weight: 500; word-break: break-word; }
.pagination { margin-top: 16px; }
.pagination nav { display: flex; justify-content: center; }

/* Auth pages */
.auth { min-height: calc(100vh - 72px); display: grid; place-items: center; padding: 32px 16px; }
.auth .card { position: relative; overflow: hidden; width: 100%; max-width: 440px; padding: 30px 28px; border-color: var(--line-2);
  background: radial-gradient(ellipse at 50% -20%, rgba(34, 211, 238, .2), transparent 60%), linear-gradient(160deg, #0c2a4a, #0b1c3a 60%, #151a45); }
.auth .card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--primary-grad); }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--muted); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn-google svg { width: 18px; height: 18px; }
.auth h1 { font-size: 28px; font-weight: 900; text-transform: uppercase; } .auth p.sub { color: var(--muted); margin-top: -6px; }

/* Home */
.hero { padding: 72px 0 56px; text-align: center; }
.hero h1 { font-size: clamp(30px, 5vw, 48px); max-width: 760px; margin: 0 auto 16px; }
.hero p { font-size: 18px; color: var(--muted); max-width: 600px; margin: 0 auto 28px; }
.hero .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; padding-bottom: 64px; }
.features .icon { font-size: 26px; margin-bottom: 6px; }

/* Chat window */
.chat { display: flex; flex-direction: column; height: calc(100vh - 100px); min-height: 440px; padding: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.chat-head .title { font-weight: 700; }
.chat-title { flex: 1; min-width: 0; }
.chat-title .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-avatar { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 17px;
  background: var(--primary-grad); color: var(--on-primary); }
.chat-back, .chat-info-btn, .sheet-close, .sheet-backdrop, .tabbar { display: none; }

/* ---- Staff inbox: messaging-app style conversation list ---- */
.inbox { max-width: 860px; }
.inbox-head { justify-content: flex-start; margin-bottom: 14px; }
.inbox-total { padding: 5px 12px; border-radius: 99px; background: var(--surface-2); font-size: 13px; font-weight: 600; }
.inbox-search input { border-radius: 14px; padding: 13px 16px; }
.inbox-filters { display: flex; gap: 8px; margin: 14px 0; overflow-x: auto; scrollbar-width: none; }
.inbox-filters::-webkit-scrollbar { display: none; }
.inbox-filters a { flex-shrink: 0; padding: 8px 16px; border-radius: 99px; background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 14px; white-space: nowrap; }
.inbox-filters a:hover { text-decoration: none; background: var(--primary-soft); }
.inbox-filters a.active { background: var(--orange); color: #fff; }
.inbox-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.inbox-row { display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.inbox-row:last-child { border-bottom: 0; }
.inbox-row:hover { background: var(--surface-2); }
.inbox-row-link { flex: 1; min-width: 0; display: flex; gap: 14px; padding: 14px 0; color: var(--text); }
.inbox-row-link:hover { text-decoration: none; }
.inbox-avatar { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 16px;
  color: #fff; background: linear-gradient(135deg, #ec4899, var(--purple)); }
.inbox-row-main { flex: 1; min-width: 0; }
.inbox-row-top, .inbox-row-mid { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.inbox-row-top strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-time { flex-shrink: 0; font-size: 12px; color: var(--muted); }
.inbox-row-mid { margin: 4px 0; }
.inbox-tags { display: flex; gap: 6px; min-width: 0; overflow: hidden; }
.inbox-tags .badge { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticks { width: 17px; height: 17px; flex-shrink: 0; color: var(--muted); }
.ticks.read { color: var(--green); }
.msg .meta .ticks { width: 15px; height: 15px; margin-left: 3px; vertical-align: -3px; }
.inbox-preview { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-row.is-unread .inbox-preview { color: var(--text); font-weight: 600; }
.chat-aside { align-self: start; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.send-btn svg { display: none; width: 20px; height: 20px; }
.chat-body { flex: 1; overflow-y: auto; padding: 18px; background: var(--input); display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 76%; display: flex; flex-direction: column; }
.msg .bubble { padding: 9px 13px; border-radius: 14px; word-wrap: break-word; }
.msg .bubble .text { display: block; white-space: pre-wrap; }
.msg .meta { font-size: 11.5px; color: var(--muted); margin: 3px 6px 0; }
.msg.theirs { align-self: flex-start; }
.msg.theirs .bubble { background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.mine .bubble { background: linear-gradient(160deg, #67e8f9, #0ea5e9); color: var(--on-primary); font-weight: 500; border-bottom-right-radius: 4px; }
.msg.system .bubble { background: rgba(124,58,237,.16); border: 1px solid rgba(124,58,237,.35); color: var(--text); }
.msg.mine.system .bubble { border-bottom-right-radius: 4px; }
.msg .bubble img { display: block; max-width: 100%; max-height: 260px; border-radius: 10px; }
.msg .bubble a + .text { margin-top: 6px; }
.attach { display: grid; place-items: center; flex: 0 0 46px; height: 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; font-size: 18px; }
.attach:hover { border-color: var(--primary); }
.attach-preview { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--surface); font-size: 13px; color: var(--muted); }
.attach-preview img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.attach-preview span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-preview button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; }
.join-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-top: 1px solid var(--line); background: rgba(245,158,11,.1); color: #fcd34d; font-size: 14px; }
.join-bar.locked { background: rgba(148,163,184,.1); color: var(--muted); }
.join-bar[hidden], .chat-form[hidden], .attach-preview[hidden] { display: none; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--surface); }
.chat-head { background: rgba(8, 24, 46, .6); }
.chat-form textarea { resize: none; height: 46px; }
.chat-layout { display: grid; grid-template-columns: 1fr 300px; gap: 18px; }

@media (max-width: 800px) {
  .grid-2, .chat-layout { grid-template-columns: 1fr; }
  .topbar .container { height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
  .msg { max-width: 88%; }
  .chat { height: calc(100vh - 160px); }
}

/* Sidebar becomes a slide-in menu on tablets and phones */
@media (max-width: 960px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .25s ease; box-shadow: 0 0 40px rgba(0,0,0,.5); }
  .shell.side-open .sidebar { transform: none; }
  .shell.side-open .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 25; }
  .mobilebar { display: flex; align-items: center; gap: 12px; height: 58px; padding: 0 16px; position: sticky; top: 0; z-index: 20;
    background: rgba(8, 24, 46, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .menu-btn { background: none; border: 0; color: var(--text); font-size: 22px; cursor: pointer; padding: 4px; }
  .chat { height: calc(100vh - 150px); }
}

/* Admin: games & site images */
select, input[type=number] { width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 12px; font: inherit; background: var(--input); color: var(--text); }
input[type=color] { width: 48px; height: 42px; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--input); cursor: pointer; }
input[type=file] { color: var(--muted); }
input[type=file]::file-selector-button { margin-right: 10px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 14px; }
.game-row { display: grid; grid-template-columns: 120px 1fr; gap: 20px; align-items: start; }
.game-thumb { width: 120px; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; display: grid; place-items: center; font-size: 44px; }
.game-thumb img { width: 100%; height: 100%; object-fit: cover; background: var(--input); }
.image-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.image-slots h3 { margin-bottom: 4px; }
.slot-preview { height: 170px; margin: 12px 0; border-radius: 10px; display: grid; place-items: center; overflow: hidden;
  background: repeating-conic-gradient(#0f2544 0% 25%, #0a1b33 0% 50%) 50% / 20px 20px; border: 1px solid var(--line); }
.announcement-grid { grid-template-columns: 90px 1fr 2fr 120px; }
.win-grid { grid-template-columns: 2fr 1fr 1fr; }
.announcement-preview { margin-bottom: 14px; padding: 10px 14px; border-radius: 10px; background: #040d1c; border: 1px solid var(--line);
  font-weight: 800; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.announcement-preview b { color: var(--primary); }
.announcement-preview .badge { margin-left: 8px; text-transform: none; }
@media (max-width: 800px) { .announcement-grid { grid-template-columns: 80px 1fr; } .win-grid { grid-template-columns: 1fr 1fr; } }
.slot-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
@media (max-width: 600px) { .game-row { grid-template-columns: 1fr; } }

/* Laravel "pagination::default" markup */
ul.pagination { display: flex; gap: 4px; list-style: none; padding: 0; margin: 16px 0 0; justify-content: center; flex-wrap: wrap; }
ul.pagination li > * { display: block; padding: 5px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
ul.pagination li.active > * { background: var(--primary-grad); border-color: transparent; color: var(--on-primary); font-weight: 700; }
ul.pagination li.disabled > * { color: var(--muted); }

/* ============================================================
   Phones & small tablets: look and feel of a native mobile app
   (bottom tab bar, full-screen chat, bottom sheets, safe areas)
   ============================================================ */
@media (max-width: 960px) {
  /* 16px inputs stop iOS from zooming in on focus */
  input[type=text], input[type=email], input[type=password], input[type=search], textarea, select { font-size: 16px; }
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .card { border-radius: 16px; padding: 18px; }
  .page { padding-top: 16px; padding-bottom: 24px; }
  .page-head h1 { font-size: 20px; }
  .truncate { max-width: 180px; }

  /* Slide-in sidebar drawer: keep clear of the notch and home bar */
  /* Pinned to top and bottom (not a vh height, which on phones reaches behind the browser toolbar and hides Log out) */
  .sidebar { top: 0; bottom: 0; height: auto; max-height: none; padding-top: calc(20px + env(safe-area-inset-top)); padding-bottom: calc(16px + env(safe-area-inset-bottom));
    overscroll-behavior: contain; }
  .side-nav { flex: 0 0 auto; }
  /* Account + Log out stay at the bottom edge, even when the menu has to scroll */
  .side-user { margin-top: auto; position: sticky; bottom: 0; background: rgba(7, 20, 41, .98); padding-bottom: 4px; }

  /* Title bar */
  .mobilebar { height: auto; min-height: 56px; padding: env(safe-area-inset-top) 16px 0; gap: 12px; }
  .mobilebar .brand-dot { flex: 0 0 30px; width: 30px; height: 30px; font-size: 16px; }
  .mobilebar .brand-dot:hover { text-decoration: none; }
  .mobilebar-title { flex: 1; min-width: 0; font-weight: 800; font-size: 17px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mobilebar-avatar { width: 32px; height: 32px; font-size: 14px; }

  /* Bottom tab bar */
  .shell-main main { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: rgba(8, 24, 46, .95); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; border: 0; background: none;
    color: var(--muted); font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-tap-highlight-color: transparent; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.active { color: var(--primary); }
  .tab-icon { position: relative; font-size: 21px; line-height: 1.2; }
  .tabbar a.active .tab-icon { filter: drop-shadow(0 0 8px rgba(34, 211, 238, .55)); }
  .tab-icon .badge-count { position: absolute; top: -4px; left: 60%; font-size: 10px; padding: 1px 5px; min-width: 18px; }

  /* Horizontal-scrolling filter chips */
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 14px; padding: 0 16px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { white-space: nowrap; flex-shrink: 0; }

  /* Inbox list runs edge to edge */
  .inbox-list { margin: 0 -16px; border-left: 0; border-right: 0; border-radius: 0; }

  /* ---- Full-screen chat ---- */
  .chat-screen .mobilebar, .chat-screen .tabbar, .chat-screen .page-head { display: none; }
  .chat-screen .shell-main main { padding-bottom: 0; }
  .chat-screen .page { padding: 0; }
  .chat-screen .chat-layout { display: block; }
  .chat-screen .chat { position: fixed; top: 0; left: 0; right: 0; height: var(--app-height, 100dvh); min-height: 0; z-index: 15;
    padding: 0; border: 0; border-radius: 0; box-shadow: none; }
  .chat-screen .alert { position: fixed; z-index: 40; left: 12px; right: 12px; top: calc(env(safe-area-inset-top) + 70px);
    box-shadow: var(--shadow); backdrop-filter: blur(10px); animation: toast 4s ease forwards; pointer-events: none; }
  @keyframes toast { 0%, 80% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
  /* The full-screen chat would cover the notifications prompt: float it over the chat instead */
  .chat-screen .push-banner { position: fixed; z-index: 40; left: 12px; right: 12px; width: auto; margin: 0;
    top: calc(env(safe-area-inset-top) + 64px); background: var(--surface-2); box-shadow: var(--shadow); }

  .chat-head { gap: 10px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px 6px; background: rgba(13, 34, 64, .96); backdrop-filter: blur(14px); }
  .chat-head .title { font-size: 16px; }
  .chat-head .badge { font-size: 11px; padding: 1px 8px; }
  .chat-head .btn-sm { min-height: 34px; padding: 5px 10px; white-space: nowrap; }
  .chat-back { display: grid; place-items: center; width: 36px; height: 40px; flex: 0 0 36px; padding: 0; border: 0; background: none; color: var(--primary); cursor: pointer; }
  .chat-back svg { width: 26px; height: 26px; }
  .chat-head .chat-avatar { width: 38px; height: 38px; flex-basis: 38px; font-size: 16px; }
  .chat-info-btn { display: inline-flex; font-size: 17px; }

  .chat-body { padding: 14px 12px; gap: 6px; overscroll-behavior: contain;
    background: radial-gradient(circle at 20% 10%, rgba(34,211,238,.08), transparent 45%), var(--input); }
  .msg { max-width: 82%; }
  .msg .bubble { border-radius: 18px; padding: 8px 13px; }
  .msg .meta { font-size: 11px; margin-bottom: 4px; }


  .join-bar { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .join-bar form, .join-bar .btn { flex-shrink: 0; }

  .chat-form { align-items: flex-end; gap: 6px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .chat-form textarea { height: 44px; max-height: 120px; padding: 10px 16px; border-radius: 22px; line-height: 1.4; }
  .attach { flex: 0 0 44px; height: 44px; border: 0; border-radius: 50%; background: none; font-size: 21px; }
  .send-btn { flex: 0 0 44px; width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; }
  .send-btn span { display: none; }
  .send-btn svg { display: block; }

  /* Customer info: bottom sheet */
  .chat-aside { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-height: 85dvh; overflow-y: auto;
    border-radius: 20px 20px 0 0; padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
    transform: translateY(105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
  .chat-aside::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 12px; }
  .info-open .chat-aside { transform: none; }
  .sheet-close { display: block; border: 0; background: var(--surface-2); color: var(--muted); width: 32px; height: 32px; border-radius: 50%; font-size: 14px; cursor: pointer; }
  .sheet-head h3 { margin: 0; }
  .sheet-head { margin-bottom: 12px; }
  .info-open .sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, .55); }
}

/* "Turn on notifications" prompt (js/push.js) */
.push-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px auto 0; max-width: 1088px; width: calc(100% - 32px);
    padding: 12px 14px; border-radius: var(--radius); border: 1.5px solid var(--primary); background: var(--primary-soft); }
.push-banner[hidden] { display: none; }
.push-banner-icon { font-size: 20px; }
.push-banner-text { flex: 1 1 220px; }

/* User notifications page */
.notification { margin-bottom: 12px; padding: 16px 18px; }
.notification-unread { border-color: var(--primary); }
.notification-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notification-time { margin-left: auto; }
.notification p { margin: 6px 0 0; white-space: pre-line; }
.notification .btn { margin-top: 10px; }
.notification { scroll-margin-top: 80px; }
.notification:target { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow); }

/* "Back to admin" box shown in the sidebar while an admin is logged in as someone else */
.side-return { display: grid; gap: 8px; margin: 0 12px 12px; padding: 12px; border: 1px solid rgba(245,158,11,.45); background: rgba(245,158,11,.12); border-radius: 10px; font-size: 13px; color: #fcd34d; }

/* Popup shown to a customer on other pages when an agent replies */
.reply-toast { position: fixed; z-index: 60; right: 20px; bottom: 100px; width: min(380px, calc(100% - 24px)); display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1.5px solid var(--primary); box-shadow: var(--shadow); color: var(--text);
  animation: reply-toast-in .25s ease-out; }
.reply-toast[hidden] { display: none; }
.reply-toast:hover { text-decoration: none; }
.reply-toast-icon { font-size: 24px; }
.reply-toast-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.reply-toast-text span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-toast-close { background: none; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px; }
@keyframes reply-toast-in { from { transform: translateY(16px); opacity: 0; } }
@media (max-width: 960px) { .reply-toast { right: 12px; left: 12px; bottom: calc(160px + env(safe-area-inset-bottom)); width: auto; } }

/* Minimize the customer chat into a floating chat icon */
.chat-min { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; margin-left: auto; padding: 0; border-radius: 12px;
  border: 1.5px solid var(--line); background: none; color: var(--muted); cursor: pointer; }
.chat-min:hover { color: var(--text); border-color: var(--line-2); }
.chat-min svg { width: 20px; height: 20px; }
.chat-min-note { display: none; max-width: 420px; margin: 12vh auto 0; text-align: center; }
.chat-min-note-icon { font-size: 40px; }
.chat-minimized .chat { display: none; }
.chat-minimized .chat-min-note { display: block; }
.chat-launcher { position: fixed; z-index: 50; right: 24px; bottom: 24px; width: 64px; height: 64px; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #67e8f9, #0ea5e9 55%, #7c3aed);
  box-shadow: 0 10px 28px rgba(14, 165, 233, .45), inset 0 1px 0 rgba(255, 255, 255, .35); animation: chat-launcher-in .3s cubic-bezier(.2, 1.4, .4, 1);
  transition: transform .15s ease; }
.chat-launcher[hidden] { display: none; }
.chat-launcher:hover { transform: scale(1.07); text-decoration: none; }
.chat-launcher svg { width: 34px; height: 34px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .25)); }
.chat-launcher::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(34, 211, 238, .6); animation: chat-launcher-pulse 2.2s ease-out infinite; }
.chat-launcher .badge-count { position: absolute; top: -2px; right: -2px; border: 2px solid var(--bg); }
@keyframes chat-launcher-in { from { transform: scale(0); opacity: 0; } }
@keyframes chat-launcher-pulse { from { transform: scale(1); opacity: .9; } to { transform: scale(1.55); opacity: 0; } }
@media (max-width: 960px) { .chat-launcher { right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); } }
@media (prefers-reduced-motion: reduce) { .chat-launcher, .chat-launcher::before { animation: none; } }

/* Message tone: mute button and volume popover */
.tone-btn { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; padding: 0; border-radius: 12px; border: 1.5px solid var(--line);
  background: none; color: var(--primary); cursor: pointer; }
.tone-btn:hover { border-color: var(--line-2); }
.tone-btn svg, .side-tone svg { width: 20px; height: 20px; }
.tone-off { display: none; }
.tone-muted .tone-on { display: none; }
.tone-muted .tone-off { display: block; }
.tone-muted .tone-btn, .tone-muted .side-tone { color: var(--muted); }
.chat-min { margin-left: 0; }
.chat-head .tone-btn { margin-left: auto; }
.side-tone { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: auto; padding: 10px 12px; border: 0; border-radius: 12px; background: none; color: var(--muted);
  font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.side-tone:hover { background: var(--surface-2); color: var(--text); }
.side-tone + .side-user { margin-top: 0; }
.tone-pop { position: fixed; z-index: 80; width: 250px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1.5px solid var(--line-2); box-shadow: var(--shadow); }
.tone-pop[hidden] { display: none; }
.tone-mute { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.tone-mute input { width: 18px; height: 18px; accent-color: var(--primary); }
.tone-vol { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.tone-vol input { flex: 1; min-width: 0; accent-color: var(--primary); }
.tone-muted .tone-vol { opacity: .45; }

/* Sound is blocked until the next tap: nudge the speaker buttons */
.tone-needs-tap .tone-btn, .tone-needs-tap .side-tone { animation: tone-nudge 1.2s ease-in-out infinite; color: var(--gold); border-color: var(--gold); }
@keyframes tone-nudge { 50% { transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .tone-needs-tap .tone-btn, .tone-needs-tap .side-tone { animation: none; } }

/* Staff chat alarm bell */
.bell-btn { position: relative; display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; padding: 0; border-radius: 12px; border: 1.5px solid var(--line);
  background: none; color: var(--primary); cursor: pointer; }
.bell-btn:hover { border-color: var(--line-2); }
.bell-btn svg, .side-bell svg { width: 20px; height: 20px; }
.bell-btn .badge-count { position: absolute; top: -6px; right: -6px; font-size: 10px; padding: 1px 5px; min-width: 18px; border: 2px solid var(--bg); }
.bell-btn .badge-count[hidden], .side-bell .badge-count[hidden] { display: none; }
.bell-btn-lg { width: 46px; height: 46px; flex-basis: 46px; margin-left: auto; border-radius: 50%; background: var(--surface-2); }
.bell-btn-lg svg { width: 24px; height: 24px; }
.bell-off { display: none; }
.bell-muted .bell-on { display: none; }
.bell-muted .bell-off { display: block; }
.bell-muted .bell-btn, .bell-muted .side-bell { color: var(--muted); }
.side-bell .badge-count { margin-left: auto; }
.bell-ringing .bell-btn, .bell-ringing .side-bell { color: var(--gold); border-color: var(--gold); }
.bell-ringing .bell-btn svg, .bell-ringing .side-bell svg { transform-origin: 50% 8%; animation: bell-shake .9s ease-in-out infinite; }
.bell-ringing.bell-muted .bell-btn svg, .bell-ringing.bell-muted .side-bell svg { animation: none; }
/* The inbox page has its own big bell, so the top bar and sidebar copies hide there. */
.inbox-screen .mobilebar .bell-btn, .inbox-screen .side-bell { display: none; }
@keyframes bell-shake { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(16deg); } 30% { transform: rotate(-14deg); } 45% { transform: rotate(10deg); } 60% { transform: rotate(-8deg); } 75% { transform: rotate(4deg); } }
@media (prefers-reduced-motion: reduce) { .bell-ringing .bell-btn svg, .bell-ringing .side-bell svg { animation: none; } }

/* Chat quick buttons and the game picker */
.quick-actions { display: flex; gap: 8px; padding: 8px 12px 0; background: var(--surface); border-top: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.quick-actions::-webkit-scrollbar { display: none; }
.quick-chip { flex-shrink: 0; padding: 8px 16px; border-radius: 99px; border: 1.5px solid var(--line-2); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.quick-chip:hover, .quick-chip[aria-expanded="true"] { border-color: var(--primary); color: var(--primary); }
.quick-actions + .game-picker + .chat-form, .quick-actions + .chat-form { border-top: 0; }
.game-picker { display: flex; flex-direction: column; max-height: 55%; min-height: 200px; background: var(--surface); border-top: 1px solid var(--line); }
.game-picker[hidden] { display: none; }
.game-picker-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 4px; }
.game-picker-close { border: 0; background: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px 8px; }
.game-picker-tabs { display: flex; gap: 6px; padding: 4px 14px 8px; overflow-x: auto; scrollbar-width: none; }
.game-picker-tabs button { flex-shrink: 0; padding: 5px 14px; border-radius: 99px; border: 0; background: var(--surface-2); color: var(--muted); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; }
.game-picker-tabs button.active { background: var(--primary); color: var(--on-primary); }
.game-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; padding: 6px 14px 14px; overflow-y: auto; overscroll-behavior: contain; }
.game-pick { display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; color: var(--text); font: inherit; cursor: pointer; text-align: center; }
.game-pick[hidden] { display: none; }
.game-pick-art { aspect-ratio: 1; border-radius: 16px; overflow: hidden; display: grid; place-items: center; font-size: 34px;
  background: linear-gradient(160deg, var(--from, #7c3aed), var(--to, #1e1b4b)); border: 1.5px solid var(--line); transition: transform .12s ease, border-color .12s ease; }
.game-pick-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.game-pick:hover .game-pick-art, .game-pick:active .game-pick-art { transform: scale(1.05); border-color: var(--primary); }
.game-pick-name { font-size: 12px; font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (max-width: 960px) { .game-picker { max-height: 60%; } .game-picker-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); } }

/* ---- Customer header: logo + account menu on every page (same as the homepage header) ---- */
.userbar { display: flex; align-items: center; gap: 12px; height: 72px; padding: 0 28px; position: sticky; top: 0; z-index: 20;
  background: rgba(8, 24, 46, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.userbar .user-menu { margin-left: auto; }
.userbar .tone-btn { display: none; margin-left: auto; } /* computers use the sidebar's "Message sound" */
.has-userbar .chat { height: calc(100vh - 172px); }
@media (min-width: 961px) { .has-userbar .sidebar > .brand { display: none; } } /* the logo is in the header instead */
@media (max-width: 960px) {
  .userbar { height: auto; min-height: 56px; padding: env(safe-area-inset-top) 16px 0; }
  .userbar .brand { font-size: 20px; }
  .userbar .logo-img { height: 32px; }
  .userbar .user-menu-btn { width: 36px; height: 36px; }
  .userbar .tone-btn { display: grid; }
  .userbar .tone-btn + .user-menu { margin-left: 0; }
  /* Full-screen chat sits under the header; its own bar already has the sound button */
  .has-userbar.chat-screen .userbar .tone-btn { display: none; }
  .has-userbar.chat-screen .userbar .user-menu { margin-left: auto; }
  .has-userbar.chat-screen .chat { top: calc(56px + env(safe-area-inset-top)); height: calc(var(--app-height, 100dvh) - 56px - env(safe-area-inset-top)); }
  .has-userbar .chat-head { padding-top: 8px; }
  .has-userbar.chat-screen .alert { top: calc(env(safe-area-inset-top) + 126px); }
  .has-userbar.chat-screen .push-banner { top: calc(env(safe-area-inset-top) + 120px); }
}
