:root {
  --desktop-bg: linear-gradient(135deg, #f4f7fb 0%, #dbeafe 48%, #e0e7ff 100%);
  --text: #1f2937;
  --muted: #6b7280;
  --window-bg: rgba(255, 255, 255, 0.88);
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --border: rgba(15, 23, 42, 0.1);
  --taskbar-bg: rgba(255, 255, 255, 0.72);
  --accent: #4f7cff;
  --accent-soft: rgba(79, 124, 255, 0.14);
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.14);
  --shadow-active: 0 22px 70px rgba(79, 124, 255, 0.22);
  --danger: #ef4444;
  --radius: 16px;
  color-scheme: light;
}

body[data-theme="dark"] {
  --desktop-bg: linear-gradient(135deg, #0f172a 0%, #172554 52%, #312e81 100%);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --window-bg: rgba(15, 23, 42, 0.88);
  --surface: rgba(15, 23, 42, 0.72);
  --surface-solid: #111827;
  --border: rgba(255, 255, 255, 0.12);
  --taskbar-bg: rgba(15, 23, 42, 0.72);
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.16);
  --shadow: 0 18px 58px rgba(0, 0, 0, 0.34);
  --shadow-active: 0 24px 76px rgba(96, 165, 250, 0.2);
  --danger: #f87171;
  color-scheme: dark;
}

body[data-wallpaper="cloud"] {
  --desktop-bg: linear-gradient(135deg, #f4f7fb 0%, #dbeafe 48%, #e0e7ff 100%);
}

body[data-wallpaper="ocean"] {
  --desktop-bg: linear-gradient(135deg, #e0f2fe 0%, #7dd3fc 46%, #2563eb 100%);
}

body[data-wallpaper="dawn"] {
  --desktop-bg: linear-gradient(135deg, #fff7ed 0%, #fdba74 42%, #818cf8 100%);
}

body[data-wallpaper="forest"] {
  --desktop-bg: linear-gradient(135deg, #ecfdf5 0%, #86efac 46%, #166534 100%);
}

body[data-wallpaper="midnight"] {
  --desktop-bg: linear-gradient(135deg, #0f172a 0%, #1e3a8a 52%, #581c87 100%);
}

body[data-wallpaper="custom"] {
  --desktop-bg: linear-gradient(rgba(15, 23, 42, 0.08), rgba(15, 23, 42, 0.08)), var(--custom-wallpaper-image),
    linear-gradient(135deg, #f4f7fb 0%, #dbeafe 48%, #e0e7ff 100%);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

:focus-visible {
  outline: 3px solid rgba(79, 124, 255, 0.45);
  outline-offset: 2px;
}

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--desktop-bg);
  transition: opacity 180ms ease, visibility 180ms ease;
}

.boot-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(320px, calc(100vw - 40px));
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--window-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.boot-card h1,
.boot-card p {
  margin: 0;
}

.boot-card p {
  color: var(--muted);
}

.boot-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
}

.boot-progress {
  width: 180px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--accent-soft);
}

.boot-progress span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  animation: boot-slide 900ms ease-in-out infinite alternate;
}

.desktop {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--desktop-bg);
  background-position: center;
  background-size: cover;
  transition: background 160ms ease, color 160ms ease;
}

.desktop::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.38), transparent 28%),
    radial-gradient(circle at 82% 20%, rgba(79, 124, 255, 0.22), transparent 26%),
    linear-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: auto, auto, 72px 72px, 72px 72px;
  pointer-events: none;
}

.desktop-icons {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(auto-fill, 82px);
  grid-auto-rows: 96px;
  gap: 12px;
  width: min(360px, calc(100vw - 48px));
}

