:root {
  color-scheme: dark;
  --bg: var(--tg-theme-bg-color, #0d111a);
  --card: var(--tg-theme-secondary-bg-color, #171d2a);
  --text: var(--tg-theme-text-color, #f4f6fb);
  --muted: var(--tg-theme-hint-color, #98a2b4);
  --link: var(--tg-theme-link-color, #7c9cff);
  --button: var(--tg-theme-button-color, #6f5cff);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --border: rgba(255,255,255,.09);
  --danger: #ff6b7a;
  --ok: #59d89c;
  --warning: #ffd166;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { padding: env(safe-area-inset-top) 0 calc(82px + env(safe-area-inset-bottom)); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.topbar { position: sticky; top: 0; z-index: 10; display:flex; justify-content:space-between; align-items:center; padding:18px 18px 12px; background:linear-gradient(180deg,var(--bg) 72%,transparent); }
.eyebrow { font-size:10px; letter-spacing:.26em; color:#9e8cff; font-weight:800; }
h1 { margin:3px 0 0; font-size:24px; }
h2 { font-size:20px; margin:0 0 12px; }
h3 { font-size:16px; margin:0; }
p { line-height:1.45; }
main { max-width:760px; margin:0 auto; padding:4px 14px 24px; }
.view { display:none; animation:fade .18s ease; }
.view.active { display:block; }
@keyframes fade { from { opacity:.4; transform:translateY(3px) } to { opacity:1; transform:none } }
.card { background:linear-gradient(145deg,rgba(255,255,255,.035),transparent),var(--card); border:1px solid var(--border); border-radius:18px; padding:16px; margin-bottom:12px; box-shadow:0 10px 28px rgba(0,0,0,.13); }
.hero { padding:20px; background:radial-gradient(circle at 90% 0%,rgba(124,92,255,.33),transparent 42%),var(--card); }
.hero h2 { font-size:25px; }
.muted { color:var(--muted); }
.row { display:flex; gap:10px; align-items:center; }
.between { justify-content:space-between; }
.grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.stat { padding:13px; background:rgba(255,255,255,.035); border:1px solid var(--border); border-radius:14px; }
.stat b { display:block; font-size:20px; margin-top:3px; overflow-wrap:anywhere; font-variant-numeric:tabular-nums; }
.btn { width:100%; border:0; border-radius:13px; padding:13px 15px; background:var(--button); color:var(--button-text); font-weight:800; }
.btn.secondary { background:rgba(255,255,255,.07); color:var(--text); border:1px solid var(--border); }
.btn.danger { background:rgba(255,107,122,.16); color:#ff9baa; border:1px solid rgba(255,107,122,.25); }
.btn.small { width:auto; padding:9px 12px; font-size:13px; }
.icon-btn { width:40px; height:40px; border-radius:13px; border:1px solid var(--border); background:var(--card); color:var(--text); font-size:20px; }
.actions { display:grid; gap:9px; }
label { display:block; font-size:13px; font-weight:700; margin:13px 0 6px; }
input, textarea, select { width:100%; border:1px solid var(--border); border-radius:12px; padding:12px; background:rgba(0,0,0,.16); color:var(--text); outline:none; }
textarea { min-height:106px; resize:vertical; }
input:focus, textarea:focus, select:focus { border-color:rgba(124,156,255,.7); }
.ticket { display:block; width:100%; text-align:left; border:1px solid var(--border); border-radius:14px; padding:13px; margin-top:8px; color:var(--text); background:rgba(255,255,255,.03); }
.ticket .num { font-weight:850; }
.ticket .status { color:var(--muted); font-size:12px; margin-top:5px; }
.badge { display:inline-flex; align-items:center; gap:5px; border-radius:999px; background:rgba(255,255,255,.07); padding:5px 9px; font-size:11px; color:var(--muted); }
.question { border-top:1px solid var(--border); margin-top:12px; padding-top:10px; }
.message { max-width:88%; padding:10px 12px; border-radius:14px; margin:8px 0; white-space:pre-wrap; overflow-wrap:anywhere; }
.message.user { margin-left:auto; background:rgba(111,92,255,.2); border:1px solid rgba(111,92,255,.3); }
.message.staff { background:rgba(89,216,156,.10); border:1px solid rgba(89,216,156,.2); }
.message .meta { font-size:10px; color:var(--muted); margin-bottom:4px; }
.tabbar { position:fixed; bottom:0; left:0; right:0; z-index:20; display:grid; grid-template-columns:repeat(4,1fr); padding:8px 8px calc(8px + env(safe-area-inset-bottom)); backdrop-filter:blur(20px); background:rgba(11,14,22,.91); border-top:1px solid var(--border); }
.tab { border:0; background:transparent; color:var(--muted); display:grid; place-items:center; gap:3px; padding:6px 2px; }
.tab span { font-size:20px; }
.tab small { font-size:10px; }
.tab.active { color:var(--text); }
.toast { position:fixed; left:50%; bottom:96px; transform:translateX(-50%) translateY(10px); opacity:0; pointer-events:none; max-width:90%; padding:10px 14px; border-radius:12px; background:#222938; color:white; transition:.2s; z-index:50; text-align:center; }
.toast.show { opacity:1; transform:translateX(-50%) translateY(0); }
.error { color:#ff9baa; }
.success { color:#82e6b6; }
.loading { padding:28px 10px; text-align:center; color:var(--muted); }
.game-session { display:flex; flex-direction:column; align-items:center; gap:8px; min-height:0; }
.canvas-wrap { position:relative; overflow:hidden; width:min(100%, 440px, calc((100dvh - 250px) * 9 / 13)); min-width:230px; aspect-ratio:9/13; margin:0 auto; border-radius:18px; border:1px solid var(--border); background:linear-gradient(#142b45,#0a1828 55%,#07111d); box-shadow:0 16px 36px rgba(0,0,0,.22); }
#game-canvas { display:block; width:100%; height:100%; touch-action:none; }
.game-hud { position:absolute; inset:10px 10px auto; display:grid; grid-template-columns:1fr auto 1fr; align-items:center; gap:8px; pointer-events:none; font-weight:800; text-shadow:0 1px 3px #000; font-size:13px; }
.game-hud__score { justify-self:start; min-width:0; white-space:nowrap; font-variant-numeric:tabular-nums; }
.game-hud__time { justify-self:center; }
.game-hud__lives { justify-self:end; letter-spacing:-2px; white-space:nowrap; }
.game-help { width:min(100%, 520px); margin:0; text-align:center; font-size:12px; line-height:1.35; }
@media (max-height:760px) { .topbar { padding-top:10px; padding-bottom:7px; } .topbar h1 { font-size:20px; } main { padding-top:0; padding-bottom:12px; } .canvas-wrap { width:min(100%, 400px, calc((100dvh - 205px) * 9 / 13)); } .game-help { font-size:11px; } }
@media (max-height:620px) { .canvas-wrap { width:min(100%, 350px, calc((100dvh - 170px) * 9 / 13)); } .game-help { display:none; } }
.leaderboard { counter-reset:rank; list-style:none; padding:0; margin:0; }
.leaderboard li { display:flex; justify-content:space-between; gap:10px; padding:10px 0; border-bottom:1px solid var(--border); }
.leaderboard li b { flex:0 0 auto; font-variant-numeric:tabular-nums; }
.leaderboard li:last-child { border-bottom:0; }
.empty { text-align:center; color:var(--muted); padding:20px 8px; }
.file-note { font-size:12px; color:var(--muted); margin-top:5px; }
@media (min-width:640px) { main { padding-left:20px; padding-right:20px; } .hero { padding:24px; } }

/* v0.2.3: custom category picker for Telegram Mini App */
.required-mark { color: var(--danger); }
.field-error { min-height: 18px; margin-top: 6px; color: #ff9baa; font-size: 12px; font-weight: 700; }
.category-picker-trigger {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(124,156,255,.55);
  border-radius: 14px;
  background: rgba(7,13,24,.58);
  color: var(--text);
  text-align: left;
  outline: none;
  transition: border-color .16s ease, background .16s ease, transform .1s ease;
}
.category-picker-trigger:active { transform: scale(.995); }
.category-picker-trigger:focus-visible { border-color: #8ea7ff; box-shadow: 0 0 0 3px rgba(124,156,255,.15); }
.category-picker-trigger.selected { border-color: rgba(111,92,255,.85); background: rgba(111,92,255,.08); }
.category-picker-trigger__content { min-width: 0; display: flex; align-items: center; gap: 11px; }
.category-picker-trigger__emoji { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,.06); font-size: 20px; }
.category-picker-trigger__text { min-width: 0; display: grid; gap: 3px; }
.category-picker-trigger__text strong { font-size: 15px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-picker-trigger__text small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-picker-trigger__chevron { flex: 0 0 auto; color: var(--muted); font-size: 21px; line-height: 1; transform: translateY(-2px); }

body.picker-open { overflow: hidden; }
.category-picker { position: fixed; inset: 0; z-index: 100; pointer-events: none; visibility: hidden; }
.category-picker.open { pointer-events: auto; visibility: visible; }
.category-picker__backdrop { position: absolute; inset: 0; width: 100%; border: 0; padding: 0; background: rgba(0,0,0,.56); opacity: 0; transition: opacity .2s ease; }
.category-picker.open .category-picker__backdrop { opacity: 1; }
.category-picker__sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(78vh, 720px);
  display: flex;
  flex-direction: column;
  padding: 8px 14px calc(16px + env(safe-area-inset-bottom));
  border: 1px solid rgba(255,255,255,.10);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background: #101827;
  box-shadow: 0 -22px 60px rgba(0,0,0,.45);
  transform: translateY(105%);
  transition: transform .24s cubic-bezier(.2,.75,.25,1);
}
.category-picker.open .category-picker__sheet { transform: translateY(0); }
.category-picker__handle { width: 42px; height: 4px; margin: 1px auto 11px; border-radius: 99px; background: rgba(255,255,255,.20); }
.category-picker__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.category-picker__header h3 { margin-top: 4px; font-size: 19px; }
.category-picker__close { width: 38px; height: 38px; flex: 0 0 auto; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.055); color: var(--text); font-size: 24px; line-height: 1; }
.category-picker__search-wrap { display: flex; align-items: center; gap: 8px; padding: 0 11px; margin-bottom: 10px; border: 1px solid rgba(255,255,255,.11); border-radius: 13px; background: #0a1220; color: var(--muted); }
.category-picker__search { border: 0; border-radius: 0; padding: 11px 0; background: transparent; color: #fff; }
.category-picker__search:focus { border-color: transparent; }
.category-picker__search::placeholder { color: #7f8ba0; opacity: 1; }
.category-picker__list { min-height: 80px; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 7px; padding: 1px 1px 3px; scrollbar-width: thin; }
.category-option {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) 24px;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid rgba(255,255,255,.075);
  border-radius: 14px;
  background: #162133;
  color: #f7f9ff;
  text-align: left;
  transition: background .14s ease, border-color .14s ease, transform .1s ease;
}
.category-option:active { transform: scale(.993); background: #1d2b42; }
.category-option.selected { border-color: rgba(124,156,255,.78); background: linear-gradient(135deg,rgba(111,92,255,.18),rgba(22,33,51,.96)); }
.category-option__emoji { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: rgba(255,255,255,.06); font-size: 22px; }
.category-option__body { min-width: 0; display: grid; gap: 3px; }
.category-option__body strong { font-size: 14px; color: #fff; }
.category-option__body small { display: -webkit-box; overflow: hidden; color: #9eabc0; font-size: 11px; line-height: 1.3; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.category-option__check { justify-self: end; color: #9eb0ff; font-size: 18px; font-weight: 900; }
.category-picker__empty { padding: 28px 12px; text-align: center; color: var(--muted); }

/* Native selects remain only for dynamic CHOICE questions. Keep them readable in all WebViews. */
select, select option { background: #162133; color: #fff; }
select option:checked { background: #25344d; color: #fff; }
.btn:disabled { opacity: .48; cursor: not-allowed; filter: saturate(.55); }

@media (min-width: 640px) {
  .category-picker__sheet { left: 50%; right: auto; width: min(620px, calc(100% - 32px)); transform: translate(-50%, 105%); border-radius: 24px 24px 0 0; }
  .category-picker.open .category-picker__sheet { transform: translate(-50%, 0); }
}

/* v0.2.7: game economy, upgrade shop and leaderboard run time */
.game-hud { grid-template-columns: minmax(0,1fr) auto auto minmax(0,1fr); }
.game-hud__coins { justify-self:center; white-space:nowrap; color:#ffd86a; font-variant-numeric:tabular-nums; }
.game-wallet { padding:12px 0 4px; align-items:flex-end; }
.game-wallet > div { display:grid; gap:3px; }
.game-wallet > div:last-child { text-align:right; }
.game-wallet b { font-size:18px; font-variant-numeric:tabular-nums; }
.upgrade-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; margin-top:12px; }
.upgrade-card { display:flex; flex-direction:column; min-width:0; padding:12px; border:1px solid var(--border); border-radius:15px; background:rgba(255,255,255,.035); }
.upgrade-card__head { display:flex; align-items:center; gap:9px; min-width:0; }
.upgrade-card__head > div { min-width:0; display:grid; gap:2px; }
.upgrade-card__head strong { font-size:14px; overflow:hidden; text-overflow:ellipsis; }
.upgrade-card__head small { color:var(--muted); font-size:10px; letter-spacing:.02em; }
.upgrade-card__icon { flex:0 0 auto; width:37px; height:37px; display:grid; place-items:center; border-radius:11px; background:rgba(255,255,255,.06); font-size:21px; }
.upgrade-card p { flex:1; margin:9px 0 11px; color:var(--muted); font-size:11px; line-height:1.35; }
.upgrade-card .btn { width:100%; }
.leaderboard__player { min-width:0; display:flex; align-items:center; }
.leaderboard__player strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.leaderboard__result { flex:0 0 auto; display:grid; justify-items:end; gap:2px; }
.leaderboard__result b { font-size:14px; }
.leaderboard__result small { color:var(--muted); font-size:10px; font-variant-numeric:tabular-nums; }
@media (max-width:420px) {
  .upgrade-grid { grid-template-columns:1fr; }
  .game-hud { font-size:11px; gap:5px; inset-left:7px; inset-right:7px; }
}

/* v0.2.8: renderer-independent NeverLand coin + 50-level upgrade progression */
.nl-coin {
  display:inline-grid;
  place-items:center;
  width:1.05em;
  height:1.05em;
  box-sizing:border-box;
  flex:0 0 auto;
  border-radius:50%;
  border:1px solid #ffe58a;
  background:radial-gradient(circle at 32% 28%,#fff3a6 0 12%,#ffd34f 38%,#e99a17 68%,#9f5700 100%);
  box-shadow:inset 0 0 0 1px rgba(117,61,0,.45),0 0 7px rgba(255,191,53,.14);
  color:#6a3900;
  font:800 .58em/1 system-ui,sans-serif;
  vertical-align:-.08em;
}
.nl-coin > span { transform:translateY(.02em); }
.nl-coin--sm { width:.95em; height:.95em; font-size:.95em; }
.nl-coin--hud { width:1.25em; height:1.25em; font-size:1em; }
.coin-amount { display:inline-flex; align-items:center; justify-content:center; gap:.32em; white-space:nowrap; font-variant-numeric:tabular-nums; }
.upgrade-progress { height:5px; margin-top:8px; overflow:hidden; border-radius:999px; background:rgba(255,255,255,.07); }
.upgrade-progress > span { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#4c8dcc,#72b8ff); transition:width .2s ease; }
.upgrade-card__head small { font-variant-numeric:tabular-nums; }
.upgrade-card .btn .coin-amount { color:inherit; }


/* v0.3.0: voluntary early finish with saved progress */
.game-actions { width:min(100%, 440px); display:flex; justify-content:center; }
.game-stop-btn { width:100%; min-height:40px; padding:9px 14px; border-color:rgba(255,255,255,.12); }
.game-finish-note { margin:0 0 12px; font-size:12px; font-weight:700; }
@media (max-height:620px) {
  .game-actions { width:min(100%, 350px); }
  .game-stop-btn { min-height:36px; padding:7px 12px; font-size:12px; }
}

/* v0.3.1: live ticket sync + graceful backend sleep screen */
.sleep-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 13, 22, .94);
  backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, visibility .18s ease;
}
.sleep-overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.sleep-card {
  width: min(100%, 430px);
  padding: 28px 22px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(35,48,67,.98), rgba(19,27,40,.98));
  box-shadow: 0 24px 80px rgba(0,0,0,.42);
  text-align: center;
}
.sleep-card__icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 20px;
  background: rgba(124,156,255,.10);
  font-size: 38px;
}
.sleep-card h2 { margin: 8px 0 8px; }
.sleep-card p { margin: 0 0 18px; line-height: 1.45; }
.ticket-meta-row { display:flex; flex-wrap:wrap; gap:7px; align-items:center; }
.ticket-priority { opacity:.9; }

/* v19: stable startup containers, iOS/WebView-safe game layout. */
[hidden] { display:none !important; }
#app:not(.app-ready) .view { display:none !important; }
#app-status { width:100%; }
#app:not(.app-ready) .tab { opacity:.65; }
body.game-active { height:var(--app-vh,100dvh); min-height:0; padding:0; overflow:hidden; }
body.game-active #app {
  height:100%; min-height:0; display:grid; grid-template-rows:auto minmax(0,1fr) auto;
  padding-top:max(env(safe-area-inset-top,0px),var(--app-safe-top,0px));
  padding-left:max(env(safe-area-inset-left,0px),var(--app-safe-left,0px));
  padding-right:max(env(safe-area-inset-right,0px),var(--app-safe-right,0px));
}
body.game-active .topbar { position:relative; top:auto; flex:0 0 auto; padding:9px 14px 7px; background:var(--bg); }
body.game-active .topbar h1 { font-size:20px; }
body.game-active main { width:100%; min-height:0; max-height:100%; margin:0 auto; padding:0 12px 8px; overflow:hidden; }
body.game-active .view.active { height:100%; width:100%; min-height:0; animation:none; }
body.game-active .tabbar { position:static; padding:5px 8px calc(5px + max(env(safe-area-inset-bottom,0px),var(--app-safe-bottom,0px))); }
body.game-active .tab { padding:4px 2px; }
body.game-active .game-session { height:100%; min-height:0; gap:6px; width:100%; }
body.game-active .game-hud { position:static; inset:auto; flex:0 0 auto; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); width:100%; max-width:500px; gap:4px; font-size:14px; color:#fff; text-shadow:none; }
body.game-active .game-hud > span { display:grid; text-align:center; min-width:0; border:1px solid var(--border); border-radius:10px; background:var(--card); padding:5px 2px; }
body.game-active .game-hud small { font-size:9px; color:#abb9cc; }
body.game-active .game-hud b { font-size:clamp(10px,2.8vw,15px); white-space:nowrap; font-variant-numeric:tabular-nums; }
body.game-active .game-hud .low-lives { color:#ff937c; }
.game-stage { flex:1 1 0; min-height:0; width:100%; display:grid; place-items:center; overflow:hidden; }
body.game-active .canvas-wrap { flex:none; min-width:0; width:1px; height:1px; max-width:100%; max-height:100%; aspect-ratio:auto; border-radius:14px; margin:0; }
body.game-active .game-actions { flex:0 0 auto; display:grid; grid-template-columns:1fr 2.2fr; width:100%; max-width:500px; gap:7px; }
body.game-active .game-actions .btn { min-height:42px; padding:8px; font-size:12px; }
body.game-active .game-help { flex:0 0 auto; margin:0; font-size:10px; line-height:1.25; width:100%; color:#b4bdcc; }
.game-feedback { position:absolute; left:6px; right:6px; top:8px; color:#fff3ba; font-weight:800; font-size:13px; text-align:center; pointer-events:none; text-shadow:0 1px 4px #000; }
.game-pause-panel { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; padding:16px; background:rgba(5,13,25,.87); text-align:center; color:#f4f8ff; }
.game-pause-panel p { margin:0; font-size:12px; line-height:1.4; }
.game-pause-panel .btn { max-width:230px; }
@media (max-height:550px) {
  body.game-active .topbar { padding-top:4px; padding-bottom:4px; }
  body.game-active .topbar h1 { font-size:17px; }
  body.game-active .topbar .eyebrow { display:none; }
  body.game-active .game-help { display:none; }
  body.game-active .game-hud > span { padding:2px; }
}

/* v21: native WebView height recovery and safe small-window fallback. */
body.game-active.viewport-short .topbar { padding-top:4px; padding-bottom:4px; }
body.game-active.viewport-short .topbar h1 { font-size:17px; }
body.game-active.viewport-short .topbar .eyebrow { display:none; }
body.game-active.viewport-short .game-help { display:none; }
body.game-active.viewport-short .game-hud > span { padding:2px; }
.game-layout-notice { margin:0; padding:10px; border-radius:10px; background:#272233; color:#ffe3a6; font-size:12px; line-height:1.4; }
body.game-active.game-cramped main { overflow-y:auto; overscroll-behavior:contain; }
body.game-active.game-cramped .game-session { height:auto; padding-bottom:8px; }
body.game-active.game-cramped .game-stage { flex:none; height:220px; }
body.game-active.game-cramped .game-help { display:none; }
body.game-active.game-cramped .game-hud, body.game-active.game-cramped .game-actions { flex-shrink:0; }
/* v22 Hub modules: explicit contrast, wrapping and no dependence on hover. */
.hub-notice{border:1px solid rgba(185,162,255,.45);background:rgba(130,94,200,.1);border-radius:14px;padding:12px;margin:10px 0;color:var(--text)}
.hub-notice p{margin:4px 0}.hub-notice pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:12px;max-height:230px;overflow:auto}
.hub-incident{padding:14px;margin:8px 0 12px;border:1px solid rgba(255,205,110,.35);border-radius:14px;background:rgba(180,134,30,.08)}
.hub-incident .row{flex-wrap:wrap}.hub-incident p{white-space:pre-wrap;overflow-wrap:anywhere}
.hub-toolbar{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0}.hub-toolbar .file-note{width:100%;margin:0}
.hub-task{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 0;border-bottom:1px solid var(--border)}
.hub-task>div{flex:1;min-width:0}.hub-task small,.hub-achievement small,.hub-ranking small{display:block;color:var(--muted);margin:5px 0;overflow-wrap:anywhere}
.hub-task progress{width:100%;height:8px;accent-color:#a58cf3}.hub-task button{flex-shrink:0}
.hub-achievement{display:flex;gap:10px;align-items:center;padding:8px 0;font-weight:400}.hub-achievement input{width:20px;min-width:20px;height:20px;accent-color:#a58cf3}
.hub-cosmetics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.hub-cosmetic{display:flex;align-items:center;flex-direction:column;gap:10px;padding:12px;border-radius:14px;border:1px solid var(--border);text-align:center;min-width:0}
.hub-cosmetic strong{min-height:2.8em;overflow-wrap:anywhere}.hub-cosmetic canvas{width:144px;max-width:100%;height:auto;border-radius:12px}.hub-cosmetic button{width:100%}
.hub-ranking{display:flex;align-items:center;justify-content:space-between;gap:10px;border-bottom:1px solid var(--border);padding:10px 0}.hub-ranking>*{min-width:0;overflow-wrap:anywhere}
.hub-date{width:100%;margin:0}.hub-date input{width:auto;max-width:100%;margin-left:10px}.hub-status-host:empty{display:none}
#game-pause-panel .btn{margin-top:8px}.hub-notice input[type=checkbox]{width:auto}
@media(max-width:340px){.hub-cosmetics{grid-template-columns:1fr}.hub-task{flex-wrap:wrap}.hub-date input{width:100%;margin:8px 0}}
@media(prefers-reduced-motion:reduce){.view{animation:none}}

/* v23: one spacing scale for the pause card; no accumulated margin + gap.
 * The dialog is constrained by the available stage, not the portrait canvas. */
body.game-active .game-stage { position:relative; max-width:500px; }
body.game-active .game-pause-panel {
  z-index:3; margin:0; max-width:none; min-height:0; overflow:auto;
  overscroll-behavior:contain; justify-content:flex-start; align-items:stretch;
  padding:clamp(12px,3vw,20px); gap:0; border-radius:14px;
}
.game-pause-content { width:100%; min-width:0; margin:auto 0; display:grid; gap:12px; flex:0 0 auto; }
.game-pause-content > h3 { margin:0; line-height:1.2; font-size:20px; }
.game-pause-content > p { margin:0; line-height:1.45; overflow-wrap:anywhere; }
.game-pause-actions { display:grid; grid-template-columns:minmax(0,1fr); gap:8px; width:100%; max-width:300px; margin:0 auto; }
body.game-active #game-pause-panel .btn { width:100%; max-width:none; min-height:44px; padding:10px 12px; margin:0; line-height:1.25; overflow-wrap:anywhere; }
body.game-active #game-save-status { display:block; min-height:2.5em; max-height:2.5em; overflow:hidden; }
body.game-active #game-save-status[data-state="warning"] { color:#ffe3a6; }
body.game-active .game-help > br:first-of-type { display:none; }
body.game-active .game-actions .btn { min-height:44px; }
.hub-task, .hub-ranking, .hub-achievement { gap:12px; }
.hub-achievement > span { min-width:0; overflow-wrap:anywhere; }
.hub-achievement { align-items:flex-start; }
.hub-achievement input { margin:3px 0 0; flex-shrink:0; }
.card > .row.between { flex-wrap:wrap; row-gap:8px; }
.card > .row.between > h3 { margin:0; }
.hub-toolbar .btn { min-height:44px; }
button:disabled { cursor:default; }
@media (min-width:650px) and (max-height:500px) {
  .game-pause-content { grid-template-columns:minmax(0,1fr) minmax(180px,1.2fr); column-gap:16px; row-gap:8px; text-align:left; }
  .game-pause-content > h3 { grid-column:1; align-self:end; font-size:18px; }
  .game-pause-content > p { grid-column:1; align-self:start; }
  .game-pause-actions { grid-column:2; grid-row:1 / span 2; align-self:center; max-width:none; }
}

/* v23: quiet copy; absence of a hint must not reserve empty vertical space. */
#category-picker-hint[hidden], #hub-archive[hidden], .hub-notice[hidden] { display:none !important; }
.hub-toolbar [data-board][aria-pressed="true"] { border-color:var(--button); color:var(--text); background:rgba(111,92,255,.15); }

/* Mini App attachment queue: scoped, does not restyle the website or game. */
.attachment-area { margin: 10px 0 12px; min-width: 0; }
.attachment-hint, .attachment-status { margin: 6px 0; font-size: 13px; line-height: 1.4; color: #bdc9d9; }
.attachment-status:empty { display: none; }
.attachment-queue { display: grid; gap: 8px; padding: 0; margin: 8px 0; list-style: none; }
.attachment-queue:empty { display: none; }
.attachment-row { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid #40516a; border-radius: 12px; background: #162133; color: #fff; min-width: 0; }
.attachment-row img, .attachment-icon { width: 48px; height: 48px; flex: 0 0 48px; object-fit: contain; border-radius: 6px; background: #0f1826; }
.attachment-icon { display: grid; place-items: center; font-size: 24px; }
.attachment-info { min-width: 0; flex: 1; display: grid; gap: 4px; }
.attachment-info strong { font-size: 14px; overflow-wrap: anywhere; }
.attachment-info small { color: #bdc9d9; font-size: 12px; }
.attachment-error { font-size: 12px; color: #ffbdbd; overflow-wrap: anywhere; }
.attachment-row .btn { flex: 0 0 40px; width: 40px; height: 40px; padding: 0; font-size: 22px; }

.attachment-info strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }

/* Mini App conversation: private media and reply quotes. */
#messages .message { min-width:0; overflow-wrap:anywhere; }
.message-text { white-space:pre-wrap; }
.message-quote { margin:8px 0 10px; padding:10px 12px; border-left:3px solid #90b6ff; border-radius:8px; background:rgba(6,16,32,.45); font-size:.88rem; }
.message-quote strong { display:block; margin-bottom:5px; color:#b9d2ff; }
.message-quote div { white-space:pre-wrap; color:#e8edf7; }
.message-attachment { display:grid; gap:8px; margin-top:8px; min-width:0; }
.message-file-name { overflow-wrap:anywhere; font-size:.92rem; }
.message-file-button { justify-self:start; border:1px solid #708eb4; border-radius:9px; background:#223c5b; color:#f4f7ff; padding:9px 13px; font:inherit; cursor:pointer; }
.message-file-button:focus-visible,.message-image-open:focus-visible { outline:2px solid #bed7ff; outline-offset:3px; }
.message-file-preview { min-width:0; }
.message-file-preview:empty,.message-file-status:empty { display:none; }
.message-file-status { color:#edc59c; font-size:.86rem; }
.message-image-open { display:block; max-width:100%; padding:0; border:0; border-radius:10px; background:#122035; cursor:zoom-in; overflow:hidden; }
.message-image { display:block; max-width:100%; max-height:320px; width:auto; height:auto; object-fit:contain; }
.message-video { display:block; width:100%; max-height:360px; border-radius:10px; background:#080f1a; }
.attachment-viewer { position:fixed; inset:0; z-index:2000; display:flex; align-items:center; justify-content:center; padding:16px; padding-top:max(16px,env(safe-area-inset-top)); padding-bottom:max(16px,env(safe-area-inset-bottom)); background:rgba(0,4,12,.92); }
.attachment-viewer-card { display:flex; flex-direction:column; gap:12px; max-width:1100px; width:100%; max-height:100%; overflow:auto; padding:14px; border:1px solid #506782; border-radius:14px; background:#142136; }
.attachment-viewer-header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.attachment-viewer-header strong { min-width:0; overflow-wrap:anywhere; color:#f4f7ff; }
.attachment-viewer-header button { flex-shrink:0; }
.attachment-viewer-image { display:block; min-height:0; max-height:72vh; max-height:72dvh; max-width:100%; width:auto; height:auto; object-fit:contain; align-self:center; }
@media(max-width:480px){ .attachment-viewer{padding:8px;} .attachment-viewer-card{padding:10px;} .message-image{max-height:270px;} }

/* Archive and active queue share the existing conversation/media renderer. */
.ticket-scopes {display:flex;gap:8px;margin:12px 0;flex-wrap:wrap}
.ticket-scopes .btn {flex:1;min-width:115px}
.ticket-readonly {padding:14px 0 0;border-top:1px solid var(--border, #465169);margin-top:12px}
#ticket-older {margin:8px 0 14px;width:100%}
#ticket-older[hidden] {display:none}
#support-list-status:empty, #support-pages:empty {display:none}
#support-list-status:not(:empty),#support-pages:not(:empty) {padding:12px 0}

/* Scoped to the new complaint selector; game/layout and website styles unchanged. */
#complaint-staff-picker[hidden] { display: none; }
#complaint-staff-picker { margin: 16px 0; }
.support-notice { margin: 12px 0; padding: 12px; border: 1px solid #6475a9; border-radius: 12px; color: #e8edf9; background: #202c43; font-size: 14px; line-height: 1.45; }
.complaint-chosen { padding: 8px 0; color: #fff; overflow-wrap: anywhere; font-weight: 600; }
.complaint-employees { display: grid; gap: 6px; max-height: 220px; overflow-y: auto; margin-top: 8px; }
.complaint-employee { min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid #536586; background: #202c43; color: #f5f7ff; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.complaint-employee[aria-pressed="true"] { border-color: #abbbff; background: #344873; }
.complaint-employee:focus-visible { outline: 2px solid #d4ddff; outline-offset: -3px; }
.support-close-reason { font-size: 14px; color: #ced9ed; overflow-wrap: anywhere; }
