/* Application visual system. Game artwork and player geometry stay in styles.css. */
.account-binding-actions { display:flex; flex-wrap:wrap; gap:12px; }
.account-binding-actions > button { flex:1 1 220px; margin:0; }
.bot-auth-dialog { width: min(480px, 100%); text-align: left; }
.bot-auth-logo { display: block; width: 220px; max-width: 80%; height: auto; margin-bottom: 24px; }
.bot-auth-dialog h2 { font-size: 24px; }
.bot-auth-dialog #botAuthStatus { overflow-wrap: anywhere; line-height: 1.7; }
.bot-auth-dialog .bot-auth-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
.bot-auth-dialog .bot-auth-actions button { width: 100%; min-width: 0; margin: 0; }
.bot-auth-identity { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 0; border-block: 1px solid var(--line); }
.bot-auth-identity > div { display: grid; gap: 6px; min-width: 0; }
.bot-auth-identity strong { font-size: 20px; overflow-wrap: anywhere; }
.bot-auth-identity small, .bot-auth-openid { color: var(--muted); font-size: 12px; }
.bot-auth-openid { overflow-wrap: anywhere; margin-top: 16px; }
.bot-auth-dialog > #botAuthCloseBtn { width: 100%; }
.song-jacket-loading, .song-jacket-unavailable { opacity: 0; }
:root {
  --font-ui: "MaiNet Rounded", "PingFang SC", "Microsoft YaHei UI", system-ui, sans-serif;
  --bg: light-dark(#f5f7fc, #1b1b1f);
  --surface: light-dark(#fff, #1b1b1f);
  --surface-soft: light-dark(#eef2f9, #27272d);
  --text: light-dark(#18243c, #ededf1);
  --muted: light-dark(#5d6b82, #b3b3bd);
  --line: light-dark(#dce3ef, #27272d);
  --accent: light-dark(#002fa7, #7a93d1);
  --accent-strong: light-dark(#00237d, #7a8dbb);
  --accent-soft: light-dark(#edf2ff, #27272d);
  --focus-ring: light-dark(#002fa733, #7a93d133);
  --motion-fast: 120ms;
  --motion-normal: 200ms;
  --motion-ease: cubic-bezier(.2, 0, 0, 1);
  --pink: light-dark(#ad426d, #d49db3);
  --green: light-dark(#217353, #8cb6a6);
  --shadow: 0 20px 64px light-dark(#18243c26, #ededf126);
  --soft-shadow: none;
  --nav-bg: light-dark(#f8faff, #1b1b1f);
  --nav-text: light-dark(#53627a, #b3b3bd);
  --control-radius: 12px;
  --item-radius: 16px;
  --panel-padding: clamp(16px, 2vw, 28px);
}

body, body.app-mode {
  background: var(--bg);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: 0;
}
button, input, select, textarea { font-family: var(--font-ui); letter-spacing: 0; }
button { touch-action: manipulation; }
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
button:disabled { cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: light-dark(#6c7890, #b3b3bd); opacity: 1; }
input, select, textarea { scroll-margin-block: 96px; }
:is(h1, h2, h3) { text-wrap: balance; }
:is(.metric-card, .song-chart-matrix, .record-row, .map-distance) { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

.page-loading-modal { margin: auto; padding: 0; border: 0; background: transparent; max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); overscroll-behavior: none; }
.page-loading-modal::backdrop { background: light-dark(#0d192b70, #ededf170); backdrop-filter: none; touch-action: none; }
.page-loading-dialog { width: min(380px, 100%); max-height: calc(100dvh - 48px); overflow: auto; padding: 32px 24px 24px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: 0 24px 64px light-dark(#18243c33, #ededf133); text-align: center; }
.page-loading-dialog h2 { margin: 20px 0 8px; color: var(--text); font-size: 22px; }
.page-loading-dialog p { margin: 0 0 24px; color: var(--muted); line-height: 1.65; overflow-wrap: anywhere; }
.page-loading-dialog button { width: 100%; }
.page-loading-spinner { display: inline-block; width: 44px; height: 44px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: chart-buffer-spin .9s linear infinite; }
.page-recovery { position: fixed; top: max(var(--toast-top, 84px), env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); z-index: 100000; display: flex; align-items: center; flex-wrap: wrap; gap: 12px; width: min(380px, calc(100vw - 32px)); padding: 16px; margin: 0; border: 1px solid light-dark(#efc67e, #35353d); border-radius: 12px; background: light-dark(#fff6e5, #1b1b1f); color: light-dark(#6f4512, #b49e84); box-shadow: var(--shadow); line-height: 1.6; animation: page-recovery-enter var(--motion-normal) var(--motion-ease); }
.page-recovery > span { flex: 1 1 240px; }
@keyframes page-recovery-enter { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .page-loading-spinner { animation: none; border-right-color: var(--accent); } .page-recovery { animation: none; } }

/* Interaction states share one timing scale; game canvas animation is independent. */
.skip-navigation { position: fixed; left: 16px; top: -100px; z-index: 100001; padding: 12px 18px; background: var(--accent); color: light-dark(#fff, #1b1b1f); border-radius: 8px; }
.skip-navigation:focus { top: 12px; }
body:not(.app-mode) .skip-navigation { display: none; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button { transition: background-color var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease), box-shadow var(--motion-fast) var(--motion-ease); }
button:active:not(:disabled) { filter: brightness(.96); }
body.app-mode .view-section.active { animation: view-reveal var(--motion-normal) var(--motion-ease); }
.best50-modal:not(.hidden), .support-modal:not(.hidden) { animation: view-reveal var(--motion-normal) var(--motion-ease); }
@keyframes view-reveal { from { opacity: 0; } to { opacity: 1; } }
/* Login */
.shell { width: min(460px, calc(100% - 32px)); gap: 24px; padding: 40px 0 28px; min-height: 100svh; }
.auth-logo { width: 300px; max-width: 86%; height: auto; margin: 0 auto; }
.auth-card { padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 8px 32px light-dark(#18243c06, #ededf106); backdrop-filter: none; }
.auth-tabs { gap: 4px; padding: 5px; background: var(--surface-soft); border-radius: 14px; margin-bottom: 28px; }
.auth-tabs .tab { border: 0; border-radius: 12px; background: transparent; color: var(--muted); min-height: 44px; font-weight: 600; }
.auth-tabs .tab.active { color: var(--accent-strong); background: light-dark(#fff, #1b1b1f); box-shadow: 0 1px 4px light-dark(#17231c12, #ededf112); }
.section-title h2 { font-size: 22px; font-weight: 650; }
.section-title p, .muted, .field-hint { color: var(--muted); }
.site-footer { font-size: 12px; }
.site-footer small { font-size: 11px; }
.footer-actions { gap: 8px; flex-wrap: wrap; }
.site-footer .support-link { padding: 8px; font-weight: 500; }

/* Inputs and commands */
body .field { gap: 7px; margin: 16px 0; min-width: 0; }
body .field > span { color: var(--text); font-size: 13px; font-weight: 600; }
body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
body select, body textarea,
body.app-mode input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
body.app-mode select, body.app-mode textarea {
  min-width: 0; max-width: 100%; border: 1px solid light-dark(#cbd1da, #55555f); border-radius: var(--control-radius);
  background: light-dark(#fff, #1b1b1f); color: var(--text); box-shadow: none; font-size: 16px;
  padding: 10px 12px; min-height: 44px;
  font-weight: 400;
}
body input:focus, body select:focus, body textarea:focus {
  outline: 3px solid var(--focus-ring); outline-offset: 1px; border-color: var(--accent);
}
body select, body.app-mode select {
  appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url('/assets/ui/chevron-down.svg'); background-repeat: no-repeat;
  background-position: right 10px center; background-size: 16px;
}
input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: var(--accent); }
body input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: 0 0 18px;
  width: 18px; height: 18px; min-height: 18px; padding: 0;
  border: 1.5px solid var(--muted); border-radius: 5px;
  background: var(--surface, light-dark(#fff, #1b1b1f)); cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
body input[type="checkbox"]:checked, body input[type="checkbox"]:indeterminate {
  border-color: var(--accent); background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='m4 9 3 3 7-7' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: center; background-repeat: no-repeat; background-size: 18px;
}
body input[type="checkbox"]:indeterminate {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M4 9h10' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
body input[type="checkbox"]:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
body input[type="checkbox"]:disabled { opacity: .5; cursor: not-allowed; }
@media (forced-colors: active) { body input[type="checkbox"] { appearance: auto; -webkit-appearance: auto; } }
@media (prefers-reduced-motion: reduce) { body input[type="checkbox"] { transition: none; } }
input[type="file"]::file-selector-button { border: 0; border-radius: 4px; padding: 6px 10px; margin-right: 10px; background: var(--surface-soft); color: var(--text); cursor: pointer; }
body .primary, body.app-mode .primary,
body .ghost, body.app-mode .ghost,
body .secondary, body.app-mode .secondary {
  min-height: 44px; padding: 10px 18px; border-radius: var(--control-radius); box-shadow: none;
  font-size: 14px; line-height: 1.4; font-weight: 600; white-space: normal;
  transition: background-color .15s ease, border-color .15s ease;
}
body .primary, body.app-mode .primary { background: var(--accent); color: light-dark(#fff, #1b1b1f); border: 1px solid var(--accent); }
body .primary:hover:not(:disabled) { background: var(--accent-strong); transform: none; }
body .ghost, body.app-mode .ghost,
body .secondary, body.app-mode .secondary { background: light-dark(#fff, #1b1b1f); color: var(--text); border: 1px solid var(--line); }
body .ghost:hover:not(:disabled), body .secondary:hover:not(:disabled) { background: var(--surface-soft); border-color: light-dark(#bac4d6, #55555f); transform: none; }
body .primary:focus-visible { outline-color: var(--accent); outline-offset: 4px; }
body .primary[aria-busy="true"], body form[aria-busy="true"] .primary { cursor: progress; }
#authView .form-message.error:not(:empty) { padding: 12px 14px; margin-top: 16px; border-radius: 10px; background: light-dark(#fff0f1, #27272d); color: light-dark(#a3233b, #cf8d99); line-height: 1.65; }
body .primary:disabled, body .ghost:disabled, body .secondary:disabled { opacity: .5; }
body.app-mode .compact-action { width: auto; min-width: 0; }
body.app-mode .action-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; width: auto; }
body.app-mode .action-row > button { flex: 0 1 auto; margin: 0; }
body.app-mode .ghost.refresh-command { display: inline-grid; place-items: center; width: 44px; min-width: 44px; height: 44px; padding: 12px; font-size: 0; }
.refresh-command::before { content: ""; display: block; width: 18px; height: 18px; background: currentColor; -webkit-mask: url('/assets/ui/refresh-cw.svg') center / contain no-repeat; mask: url('/assets/ui/refresh-cw.svg') center / contain no-repeat; }
.check-row, .privacy-row { align-items: start; line-height: 1.6; }
.check-row input { flex-shrink: 0; margin-top: 4px; }

/* Shell, navigation and toolbar */
body.app-mode .home { grid-template-columns: 244px minmax(0, 1fr); height: auto; min-height: 100dvh; overflow: visible; }
body.app-mode .sidebar { position: sticky; top: 0; height: 100dvh; padding: 20px 14px; background: var(--nav-bg); border: 0; border-right: 1px solid var(--line); box-shadow: none; border-radius: 0; gap: 24px; color: var(--nav-text); }
body.app-mode .sidebar-brand { grid-template-columns: minmax(0, 1fr) 36px; gap: 10px; min-height: 44px; }
body.app-mode .sidebar-logo { width: 100%; height: auto; max-height: 54px; object-fit: contain; }
body.app-mode #sidebarToggle { display: grid; place-items: center; width: 36px; height: 44px; min-height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: light-dark(#e8ecf2, #27272d); color: light-dark(#283345, #ededf1); opacity: 1; box-shadow: none; font-size: 24px; }
body.app-mode #sidebarToggle:hover { background: light-dark(#dbe2ed, #27272d); }
body.app-mode .sidebar :focus-visible { outline-color: var(--accent); }
body.app-mode .sidebar-nav { gap: 4px; }
body.app-mode .nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; min-height: 44px; border-radius: 12px; font-weight: 400; color: var(--nav-text); background: transparent; text-align: left; }
body.app-mode .nav-item:hover { background: light-dark(#e9edf3, #27272d); color: var(--text); }
body.app-mode .nav-item.active { background: light-dark(#e5edff, #27272d); color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 var(--accent); }
body.app-mode .nav-item::before { content: ""; display: block; flex: 0 0 18px; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--nav-icon) center / contain no-repeat; mask: var(--nav-icon) center / contain no-repeat; }
.nav-item[data-section="overview"] { --nav-icon: url('/assets/ui/house.svg'); }
.nav-item[data-section="announcements"], .nav-item[data-section="announcementAdmin"] { --nav-icon: url('/assets/ui/megaphone.svg'); }
.nav-item[data-section="songs"] { --nav-icon: url('/assets/ui/search.svg'); }
.nav-item[data-section="help"] { --nav-icon: url('/assets/ui/list-checks.svg'); }
.nav-item[data-section="collectibles"] { --nav-icon: url('/assets/ui/gem.svg'); }
.nav-item[data-section="best50"] { --nav-icon: url('/assets/ui/disc-3.svg'); }
.nav-item[data-section="leaderboard"] { --nav-icon: url('/assets/ui/trophy.svg'); }
.nav-item[data-section="nearbyShops"] { --nav-icon: url('/assets/ui/map-pin.svg'); }
.nav-item[data-section="recentUpdate"] { --nav-icon: url('/assets/ui/sparkles.svg'); }
.nav-item[data-section="activate"] { --nav-icon: url('/assets/ui/qr-code.svg'); }
.nav-item[data-section="accountBind"] { --nav-icon: url('/assets/ui/user-plus.svg'); }

/* The menu scrolls independently; recommendations stay at the sidebar foot. */
body.app-mode .sidebar, body.app-mode .home.sidebar-expanded .sidebar { --sidebar-padding-x: 14px; overflow: hidden; gap: 16px; padding-bottom: 8px; scrollbar-gutter: auto; }
body.app-mode .sidebar-brand { flex-shrink: 0; }
body.app-mode .sidebar-nav { flex: 1 1 0; overflow-y: auto; overflow-x: hidden; align-content: start; overscroll-behavior: contain; scrollbar-width: none; scrollbar-gutter: auto; }
body.app-mode .sidebar-nav::-webkit-scrollbar { display: none; width: 0; height: 0; }
body.modal-scroll-locked .sidebar-nav { overflow: hidden !important; }
.sidebar-ad { position: relative; flex: 0 0 auto; min-width: 0; margin-top: 8px; }
.sidebar-ad:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 12px; }
.sidebar-ad::before { content: ''; position: absolute; inset: -20px calc(-1 * var(--sidebar-padding-x, 14px)) auto; height: 12px; background: linear-gradient(to top, light-dark(#17243b24, #ededf124), transparent); pointer-events: none; opacity: 0; }
.sidebar-ad.has-more-options::before { opacity: 1; }
.sidebar-ad-toolbar { position: absolute; top: 8px; left: 8px; right: 8px; z-index: 1; display: flex; align-items: flex-start; gap: 8px; pointer-events: none; font-size: 11px; line-height: 1.5; }
.sidebar-ad-label, .sidebar-ad-count:not(:empty) { padding: 3px 7px; border-radius: 6px; background: light-dark(#17243bbd, #ededf1bd); color: light-dark(#fff, #1b1b1f); }
.sidebar-ad-count { margin-left: auto; font-variant-numeric: tabular-nums; }
.sidebar-ad-media { aspect-ratio: 16 / 9; overflow: hidden; border-radius: 12px; background: var(--surface-soft); touch-action: pan-y; user-select: none; }
.sidebar-ad.is-swiping .sidebar-ad-media { cursor: grabbing; }
.sidebar-ad-slide { display: block; width: 100%; height: 100%; }
.sidebar-ad-slide[hidden], .sidebar-ad-toolbar [hidden] { display: none; }
.sidebar-ad-slide img { display: block; width: 100%; height: 100%; object-fit: contain; }
@media (min-width: 761px) {
  body.app-mode .home.sidebar-collapsed .sidebar-ad-media { width: 100%; height: 44px; min-height: 44px; aspect-ratio: auto; border-radius: 7px; }
  body.app-mode .home.sidebar-collapsed .sidebar-ad-toolbar { display: none; }
  body.app-mode .home.sidebar-collapsed .sidebar-ad-slide img { object-fit: cover; }
}
@media (max-width: 760px) { body.app-mode .sidebar, body.app-mode .home.sidebar-expanded .sidebar { --sidebar-padding-x: 16px; } }
@media (max-height: 500px) { .sidebar-ad-media { max-height: 92px; } }

body .toast-container, body.app-mode .toast-container {
  top: max(var(--toast-top, 84px), env(safe-area-inset-top)); left: auto;
  right: max(16px, env(safe-area-inset-right)); bottom: auto; transform: none; width: min(380px, calc(100vw - 32px));
  z-index: 100000;
}
.form-message[hidden] { display: none !important; }
.chart-player-loading { font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: #14201de6; overflow-wrap: anywhere; }
.chart-player-loading::before { content: ''; display: inline-block; width: 24px; height: 24px; border: 3px solid #ffffff60; border-top-color: #fff; border-radius: 50%; animation: chart-buffer-spin 1s linear infinite; }
@keyframes chart-buffer-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .chart-player-loading::before { animation: none; } }
.chart-player-timeline { width: 100%; min-width: 0; padding: 16px 0 4px; border-top: 1px solid var(--line); }
.chart-player-timeline .chart-player-transport { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.chart-player-timeline .chart-player-play { position: relative; width: 52px; height: 52px; padding: 0; border-radius: 50%; font-size: 0; line-height: 0; display: block; }
.chart-player-play::before { content: ''; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 24px; height: 24px; background: currentColor; mask: url('/assets/ui/play.svg') center / contain no-repeat; -webkit-mask: url('/assets/ui/play.svg') center / contain no-repeat; }
.chart-player-timeline #chartPlayerSeek { display: none; }
.chart-player-play[aria-label="暂停"]::before { mask-image: url('/assets/ui/pause.svg'); -webkit-mask-image: url('/assets/ui/pause.svg'); }
.chart-player-timeline .chart-player-density { width: 100%; height: 202px; margin-top: 10px; background: #101214; border: 1px solid #343a40; border-radius: 8px; touch-action: none; cursor: ew-resize; }
.chart-player-timeline input[type="range"] { min-width: 0; width: 100%; height: 44px; touch-action: pan-y; }
.chart-player-timeline input[type="range"]::-webkit-slider-runnable-track { height: 10px; border-radius: 8px; background: linear-gradient(to right, var(--accent) 0 var(--chart-seek-progress, 0%), #abc9bd var(--chart-seek-progress, 0%) var(--chart-seek-buffered, 0%), #e4e9e7 var(--chart-seek-buffered, 0%) 100%); }
.chart-player-timeline input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -6px; }
.chart-player-timeline input[type="range"]::-moz-range-track { height: 10px; border-radius: 8px; }
.chart-player-timeline input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; }
@media (max-width: 600px) {
  body .toast-container, body.app-mode .toast-container { width: min(280px, calc(100vw - 64px)); }
  .chart-player-timeline .chart-player-transport { grid-template-columns: 48px minmax(0, 1fr) 48px; gap: 8px; }
  .chart-player-timeline .chart-player-play { width: 48px; height: 48px; }
  .chart-player-timeline #chartPlayerDuration { text-align: right; }
}

/* Transparent region art within the existing white / blue application grid. */
body.app-mode .map-search-form { display:flex; align-items:end; gap:12px; margin:24px 0; max-width:760px; }
body.app-mode .map-search-form .field { flex:1; min-width:0; margin:0; }
.map-gallery { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:20px; }
body.app-mode .map-card { min-width:0; display:flex; flex-direction:column; gap:12px; padding:20px; border:1px solid var(--line); border-radius:var(--item-radius); background:var(--surface); }
body.app-mode .map-open { display:block; width:100%; border:0; border-radius:4px; background:transparent; color:var(--text); padding:0; text-align:left; cursor:pointer; box-shadow:none; }
body.app-mode .map-open:hover { color:var(--accent); }
.map-open h3 { margin:12px 0 4px; min-height:2.8em; font-size:17px; line-height:1.4; overflow-wrap:anywhere; }
.map-open > .muted { font-size:12px; font-weight:400; }
.map-preview { display:flex; align-items:center; justify-content:center; height:160px; min-width:0; background:transparent; }
body.app-mode .map-preview img { display:block; max-width:100%; width:auto; max-height:100%; height:auto; object-fit:contain; }
.map-preview > span { font-size:12px; text-align:left; }
.map-card-meta { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:8px; }
.map-distance { font-size:13px; font-variant-numeric:tabular-nums; }
.map-status { display:inline-block; width:fit-content; padding:3px 8px; border-radius:6px; color:var(--accent); background:var(--accent-soft); font-size:12px; font-weight:600; line-height:1.6; }
.map-status-complete { color:var(--green); background:light-dark(#eff7f2, #27272d); }
.map-status-locked, .map-status-unknown { color:var(--muted); background:var(--surface-soft); }
body.app-mode .map-cache { margin:0; color:var(--muted); font-size:11px; line-height:1.65; overflow-wrap:anywhere; }
body.app-mode .map-card > .primary { width:100%; margin-top:auto; }
.map-dialog { width:min(860px,calc(100vw - 32px)); max-height:calc(100dvh - 48px); overflow:auto; box-sizing:border-box; padding:28px; border:1px solid var(--line); border-radius:var(--item-radius); color:var(--text); background:var(--surface); font-family:var(--font-ui); }
.map-dialog::backdrop { background:light-dark(#171c2966, #ededf166); }
.map-dialog-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:24px; padding-bottom:16px; border-bottom:1px solid var(--line); }
.map-dialog-heading h2 { margin:0; font-size:22px; line-height:1.4; overflow-wrap:anywhere; }
.map-dialog-heading button { flex-shrink:0; }
.map-detail-hero { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); align-items:center; gap:28px; margin-bottom:24px; }
.map-detail-hero .map-preview { height:220px; }
.map-detail-info { display:flex; flex-direction:column; align-items:flex-start; gap:12px; min-width:0; }
.map-detail-info > p { margin:0; font-size:13px; }
.map-detail-metrics { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; width:100%; margin:4px 0; padding-block:16px; border-block:1px solid var(--line); }
.map-detail-metrics dt { font-size:12px; color:var(--muted); }
.map-detail-metrics dd { margin:6px 0 0; font-size:19px; font-weight:700; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.map-rewards { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-top:16px; }
body.app-mode .map-reward.ghost { display:flex; flex-direction:column; align-items:flex-start; justify-content:center; gap:6px; min-height:86px; padding:16px; border:1px solid var(--line); border-radius:var(--control-radius); color:var(--text); background:var(--surface); text-align:left; white-space:normal; min-width:0; }
body.app-mode .map-reward.ghost:hover { border-color:var(--accent); background:var(--surface); }
.map-reward strong { overflow-wrap:anywhere; line-height:1.5; }
.map-reward span { font-size:12px; font-weight:400; color:var(--muted); }
.map-candidate-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:8px 0 16px; border-bottom:1px solid var(--line); }
.map-candidate-heading h3 { margin:0; font-size:17px; }
.map-candidate-heading > span { font-size:13px; }
body.app-mode .map-candidate { display:flex; align-items:center; gap:20px; padding:20px 0; border-bottom:1px solid var(--line); }
.map-candidate .map-preview { width:100px; height:76px; flex-shrink:0; }
.map-candidate-info { display:flex; flex:1; flex-direction:column; align-items:flex-start; min-width:0; gap:6px; }
.map-candidate-info strong { overflow-wrap:anywhere; }
.map-candidate-info > .muted { font-size:12px; }
.map-candidate > button { flex-shrink:0; }
.map-submit-row { display:flex; align-items:center; justify-content:space-between; gap:24px; margin-top:24px; }
.map-submit-row p { margin:0; max-width:480px; font-size:12px; }
.map-submit-row button { flex-shrink:0; }
.song-unlock-info { padding:16px 0; border-bottom:1px solid var(--line); }
.song-unlock-info button { white-space:normal; margin:4px 8px 4px 0; text-align:left; }
.song-unlock-states { display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:8px; margin:12px 0; }
.song-unlock-states > div { min-width:0; padding:10px 12px; border:1px solid var(--line); border-radius:10px; }
.song-unlock-states dt { font-size:13px; white-space:nowrap; }
.song-unlock-states dd { margin:4px 0 0; font-weight:600; overflow-wrap:anywhere; }
@media(max-width:1100px) { .map-gallery { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:600px) {
  body.app-mode .map-search-form { flex-wrap:wrap; }
  .map-search-form button { width:100%; }
  .map-gallery { gap:12px; }
  body.app-mode .map-card { padding:14px; gap:10px; }
  .map-preview { height:115px; }
  .map-open h3 { font-size:15px; }
  body.app-mode .map-card > .primary { padding:10px 8px; font-size:12px; }
  .map-rewards { grid-template-columns:1fr; }
  .map-dialog { padding:20px; width:calc(100vw - 24px); max-height:calc(100dvh - 24px); }
  .map-dialog-heading { margin-bottom:16px; }
  .map-dialog-heading h2 { font-size:19px; }
  .map-detail-hero { grid-template-columns:1fr; gap:16px; }
  .map-detail-hero .map-preview { height:155px; }
  .map-detail-info > .primary { width:100%; }
  .map-detail-metrics dd { font-size:18px; }
  body.app-mode .map-candidate { gap:12px; }
  .map-candidate .map-preview { width:64px; height:64px; }
  .map-candidate > button { padding-inline:12px; }
  .map-submit-row { flex-direction:column; align-items:stretch; gap:16px; }
}
@media(max-width:380px) { .map-gallery { grid-template-columns:minmax(0,1fr); } }
.nav-item[data-section="checker"] { --nav-icon: url('/assets/ui/refresh-cw.svg'); }
.nav-item[data-section="maimaiOption"], .nav-item[data-section="settings"] { --nav-icon: url('/assets/ui/settings-2.svg'); }
.nav-item[data-section="region"] { --nav-icon: url('/assets/ui/map.svg'); }
.nav-item[data-section="mapRegions"], .nav-item[data-section="mapUpload"] { --nav-icon: url('/assets/ui/map.svg'); }
.nav-item[data-section="rankModify"] { --nav-icon: url('/assets/ui/list-checks.svg'); }
.nav-item[data-section="reborn"] { --nav-icon: url('/assets/ui/refresh-cw.svg'); }
.nav-item[data-section="kaleid"] { --nav-icon: url('/assets/ui/key-round.svg'); }
.nav-item[data-section="itemIssue"] { --nav-icon: url('/assets/ui/gift.svg'); }
.nav-item[data-section="friendAdd"] { --nav-icon: url('/assets/ui/user-plus.svg'); }
.nav-item[data-section="unlock"] { --nav-icon: url('/assets/ui/lock-open.svg'); }
.nav-item[data-section="score"], .nav-item[data-section="collectibleUpload"] { --nav-icon: url('/assets/ui/upload.svg'); }
.nav-item[data-section="plate"] { --nav-icon: url('/assets/ui/list-checks.svg'); }
.nav-item[data-section="admin"] { --nav-icon: url('/assets/ui/users.svg'); }
.nav-item[data-section="fileAdmin"] { --nav-icon: url('/assets/ui/folder.svg'); }
.nav-item[data-section="siteStatus"] { --nav-icon: url('/assets/ui/activity.svg'); }
body.app-mode .nav-group { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); gap: 4px; }
body.app-mode .nav-group-toggle { background: transparent; padding: 8px 12px; color: var(--muted); font-size: 12px; font-weight: 600; }
body.app-mode .nav-group.has-active .nav-group-toggle { background: var(--accent-soft); color: var(--accent); border-radius: 8px; }
body.app-mode .nav-group-toggle::after { color: var(--muted); }
body.app-mode .nav-group-toggle small { display: none; }
body.app-mode .nav-group-items { padding-left: 0; gap: 4px; }
body.app-mode .sidebar-collapsed { grid-template-columns: 76px minmax(0, 1fr); }
body.app-mode .home.sidebar-collapsed .sidebar { --sidebar-padding-x: 10px; padding: 24px 10px 8px; }
body.app-mode .home.sidebar-collapsed .sidebar-brand { display: flex; flex-direction: column; gap: 8px; }
body.app-mode .home.sidebar-collapsed .sidebar-logo { display: none; }
body.app-mode .home.sidebar-collapsed .nav-item { display: flex; justify-content: center; padding: 12px 0; font-size: 0; }
body.app-mode .home.sidebar-collapsed .nav-item::before { content: ""; width: 20px; height: 20px; flex-basis: 20px; }
body.app-mode .home.sidebar-collapsed .nav-group-toggle { font-size: 0; padding: 8px 0; min-height: 36px; }
body.app-mode .home.sidebar-collapsed .nav-group-toggle span { font-size: 10px; font-weight: 500; }
body.app-mode .workspace { min-width: 0; overflow: visible; padding: 0 40px 32px; }
body.app-mode .view-section { max-width: 1440px; width: 100%; margin: 0 auto; }
body.app-mode .app-topbar { position: sticky; top: 0; z-index: 50; min-height: 72px; margin: 0 -40px 32px; padding: 12px 40px; background: var(--surface); border-bottom: 1px solid var(--line); pointer-events: auto; justify-content: space-between; box-shadow: none; }
.topbar-location { color: var(--muted); font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
body.app-mode .top-avatar-button { width: 36px; height: 36px; min-height: 36px; box-shadow: none; border: 1px solid var(--line); }
body.app-mode .top-logout-button { min-height: 36px; border-radius: 10px; padding: 6px 12px; font-size: 12px; background: var(--surface-soft); color: var(--muted); box-shadow: none; font-weight: 500; }
body.app-mode .user-menu { background: light-dark(#fff, #1b1b1f); backdrop-filter: none; border-radius: 16px; box-shadow: var(--shadow); }
body.app-mode .workspace-header { margin-bottom: 32px; }
body.app-mode .workspace-header h2 { font-size: 28px; line-height: 1.35; font-weight: 700; margin: 0; color: var(--text); letter-spacing: -.02em; }
body.app-mode .workspace-header .eyebrow { color: var(--muted); font-size: 12px; font-weight: 400; margin: 0 0 8px; }
body.app-mode .workspace-header p.muted { font-size: 13px; margin: 10px 0 0; max-width: 720px; }
body.app-mode .workspace-header.split-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 32px; }
body.app-mode .split-header > div:first-child { min-width: 0; flex: 1 1 240px; }

/* Unframed sections and repeated items */
body.app-mode .workspace-header.overview-header { margin-bottom: 28px; align-items: center; gap: 20px; }
body.app-mode .overview-profile { display: flex; align-items: center; gap: 16px; min-width: 0; }
.overview-profile > img { width: 56px; height: 56px; object-fit: cover; border-radius: 50%; border: 1px solid var(--line); flex: 0 0 auto; }
.overview-profile > div { min-width: 0; }
body.app-mode .overview-profile h2 { font-size: 24px; overflow-wrap: anywhere; }
.overview-identity { margin: 4px 0 0; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.overview-shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; flex: 0 0 auto; }
body.app-mode .overview-shortcut { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-width: 140px; margin: 0; }
.overview-shortcut::before { content: ""; flex: 0 0 18px; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--shortcut-icon) center / contain no-repeat; mask: var(--shortcut-icon) center / contain no-repeat; }
#overviewActivateBtn { --shortcut-icon: url('/assets/ui/qr-code.svg'); }
#overviewBest50Btn { --shortcut-icon: url('/assets/ui/disc-3.svg'); }
body.app-mode .overview-account-metric #maimaiNickname { font-size: 22px; overflow-wrap: anywhere; }
body.app-mode .account-identifier, body.app-mode .account-identifier span { font-size: 12px; font-weight: 400; color: var(--muted); }
body.app-mode .account-identifier span { display: inline; }
.overview-site-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin: 28px 0 0; padding: 22px 0 0; border-top: 1px solid var(--line); }
.overview-site-summary > div { display: flex; align-items: center; gap: 12px; min-width: 0; }
.overview-site-summary dt { font-size: 12px; color: var(--muted); }
.overview-site-summary dd { margin: 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
body.app-mode :is(.tool-panel, .cache-overview, .stats-panel, .best-panel) { background: transparent; border: 0; border-radius: 0; box-shadow: none; padding: 24px 0; }
body.app-mode :is(.tool-panel, .cache-overview):not(.kaleid-card):not(.settings-panel) { padding: var(--panel-padding); background: var(--surface); border: 1px solid var(--line); border-radius: var(--item-radius); }
body.app-mode :is(.stats-panel, .announcement-admin-panel) { border-top: 1px solid var(--line); }
body.app-mode .best-panel { padding-top: 0; }
body.app-mode .best-panel-title { margin-bottom: 16px; gap: 12px; align-items: center; flex-wrap: wrap; }
body.app-mode .best-panel-title h3, body.app-mode .compact-title h2 { font-size: 16px; font-weight: 650; }
body.app-mode .best-panel-title > span { font-size: 12px; color: var(--muted); }
body.app-mode :is(.metric-card, .song-result-card, .best-card, .admin-row, .collectible-card, .kaleid-card, .announcement-card, .announcement-admin-row) { background: light-dark(#fff, #1b1b1f); border: 1px solid var(--line); border-radius: var(--item-radius); box-shadow: none; }
body.app-mode :is(.metric-card, .admin-row, .announcement-card, .announcement-admin-row) { padding: 24px; }
body.app-mode :is(.overview-control-card, .overview-item) { background: transparent; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
body.app-mode .overview-account-layout { display: grid; grid-template-columns: minmax(220px, .85fr) minmax(0, 1.8fr); gap: 32px; align-items: center; padding: var(--panel-padding); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
body.app-mode .overview-control-grid { grid-template-columns: 1fr; gap: 16px; margin: 0; max-width: none; }
body.app-mode .overview-control-grid .field { margin: 0; }
body.app-mode .overview-control-grid .field-hint { font-size: 11px; font-weight: 400; }
body.app-mode .overview-metric-grid { grid-template-columns: 1fr 1.25fr !important; gap: 24px 0; padding: 12px 0 12px 28px; border: 0; border-left: 1px solid var(--line); margin: 0; }
body.app-mode .overview-metric-grid .metric-card { padding: 0 20px; border: 0; border-left: 1px solid var(--line); border-radius: 0; background: transparent; }
body.app-mode .overview-metric-grid .metric-card:first-child { border-left: 0; padding-left: 0; }
body.app-mode .overview-metric-grid .cache-metric-card { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; border: 0; border-top: 1px solid var(--line); padding: 16px 0 0; }
body.app-mode .overview-metric-grid .cache-metric-card small { display: none; }
body.app-mode .metric-card strong { font-size: 28px; line-height: 1.3; font-weight: 650; font-variant-numeric: tabular-nums; }
body.app-mode .metric-card > span, body.app-mode .metric-card small { color: var(--muted); font-size: 12px; font-weight: 400; }
body.app-mode .rating-card { background: light-dark(#f2f7f3, #27272d); border-color: light-dark(#dae7dd, #27272d); }
body.app-mode .rating-card strong { color: var(--accent-strong); }
body.app-mode .cache-metric-card strong { font-size: 16px; }
body.app-mode .supporter-avatar-button, body.app-mode .developer-avatar-button { box-shadow: none; border: 1px solid var(--line); background: light-dark(#fff, #1b1b1f); }
body.app-mode .overview-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px; }
body.app-mode .overview-item { min-height: 0; align-content: start; gap: 4px; }
body.app-mode .overview-item strong { font-size: 15px; font-weight: 600; }
body.app-mode .overview-side-grid { grid-template-columns: minmax(0, 1.8fr) minmax(250px, 1fr); gap: 32px; margin-top: 8px; }
body.app-mode .leaderboard-list { gap: 0; }
body.app-mode .leaderboard-row { background: transparent; box-shadow: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 14px 0; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; }
body.app-mode .leaderboard-row.current { background: var(--accent-soft); border-radius: 6px; padding-inline: 10px; }
body.app-mode .leaderboard-row > strong { background: transparent; color: var(--muted); font-size: 13px; }
body.app-mode .leaderboard-actions { display: flex; flex-direction: row; grid-column: auto; justify-content: flex-end; gap: 14px; }
body.app-mode .leaderboard-actions b { font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; }
body.app-mode .leaderboard-best50-button { min-height: 34px; padding: 6px 10px; font-size: 12px; }
body.app-mode .current-rank { background: transparent; border: 0; padding: 12px 0; font-size: 12px; color: var(--accent-strong); }
/* One aligned settings rail replaces the previous mixed-span card grid. */
body.app-mode .settings-grid { display: block; max-width: 1060px; }
body.app-mode .settings-grid .settings-panel { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; padding: 28px 0; margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; box-shadow: none; max-width: none; align-items: start; }
body.app-mode .settings-panel .section-title { display: block; margin: 0; }
body.app-mode .settings-panel .section-title p { margin: 8px 0 0; font-size: 13px; }
.settings-content { display: grid; min-width: 0; gap: 20px; justify-items: start; }
body.app-mode .settings-content > .field { width: 100%; margin: 0; }
body.app-mode .settings-content .password-grid { width: 100%; grid-template-columns: 1fr; gap: 16px; }
body.app-mode .settings-content .password-grid .field { margin: 0; }
body.app-mode .settings-content > .primary { width: auto; min-width: 140px; margin: 0; }
body.app-mode .settings-content .privacy-row { width: 100%; margin: 0; padding: 0; border: 0; background: transparent; border-radius: 0; }

/* Repeated gate cards must not inherit the unframed section's zero side padding. */
body.app-mode .kaleid-grid { gap: 20px; }
body.app-mode .tool-panel.kaleid-card { padding: 24px; gap: 24px; max-width: none; }
body.app-mode .kaleid-card-head { flex-wrap: wrap; gap: 12px; }
body.app-mode .kaleid-card-head > div { min-width: 0; }
body.app-mode .kaleid-card-head h3 { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
body.app-mode .kaleid-card-head span { font-size: 12px; font-weight: 400; letter-spacing: 0; }
body.app-mode .kaleid-card-head > strong { white-space: normal; padding: 5px 10px; font-size: 11px; font-weight: 500; border-radius: 8px; background: light-dark(#f1f3f2, #27272d); color: light-dark(#58635c, #b3b3bd); }
body.app-mode .kaleid-card.unlocked .kaleid-card-head > strong { background: light-dark(#e7f4ea, #27272d); color: light-dark(#236437, #ededf1); }
body.app-mode .kaleid-status-grid { background: transparent; padding: 0; border-radius: 0; grid-template-columns: minmax(90px, 1fr) minmax(0, 1fr); gap: 12px 16px; }
body.app-mode .kaleid-status-grid strong { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
body.app-mode .kaleid-actions { padding-top: 20px; border-top: 1px solid var(--line); }

/* Search: two equal commands, followed by a separate filter disclosure. */
body.app-mode #songSearchForm.song-search-form { padding: 20px; margin-bottom: 24px; background: var(--surface) !important; border: 1px solid var(--line); border-radius: var(--item-radius); box-shadow: none !important; }
#songSearchForm .song-search-row { gap: 10px; }
body.app-mode #songSearchForm .song-search-main { margin: 0 0 2px; }
body.app-mode #songAdvancedFilterToggle { min-height: 36px; background: transparent; border: 0; padding: 8px 0; color: var(--muted); text-align: left; justify-content: flex-start; }
body.app-mode #songAdvancedFilterPanel.song-filter-panel { background: transparent !important; box-shadow: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 16px 0 0; margin-top: 10px; }
body.app-mode .song-result-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; padding-right: 0; align-items: stretch; }
body.app-mode .song-result-main-button { padding: 20px; gap: 16px; grid-template-columns: 64px minmax(0, 1fr); }
body.app-mode .song-result-main-button > img { width: 64px; border-radius: 10px; }
body.app-mode .song-result-title { font-size: 15px; font-weight: 650; line-height: 1.4; }
body.app-mode .song-result-meta-chip { background: transparent; padding: 0; border: 0; font-size: 11px; }
body.app-mode .song-result-meta-chip b { font-weight: 500; }
body.app-mode .song-result-meta-grid { gap: 4px 12px; }
body.app-mode .song-result-meta-chip.match-chip { display: none; }
body.app-mode .song-result-card:hover { border-color: light-dark(#8ca8df, #c3d2ee); box-shadow: none; }
body.app-mode .song-result-card.active { border-color: var(--accent); box-shadow: inset 3px 0 var(--accent); }
body.app-mode .best50-columns { gap: 24px; }
body.app-mode .best-card { padding: 14px; gap: 12px; transition: border-color .15s; }
body.app-mode .best-card:hover { transform: none; box-shadow: none; border-color: light-dark(#8ca8df, #c3d2ee); }
body.app-mode .best-summary-grid { gap: 16px; margin-bottom: 24px; }
body.app-mode .collectible-kind-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.collectible-chara .collectible-preview { position: relative; aspect-ratio: 16 / 9; }
.collectible-chara .collectible-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
body.app-mode .collectible-kind-card[data-collectible-kind="map"] { grid-column:1 / -1; }
@media (min-width: 1400px) {
  body.app-mode .collectible-kind-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  body.app-mode .collectible-kind-card[data-collectible-kind="map"] { grid-column:auto; }
}
body.app-mode .collectible-kind-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; border: 1px solid var(--line); background: light-dark(#fff, #1b1b1f); border-radius: var(--item-radius); box-shadow: none; padding: 16px; }
body.app-mode .collectible-kind-card strong { font-size: 20px; font-variant-numeric: tabular-nums; }
body.app-mode .collectible-kind-card.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
body.app-mode .collectible-kind-card small { display: none; }
body.app-mode .collectible-kind-card > span,
body.app-mode .collectible-kind-card > strong { align-self: center; grid-area: auto; margin: 0; min-width: 0; line-height: 1.4; }
body.app-mode .collectible-kind-card > span { font-weight: 600; }
body.app-mode .collectible-kind-card > strong { overflow-wrap: anywhere; }
body.app-mode .collectible-kind-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
body.app-mode #songAdvancedFilterPanel .song-filter-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 20px; padding-block: 12px; }
body.app-mode #songAdvancedFilterPanel .song-filter-row + .song-filter-row { border-top: 1px solid var(--line); }
body.app-mode #songAdvancedFilterPanel .field { margin: 0; }
body.app-mode #songAdvancedFilterPanel .song-filter-actions { align-self: end; justify-self: start; }
body.app-mode .collectible-search-form { background: transparent; border: 0; box-shadow: none; border-radius: 0; padding: 12px 0 20px; border-bottom: 1px solid var(--line); }
.collectible-meta .collectible-ownership.owned { color: light-dark(#176443, #86ae9d); background: light-dark(#e0f3e8, #27272d); }
.collectible-meta .collectible-ownership.unknown { color: light-dark(#566274, #b3b3bd); background: light-dark(#edf0f4, #27272d); }
.player-card-layer.asset-loading { opacity: .5; }
.player-card-layer.asset-failed { background: light-dark(#edf0f4, #27272d); }
.player-card-layer .card-asset-retry { position: absolute; inset: 0; width: 100%; height: 100%; border: 1px dashed light-dark(#708296, #b3b3bd); border-radius: 0; padding: 0; color: light-dark(#33445c, #ededf1); background: light-dark(#edf0f4, #27272d); font-size: 12px; }
body.app-mode .announcement-card.pinned::before, body.app-mode .announcement-admin-row.pinned::before { background: var(--accent); width: 3px; }
body.app-mode .admin-toolbar { background: transparent; box-shadow: none; border: 0; padding: 0 0 20px; gap: 12px; }
body.app-mode .admin-toolbar .field { margin: 0; }
body.app-mode #adminUsers { container: admin-users / inline-size; }
body.app-mode .admin-row { grid-template-columns: minmax(0, 1fr) auto; gap: 12px 16px; align-items: start; }
body.app-mode .admin-user-summary { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; min-width: 0; min-height: 52px; border-radius: 8px; padding: 2px; cursor: pointer; }
body.app-mode .admin-user-summary:hover { background: var(--muted-bg); }
body.app-mode .admin-user-summary:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }
body.app-mode .admin-user-summary > img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
body.app-mode .admin-user-summary > div { min-width: 0; }
body.app-mode .admin-user-info > strong { margin: 0 0 8px; color: var(--text); font-size: 17px; line-height: 1.5; }
body.app-mode .admin-user-meta { display: grid; gap: 4px; }
body.app-mode .admin-user-meta > span { color: light-dark(#43516a, #ededf1); font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
body.app-mode .admin-user-disclosure { display: inline-flex; align-items: center; gap: 6px; color: var(--muted-foreground); font-size: 12px; font-weight: 600; white-space: nowrap; }
body.app-mode .admin-user-disclosure img { width: 16px; height: 16px; transition: transform var(--motion-fast) var(--motion-ease); }
body.app-mode .admin-row.expanded .admin-user-disclosure img { transform: rotate(180deg); }
body.app-mode .admin-user-quick-actions { display: flex; align-items: center; justify-content: flex-end; min-width: 112px; }
body.app-mode .admin-user-quick-actions .user-record-button { width: 100%; margin: 0; white-space: nowrap; }
body.app-mode .admin-row .admin-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "role access" "identity identity" "maintenance maintenance"; gap: 12px 16px; width: auto; padding-top: 4px; }
body.app-mode .admin-action-group { min-width: 0; padding-top: 10px; border-top: 1px solid var(--line); }
body.app-mode .admin-action-role { grid-area: role; }
body.app-mode .admin-action-identity { grid-area: identity; }
body.app-mode .admin-action-maintenance { grid-area: maintenance; }
body.app-mode .admin-action-access { grid-area: access; }
body.app-mode .admin-action-label { display: block; margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 650; line-height: 1.4; }
body.app-mode .admin-action-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
body.app-mode :is(.admin-action-role, .admin-action-access) .admin-action-controls { grid-template-columns: minmax(0, 1fr); }
body.app-mode .admin-action-group .admin-action-controls > * { width: 100%; min-width: 0; min-height: 44px; border-radius: var(--control-radius); padding: 8px 10px; font-size: 14px; line-height: 1.5; white-space: normal; }
body.app-mode .admin-action-controls > :last-child:nth-child(odd):not(:only-child) { grid-column: 1 / -1; }
@container admin-users (max-width: 640px) {
  body.app-mode .admin-row { grid-template-columns: minmax(0, 1fr); }
  body.app-mode .admin-user-summary { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; }
  body.app-mode .admin-user-summary > img { width: 40px; height: 40px; }
  body.app-mode .admin-user-disclosure > span { display: none; }
  body.app-mode .admin-user-quick-actions { width: 100%; min-width: 0; }
  body.app-mode .admin-row .admin-actions { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr); grid-template-areas: "role" "identity" "maintenance" "access"; }
}

/* Dialogs use solid surfaces; expensive full-screen blur is unnecessary. */
.support-modal, .best50-modal, .ban-modal, .reauth-modal { backdrop-filter: none; background: light-dark(#18252e80, #ededf180); padding: 20px; }
:is(.support-dialog, .best50-dialog, .ban-dialog, .reauth-dialog, .user-menu, .supporter-user-card) { background: light-dark(#fff, #1b1b1f); border-radius: 20px; backdrop-filter: none; box-shadow: var(--shadow); }
.best50-dialog, .support-dialog { max-height: calc(100dvh - 40px); overscroll-behavior: contain; border: 1px solid var(--line); isolation: isolate; }
.chart-player-speed > span { white-space: nowrap; }
.support-close { width: 44px; height: 44px; min-height: 44px; border-radius: 12px; background: var(--surface-soft); color: var(--text); }
.contact-dialog .contact-developer-button { display: inline-flex; align-items: center; justify-content: center; width: min(100%, 240px); margin: 8px 0 16px; text-decoration: none; }
.supporter-user-card { background: light-dark(#fff, #1b1b1f) !important; backdrop-filter: none; }
.toast { backdrop-filter: none; background: light-dark(#fff, #1b1b1f); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
body.app-mode .form-message:not(:empty):not([hidden]) { display: block; padding: 10px 0; margin: 0; font-size: 13px; }
body.app-mode .form-message:empty { display: none; }
.song-result-card, .collectible-card, .admin-row { content-visibility: auto; contain-intrinsic-size: auto 160px; }

/* Persistent outcomes and reader identities must remain readable on narrow phones. */
body.app-mode .announcement-reader-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border: 0; background: transparent; }
.announcement-reader-avatar { flex: 0 0 40px; width: 40px; height: 40px; aspect-ratio: 1; border-radius: 50%; object-fit: cover; }
.announcement-reader-row > div { display: grid; gap: 4px; min-width: 0; }
.announcement-reader-row strong, .announcement-reader-row span { overflow-wrap: anywhere; }
.operation-history { border-block: 1px solid var(--line); padding: 20px 0; margin: 0 0 28px; }
.operation-history h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.operation-history-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; }
.operation-history-row + .operation-history-row { border-top: 1px solid var(--line); }
.operation-history-row > div { min-width: 0; flex: 1; }
.operation-history-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 14px; min-width: 0; }
.operation-history-title strong { min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.operation-outcome { font-size: 12px; color: var(--muted); }
.log-success .operation-outcome { color: light-dark(#237047, #8db59f); }
.log-error .operation-outcome { color: light-dark(#b02f46, #d6939f); }
.log-running .operation-outcome { color: light-dark(#866118, #c0ad87); }
.operation-history-row p { margin: 6px 0; font-size: 13px; overflow-wrap: anywhere; white-space: pre-wrap; }
.operation-history-row small { color: var(--muted); font-size: 11px; }
.operation-history-row > button { flex: 0 0 auto; }
.record-log-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.record-log-message { margin: 0; font-size: 13px; }
.operation-log-list .record-row { min-width: 0; overflow-wrap: anywhere; }
.operation-log-list .record-row small { white-space: pre-wrap; }
.record-log-more { margin-top: 16px; }

/* Avoid intrinsic-width and text autosizing differences in Android WebViews. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body.app-mode .workspace, .view-section, .tool-panel, .record-tab-content, .announcement-admin-body { min-width: 0; }
.record-tabs { min-width: 0; flex-wrap: wrap; }
body.app-mode .view-section > :not(.workspace-header) { max-width: 100%; }
@supports not (height: 100dvh) {
  body.app-mode .sidebar { height: 100vh; }
  .best50-dialog, .support-dialog { max-height: calc(100vh - 40px); }
}
@media (max-width: 1024px), (pointer: coarse) {
  .song-result-card, .collectible-card, .admin-row { content-visibility: visible; contain-intrinsic-size: none; }
}

@media (min-width: 761px) {
  body.app-mode #songSearchForm .song-search-row { max-width: none; display: grid; grid-template-columns: minmax(0, 1fr) 112px 112px auto; align-items: end; gap: 12px; }
  body.app-mode #songSearchForm .song-search-main { grid-column: 1; margin: 0; }
  body.app-mode #songSearchForm .song-search-row > button { grid-column: auto; width: 100%; min-height: 44px; margin: 0; }
  body.app-mode #songSearchForm #songAdvancedFilterToggle { padding-inline: 8px; }
  body.app-mode .song-detail-panel { width: min(620px, calc(100vw - 92px)); border-radius: 20px; padding: 24px; border-left: 1px solid var(--line); }
}
@media (max-width: 1180px) {
  body.app-mode .overview-account-layout { grid-template-columns: 1fr; gap: 24px; }
  body.app-mode .overview-control-grid { grid-template-columns: 1.4fr 1fr; }
  body.app-mode .overview-metric-grid { border-left: 0; padding: 0; }
  body.app-mode .workspace { padding-inline: 24px; }
  body.app-mode .app-topbar { margin-inline: -24px; padding-inline: 24px; }
  body.app-mode .overview-side-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  body.app-mode .overview-community-stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
  body.app-mode .settings-grid .settings-panel { grid-template-columns: 180px minmax(0, 1fr); gap: 24px; }
}
@media (max-width: 760px) {
  body.app-mode .home, body.app-mode .home.sidebar-expanded { display: block; width: 100%; height: auto; min-height: 100dvh; }
  body.app-mode .workspace, body.app-mode .home.sidebar-expanded .workspace { margin-left: 0; padding: 0 16px 24px; overflow: visible; min-height: 100dvh; }
  body.app-mode .app-topbar { position: sticky; top: 0; right: auto; left: auto; width: auto; min-height: 64px; margin: 0 -16px 24px; padding: max(10px, env(safe-area-inset-top)) 16px 10px 64px; background: light-dark(#fff, #1b1b1f); border-radius: 0; box-shadow: none; backdrop-filter: none; }
  body.app-mode .top-user { width: auto; padding: 0; background: transparent; box-shadow: none; border: 0; backdrop-filter: none; }
  body.app-mode .mobile-menu-button { top: max(10px, env(safe-area-inset-top)); left: 12px; width: 44px; height: 44px; min-height: 44px; padding: 10px; display: grid; place-items: center; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent); color: light-dark(#fff, #1b1b1f); opacity: 1; box-shadow: none; backdrop-filter: none; z-index: 54; }
  body.app-mode .mobile-menu-text { display: none; }
  body.app-mode .sidebar, body.app-mode .home.sidebar-expanded .sidebar { position: fixed; width: min(288px, 86vw); z-index: 60; padding: max(24px, env(safe-area-inset-top)) 16px max(8px, env(safe-area-inset-bottom)); height: 100dvh; min-height: 0; max-height: 100dvh; background: var(--nav-bg); border-radius: 0 20px 20px 0; border: 0; }
  body.app-mode .sidebar-brand, body.app-mode .home.sidebar-expanded .sidebar-brand { grid-template-columns: minmax(0, 1fr) 36px; }
  body.app-mode .home.sidebar-expanded .nav-item { display: flex; justify-content: flex-start; font-size: 14px; padding: 10px 12px; }
  body.app-mode .home.sidebar-expanded .nav-item::before { content: ""; }
  body.app-mode .mobile-sidebar-backdrop { backdrop-filter: none; }
  body.app-mode .workspace-header { margin-bottom: 20px; padding: 0; }
  body.app-mode .workspace-header h2 { font-size: 24px; }
  body.app-mode .workspace-header.overview-header { gap: 20px; margin-bottom: 24px; }
  body.app-mode .overview-shortcuts { flex: 1 1 100%; }
  body.app-mode .overview-shortcut { width: 100%; min-width: 0; min-height: 48px; padding-inline: 10px; }
  body.app-mode .overview-account-metric #maimaiNickname { font-size: 20px; }
  .overview-site-summary { gap: 12px; }
  .overview-site-summary > div { flex-direction: column; align-items: flex-start; gap: 6px; }
  body.app-mode .workspace-header.split-header { gap: 12px; margin-bottom: 20px; }
  body.app-mode .split-header > div:first-child { flex-basis: 180px; }
  body.app-mode .split-header > .action-row { flex: 1 1 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  body.app-mode .split-header > .action-row:has(> .refresh-command:only-child) { flex: 0 0 auto; display: flex; }
  body.app-mode .action-row > button, body.app-mode .split-header > .compact-action { width: auto; }
  body.app-mode .overview-account-layout { padding: 20px; gap: 20px; }
  body.app-mode .overview-control-grid { gap: 12px; grid-template-columns: 1fr 1fr; margin: 0; }
  body.app-mode .overview-control-grid .field-hint { display: none; }
  body.app-mode .overview-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 20px 0; padding: 0; margin: 0; }
  body.app-mode .overview-metric-grid .cache-metric-card { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; border-left: 0; border-top: 1px solid var(--line); padding: 20px 0 0; }
  body.app-mode .cache-metric-card strong { font-size: 16px; }
  body.app-mode .cache-metric-card small { display: none; }
  body.app-mode .metric-card { padding: 16px; }
  body.app-mode .overview-metric-grid .metric-card:not(.cache-metric-card) { padding: 0 0 0 20px; }
  body.app-mode .overview-metric-grid .metric-card:first-child { padding-left: 0; }
body.app-mode .overview-metric-grid .metric-card strong { font-size: 24px; }
  body.app-mode .overview-metric-grid .cache-metric-card strong { font-size: 16px; }
  body.app-mode .overview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 12px; }
  body.app-mode .overview-side-grid { grid-template-columns: 1fr; gap: 16px; }
  body.app-mode .overview-community-stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  body.app-mode .leaderboard-row { grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; }
  body.app-mode .leaderboard-actions { gap: 8px; }
  body.app-mode .leaderboard-actions b { font-size: 15px; }
  body.app-mode .leaderboard-best50-button { font-size: 11px; padding: 6px 8px; }
  body.app-mode .settings-grid .settings-panel { grid-template-columns: 1fr; gap: 24px; padding: 24px 0; }
  .settings-content { width: 100%; }
  body.app-mode .settings-content > .primary { width: 100%; }
  body.app-mode .token-grid { grid-template-columns: 1fr; gap: 16px; }
  body.app-mode .tool-panel.kaleid-card { padding: 20px; }
  body.app-mode .kaleid-actions > button { width: 100%; }
  body.app-mode .song-result-list { grid-template-columns: 1fr; }
  body.app-mode .song-result-main-button { padding: 14px; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; }
  body.app-mode .song-result-main-button > img { width: 56px; }
  body.app-mode .best50-columns { grid-template-columns: 1fr; gap: 24px; }
  body.app-mode .best-summary-grid { gap: 8px; }
  body.app-mode .best-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  body.app-mode .best-summary-grid .rating-card { grid-column: auto; }
  body.app-mode .best-summary-grid .metric-card { padding: 12px; }
  body.app-mode .best-summary-grid .metric-card strong, body.app-mode .best-summary-grid .rating-card strong { font-size: 22px; }
  body.app-mode .collectible-kind-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  body.app-mode .collectible-kind-card { flex-direction: column; gap: 4px; padding: 12px 4px; min-height: 72px; }
  body.app-mode #songAdvancedFilterPanel .song-filter-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  body.app-mode #songAdvancedFilterPanel .song-filter-row .field { grid-column: auto; }
  body.app-mode .collectible-kind-card span { font-size: 13px; }
  body.app-mode .collectible-kind-card strong { font-size: 18px; }
  body.app-mode .admin-row { padding: 16px; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  body.app-mode .admin-toolbar.unified-admin-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.app-mode .admin-toolbar .admin-search-field { grid-column: 1 / -1; }
  body.app-mode .admin-toolbar #clearAdminSearchBtn { grid-column: 1 / -1; }
  body.app-mode .admin-action-controls > * { min-height: 44px; }
  .support-modal, .best50-modal, .ban-modal, .reauth-modal { padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
  .best50-dialog, .support-dialog { max-width: 100%; max-height: calc(100dvh - 32px); padding: 20px 16px; }
  .user-menu { max-width: calc(100vw - 32px); }
  .app-footer { margin-top: 20px; padding-bottom: env(safe-area-inset-bottom); }
}
@media (max-width: 380px) {
  .shell { width: calc(100% - 28px); padding: 24px 0; }
  .auth-card { padding: 0; }
  body.app-mode .workspace, body.app-mode .home.sidebar-expanded .workspace { padding-inline: 12px; }
  body.app-mode .app-topbar { margin-inline: -12px; }
  body.app-mode .overview-community-stack { grid-template-columns: 1fr; }
  body.app-mode .tool-panel.kaleid-card { padding: 16px; }
  body.app-mode .leaderboard-actions { flex-direction: column; align-items: end; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
/* A single detail node follows its title on mobile and occupies the right pane on desktop. */
body.app-mode .announcement-feed-panel { width: 100%; max-width: none; }
body.app-mode #announcementList { display: grid; grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.6fr); gap: 8px 28px; align-items: start; }
body.app-mode .announcement-summary { grid-column: 1; display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-width: 0; min-height: 56px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: light-dark(#fff, #1b1b1f); color: var(--text); text-align: left; }
body.app-mode .announcement-summary > span:first-child { min-width: 0; overflow-wrap: anywhere; }
body.app-mode .announcement-summary.is-selected { border-color: var(--accent); background: var(--accent-soft); }
body.app-mode .announcement-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.app-mode .announcement-summary .announcement-read-state { flex: 0 0 auto; font-size: 12px; }
body.app-mode .announcement-read-state.is-unread { color: light-dark(#c52b40, #e1919c); background: light-dark(#fff0f2, #27272d); }
body.app-mode .announcement-detail, body.app-mode .announcement-detail-placeholder { grid-column: 2; min-width: 0; margin: 0; padding: 20px 24px; border-left: 1px solid var(--line); overflow-wrap: anywhere; }
body.app-mode .announcement-detail h3 { margin-top: 0; font-size: 20px; line-height: 1.5; }
body.app-mode .announcement-detail[hidden], body.app-mode .announcement-unread-badge[hidden] { display: none; }
body.app-mode .nav-item[data-section="announcements"] { position: relative; }
body.app-mode .announcement-unread-badge { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; min-width: 22px; height: 22px; margin-left: auto; padding: 0 5px; border-radius: 50%; background: light-dark(#d62d45, #ea929e); color: light-dark(#fff, #1b1b1f); font-size: 11px; line-height: 1; font-weight: 700; }
body.app-mode .home.sidebar-collapsed .announcement-unread-badge { position: absolute; top: 0; right: 0; }
@media (max-width: 760px) {
  body.app-mode #announcementList { display: flex; flex-direction: column; gap: 8px; }
  body.app-mode .announcement-detail { width: 100%; padding: 16px; border-left: 2px solid var(--accent); margin-bottom: 12px; }
  body.app-mode .announcement-detail-placeholder { display: none; }
  body.app-mode .home.sidebar-expanded .announcement-unread-badge { position: static; margin-left: auto; }
}
/* Best50: compact score sheet; chart colors carry difficulty, not navigation. */
body.app-mode #leaderboardBest50Modal > .best50-dialog { width: min(1320px, calc(100vw - 32px)); overflow-y: auto; overflow-x: hidden; }
body.app-mode #leaderboardBest50Body .leaderboard-best50-columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
body.app-mode #leaderboardBest50Body .best-panel { min-width: 0; padding: 0; border: 0; background: transparent; }
body.app-mode #leaderboardBest50Body .best-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
body.app-mode #leaderboardBest50Body .leaderboard-best50-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
body.app-mode #leaderboardBest50Body .metric-card { padding: 12px; border: 0; border-right: 1px solid var(--line); border-radius: 0; min-width: 0; }
body.app-mode #leaderboardBest50Body .metric-card:last-child { border-right: 0; }
@media (max-width: 1100px) { body.app-mode #leaderboardBest50Body .best-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 850px) { body.app-mode #leaderboardBest50Body .best-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }
@media (max-width: 379px) { body.app-mode #leaderboardBest50Body .best-list { grid-template-columns: minmax(0, 1fr); } }
body.app-mode .b50-checker-field { display: flex; align-items: center; gap: 12px; margin: 0 0 20px; font-size: 13px; }
body.app-mode .b50-checker-field select { width: 220px; max-width: calc(100% - 60px); min-width: 0; }
body.app-mode [data-view-section="best50"] > .workspace-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
body.app-mode [data-view-section="best50"] > .workspace-header .action-row { display: flex; flex-wrap: nowrap; width: auto; gap: 8px; }
body.app-mode #exportBest50Btn { flex: 0 0 auto; width: auto; min-width: 0; padding: 10px 12px; }
body.app-mode #best50Summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
body.app-mode #best50Summary .metric-card { padding: 0 20px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: transparent; min-height: 0; gap: 4px; }
body.app-mode #best50Summary .metric-card:first-child { padding-left: 0; }
body.app-mode #best50Summary .metric-card:last-child { border-right: 0; }
body.app-mode #best50Summary strong { font-size: 26px; }
body.app-mode [data-view-section="best50"] .best50-columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }
body.app-mode .best50-result-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(288px, 320px); gap: 24px; align-items: start; min-width: 0; }
body.app-mode .best50-result-layout:not(.has-rating-distribution) { grid-template-columns: minmax(0, 1fr); }
body.app-mode [data-view-section="best50"] .best-panel { min-width: 0; max-width: none; padding: 0; background: transparent; border: 0; }
body.app-mode [data-view-section="best50"] .best-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
body.app-mode .b50-player { display: flex; gap: 24px; align-items: center; padding: 12px 0 24px; min-width: 0; }
body.app-mode .b50-player > img { width: 210px; height: 70px; object-fit: contain; }
body.app-mode .b50-player > div { min-width: 0; }
body.app-mode .b50-player span { font-size: 11px; color: light-dark(#65736d, #b3b3bd); }
body.app-mode .b50-player h3 { font-size: 24px; margin: 5px 0; overflow-wrap: anywhere; }
body.app-mode .b50-player p { font-size: 13px; color: light-dark(#65736d, #b3b3bd); margin: 0; }
body.app-mode .b50-score-card { display: grid; grid-template-columns: 64px minmax(0, 1fr); grid-template-rows: 68px 30px; gap: 0 8px; padding: 8px 8px 0; width: 100%; min-width: 0; border: 1px solid var(--chart-color); border-radius: 8px; background: var(--chart-color); color: #fff; text-align: left; overflow: hidden; box-shadow: none; }
body.app-mode .b50-score-card:hover { filter: brightness(1.05); transform: none; }
body.app-mode .b50-score-card:focus-visible { outline: 3px solid #267958; outline-offset: 3px; }
body.app-mode .b50-cover { position: relative; width: 64px; height: 64px; background: light-dark(#edf0ee, #27272d); }
body.app-mode .b50-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
body.app-mode .b50-cover span { position: absolute; left: 0; bottom: 0; padding: 1px 4px; background: light-dark(#17221de6, #ededf1e6); color: white; font-size: 10px; line-height: 1.5; }
body.app-mode .b50-score-body { position: relative; min-width: 0; }
body.app-mode .b50-song-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid light-dark(#ffffff66, #1b1b1f66); font-size: 12px; line-height: 18px; }
body.app-mode .b50-title-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
body.app-mode .b50-title-row .b50-song-title { min-width: 0; flex: 1; }
body.app-mode .b50-title-row img.song-long-track-badge {
  flex: 0 0 34px; width: 34px; max-width: 34px; height: auto;
  aspect-ratio: 139 / 68; object-fit: contain; background: transparent;
  border: 0; border-radius: 0;
}
body.app-mode .b50-achievement { font-size: 23px; font-weight: 750; line-height: 28px; white-space: nowrap; font-variant-numeric: tabular-nums; }
body.app-mode .b50-chart-meta { padding-right: 44px; overflow: hidden; font-size: 11px; line-height: 18px; white-space: nowrap; text-overflow: ellipsis; }
body.app-mode .b50-play-count { position: absolute; right: 0; bottom: 1px; color: #fff; font-size: 10px; font-weight: 750; line-height: 16px; white-space: nowrap; font-variant-numeric: tabular-nums; }
body.app-mode .b50-card-footer { grid-column: 1 / -1; display: flex; align-items: center; gap: 4px; min-width: 0; margin: 0 -8px; padding: 3px 6px; background: light-dark(#fff, #1b1b1f); color: light-dark(#53625b, #b3b3bd); }
body.app-mode .b50-card-footer small { font-size: 9px; white-space: nowrap; }
body.app-mode .b50-card-footer img { display: block; position: static; transform: none; width: 23px !important; height: 23px !important; max-width: none; max-height: none; object-fit: contain; flex: 0 0 23px; }
body.app-mode .b50-card-footer img.maimai-status-icon-rate { width: 45px !important; flex-basis: 45px; }
body.app-mode .b50-dx-score { margin-left: auto; }
.rating-distribution-panel { position: sticky; top: 92px; min-width: 0; max-height: calc(100dvh - 116px); overflow: hidden auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 8px 24px light-dark(#26342d14, #00000030); scrollbar-width: thin; }
.rating-distribution-panel[hidden] { display: none !important; }
.rating-distribution-panel-header { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.rating-distribution-panel-header h3 { min-width: 0; margin: 0; font-size: 15px; line-height: 1.4; }
.rating-distribution-toggle { display: none; min-width: 64px; min-height: 44px; margin: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--foreground); font-size: 12px; cursor: pointer; touch-action: manipulation; }
.rating-distribution-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rating-distribution-content { display: grid; gap: 0; min-width: 0; }
.rating-distribution-table { min-width: 0; padding: 14px; border-bottom: 1px solid var(--line); }
.rating-distribution-table:last-child { border-bottom: 0; }
.rating-distribution-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rating-distribution-title h4 { margin: 0; font-size: 14px; line-height: 1.4; }
.rating-distribution-title span { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rating-distribution-meta { display: grid; gap: 3px; margin-top: 8px; font-size: 10px; line-height: 1.45; font-variant-numeric: tabular-nums; }
.rating-distribution-meta span { min-width: 0; overflow-wrap: anywhere; }
.rating-distribution-meta .is-player { color: light-dark(#176145, #9fd3bc); }
.rating-distribution-meta .is-peer { color: light-dark(#984069, #e4a6c1); }
.rating-distribution-plot { position: relative; height: 188px; min-width: 0; margin-top: 8px; overflow: hidden; border-top: 1px solid var(--line); }
.rating-distribution-bars { position: absolute; inset: 56px 0 0; display: grid; grid-template-columns: repeat(var(--bucket-count, 1), minmax(0, 1fr)); align-items: stretch; gap: 1px; min-width: 0; }
.rating-distribution-bucket { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 16px minmax(0, 1fr) 34px; align-items: end; justify-items: center; min-width: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.rating-distribution-bucket > span { align-self: center; font-size: 8px; line-height: 1; }
.rating-distribution-bucket > i { display: block; align-self: end; width: 42%; min-width: 1px; height: var(--bar-height); min-height: 0; border-radius: 2px 2px 1px 1px; background: light-dark(#80639d, #b9a0d1); }
.rating-distribution-bucket > small { align-self: center; width: 26px; overflow: visible; color: var(--muted); font-size: 7px; line-height: 1; text-align: center; transform: rotate(-90deg); white-space: nowrap; }
.rating-distribution-marker { --marker-color: #176145; position: absolute; z-index: 3; top: 54px; bottom: 33px; width: 0; border-left: 2px solid var(--marker-color); color: var(--marker-color); pointer-events: none; }
.rating-distribution-marker.is-peer { --marker-color: #b44778; margin-left: 2px; border-left-style: dashed; }
.rating-distribution-marker > span { position: absolute; top: -48px; left: 0; max-width: 116px; padding: 2px 4px; transform: translateX(-50%); overflow: hidden; border: 1px solid currentColor; border-radius: 4px; background: var(--surface); font-size: 9px; font-weight: 700; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.rating-distribution-marker.is-peer > span { top: -25px; }
.rating-distribution-marker.align-start > span { transform: translateX(0); }
.rating-distribution-marker.align-end > span { transform: translateX(-100%); }
.rating-distribution-empty { position: absolute; inset: 58px 0 0; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: 12px; text-align: center; }
.b50-export-dialog { width: min(1000px, calc(100vw - 32px)); max-height: 90vh; max-height: 90dvh; overflow-y: auto; background: white; border-radius: 8px; }
.b50-export-dialog > img { display: block; width: 100%; height: auto; }
.b50-export-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: 0; padding: 12px 16px; background: light-dark(#fff, #1b1b1f); }
.b50-export-controls a { color: light-dark(#217352, #8cb6a5); font-weight: 650; }
.best50-export-picker-dialog { width: min(460px, calc(100vw - 32px)); }
.best50-export-picker-form { display: grid; gap: 14px; }
.best50-export-picker-form .field { margin: 0; }
.best50-export-picker-status { min-height: 1.6em; margin: 0; color: var(--muted-foreground); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.best50-export-picker-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
body .best50-export-picker-actions > button.ui-action,
body.app-mode .best50-export-picker-actions > button.ui-action { width: 100%; min-height: 44px; margin: 0; }
@media (min-width: 1700px) { body.app-mode [data-view-section="best50"] .best-list { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 1390px) { body.app-mode [data-view-section="best50"] .best-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1000px) { body.app-mode [data-view-section="best50"] .best-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  body.app-mode .best50-result-layout { display: block; }
  body.app-mode .rating-distribution-panel { position: fixed; z-index: 75; top: auto; right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); left: max(12px, env(safe-area-inset-left)); max-height: min(46dvh, 420px); overflow: hidden; box-shadow: 0 14px 40px light-dark(#17221d42, #00000080); }
  body.app-mode:has([data-view-section="best50"].active .rating-distribution-panel:not([hidden])) .back-to-top,
  body.app-mode:has(#leaderboardBest50Modal:not(.hidden) .rating-distribution-panel:not([hidden])) .back-to-top { display: none; }
  body.app-mode .rating-distribution-panel-header { min-height: 60px; padding: 8px 12px; }
  body.app-mode .rating-distribution-toggle { display: inline-flex; align-items: center; justify-content: center; }
  body.app-mode .rating-distribution-content { max-height: calc(min(46dvh, 420px) - 60px); overflow-y: auto; overscroll-behavior: contain; }
  body.app-mode .rating-distribution-panel.is-collapsed .rating-distribution-content { display: none; }
  body.app-mode .view-section.has-rating-distribution,
  body.app-mode .leaderboard-best50-body.has-rating-distribution { padding-bottom: calc(min(48dvh, 436px) + max(12px, env(safe-area-inset-bottom))); }
  body.app-mode .view-section.has-rating-distribution.rating-distribution-collapsed,
  body.app-mode .leaderboard-best50-body.has-rating-distribution.rating-distribution-collapsed { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
}
@media (max-width: 600px) {
  body.app-mode #best50Summary .metric-card { padding: 0 10px; }
  body.app-mode #best50Summary strong { font-size: 22px; }
  body.app-mode .b50-player { gap: 16px; }
  body.app-mode .b50-player > img { width: 120px; height: 40px; }
  body.app-mode .b50-player h3 { font-size: 20px; }
  body.app-mode [data-view-section="best50"] .best-list { gap: 8px; }
  body.app-mode .b50-score-card { grid-template-columns: 42px minmax(0, 1fr); grid-template-rows: 58px 44px; padding: 6px 6px 0; column-gap: 5px; }
  body.app-mode .b50-cover { width: 42px; height: 42px; }
  body.app-mode .b50-song-title { font-size: 10px; line-height: 16px; }
  body.app-mode .b50-achievement { font-size: 16px; line-height: 22px; }
  body.app-mode .b50-chart-meta { padding-right: 36px; font-size: 9px; line-height: 16px; }
  body.app-mode .b50-play-count { bottom: 0; font-size: 9px; line-height: 14px; }
  body.app-mode .b50-card-footer { flex-wrap: wrap; justify-content: center; align-content: center; gap: 1px 3px; margin: 0 -6px; padding: 2px 4px; }
  body.app-mode .b50-card-footer img { width: 21px !important; height: 21px !important; flex-basis: 21px; }
  body.app-mode .b50-card-footer img.maimai-status-icon-rate { width: 38px !important; flex-basis: 38px; }
  body.app-mode .b50-dx-score { flex-basis: 100%; text-align: right; line-height: 12px; }
}
@media (max-width: 379px) {
  body.app-mode [data-view-section="best50"] .best-list { grid-template-columns: minmax(0, 1fr); }
  body.app-mode .b50-score-card { grid-template-columns: 54px minmax(0, 1fr); }
  body.app-mode .b50-cover { width: 54px; height: 54px; }
  body.app-mode .b50-achievement { font-size: 23px; }
  body.app-mode .b50-dx-score { flex-basis: auto; }
}

body.app-mode .token-grid { gap: 32px; align-items: start; }
body.app-mode .token-card { min-width: 0; border-top: 0; }
body.app-mode .token-card-title { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
body.app-mode .token-card-title > div { min-width: 0; }
body.app-mode .token-card-title h3 { font-size: 20px; font-weight: 600; }
body.app-mode .token-card-title p { margin-bottom: 0; overflow-wrap: anywhere; }
body.app-mode .token-card-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: 100%; }
body.app-mode .token-card-actions > button { width: 100%; min-height: 46px; margin: 0; padding: 10px 12px; }
body.app-mode .checker-oauth-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
body.app-mode .checker-oauth-actions > button { width: 100%; min-width: 0; min-height: 46px; margin: 0; padding: 10px 12px; white-space: normal; }
body.app-mode .checker-oauth-actions > [data-oauth-action="begin"] { grid-column: 1 / -1; }
body.app-mode .checker-authorization { display: grid; gap: 8px; overflow-wrap: anywhere; }
body.app-mode .checker-authorization a { color: var(--accent, light-dark(#217352, #8cb6a5)); font-weight: 650; padding: 8px 0; }
body.app-mode .checker-authorization small { color: var(--muted); }
/* Hide chrome without removing touch, wheel or keyboard scrolling. */
:is([role="dialog"], [role="alertdialog"], [class*="-card"], .song-detail-panel, .b50-export-dialog, .admin-row),
:is([role="dialog"], [role="alertdialog"], [class*="-card"], .song-detail-panel, .b50-export-dialog, .admin-row) * { scrollbar-width: none; scrollbar-gutter: auto; }
:is([role="dialog"], [role="alertdialog"], [class*="-card"], .song-detail-panel, .b50-export-dialog, .admin-row)::-webkit-scrollbar,
:is([role="dialog"], [role="alertdialog"], [class*="-card"], .song-detail-panel, .b50-export-dialog, .admin-row) *::-webkit-scrollbar { display: none; width: 0; height: 0; }
body.app-mode :is(.song-result-card, .collectible-card, .admin-row, .announcement-admin-row) { box-shadow: 0 3px 14px light-dark(#1c284405, #ededf105); }
body.app-mode :is(.song-result-card, .collectible-card):hover { border-color: light-dark(#bac8e3, #55555f); }
@media (max-width: 760px) {
  body.app-mode .token-grid { gap: 12px; }
  body.app-mode .token-card { padding: 24px 0; gap: 20px; }
  body.app-mode .token-card + .token-card { border-top: 1px solid var(--line); }
  body.app-mode .checker-header-actions { width: 100%; }
  body.app-mode .checker-header-actions > button { width: 100%; }
  body.app-mode .collectible-kind-card { align-items: center; justify-content: center; text-align: center; }
}
.password-rules { list-style: none; padding: 0; margin: -4px 0 18px; display: grid; gap: 8px; }
.password-rules li { display: flex; align-items: flex-start; gap: 8px; color: light-dark(#747d86, #b3b3bd); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.password-rules li.satisfied { color: light-dark(#187546, #87b79f); }
.password-rule-state { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.password-rule-icon { display: inline-block; flex: 0 0 16px; height: 18px; position: relative; margin-top: 1px; }
.password-rule-icon::before, .password-rule-icon::after { content: ''; position: absolute; top: 8px; left: 3px; width: 10px; height: 2px; background: currentColor; transform: rotate(45deg); }
.password-rule-icon::after { transform: rotate(-45deg); }
.satisfied .password-rule-icon::before { top: 9px; left: 1px; width: 6px; }
.satisfied .password-rule-icon::after { top: 7px; left: 4px; width: 11px; }
.login-preferences { display: flex; flex-wrap: wrap; gap: 12px 24px; margin: 8px 0 20px; }
.login-preferences label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; cursor: pointer; }
body .login-preferences input { width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; accent-color: var(--primary, light-dark(#185b45, #ededf1)); }
.unlock-preview { margin: 24px 0; }
.unlock-preview-toolbar, #unlockSelectionActions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.unlock-preview-toolbar { justify-content: space-between; margin-bottom: 16px; }
.unlock-preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px; }
body.app-mode .unlock-song { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface, light-dark(#fff, #1b1b1f)); min-width: 0; }
body.app-mode .unlock-song-cover { width: 64px; height: 64px; min-height: 0; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: light-dark(#eff3f1, #27272d); display: block; }
.unlock-song-cover img { width: 100%; height: 100%; display: block; object-fit: cover; }
.unlock-song-info { min-width: 0; display: grid; gap: 6px; }
body.app-mode .unlock-song-name { padding: 0; min-height: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; font-weight: 700; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.unlock-song-name:hover { text-decoration: underline; }
.unlock-song-name:focus-visible { outline: 2px solid var(--primary, light-dark(#185b45, #ededf1)); outline-offset: 4px; }
.unlock-song-info > span { color: var(--muted); font-size: 12px; }
.unlock-song-select { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; min-height: 44px; cursor: pointer; border-top: 1px solid var(--line); padding-top: 8px; font-size: 13px; }
body.app-mode .unlock-song-select input { width: 18px; height: 18px; min-height: 0; flex: 0 0 18px; accent-color: var(--primary, light-dark(#185b45, #ededf1)); }
body.app-mode .maimai-avatar { display: block; width: 52px; height: 52px; flex: 0 0 52px; object-fit: contain; border-radius: 8px; background: light-dark(#eff3f1, #27272d); }
body.app-mode .b50-player { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px; }
body.app-mode .b50-player > .maimai-avatar { width: 76px; height: 76px; }
body.app-mode .b50-player > .b50-brand { width: 210px; height: 70px; justify-self: end; }
body.app-mode .b50-player small { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; }
body.app-mode .selected-account-context { display: flex; align-items: center; gap: 14px; padding: 14px 0 18px; margin-bottom: 22px; border-bottom: 1px solid var(--line); min-width: 0; }
body.app-mode .selected-account-context > div { display: grid; gap: 3px; min-width: 0; }
body.app-mode .selected-account-context small { color: var(--muted); font-size: 11px; }
body.app-mode .selected-account-context strong { font-size: 16px; overflow-wrap: anywhere; }
body.app-mode .selected-account-context span { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
body.app-mode .leaderboard-row .leaderboard-player { display: flex; flex-direction: row; align-items: center; gap: 10px; min-width: 0; }
body.app-mode .leaderboard-row .leaderboard-identity { display: flex; flex-direction: column; min-width: 0; }
.b50-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 16px; margin-bottom: 24px; }
body.app-mode .b50-controls .b50-checker-field { flex: 1 1 220px; max-width: 360px; margin: 0; min-width: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); }
body.app-mode .b50-controls .b50-checker-field > span { white-space: nowrap; }
body.app-mode .b50-controls select { min-width: 0; max-width: none; width: 100%; }
.player-card { position: relative; width: 100%; aspect-ratio: 1080 / 452; background: light-dark(#e9edf5, #27272d); overflow: hidden; border-radius: 8px; isolation: isolate; }
.player-card[hidden] { display: none; }
.player-card-scene { position: absolute; inset: 0 auto auto 0; width: 1080px; height: 452px; transform-origin: top left; }
.player-card-scene, .player-card-scene * { user-select: none; -webkit-user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none; }
.player-card-layer > img { pointer-events: none; }
.player-card-layer { position: absolute; overflow: hidden; box-sizing: border-box; }
body.app-mode .player-card-layer > img { display: block; width: 100%; height: 100%; max-width: none; object-fit: fill; }
.player-card-text { display: flex; align-items: center; white-space: nowrap; font-family: "MaiNet Rounded", sans-serif; font-weight: 700; color: light-dark(#202434, #ededf1); }
body.app-mode .b50-player-caption { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; padding: 16px 0; }
body.app-mode .b50-player-caption .maimai-avatar { width: 32px; height: 32px; flex-basis: 32px; }
body.app-mode .b50-player-caption h3 { font-size: 16px; margin: 0; overflow-wrap: anywhere; }
body.app-mode .b50-player-caption p, body.app-mode .b50-player-caption small { font-size: 12px; margin: 0; color: var(--muted); }
body.app-mode #best50Summary > [hidden], .best50-columns > [hidden] { display: none; }
body.app-mode #best50Summary.is-filtered { grid-template-columns: minmax(0, 1fr) !important; }
body.app-mode #best50Summary.is-filtered > .metric-card { padding-left: 0; }
@media (max-width: 600px) {
  body.app-mode .b50-controls { gap: 12px; }
  body.app-mode .b50-controls .b50-checker-field { flex-basis: calc(50% - 6px); max-width: none; grid-template-columns: minmax(0, 1fr); gap: 6px; }
  body.app-mode .b50-controls select { font-size: 13px; padding: 10px; }
  body.app-mode [data-view-section="best50"] > .workspace-header { grid-template-columns: minmax(0, 1fr); align-items: start; gap: 14px; }
  body.app-mode [data-view-section="best50"] > .workspace-header .action-row { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
  body.app-mode [data-view-section="best50"] > .workspace-header .action-row button { flex: 1 1 auto; }
}
body.app-mode .leaderboard-row .maimai-avatar { width: 40px; height: 40px; flex-basis: 40px; }
@media (max-width: 600px) {
  body.app-mode .b50-player { gap: 10px; }
  body.app-mode .b50-player > .maimai-avatar { width: 48px; height: 48px; }
  body.app-mode .b50-player > .b50-brand { width: 96px; height: 32px; }
  body.app-mode .b50-player h3 { font-size: 18px; }
  body.app-mode .leaderboard-row .leaderboard-player { gap: 7px; }
  body.app-mode .leaderboard-row .maimai-avatar { width: 32px; height: 32px; flex-basis: 32px; }
}
/* Account inheritance reuses the site's panels, controls and blue accent. */
.reborn-scan-grid { max-width:720px; }
.reborn-steps { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin:20px 0; }
.reborn-steps button { padding:12px 6px; border:0; border-bottom:2px solid light-dark(#e4e8f0, #27272d); border-radius:0; background:transparent; color:light-dark(#667085, #b3b3bd); font-size:13px; text-align:center; }
.reborn-steps button.active { color:light-dark(#002fa7, #7a93d1); border-color:light-dark(#002fa7, #7a93d1); font-weight:700; }
.reborn-scan-grid form { min-width:0; }
.reborn-scan-grid textarea { width:100%; resize:vertical; }
.reborn-levels,.reborn-actions { display:flex; flex-wrap:wrap; gap:12px; margin:16px 0; }
.reborn-levels { border:1px solid var(--border,light-dark(#e4e8f0, #27272d)); border-radius:12px; padding:14px; }
.reborn-entries details { margin:12px 0; padding:14px; border:1px solid var(--border,light-dark(#e4e8f0, #27272d)); border-radius:12px; }
.reborn-entry { display:flex; align-items:flex-start; gap:10px; padding:10px 0; border-bottom:1px solid light-dark(#edf0f5, #27272d); overflow-wrap:anywhere; }
.reborn-entry:last-child { border-bottom:0; }
body.app-mode .reborn-entry input[type="checkbox"], body.app-mode .reborn-levels input[type="checkbox"] { width:18px; height:18px; min-height:0; flex:0 0 18px; margin:4px 0 0; padding:0; accent-color:light-dark(#002fa7, #7a93d1); }
.reborn-levels label { display:inline-flex; align-items:center; gap:8px; min-height:32px; }
.reborn-entry span { min-width:0; flex:1; }
.reborn-entry small { display:block; color:light-dark(#667085, #b3b3bd); }
.reborn-progress { width:100%; accent-color:light-dark(#002fa7, #7a93d1); }
@media(max-width:640px) { .reborn-scan-grid { grid-template-columns:1fr; } .reborn-actions button { flex:1 1 40%; } }

/* Shared, clickable workspace tabs use the same underline as account inheritance. */
body.app-mode .feature-tabs {
  display:flex; flex-wrap:wrap; gap:4px; margin:16px 0 24px; padding:5px;
  border:1px solid var(--line); border-radius:14px; background:var(--surface); min-width:0;
}
body.app-mode .feature-tabs > [role="tab"] {
  display:flex; align-items:center; justify-content:center; gap:8px; flex:1 1 120px;
  min-width:0; min-height:44px; padding:10px 16px; margin:0;
  border:0; border-radius:10px;
  box-shadow:none; background:transparent; color:var(--muted); font-size:14px; line-height:1.5;
  white-space:normal; overflow-wrap:anywhere; text-align:center;
  transition:background-color .15s ease, color .15s ease, border-color .15s ease;
}
body.app-mode .feature-tabs > [role="tab"]:hover { background:var(--surface-soft); color:var(--text); }
body.app-mode .feature-tabs > [role="tab"].active,
body.app-mode .feature-tabs > [role="tab"][aria-selected="true"] { background:var(--accent-soft); color:var(--accent); font-weight:700; box-shadow:inset 0 0 0 1px light-dark(#d6e1fb, #27272d); }
body.app-mode .feature-tabs > [role="tab"]:disabled { opacity:.45; cursor:not-allowed; }
body.app-mode .feature-tabs > [role="tab"]:focus-visible { outline:2px solid light-dark(#002fa7, #7a93d1); outline-offset:-3px; }
.feature-tab-panel[hidden], .feature-tabs[hidden], .feature-tabs > [hidden], .admin-account-overview[hidden], label[hidden], button[hidden] { display:none !important; }
body.app-mode .feature-tabbed-layout:not(.view-section) { display:block; }
body.app-mode .collectible-kind-grid.feature-tabs .collectible-kind-card { grid-template-columns:none; flex-direction:row; }
body.app-mode .collectible-kind-grid.feature-tabs strong { font-size:12px; font-weight:500; opacity:.7; }
body.app-mode .collectible-kind-grid.feature-tabs small { display:none; }
body.app-mode .settings-grid.feature-tabbed-layout .settings-panel { border-top:0; padding-top:8px; }
body.app-mode .feature-tab-panel { min-width:0; }
.admin-account-row { display:flex; flex-wrap:wrap; align-items:center; gap:16px 24px; padding:20px; }
.admin-account-heading { display:flex; flex:1 1 260px; align-items:center; gap:14px; min-width:0; }
body.app-mode .admin-account-heading .maimai-avatar { flex:0 0 56px; width:56px; height:56px; border-radius:8px; object-fit:cover; }
.admin-account-heading > div { min-width:0; overflow-wrap:anywhere; }
.admin-account-heading strong { color:var(--text); font-size:17px; line-height:1.5; }
.admin-account-heading p { margin:4px 0; font-size:14px; color:light-dark(#43516a, #ededf1); line-height:1.65; }
.admin-account-heading small { display:block; font-size:13px; color:var(--muted); line-height:1.65; }
.admin-account-actions { display:flex; flex:0 1 auto; flex-wrap:wrap; gap:8px; margin:0; }
.admin-account-actions > button { margin:0; }
body.app-mode .admin-account-overview { flex:1 1 100%; margin-top:0; border-top:1px solid var(--line); padding-top:16px; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 24px; }
.admin-account-overview .overview-item { min-width:0; overflow-wrap:anywhere; }
.reborn-account-summary { padding:16px 0; overflow-wrap:anywhere; }
.reborn-introduction { max-width:80ch; line-height:1.9; margin:12px 0 24px; }
.reborn-account-hero { display:flex; align-items:center; gap:20px; padding:24px; border:1px solid var(--border); border-radius:12px; background:var(--surface); }
.reborn-account-hero .maimai-avatar { width:80px; height:80px; border-radius:16px; flex:none; }
.reborn-account-identity { flex:1; min-width:0; }
.reborn-account-identity h3 { margin:2px 0; font-size:24px; line-height:1.4; overflow-wrap:anywhere; }
.reborn-account-rating { flex:none; text-align:right; }
.reborn-account-rating span { display:block; color:var(--muted); font-size:13px; }
.reborn-account-rating strong { display:block; font-size:30px; line-height:1.4; font-variant-numeric:tabular-nums; }
.reborn-account-info,.reborn-account-inventory { margin-top:28px; }
.reborn-account-info h3,.reborn-account-inventory h3 { margin:0 0 16px; font-size:17px; }
.reborn-account-info .overview-grid { margin:0; padding:20px; border:1px solid var(--border); border-radius:12px; }
.reborn-list-tools { display:flex; flex-wrap:wrap; align-items:flex-end; gap:12px; margin:20px 0 8px; }
.reborn-list-tools .field { flex:0 1 200px; min-width:0; margin:0; gap:6px; }
.reborn-list-tools .reborn-search-field { flex:1 1 240px; }
body.app-mode .reborn-list-tools :is(input,select,button).ui-input,
body.app-mode .reborn-list-tools button.ui-action { min-height:44px; }
body.app-mode .reborn-list-tools input::placeholder { color:var(--muted); opacity:1; }
.reborn-entries summary { min-height:44px; padding:8px 0; font-weight:600; cursor:pointer; }
.reborn-entries details.reborn-anomalies { border-color:color-mix(in srgb,var(--pink) 45%,var(--border)); background:color-mix(in srgb,var(--pink) 5%,var(--surface)); }
.reborn-anomaly-note { margin:8px 0 12px; max-width:75ch; font-size:14px; line-height:1.8; }
.reborn-entry { min-height:44px; }
.reborn-entry .reborn-entry-body { display:block; line-height:1.7; }
.reborn-entry .reborn-entry-body strong { display:block; font-size:15px; font-weight:600; }
.reborn-entry .reborn-entry-meta { display:block; font-size:13px; color:var(--text); }
.reborn-entry .reborn-entry-status { margin-top:3px; font-size:12px; }
.reborn-entry .reborn-entry-reason { color:var(--pink); font-size:13px; margin-top:4px; }
.reborn-category-check { align-items:center; font-size:14px; }
.reborn-more { min-height:44px; margin:12px 0 0; }
.reborn-empty { padding:24px 16px; text-align:center; border:1px dashed var(--border); border-radius:12px; line-height:1.8; }
body.app-mode .reborn-steps.feature-tabs { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); width:100%; overflow:visible; }
body.app-mode .reborn-steps.feature-tabs > [role="tab"] { min-height:44px; white-space:normal; padding:10px 8px; }
@media(max-width:640px) {
  body.app-mode .reborn-steps.feature-tabs { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .reborn-account-hero { padding:16px; gap:12px; flex-wrap:wrap; }
  .reborn-account-hero .maimai-avatar { width:64px; height:64px; border-radius:12px; }
  .reborn-account-identity { flex:1 1 130px; }
  .reborn-account-identity h3 { font-size:21px; }
  .reborn-account-rating { text-align:left; padding-left:76px; width:100%; }
  .reborn-account-rating span,.reborn-account-rating strong { display:inline; }
  .reborn-account-rating strong { font-size:26px; margin-left:12px; }
  .reborn-list-tools .field { flex:1 1 100%; }
  body.app-mode .reborn-list-tools :is(input,select).ui-input { font-size:16px; }
  .reborn-list-tools button { width:100%; }
  .reborn-account-info .overview-grid { padding:16px; }
}
@media(max-width:640px) {
  body.app-mode .feature-tabs { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px; margin:12px 0 20px; }
  body.app-mode .feature-tabs > [role="tab"] { flex-basis:100px; padding:10px 8px; font-size:13px; }
  body.app-mode .feature-tabs > [role="tab"]:last-child:nth-child(odd) { grid-column:1 / -1; }
  .admin-account-row { padding:16px 12px; }
  body.app-mode .admin-account-overview { grid-template-columns:minmax(0,1fr); }
  .admin-account-actions button { flex:1 1 110px; min-height:44px; }
  body.app-mode .admin-account-heading .maimai-avatar { flex-basis:44px; width:44px; height:44px; }
}
@media(prefers-reduced-motion:reduce) { body.app-mode .feature-tabs > [role="tab"] { transition:none; } }

body.app-mode .song-detail-dialog { width: min(720px, 100%); padding: 0 16px 20px; border-radius: 20px; }
/* Keep scrolling content and padding inside the visible rounded surface. */
body.app-mode :is(.song-detail-panel, .song-detail-dialog) { clip-path: inset(0 round 20px); }

/* Keep shared controls readable at narrow widths and enlarged text sizes. */
@media (max-width: 480px) {
  .shell { gap:20px; padding-top:28px; }
  .auth-card { padding:24px 20px; border-radius:20px; }
  .auth-logo { width:260px; }
  body.app-mode #songSearchForm.song-search-form { padding:16px; }
  body.app-mode .overview-account-layout { padding:16px; }
}
@media (prefers-reduced-motion: reduce) {
  body.app-mode .view-section.active, .support-modal:not(.hidden), .best50-modal:not(.hidden) { animation:none; }
}
/* Province selection and administrator cabinet audit. */
.province-count-details { margin-top:20px; border-top:1px solid var(--line); padding-top:16px; }
.province-count-details summary { cursor:pointer; min-height:44px; display:flex; align-items:center; font-weight:600; }
.province-counts { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:8px 24px; padding:10px 0; }
.province-counts > div { display:flex; justify-content:space-between; gap:12px; padding:8px 0; border-bottom:1px solid var(--line); }
.keychip-admin { margin-top:24px; padding-top:20px; border-top:1px solid var(--line); }
.keychip-admin h3 { font-size:16px; margin:0 0 14px; }
.keychip-results { max-height:420px; overflow-y:auto; overscroll-behavior:contain; margin:12px 0 20px; }
.keychip-row { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px 4px; border-bottom:1px solid var(--line); }
.keychip-row > div:first-child { min-width:0; }
.keychip-row strong,.keychip-row p,.network-record { overflow-wrap:anywhere; }
.keychip-row p { margin:5px 0 0; line-height:1.65; }
.keychip-actions { display:flex; flex-shrink:0; flex-wrap:wrap; gap:8px; }
.keychip-fault-note { color:var(--pink); font-size:13px; }
.network-record { border:1px solid var(--line); border-radius:10px; padding:16px; margin-top:12px; }
.network-record h3 { margin:0 0 8px; font-size:16px; }
.network-record p { margin:6px 0 0; line-height:1.7; }
.province-fallback-dialog { max-width:480px; width:calc(100vw - 32px); box-sizing:border-box; padding:28px; border:1px solid var(--line); border-radius:16px; background:var(--surface); color:var(--text); }
.province-fallback-dialog::backdrop { background:#10152199; touch-action:none; }
.province-fallback-dialog h2 { font-size:21px; margin:8px 0 16px; }
.province-fallback-dialog p { line-height:1.8; }
#provinceFallbackLocation { overflow-wrap:anywhere; }
.province-fallback-actions { display:flex; justify-content:flex-end; gap:12px; margin-top:24px; }
.province-fallback-actions > button { flex:1 1 0; white-space:nowrap; }
.province-fallback-actions > button[hidden] { display:none; }
body.province-confirmation-open { overflow:hidden; overscroll-behavior:none; }
@media(max-width:600px) { .keychip-row { align-items:stretch; flex-direction:column; gap:10px; } .keychip-actions { justify-content:flex-end; } .province-fallback-dialog { padding:22px; } .province-fallback-actions { flex-direction:column-reverse; } }