.desktop-icon {
  display: grid;
  place-items: center;
  grid-template-rows: 46px minmax(18px, auto);
  gap: 7px;
  width: 82px;
  height: 96px;
  min-height: 96px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: #fff;
  text-shadow: 0 1px 6px rgba(15, 23, 42, 0.36);
  cursor: default;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.desktop-icon > span:last-child {
  max-width: 100%;
  overflow-wrap: anywhere;
  line-height: 1.15;
  text-align: center;
}

.desktop-icon:hover,
.desktop-icon:focus-visible {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.icon-glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
  color: #1f2937;
  font-size: 21px;
  line-height: 1;
  text-shadow: none;
}

.window-layer {
  position: absolute;
  inset: 0 0 76px;
  z-index: 3;
  pointer-events: none;
}

.app-window {
  position: absolute;
  display: grid;
  grid-template-rows: 42px 1fr;
  min-width: 280px;
  min-height: 220px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--window-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(1.15);
  pointer-events: auto;
  min-height: 0;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease, opacity 140ms ease;
}

.app-window.is-active {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  box-shadow: var(--shadow-active);
}

.app-window.is-minimized {
  display: none;
}

.app-window.is-maximized {
  left: 0 !important;
  top: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0;
  border-width: 0;
}

.app-window.is-maximized .resize-handle {
  display: none;
}

.window-titlebar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
  cursor: grab;
  user-select: none;
}

.window-titlebar:active {
  cursor: grabbing;
}

.window-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 15px;
  line-height: 1;
}

.window-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.window-actions {
  display: flex;
  gap: 6px;
}

.window-action {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.window-action:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.window-action[data-close-window]:hover {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

.window-content {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.resize-handle {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
}

.resize-handle::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
  border-radius: 2px;
}

.taskbar {
  position: absolute;
  right: 16px;
  bottom: 12px;
  left: 16px;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--taskbar-bg);
  box-shadow: 0 14px 42px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(18px) saturate(1.18);
}

.taskbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.launcher,
.taskbar-button,
.soft-button,
.choice-button {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.launcher:hover,
.taskbar-button:hover,
.soft-button:hover,
.choice-button:hover {
  background: var(--surface-solid);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
}

.launcher {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
}

.launcher-mark {
  width: 18px;
  height: 18px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
}

.taskbar-apps {
  display: flex;
  min-width: 0;
  gap: 8px;
  overflow: hidden;
}

.taskbar-button {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 158px;
  height: 38px;
  padding: 0 11px;
}

.taskbar-button.is-active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}

.taskbar-button span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.taskbar-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

.status-cluster {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.login-button,
.presence-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 148px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.login-avatar,
.profile-avatar {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent-soft);
  background-position: center;
  background-size: cover;
  color: var(--accent);
  font-size: 12px;
}

.profile-avatar {
  width: 28px;
  height: 28px;
}

.profile-avatar-large {
  width: 76px;
  height: 76px;
  font-size: 28px;
}

.profile-preview {
  display: grid;
  justify-items: center;
  padding: 8px 0;
}

.nickname-color-picker {
  display: grid;
  gap: 8px;
}

.nickname-color-picker > strong {
  font-size: 13px;
}

.nickname-color-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}

.nickname-color-option {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.nickname-color-option:hover,
.nickname-color-option.is-selected {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--border));
  background: var(--accent-soft);
}

.nickname-color-option span:first-child {
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  flex: 0 0 auto;
}

.nickname-color-option span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.login-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.login-button:hover,
.login-button.is-signed-in,
.presence-button:hover {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
}

.login-button.is-signed-in {
  width: 38px;
  height: 38px;
  justify-content: center;
  padding: 0;
}

.login-button.is-signed-in .login-avatar {
  width: 26px;
  height: 26px;
}

.login-button.is-signed-in .login-label {
  display: none;
}

.clock {
  min-width: 72px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
  text-align: right;
}

.start-menu {
  position: absolute;
  left: 16px;
  bottom: 76px;
  z-index: 20;
  width: 300px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--window-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(1.18);
}

.start-menu[hidden] {
  display: none;
}

.start-menu-header {
  display: grid;
  gap: 2px;
  padding: 8px 8px 12px;
}

.start-menu-header strong {
  font-size: 18px;
}

