:root {
  color-scheme: dark;
  --accent: #e51627;
  --accent-rgb: 229, 22, 39;
  --accent-soft: rgba(var(--accent-rgb), .22);
  --surface: rgba(28, 29, 34, .92);
  --surface-strong: #202126;
  --surface-soft: rgba(43, 44, 51, .74);
  --surface-hover: rgba(255, 255, 255, .075);
  --surface-active: rgba(255, 255, 255, .12);
  --border: rgba(255, 255, 255, .11);
  --border-strong: rgba(255, 255, 255, .18);
  --text: #f7f7f8;
  --muted: #b5b7bf;
  --danger: #f14f5d;
  --success: #52c48b;
  --warning: #ffbf5a;
  --taskbar-height: 48px;
  --icon-size: 42px;
  --desktop-icon-width: 92px;
  --desktop-icon-height: 87px;
  --desktop-icon-gap: 5px;
  --desktop-label-width: 88px;
  --desktop-label-size: 12px;
  --desktop-label-line-height: 15px;
  --desktop-glyph-scale: 1;
  --radius: 12px;
  --shadow: 0 24px 64px rgba(0, 0, 0, .52), 0 3px 12px rgba(0, 0, 0, .36);
  --font: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; height: 100dvh; margin: 0; overflow: hidden; overscroll-behavior: none; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { font-family: var(--font); color: var(--text); background: #030303; user-select: none; -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), .9);
  outline-offset: 2px;
}

.skip-link { position: fixed; z-index: 100000; top: -50px; left: 12px; padding: 9px 14px; border-radius: 8px; background: #fff; color: #111; }
.skip-link:focus { top: 12px; }
.small-muted, .muted { color: var(--muted); font-size: 12px; }
.danger { color: #ff98a1; }
.success { color: #8ce0b5; }

.desktop {
  position: fixed;
  inset: 0 0 calc(var(--taskbar-height) + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  background-color: #050505;
  background-image: var(--custom-wallpaper, url("../images/samurai-wallpaper.png"));
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}
.desktop-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.03), rgba(0,0,0,.1)); }
.desktop-icons { position: absolute; inset: 0; z-index: 2; }
.desktop-icon {
  position: absolute;
  width: var(--desktop-icon-width);
  min-height: var(--desktop-icon-height);
  padding: 5px 4px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: white;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: var(--desktop-icon-gap);
  cursor: default;
  text-align: center;
  text-shadow: 0 1px 3px #ff00007c, 0 1px 1px #000;
  touch-action: none;
}
.desktop-icon:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.1); }
.desktop-icon.selected { background: rgba(80, 139, 199, .26); border-color: rgba(132, 191, 255, .42); }
.desktop-icon.dragging { opacity: .75; filter: drop-shadow(0 10px 12px #000); }
.desktop-icon.drop-target { background: rgba(var(--accent-rgb), .28); border-color: rgba(var(--accent-rgb), .8); }
.desktop-icon .desktop-icon-graphic {
  width: var(--icon-size);
  height: var(--icon-size);
  display: flex;
  flex: 0 0 var(--icon-size);
  align-items: center;
  justify-content: center;
  font-size: var(--icon-size);
  line-height: 1;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,.42));
}
.desktop-icon .desktop-icon-graphic > * { flex: 0 0 auto; }
.desktop-icon .glyph-folder { transform: scale(var(--desktop-glyph-scale)); transform-origin: center; }
.desktop-icon .desktop-icon-graphic > .glyph-icon {
  width: var(--icon-size);
  min-width: var(--icon-size);
  height: var(--icon-size);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.desktop-icon .desktop-label { width: var(--desktop-label-width); max-height: calc(var(--desktop-label-line-height) * 2); align-self: center; overflow: hidden; font-size: var(--desktop-label-size); line-height: var(--desktop-label-line-height); text-align: center; word-break: break-word; }
.desktop-icon.selected .desktop-label { max-height: none; }
.selection-box { position: absolute; z-index: 9998; border: 1px solid rgba(103, 180, 255, .9); background: rgba(62, 132, 206, .24); pointer-events: none; }

.glyph-icon { width: 100%; height: 100%; display: grid; place-items: center; }
.glyph-icon svg { width: 100%; height: 100%; display: block; }
.glyph-folder { position: relative; width: 48px; height: 34px; margin-top: 8px; border-radius: 4px 5px 6px 6px; background: linear-gradient(145deg, #ffd865, #efa815); box-shadow: inset 0 2px rgba(255,255,255,.38), 0 3px 8px rgba(0,0,0,.25); }
.glyph-folder::before { content: ""; position: absolute; left: 2px; top: -7px; width: 21px; height: 11px; border-radius: 4px 5px 0 0; background: #f4be34; }
.glyph-folder::after { content: ""; position: absolute; inset: 6px 0 auto; height: 6px; background: rgba(255,255,255,.18); }
.glyph-folder.media::after { content: "▧"; inset: 5px 11px auto auto; width: auto; height: auto; color: #fff; font-size: 17px; text-shadow: none; }
.glyph-folder.games::after { content: "✦"; inset: 6px 12px auto auto; width: auto; height: auto; color: #fff; font-size: 16px; text-shadow: none; }

.window-layer { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.app-window {
  position: absolute;
  min-width: 390px;
  min-height: 280px;
  width: min(900px, calc(100vw - 90px));
  height: min(630px, calc(100vh - 120px));
  overflow: hidden;
  resize: both;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: rgba(25, 26, 31, .965);
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: window-open .16s cubic-bezier(.2,.85,.25,1);
}
@keyframes window-open { from { opacity: 0; transform: translateY(10px) scale(.975); } to { opacity: 1; transform: none; } }
.app-window.inactive { filter: saturate(.8); }
.app-window.minimized { display: none; }
.app-window.maximized { top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; resize: none; }
.app-window[data-app="profile"] { resize: none; }
.app-window[data-app="profile"] .window-control.maximize, .app-window[data-app="profile"] .resize-grip { display: none; }
.app-window.closing { animation: window-close .12s ease forwards; }
@keyframes window-close { to { opacity: 0; transform: scale(.97); } }
.titlebar { height: 38px; display: flex; align-items: center; justify-content: space-between; background: rgba(32,33,38,.98); cursor: default; }
.titlebar-title { min-width: 0; display: flex; align-items: center; gap: 9px; padding-left: 12px; font-size: 12px; font-weight: 600; }
.window-app-icon { width: 18px; height: 18px; display: grid; place-items: center; font-size: 17px; }
.window-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.window-controls { align-self: stretch; display: flex; }
.window-control { width: 46px; height: 100%; border: 0; background: transparent; font-size: 16px; line-height: 1; }
.window-control:hover { background: rgba(255,255,255,.1); }
.window-control.close:hover { background: #c42b1c; }
.window-control span { display: block; transform: translateY(-1px); }
.window-body { height: calc(100% - 38px); min-height: 0; overflow: hidden; background: rgba(29,30,35,.97); }
.resize-grip { position: absolute; right: 0; bottom: 0; width: 14px; height: 14px; cursor: nwse-resize; }

.taskbar {
  position: fixed;
  z-index: 50000;
  inset: auto 0 0;
  height: calc(var(--taskbar-height) + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 10px env(safe-area-inset-bottom, 0px);
  background: rgba(24, 24, 27, .93);
  border-top: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 -6px 25px rgba(0,0,0,.25);
  backdrop-filter: blur(22px) saturate(140%);
}
.taskbar-center { grid-column: 2; display: flex; align-items: center; justify-content: center; gap: 3px; height: 100%; }
.taskbar-right { grid-column: 3; justify-self: end; height: 100%; display: flex; align-items: center; gap: 3px; }
.taskbar-left-aligned .taskbar { grid-template-columns: 0 minmax(0, 1fr) auto; }
.taskbar-left-aligned .taskbar-center { grid-column: 2; justify-self: start; justify-content: flex-start; }
.start-search-disabled .taskbar-button[data-command="search"], .start-search-disabled .start-search { display: none; }
.quick-links-disabled .tray-chevron, .quick-links-disabled .quick-links { display: none; }
.taskbar-pinned-apps, .running-tasks { display: flex; align-items: center; gap: 3px; min-width: 0; }
.taskbar-pinned-apps { min-height: 44px; border-radius: 6px; transition: background .12s, box-shadow .12s; }
.taskbar-pinned-apps.drop-target { background: rgba(var(--accent-rgb), .18); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .58); }
.taskbar-button { position: relative; width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 5px; background: transparent; }
.taskbar-button:hover, .taskbar-button.active { background: rgba(255,255,255,.08); }
.taskbar-button.running::after, .taskbar-button.active::after { content: ""; position: absolute; bottom: 2px; left: 50%; width: 6px; height: 3px; border-radius: 3px; background: #8bdfff; transform: translateX(-50%); transition: width .14s; }
.taskbar-button.active::after { width: 18px; }
.taskbar-button .ui-icon { width: 23px; height: 23px; }
.taskbar-item-graphic { display: grid; place-items: center; width: 27px; height: 27px; font-size: 23px; line-height: 1; }
.taskbar-pinned-item { touch-action: none; user-select: none; }
.taskbar-pinned-item.dragging { z-index: 2; opacity: .72; transform: translateY(-4px) scale(1.06); }
.windows-logo { width: 23px; height: 23px; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; }
.windows-logo i { display: block; background: #34b9f1; }
.task-icon.folder-task-icon { position: relative; width: 25px; height: 19px; border-radius: 3px; background: linear-gradient(#ffd54f 0 22%, #f1ad13 22%); box-shadow: 0 2px 5px rgba(0,0,0,.28); }
.task-icon.folder-task-icon::before { content:""; position:absolute; top:-3px; left:2px; width:10px; height:5px; background:#e8a312; border-radius:2px 2px 0 0; }
.tray-chevron { width: 34px; height: 31px; border: 0; border-radius: 5px; background: transparent; font-size: 15px; }
.tray-chevron:hover, .tray-chevron[aria-expanded="true"] { background: rgba(255,255,255,.08); }
.clock { min-width: 75px; height: 42px; border: 0; border-radius: 5px; background: transparent; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; padding: 0 7px; font-size: 11px; line-height: 15px; }
.clock:hover { background: rgba(255,255,255,.07); }

.glass-panel { background: rgba(32, 33, 38, .92); border: 1px solid var(--border); box-shadow: var(--shadow); backdrop-filter: blur(28px) saturate(145%); }
.start-menu {
  position: fixed;
  z-index: 49000;
  bottom: calc(var(--taskbar-height) + env(safe-area-inset-bottom, 0px) + 10px);
  left: 50%;
  width: min(640px, calc(100vw - 24px));
  height: min(700px, calc(100vh - 78px));
  border-radius: 13px;
  transform: translate(-50%, 18px) scale(.98);
  opacity: 0;
  pointer-events: none;
  transition: .16s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.start-menu.open { transform: translate(-50%, 0) scale(1); opacity: 1; pointer-events: auto; }
.start-search { margin: 26px 34px 12px; height: 35px; border-radius: 7px; background: #24252a; border: 1px solid rgba(255,255,255,.13); border-bottom: 2px solid var(--accent); display: flex; align-items: center; gap: 10px; padding: 0 12px; }
.start-search .ui-icon { width: 16px; height: 16px; }
.start-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 13px; }
.start-section-heading { display: flex; align-items: center; justify-content: space-between; margin: 10px 40px 4px; font-size: 14px; }
.text-button { border: 0; border-radius: 5px; padding: 4px 9px; background: rgba(255,255,255,.06); font-size: 11px; }
.text-button:hover { background: rgba(255,255,255,.12); }
.pinned-apps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px 1px; padding: 9px 32px 13px; }
.start-app { min-width: 0; height: 84px; border: 0; border-radius: 6px; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; font-size: 11px; }
.start-app:hover { background: rgba(255,255,255,.075); }
.start-app .app-graphic { width: 33px; height: 33px; display: grid; place-items: center; font-size: 29px; }
.start-app .app-label { width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recommended-heading { margin-top: 4px; }
.recommended-items { min-height: 105px; display: grid; grid-template-columns: 1fr 1fr; align-content: start; gap: 2px 10px; padding: 8px 36px 15px; overflow: auto; }
.recommended-item { height: 54px; border: 0; border-radius: 6px; background: transparent; display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: 10px; text-align: left; padding: 5px 8px; }
.recommended-item:hover { background: rgba(255,255,255,.07); }
.recommended-item .rec-icon { font-size: 26px; text-align: center; }
.recommended-item span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recommended-item small { color: var(--muted); }
.start-userbar { margin-top: auto; min-height: 62px; border-top: 1px solid rgba(255,255,255,.07); background: rgba(0,0,0,.14); display: flex; align-items: center; justify-content: space-between; padding: 0 48px; }
.profile-chip { border: 0; border-radius: 7px; background: transparent; display: flex; align-items: center; gap: 11px; padding: 6px 10px; font-size: 12px; }
.profile-chip:hover { background: rgba(255,255,255,.07); }
.avatar { flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: linear-gradient(145deg, var(--accent), #64131c); color: white; font-weight: 700; box-shadow: inset 0 0 0 1px rgba(255,255,255,.24); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-small { width: 30px; height: 30px; font-size: 12px; }
.icon-button { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; }
.icon-button:hover { background: rgba(255,255,255,.08); }
.icon-button .ui-icon { width: 17px; height: 17px; }

.quick-links { position: fixed; z-index: 49000; right: 68px; bottom: calc(var(--taskbar-height) + env(safe-area-inset-bottom, 0px) + 10px); width: 300px; padding: 12px; border-radius: 12px; transform: translateY(14px); opacity: 0; pointer-events: none; transition: .14s ease; }
.quick-links.open { transform: none; opacity: 1; pointer-events: auto; }
.panel-title { height: 32px; display: flex; align-items: center; justify-content: space-between; padding: 0 5px 8px; font-size: 13px; }
.quick-links-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.quick-link { min-width: 0; height: 76px; border: 0; border-radius: 7px; background: rgba(255,255,255,.035); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 11px; }
.quick-link:hover { background: rgba(255,255,255,.1); }
.quick-link .link-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 7px; background: var(--accent-soft); font-weight: 700; }
.quick-link .link-label { max-width: 78px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.explorer-shell, .settings-shell, .chat-shell, .profile-shell { height: 100%; min-height: 0; display: flex; flex-direction: column; }
.explorer-commandbar { min-height: 46px; display: flex; align-items: center; gap: 4px; padding: 5px 10px; border-bottom: 1px solid rgba(255,255,255,.07); background: #24252a; }
.command-button { height: 33px; display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 5px; background: transparent; padding: 0 9px; font-size: 12px; }
.command-button:hover { background: rgba(255,255,255,.075); }
.command-button:disabled { opacity: .38; }
.command-button .ui-icon { width: 16px; height: 16px; }
.command-separator { width: 1px; height: 22px; margin: 0 2px; background: rgba(255,255,255,.1); }
.explorer-navrow { min-height: 42px; display: grid; grid-template-columns: auto 1fr minmax(140px, 230px); gap: 8px; align-items: center; padding: 5px 10px; border-bottom: 1px solid rgba(255,255,255,.06); background: #202126; }
.nav-buttons { display: flex; }
.nav-button { width: 31px; height: 31px; border: 0; border-radius: 5px; background: transparent; }
.nav-button:hover { background: rgba(255,255,255,.075); }
.nav-button:disabled { opacity: .35; pointer-events: none; }
.address-bar, .explorer-search { height: 31px; border: 1px solid var(--border); border-radius: 5px; background: #292a30; display: flex; align-items: center; gap: 7px; padding: 0 10px; font-size: 12px; }
.address-bar { overflow: hidden; }
.address-bar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.explorer-search .ui-icon { width: 14px; height: 14px; flex: 0 0 14px; }
.explorer-search input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12px; }
.explorer-main { min-height: 0; flex: 1; display: grid; grid-template-columns: 190px 1fr; }
.explorer-sidebar { overflow: auto; border-right: 1px solid rgba(255,255,255,.065); background: #202126; padding: 7px; }
.sidebar-item { width: 100%; height: 34px; border: 0; border-radius: 5px; background: transparent; display: flex; align-items: center; gap: 9px; padding: 0 9px; font-size: 12px; text-align: left; }
.sidebar-item:hover, .sidebar-item.active { background: rgba(255,255,255,.075); }
.sidebar-item.active { box-shadow: inset 3px 0 var(--accent); }
.sidebar-item .sidebar-icon { width: 18px; text-align: center; font-size: 16px; }
.explorer-content { min-width: 0; min-height: 0; overflow: auto; padding: 14px; background: #1c1d21; position: relative; }
.explorer-content.drop-over { box-shadow: inset 0 0 0 2px var(--accent); background: rgba(var(--accent-rgb), .07); }
.content-heading { display: flex; align-items: center; justify-content: space-between; margin: 2px 4px 13px; }
.content-heading h2 { margin: 0; font-size: 18px; font-weight: 500; }
.content-heading small { color: var(--muted); }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; align-content: start; }
.file-item { min-width: 0; height: 104px; border: 1px solid transparent; border-radius: 6px; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 7px; text-align: center; }
.file-item:hover { background: rgba(255,255,255,.055); }
.file-item.selected { background: rgba(var(--accent-rgb), .18); border-color: rgba(var(--accent-rgb), .45); }
.file-item .file-icon { width: 46px; height: 46px; display: grid; place-items: center; font-size: 39px; }
.file-item .file-name { max-width: 100%; font-size: 12px; line-height: 15px; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.file-list { width: 100%; border-collapse: collapse; font-size: 12px; }
.file-list th { position: sticky; top: -14px; z-index: 1; height: 32px; background: #1c1d21; color: var(--muted); text-align: left; font-weight: 400; border-bottom: 1px solid rgba(255,255,255,.07); }
.file-list td { height: 36px; border-bottom: 1px solid rgba(255,255,255,.035); }
.file-list tr:hover td { background: rgba(255,255,255,.05); }
.file-list .name-cell { display: flex; align-items: center; gap: 9px; }
.empty-state { height: 100%; min-height: 220px; display: grid; place-items: center; text-align: center; color: var(--muted); }
.empty-state .empty-icon { font-size: 54px; opacity: .8; }
.empty-state h3 { color: var(--text); margin: 8px 0 4px; font-size: 16px; font-weight: 500; }
.empty-state p { margin: 0; font-size: 12px; max-width: 340px; }
.statusbar { height: 25px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; border-top: 1px solid rgba(255,255,255,.06); background: #202126; color: var(--muted); font-size: 11px; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.media-card { min-width: 0; border: 1px solid transparent; border-radius: 7px; overflow: hidden; background: rgba(255,255,255,.035); }
.media-card:hover { border-color: var(--border-strong); background: rgba(255,255,255,.06); }
.media-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.media-preview { position: relative; aspect-ratio: 16/10; overflow: hidden; background: #09090b; display: grid; place-items: center; font-size: 42px; }
.media-preview img, .media-preview video { width: 100%; height: 100%; object-fit: cover; }
.media-embed-preview { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%; background: rgba(var(--accent-rgb), .82); color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.4); font-size: 25px; padding-left: 4px; }
.media-type-badge { position: absolute; right: 7px; bottom: 7px; padding: 2px 5px; border-radius: 4px; background: rgba(0,0,0,.72); font-size: 10px; }
.media-info { padding: 8px 9px 9px; }
.media-info strong, .media-info span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-info strong { font-size: 12px; font-weight: 500; }
.media-info span { color: var(--muted); margin-top: 3px; font-size: 10px; }
.viewer { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; background: rgba(4,4,6,.96); }
.viewer-toolbar { height: 46px; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; }
.viewer-content { min-height: 0; flex: 1; display: grid; place-items: center; overflow: hidden; }
.viewer-content img, .viewer-content video { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-content iframe { width: min(960px, 100%); aspect-ratio: 16/9; border: 0; border-radius: 8px; background: #000; }
.media-window-viewer,
.media-window-empty { width: 100%; height: 100%; min-width: 0; min-height: 0; overflow: hidden; background: #050506; }
.media-window-viewer { display: grid; place-items: center; padding: 10px; }
.media-window-viewer img,
.media-window-viewer video { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.media-window-viewer iframe { display: block; width: min(100%, 1280px); max-height: 100%; aspect-ratio: 16 / 9; border: 0; background: #000; }
.media-window-empty { display: grid; place-items: center; text-align: center; color: var(--muted); }

.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 12px; }
.game-card { min-height: 170px; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: linear-gradient(145deg, rgba(255,255,255,.075), rgba(255,255,255,.025)); display: flex; flex-direction: column; }
.game-cover { height: 86px; display: flex; align-items: flex-end; justify-content: space-between; padding: 12px; background: radial-gradient(circle at 80% 20%, rgba(var(--accent-rgb), .48), transparent 38%), linear-gradient(135deg, #241418, #111215); font-size: 36px; }
.game-source-badge { align-self: flex-start; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: 3px 7px; background: rgba(0,0,0,.4); color: #fff; font-size: 8px; font-weight: 700; letter-spacing: .08em; }
.library-scan { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.game-card-body { flex: 1; padding: 10px 12px; }
.game-card h3 { margin: 0 0 3px; font-size: 13px; }
.game-card p { margin: 0; color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.button { min-height: 32px; border: 1px solid var(--border); border-radius: 6px; padding: 0 14px; }
.button.primary { border-color: rgba(var(--accent-rgb), .9); background: var(--accent); color: #fff; }
.button.primary:hover { filter: brightness(1.12); }
.button.secondary { background: rgba(255,255,255,.055); }
.button.secondary:hover { background: rgba(255,255,255,.1); }
.button.danger-button { background: rgba(201,55,66,.14); border-color: rgba(241,79,93,.38); color: #ffb5bb; }
.button.small { min-height: 27px; padding: 0 10px; font-size: 11px; }

.settings-shell { flex-direction: row; background: #1b1c20; }
.settings-nav { width: 245px; flex: 0 0 auto; padding: 12px 9px; border-right: 1px solid rgba(255,255,255,.07); background: #202126; overflow: auto; }
.settings-profile-card { display: flex; align-items: center; gap: 12px; padding: 3px 10px 8px; }
.settings-profile-card .avatar { width: 47px; height: 47px; font-size: 18px; }
.settings-profile-card strong, .settings-profile-card span { display: block; max-width: 145px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-profile-card span { color: var(--muted); font-size: 11px; margin-top: 2px; }
.settings-search { display: block; height: 32px; margin: 0 6px 5px; border: 1px solid var(--border); border-bottom: 2px solid var(--accent); border-radius: 5px; background: #292a2f; }
.settings-search input { width: 100%; height: 100%; padding: 0 10px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12px; }
.settings-nav-button { width: 100%; height: 37px; border: 0; border-radius: 5px; background: transparent; display: flex; align-items: center; gap: 10px; padding: 0 10px; text-align: left; font-size: 12px; }
.settings-nav-button:hover, .settings-nav-button.active { background: rgba(255,255,255,.065); }
.settings-nav-button.active { box-shadow: inset 3px 0 var(--accent); }
.settings-nav-button .settings-nav-icon { width: 21px; text-align: center; font-size: 16px; }
.settings-content { flex: 1; min-width: 0; overflow: auto; padding: 34px 44px 44px; }
.settings-content h1 { margin: 0 0 26px; font-size: 25px; font-weight: 500; }
.settings-hero { min-height: 140px; display: grid; grid-template-columns: 190px 1fr; gap: 24px; align-items: center; margin-bottom: 24px; }
.wallpaper-preview { aspect-ratio: 16/9; border-radius: 6px; background-image: var(--custom-wallpaper, url("../images/samurai-wallpaper.png")); background-size: cover; background-position: center; box-shadow: 0 7px 18px rgba(0,0,0,.35); }
.setting-card { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 15px; margin-bottom: 4px; border: 1px solid rgba(255,255,255,.04); border-radius: 6px; background: rgba(255,255,255,.045); }
.setting-card:hover { background: rgba(255,255,255,.065); }
.setting-card .setting-copy { min-width: 0; }
.setting-card strong, .setting-card span { display: block; }
.setting-card strong { font-size: 12px; font-weight: 500; }
.setting-card span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.setting-control { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.setting-control input[type="text"], .setting-control input[type="url"], .setting-control input[type="email"], .setting-control input[type="tel"], .setting-control select { width: 215px; height: 31px; border: 1px solid var(--border); border-radius: 5px; background: #292a30; color: var(--text); padding: 0 9px; }
.setting-control input[type="color"] { width: 42px; height: 30px; border: 1px solid var(--border); border-radius: 5px; padding: 2px; background: #292a30; }
.toggle { position: relative; width: 40px; height: 21px; display: inline-block; }
.toggle input { position: absolute; opacity: 0; }
.toggle span { position: absolute; inset: 0; margin: 0; border-radius: 20px; background: #5a5c64; transition: .15s; }
.toggle span::after { content: ""; position: absolute; width: 15px; height: 15px; left: 3px; top: 3px; border-radius: 50%; background: white; transition: .15s; }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(19px); }
.toggle input:focus-visible + span { outline: 2px solid #fff; outline-offset: 2px; }
.toggle input:disabled + span { opacity: .45; }
.protected-settings { margin-top: 12px; overflow: hidden; border: 1px solid rgba(255,255,255,.08); border-radius: 9px; background: rgba(255,255,255,.035); }
.protected-settings.locked { min-height: 92px; display: flex; align-items: center; gap: 15px; padding: 18px; color: var(--muted); }
.protected-settings.locked strong { color: var(--text); }
.protected-settings.locked p, .protected-settings-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.protected-lock { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 auto; border-radius: 50%; background: rgba(var(--accent-rgb), .14); font-size: 19px; }
.protected-settings-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px; border-bottom: 1px solid rgba(255,255,255,.07); }
.hold-reveal-button { user-select: none; touch-action: none; }
.hold-reveal-button[aria-pressed="true"] { border-color: var(--accent); background: rgba(var(--accent-rgb), .2); }
.protected-settings-values { padding: 5px 15px 12px; }
.protected-settings-row { min-height: 48px; display: grid; grid-template-columns: minmax(130px, .45fr) 1fr; align-items: center; gap: 16px; border-bottom: 1px solid rgba(255,255,255,.055); }
.protected-settings-row:last-child { border-bottom: 0; }
.protected-settings-row span { color: var(--muted); font-size: 11px; }
.protected-settings-row strong { min-width: 0; overflow-wrap: anywhere; font-size: 11px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.settings-section-title { margin: 26px 0 8px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }

.profile-shell { overflow: auto; background: #1c1d21; }
.profile-cover { position: relative; z-index: 0; height: 160px; min-height: 160px; max-height: 160px; flex: 0 0 160px; overflow: hidden; background: url("../images/samurai-wallpaper.png") center 38%/cover; }
.profile-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, rgba(var(--accent-rgb), .58), rgba(15,15,18,.66)); pointer-events: none; }
.profile-cover img { width: 100%; height: 100%; display: block; object-fit: cover; }
.profile-content { position: relative; z-index: 1; width: min(730px, calc(100% - 36px)); margin: -46px auto 40px; }
.profile-header { position: relative; z-index: 1; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.profile-header-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.profile-identity { display: flex; align-items: flex-end; gap: 18px; }
.profile-identity .avatar { width: 106px; height: 106px; border: 5px solid #1c1d21; font-size: 38px; }
.profile-identity h1 { margin: 0 0 7px; font-size: 25px; }
.profile-identity p { margin: 0 0 9px; color: var(--muted); font-size: 12px; }
.profile-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 30px; }
.profile-panel { border: 1px solid var(--border); border-radius: 8px; background: rgba(255,255,255,.035); padding: 17px; }
.profile-panel h2 { margin: 0 0 14px; font-size: 14px; font-weight: 500; }
.profile-field { margin-bottom: 12px; }
.profile-field label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; }
.profile-field input, .profile-field textarea { width: 100%; border: 1px solid var(--border); border-radius: 5px; background: #292a30; color: var(--text); padding: 8px 9px; font-size: 12px; }
.profile-field textarea { min-height: 74px; resize: vertical; }
.profile-view-field { padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.07); }
.profile-view-field:last-child { border-bottom: 0; }
.profile-view-field span, .profile-view-field strong { display: block; }
.profile-view-field span { margin-bottom: 5px; color: var(--muted); font-size: 10px; }
.profile-view-field strong { font-size: 12px; font-weight: 500; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.profile-view-field.empty strong { color: var(--muted); font-weight: 400; }

.chat-shell { position: relative; background: #18191d; }
.chat-account-actions { display: flex; align-items: center; gap: 7px; }
.chat-topbar { height: 48px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-bottom: 1px solid rgba(255,255,255,.07); background: #212227; }
.chat-room-title { display: flex; align-items: center; gap: 10px; }
.chat-room-title strong, .chat-room-title span { display: block; }
.chat-room-title strong { font-size: 13px; }
.chat-room-title span { margin-top: 1px; color: var(--muted); font-size: 10px; }
.connection-pill { padding: 3px 7px; border-radius: 10px; background: rgba(82,196,139,.12); color: #8ce0b5; font-size: 10px; }
.connection-pill.offline { background: rgba(255,191,90,.12); color: #ffd287; }
.chat-grid { min-height: 0; flex: 1; display: grid; grid-template-columns: 180px 1fr 180px; }
.room-list, .user-list { min-height: 0; overflow: auto; background: #202126; padding: 8px; }
.room-list { border-right: 1px solid rgba(255,255,255,.065); }
.user-list { border-left: 1px solid rgba(255,255,255,.065); }
.chat-side-heading { margin: 7px 8px 8px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.room-button, .user-button { width: 100%; min-height: 39px; border: 0; border-radius: 5px; background: transparent; display: flex; align-items: center; gap: 9px; padding: 6px 8px; text-align: left; }
.room-button:hover, .room-button.active, .user-button:hover { background: rgba(255,255,255,.07); }
.room-button.active { box-shadow: inset 3px 0 var(--accent); }
.room-button .room-hash { width: 22px; color: var(--muted); text-align: center; font-size: 17px; }
.room-button strong, .room-button small, .user-button strong, .user-button small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-button strong, .user-button strong { font-size: 11px; }
.room-button small, .user-button small { margin-top: 1px; color: var(--muted); font-size: 9px; }
.user-avatar { position: relative; width: 29px; height: 29px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: #34363d; font-size: 10px; font-weight: 700; }
.user-avatar img, .message-avatar img, .chat-profile-avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.user-avatar::after { content: ""; position: absolute; right: -1px; bottom: 0; width: 8px; height: 8px; border: 2px solid #202126; border-radius: 50%; background: var(--success); }
.role-badge { margin-left: auto; color: var(--warning); font-size: 10px; }
.chat-center { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.message-list { min-height: 0; flex: 1; overflow: auto; padding: 15px 18px 10px; user-select: text; }
.chat-welcome { margin: 12px 0 18px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: rgba(255,255,255,.035); }
.chat-welcome h3 { margin: 0 0 5px; font-size: 14px; }
.chat-welcome p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.message { display: grid; grid-template-columns: 35px 1fr; gap: 9px; margin: 0 0 13px; }
.message-avatar { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(145deg, var(--accent), #4d1b21); font-size: 11px; font-weight: 700; }
.message-meta { display: flex; align-items: baseline; gap: 7px; }
.message-meta strong { font-size: 12px; }
.message-meta time { color: #898b93; font-size: 9px; }
.message-body { margin-top: 3px; color: #e5e6e9; font-size: 12px; line-height: 1.45; word-break: break-word; }
.system-message { margin: 8px 0; color: var(--muted); font-size: 10px; text-align: center; }
.chat-composer { flex: 0 0 auto; padding: 8px 12px 12px; }
.composer-box { display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 5px; border: 1px solid var(--border); border-radius: 8px; background: #27282e; padding: 5px; }
.composer-box textarea { min-height: 30px; max-height: 100px; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); padding: 7px 5px; font-size: 12px; }
.send-button { width: 34px; height: 34px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; }
.chat-login-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 12px 8px; padding: 8px 10px; border-radius: 6px; background: rgba(var(--accent-rgb), .13); font-size: 10px; }
.chat-profile-panel { position: absolute; z-index: 12; inset: 48px 0 0; overflow: auto; display: grid; place-items: center; padding: 18px; background: rgba(10,11,14,.76); backdrop-filter: blur(12px); }
.chat-profile-card { position: relative; width: min(680px, 100%); max-height: 100%; overflow: auto; border: 1px solid var(--border); border-radius: 12px; background: #24252a; box-shadow: 0 20px 55px rgba(0,0,0,.46); }
.chat-profile-card.loading { min-height: 210px; display: grid; place-items: center; align-content: center; gap: 12px; color: var(--muted); }
.chat-profile-card > header { position: relative; min-height: 126px; display: flex; align-items: center; gap: 18px; padding: 24px 52px 20px 26px; background: linear-gradient(135deg, rgba(var(--accent-rgb), .42), rgba(20,21,26,.9)); }
.chat-profile-card h2 { margin: 0 0 4px; font-size: 23px; }
.chat-profile-card header p { margin: 0; color: rgba(255,255,255,.72); }
.chat-profile-close { position: absolute; top: 10px; right: 10px; }
.chat-profile-avatar { width: 78px; height: 78px; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; border: 2px solid rgba(255,255,255,.7); border-radius: 50%; background: #353740; font-size: 26px; font-weight: 700; }
.chat-profile-details, .chat-profile-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; padding: 22px 24px 8px; }
.chat-profile-details > div { min-width: 0; padding: 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 7px; background: rgba(255,255,255,.025); }
.chat-profile-details span, .chat-profile-fields label { display: grid; gap: 6px; color: var(--muted); font-size: 10px; }
.chat-profile-details strong, .chat-profile-details a { display: block; margin-top: 5px; overflow-wrap: anywhere; color: var(--text); font-size: 12px; }
.chat-profile-details p { margin: 5px 0 0; color: var(--text); line-height: 1.55; white-space: pre-wrap; }
.chat-profile-details .wide, .chat-profile-fields .wide { grid-column: 1 / -1; }
.chat-profile-fields input, .chat-profile-fields textarea { width: 100%; border: 1px solid var(--border); border-radius: 6px; background: #1b1c20; color: var(--text); padding: 9px 10px; outline: 0; }
.chat-profile-fields input:focus, .chat-profile-fields textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .18); }
.chat-profile-fields textarea { resize: vertical; min-height: 92px; }
.chat-profile-actions { display: flex; align-items: center; gap: 8px; padding: 15px 24px 22px; }
.chat-profile-actions .action-spacer { flex: 1; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

.context-menu { position: fixed; z-index: 90000; width: 238px; padding: 5px; border-radius: 9px; opacity: 0; transform: scale(.97); transform-origin: top left; pointer-events: none; transition: opacity .08s, transform .08s; }
.context-menu.open { opacity: 1; transform: none; pointer-events: auto; }
.context-menu-item { width: 100%; height: 31px; border: 0; border-radius: 4px; background: transparent; display: grid; grid-template-columns: 25px 1fr auto; align-items: center; gap: 7px; padding: 0 8px; font-size: 11px; text-align: left; }
.context-menu-item:hover { background: rgba(255,255,255,.075); }
.context-menu-item:disabled { opacity: .4; }
.context-menu-shortcut { color: var(--muted); font-size: 9px; }
.context-menu-separator { height: 1px; margin: 4px 7px; background: rgba(255,255,255,.09); }

.toast-stack { position: fixed; z-index: 100000; right: 13px; bottom: calc(var(--taskbar-height) + 12px); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { width: min(340px, calc(100vw - 26px)); min-height: 58px; display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 10px; padding: 10px 13px; border: 1px solid var(--border); border-radius: 8px; background: rgba(35,36,41,.96); box-shadow: var(--shadow); backdrop-filter: blur(20px); animation: toast-in .2s ease; }
.toast.hide { animation: toast-out .2s ease forwards; }
@keyframes toast-in { from { transform: translateX(20px); opacity: 0; } }
@keyframes toast-out { to { transform: translateX(20px); opacity: 0; } }
.toast-icon { font-size: 19px; }
.toast strong, .toast span { display: block; }
.toast strong { font-size: 11px; }
.toast span { margin-top: 2px; color: var(--muted); font-size: 10px; }

.app-dialog { width: min(470px, calc(100vw - 28px)); padding: 0; border: 1px solid var(--border-strong); border-radius: 10px; background: #27282e; color: var(--text); box-shadow: var(--shadow); }
.app-dialog::backdrop { background: rgba(0,0,0,.45); backdrop-filter: blur(3px); }
.app-dialog form { padding: 22px; }
.dialog-heading { display: grid; grid-template-columns: 42px 1fr; gap: 13px; align-items: start; }
.dialog-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); font-size: 22px; }
.dialog-heading h2 { margin: 1px 0 5px; font-size: 16px; font-weight: 500; }
.dialog-heading p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; white-space: pre-line; }
.dialog-fields { margin: 17px 0 0 55px; }
.dialog-field { margin-bottom: 11px; }
.dialog-field label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; }
.dialog-field input, .dialog-field select { width: 100%; height: 33px; border: 1px solid var(--border); border-radius: 5px; background: #1f2025; color: var(--text); padding: 0 9px; font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.ui-icon { display: inline-grid; place-items: center; }
.ui-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.accent-icon { color: #74c9f1; }

@media (max-width: 800px) {
  :root { --taskbar-height: 54px; }
  button, input, textarea, select { touch-action: manipulation; }
  input, textarea, select { font-size: 16px !important; }
  .desktop-icon { touch-action: none; }
  .app-window { min-width: 0; min-height: 0; left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border: 0; border-radius: 0; resize: none; animation-duration: .1s; }
  .app-window.maximized { height: 100% !important; }
  .titlebar { height: 44px; }
  .window-body { height: calc(100% - 44px); }
  .window-control { width: 44px; }
  .resize-grip { display: none; }
  .taskbar { grid-template-columns: minmax(0, 1fr) auto; padding-inline: max(4px, env(safe-area-inset-left, 0px)) max(4px, env(safe-area-inset-right, 0px)); }
  .taskbar-left { display: none; }
  .taskbar-center, .taskbar-left-aligned .taskbar-center { grid-column: 1; width: 100%; min-width: 0; justify-self: stretch; justify-content: flex-start; overflow: hidden; }
  .taskbar-right { grid-column: 2; }
  .taskbar-button { width: 38px; min-width: 38px; }
  .taskbar-pinned-apps { flex: 1; min-width: 42px; max-width: 100%; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .taskbar-pinned-apps::-webkit-scrollbar { display: none; }
  .running-tasks { display: none; }
  .clock { min-width: 66px; padding: 0 4px; }
  .tray-chevron { width: 32px; }
  .start-menu { height: min(650px, calc(100dvh - var(--taskbar-height) - env(safe-area-inset-bottom, 0px) - 16px)); }
  .pinned-apps { grid-template-columns: repeat(4, 1fr); padding-inline: 19px; overflow: auto; }
  .recommended-items { display: none; }
  .recommended-heading { display: none; }
  .explorer-commandbar { overflow-x: auto; overflow-y: hidden; padding-inline: 6px; scrollbar-width: none; }
  .explorer-commandbar::-webkit-scrollbar { display: none; }
  .command-button { min-width: 38px; height: 38px; justify-content: center; }
  .explorer-main { grid-template-columns: 1fr; }
  .explorer-sidebar { display: none; }
  .explorer-navrow { grid-template-columns: auto 1fr; }
  .explorer-search { display: none; }
  .command-button .command-label { display: none; }
  .explorer-content { padding: 10px; }
  .content-heading { align-items: flex-start; gap: 10px; }
  .address-bar { min-width: 0; overflow: hidden; }
  .address-bar span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .statusbar { min-height: 28px; }
  .settings-nav { width: 60px; padding-inline: 6px; }
  .settings-profile-card, .settings-search, .settings-nav-button span:last-child { display: none; }
  .settings-nav-button { justify-content: center; padding: 0; }
  .settings-content { padding: 24px 16px 36px; }
  .settings-content h1 { margin-bottom: 18px; font-size: 22px; }
  .settings-hero { grid-template-columns: 1fr; }
  .setting-card { align-items: flex-start; flex-direction: column; }
  .setting-control { width: 100%; }
  .setting-control input[type="text"], .setting-control input[type="url"], .setting-control input[type="email"], .setting-control input[type="tel"], .setting-control select { width: 100%; }
  .protected-settings-heading { align-items: stretch; flex-direction: column; }
  .hold-reveal-button { width: 100%; min-height: 42px; }
  .protected-settings-row { grid-template-columns: 1fr; gap: 5px; padding: 10px 0; }
  .chat-topbar { min-height: 52px; height: auto; gap: 8px; padding-block: 5px; }
  .chat-room-title { min-width: 0; }
  .chat-room-title > span:last-child { min-width: 0; }
  .chat-room-title strong, .chat-room-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-account-actions { flex: 0 0 auto; }
  .chat-grid { grid-template-columns: 52px minmax(0, 1fr); }
  .room-list { padding: 5px; }
  .room-button { justify-content: center; padding: 0; }
  .room-button > span:not(.room-hash) { display: none; }
  .user-list { display: none; }
  .message-list { padding-inline: 10px; }
  .message { grid-template-columns: 32px minmax(0, 1fr); }
  .message-avatar { width: 32px; height: 32px; }
  .chat-composer { padding-inline: 7px; }
  .chat-profile-panel { top: 52px; padding: 8px; place-items: start center; }
  .chat-profile-card { max-height: none; }
  .chat-profile-card > header { min-height: 110px; padding: 18px 48px 18px 18px; }
  .chat-profile-avatar { width: 68px; height: 68px; }
  .chat-profile-fields, .chat-profile-details { grid-template-columns: 1fr; padding-inline: 15px; }
  .chat-profile-details .wide, .chat-profile-fields .wide { grid-column: 1; }
  .chat-profile-actions { flex-wrap: wrap; padding-inline: 15px; }
  .profile-panels { grid-template-columns: 1fr; }
  .profile-header { align-items: flex-start; flex-direction: column; }
  .profile-header-actions { width: 100%; justify-content: flex-start; }
  .profile-cover { height: 132px; min-height: 132px; max-height: 132px; flex-basis: 132px; }
  .media-window-viewer { padding: 4px; }
  .app-dialog { max-height: calc(100dvh - 24px); overflow: auto; }
  .app-dialog form { padding: 17px; }
  .dialog-fields { margin-left: 0; }
  .dialog-actions { position: sticky; bottom: -17px; padding: 10px 0 17px; background: #27282e; }
}

@media (max-width: 600px) {
  .settings-shell { flex-direction: column; }
  .settings-nav { width: 100%; height: 54px; flex: 0 0 54px; display: flex; gap: 3px; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.07); padding: 7px; scrollbar-width: none; }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav-button { width: 42px; min-width: 42px; height: 39px; flex: 0 0 42px; }
  .settings-content { padding-top: 18px; }
}

@media (max-width: 480px) {
  .start-menu { width: 100vw; bottom: calc(var(--taskbar-height) + env(safe-area-inset-bottom, 0px)); height: calc(100dvh - var(--taskbar-height) - env(safe-area-inset-bottom, 0px)); border-inline: 0; border-bottom: 0; border-radius: 14px 14px 0 0; }
  .start-search { margin: 15px 13px 8px; }
  .start-section-heading { margin-inline: 18px; }
  .pinned-apps { grid-template-columns: repeat(3, 1fr); }
  .start-userbar { padding-inline: 16px; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .quick-links { right: 6px; width: calc(100vw - 12px); }
  .connection-pill { display: none; }
  .chat-room-title > span:first-child { display: none; }
  .chat-account-actions .button { min-height: 34px; padding-inline: 9px; font-size: 10px; }
  .chat-login-banner { margin-inline: 6px; }
  .media-grid, .game-grid { grid-template-columns: 1fr; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); }
  .profile-content { width: calc(100% - 24px); }
  .profile-identity .avatar { width: 78px; height: 78px; }
  .profile-identity { align-items: center; gap: 10px; }
  .profile-identity h1 { font-size: 21px; }
  .chat-profile-card > header { gap: 12px; }
  .chat-profile-card h2 { font-size: 19px; }
  .chat-profile-actions .action-spacer { display: none; }
  .chat-profile-actions .button { flex: 1 1 135px; }
  .dialog-heading { grid-template-columns: 36px 1fr; gap: 10px; }
  .dialog-icon { width: 36px; height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