.start-menu-header span {
  color: var(--muted);
  font-size: 13px;
}

.start-menu-apps {
  display: grid;
  gap: 6px;
}

.start-menu-divider {
  height: 1px;
  margin: 6px 4px;
  background: var(--border);
}

.start-app-button {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.start-app-button:hover {
  border-color: var(--border);
  background: var(--surface);
}

.start-menu-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
}

.icon-soft-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 18px;
}

.soft-button,
.choice-button {
  padding: 7px 12px;
}

.stack,
.form-grid,
.settings-grid {
  display: grid;
  gap: 14px;
}

.settings-grid {
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  backdrop-filter: blur(12px);
}

.settings-shortcuts {
  display: grid;
  gap: 10px;
}

.settings-shortcut {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.settings-shortcut:hover {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  background: var(--accent-soft);
}

.settings-shortcut-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: var(--surface-solid);
  line-height: 1;
}

.settings-shortcut span:last-child {
  display: grid;
  gap: 2px;
}

.settings-shortcut small {
  color: var(--muted);
  font-size: 12px;
}

.section-title {
  margin: 0 0 4px;
  font-size: 18px;
}

.muted {
  color: var(--muted);
}

.text-input,
.note-area,
.terminal-input,
.community-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-solid);
  color: var(--text);
}

.text-input,
.terminal-input {
  padding: 10px 12px;
}

.text-input:focus,
.note-area:focus,
.terminal-input:focus,
.community-textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.note-area {
  min-height: 170px;
  resize: vertical;
  padding: 14px;
  line-height: 1.55;
}

.sticky-note-list {
  display: grid;
  gap: 8px;
}

.sticky-note-card {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.sticky-note-card span {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticky-note {
  position: absolute;
  z-index: 4;
  display: grid;
  grid-template-rows: 42px 1fr;
  width: 210px;
  min-height: 190px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
}

.sticky-note[data-color="yellow"] {
  background: rgba(255, 246, 174, 0.92);
}

.sticky-note[data-color="blue"] {
  background: rgba(191, 219, 254, 0.92);
}

.sticky-note[data-color="pink"] {
  background: rgba(252, 206, 232, 0.92);
}

.sticky-note[data-color="green"] {
  background: rgba(187, 247, 208, 0.92);
}

.sticky-note header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 4px;
  cursor: grab;
}

.sticky-note header input {
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  color: #1f2937;
  font-weight: 700;
  font-size: 14px;
  outline: none;
}

.sticky-note header button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.44);
  color: #374151;
  cursor: pointer;
}

.sticky-note textarea {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 2px 10px 12px;
  border: 0;
  background: transparent;
  color: #1f2937;
  resize: none;
  line-height: 1.45;
}

.sticky-note textarea:focus {
  outline: none;
}

.inline-actions,
.segmented,
.wallpaper-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-button.is-selected {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 58%, var(--border));
  color: var(--accent);
}

.wallpaper-choice {
  display: grid;
  gap: 7px;
  width: 90px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface-solid) 62%, transparent);
  cursor: pointer;
}

.wallpaper-choice.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.wallpaper-preview {
  height: 38px;
  border-radius: 12px;
}

.wallpaper-preview[data-wallpaper="cloud"] {
  background: linear-gradient(135deg, #f4f7fb, #dbeafe, #e0e7ff);
}

.wallpaper-preview[data-wallpaper="ocean"] {
  background: linear-gradient(135deg, #e0f2fe, #7dd3fc, #2563eb);
}

.wallpaper-preview[data-wallpaper="dawn"] {
  background: linear-gradient(135deg, #fff7ed, #fdba74, #818cf8);
}

.wallpaper-preview[data-wallpaper="forest"] {
  background: linear-gradient(135deg, #ecfdf5, #86efac, #166534);
}

.wallpaper-preview[data-wallpaper="midnight"] {
  background: linear-gradient(135deg, #0f172a, #1e3a8a, #581c87);
}

.custom-wallpaper {
  display: grid;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}

.custom-wallpaper .text-input {
  width: min(100%, 420px);
}

.files-layout,
.community-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 10px;
  min-height: 300px;
  height: 100%;
  min-height: 0;
}

.files-layout {
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 12px;
}

.side-list,
.content-panel,
.terminal-screen,
.post-list,
.post-detail {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.side-list,
.post-list {
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 6px;
}

.files-sidebar {
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(12px);
}

.list-button,
.file-card,
.post-card {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 8px 9px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.list-button:hover,
.file-card:hover,
.post-card:hover,
.list-button.is-selected,
.file-card.is-selected,
.post-card.is-selected {
  border-color: var(--border);
  background: var(--surface-solid);
}

.content-panel,
.post-detail {
  min-width: 0;
  padding: 12px;
  overflow: auto;
}

.files-main {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.file-preview {
  min-height: 0;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-solid) 78%, transparent);
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.55;
}

.file-grid {
  display: grid;
  gap: 8px;
}

.terminal-app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  height: 100%;
  min-height: 280px;
  position: relative;
  padding-bottom: 54px;
}

.terminal-screen {
  min-height: 190px;
  min-height: 0;
  padding: 10px 4px 12px;
  overflow: auto;
  border: 0;
  background: transparent;
  color: #dbeafe;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.terminal-line {
  white-space: pre-wrap;
}

.terminal-input {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  min-height: 42px;
  border-radius: 18px;
  background: var(--surface-solid);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.chat-layout {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  padding-bottom: 92px;
}

.chat-style-toggle {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-solid) 82%, transparent);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  backdrop-filter: blur(12px);
}

.chat-live-state {
  position: absolute;
  top: 0;
  right: 86px;
  z-index: 2;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-solid) 82%, transparent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(12px);
}

.chat-notify-button {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-solid) 82%, transparent);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(12px);
}

.chat-style-toggle:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
}

.chat-notify-button:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
}

.chat-messages {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 0;
  overflow: auto;
  padding: 34px 2px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.chat-history-loader {
  justify-self: center;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-solid) 78%, transparent);
  color: var(--muted);
  font-size: 12px;
}

.chat-message {
  display: grid;
  gap: 4px;
  width: fit-content;
  max-width: min(620px, calc(100% - 10px));
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  border-top-left-radius: 5px;
  background: var(--surface-solid);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07);
}

body[data-chat-box="hidden"] .chat-message {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  padding: 2px 0;
  border-radius: 0;
}

.chat-message .meta {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.chat-nickname {
  color: var(--name-color);
  font-weight: 800;
}

.chat-message-actions {
  display: inline-flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 140ms ease;
}

.chat-message:hover .chat-message-actions,
.chat-message:focus-within .chat-message-actions {
  opacity: 1;
}

.chat-message-actions button {
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}

.chat-message-actions button:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 44%, var(--border));
}

.chat-message p {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.38;
  font-size: 14px;
}

.chat-message a {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.chat-message img {
  display: block;
  max-width: min(300px, 100%);
  max-height: 200px;
  border-radius: 10px;
  object-fit: contain;
}

.chat-composer {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: 40px minmax(160px, 1fr) 40px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface-solid);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.community-textarea {
  height: 38px;
  min-height: 38px;
  max-height: 96px;
  resize: none;
  padding: 8px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  line-height: 22px;
  overflow-y: auto;
}

.community-textarea:focus {
  border-color: transparent;
  box-shadow: none;
}

.attach-button,
.send-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.attach-button:hover,
.send-button:hover {
  background: var(--accent);
  color: #fff;
}

.attach-button:disabled,
.send-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.attach-button:disabled:hover,
.send-button:disabled:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.send-button {
  font-size: 20px;
  font-weight: 800;
}

.attachment-panel {
  position: absolute;
  left: 10px;
  bottom: calc(100% + 8px);
  display: grid;
  gap: 8px;
  width: min(280px, calc(100vw - 60px));
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--window-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.attachment-panel[hidden] {
  display: none;
}

.mention-panel {
  position: absolute;
  left: 58px;
  right: 58px;
  bottom: calc(100% + 8px);
  z-index: 3;
  display: grid;
  gap: 4px;
  max-height: 180px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--window-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.mention-panel[hidden] {
  display: none;
}

.mention-option {
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.mention-option:hover,
.mention-option[data-active="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.nickname-button {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nickname-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(10px);
}

.pageroom-dialog,
.auth-dialog {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(10px);
}

.pageroom-card,
.auth-card {
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 36px));
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--window-bg);
  box-shadow: var(--shadow);
}

.profile-card {
  width: min(420px, calc(100vw - 36px));
}

.settings-popup-card {
  width: min(460px, calc(100vw - 36px));
  max-height: min(680px, calc(100vh - 48px));
  overflow: auto;
}

.system-popup-actions {
  display: grid;
  gap: 8px;
}

.image-picker {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 14px;
  border: 1px dashed color-mix(in srgb, var(--accent) 46%, var(--border));
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.image-picker input {
  display: none;
}

.image-picker strong {
  font-size: 14px;
}

.image-picker span {
  color: var(--muted);
  font-size: 12px;
}

.image-picker:hover,
.image-picker:focus-visible,
.image-picker.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.image-picker.has-file {
  border-style: solid;
  border-color: color-mix(in srgb, var(--accent) 65%, var(--border));
}

.pageroom-card p,
.auth-card p {
  margin: 0;
}

.presence-panel {
  position: absolute;
  right: 118px;
  bottom: 76px;
  z-index: 55;
  display: grid;
  gap: 10px;
  width: min(280px, calc(100vw - 32px));
  max-height: min(420px, calc(100vh - 112px));
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--window-bg);
  box-shadow: var(--shadow);
  overflow: auto;
  backdrop-filter: blur(18px) saturate(1.18);
}

.presence-list {
  display: grid;
  gap: 8px;
}

.presence-user {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.presence-user span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nickname-card {
  display: grid;
  gap: 10px;
  width: min(340px, 100%);
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--window-bg);
  box-shadow: var(--shadow);
}

.nickname-card p {
  margin: 0;
}

.link-embed {
  display: grid;
  gap: 3px;
  width: min(300px, 100%);
  margin-top: 2px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.link-embed strong {
  font-size: 13px;
  line-height: 1.25;
}

.link-embed:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
}

.link-embed span {
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 12px;
}

.link-embed img {
  width: 100%;
  max-height: 180px;
  border-radius: 9px;
  object-fit: cover;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  color: var(--muted);
  text-align: center;
}

.meta {
  color: var(--muted);
  font-size: 12px;
}

.toast-layer {
  position: absolute;
  right: 22px;
  bottom: 78px;
  z-index: 90;
  display: grid;
  gap: 8px;
}

.toast {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--window-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  animation: toast-in 160ms ease both;
}

@keyframes boot-slide {
  from {
    transform: translateX(-55%);
  }
  to {
    transform: translateX(140%);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .desktop-icons {
    top: 14px;
    left: 14px;
    width: calc(100vw - 28px);
  }

  .app-window {
    width: calc(100vw - 20px);
    height: calc(100vh - 100px);
    left: 10px;
    top: 10px;
  }

  .app-window.is-maximized {
    width: 100vw !important;
    height: 100vh !important;
    left: 0 !important;
    top: 0 !important;
  }

  .taskbar {
    right: 8px;
    bottom: 8px;
    left: 8px;
    grid-template-columns: auto 1fr auto;
  }

  .clock {
    min-width: 64px;
    padding-inline: 8px;
    font-size: 13px;
  }

  .start-menu {
    left: 8px;
    bottom: 68px;
    width: min(300px, calc(100vw - 16px));
  }

  .files-layout,
  .community-layout {
    grid-template-columns: 1fr;
  }

  .chat-composer {
    grid-template-columns: 1fr;
  }

  .chat-composer {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
  }
}

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