* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  user-select: none;
}

:root {
  --bg-color: #1a0836;
  --window-bg: rgba(255, 255, 255, 0.92);
  --window-text: #1a1a1a;
  --window-border: rgba(255, 255, 255, 0.4);
  --ribbon-bg: #f3f3f3;
  --sidebar-bg: #f9f9f9;
}

body.light-theme {
  --window-bg: rgba(250, 250, 250, 0.95);
  --window-text: #000000;
  --ribbon-bg: #eaeaea;
  --sidebar-bg: #f0f0f0;
}

body.dark-theme {
  --window-bg: rgba(32, 32, 32, 0.92);
  --window-text: #ffffff;
  --ribbon-bg: #2b2b2b;
  --sidebar-bg: #202020;
}

body {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background-color: var(--bg-color);
  color: #ffffff;
}

.hidden {
  display: none !important;
}

/* Logon Screen */
#logon-screen {
  height: 100%;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  background: radial-gradient(circle at center, #3c1570 0%, #17052e 100%);
}

.login-card {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 30px 40px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.back-btn {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.back-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.5; }

.avatar-box {
  width: 140px;
  height: 140px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  overflow: hidden;
}

.avatar-box svg { width: 95px; height: 95px; fill: #ffffff; }

.user-credentials { display: flex; flex-direction: column; gap: 10px; min-width: 260px; }
.username { font-size: 26px; font-weight: 400; }

.password-wrapper {
  display: flex;
  align-items: center;
  width: 280px;
  height: 38px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  overflow: hidden;
}

.password-input { flex: 1; height: 100%; border: none; outline: none; padding: 0 14px; font-size: 14px; color: #1a1a1a; }
.submit-btn { width: 38px; height: 100%; background-color: #6325b5; border: none; color: #ffffff; cursor: pointer; display: flex; justify-content: center; align-items: center; }
.submit-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.5; }

.hint-text { color: #ff9999; font-size: 13px; }
.welcome-box { display: flex; align-items: center; gap: 12px; height: 38px; }
.spinner { width: 20px; height: 20px; border: 3px solid rgba(255, 255, 255, 0.2); border-top-color: #ffffff; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.bottom-bar { position: absolute; bottom: 24px; left: 0; right: 0; padding: 0 32px; display: flex; justify-content: space-between; align-items: center; }
.bottom-left, .bottom-right { display: flex; align-items: center; gap: 12px; }
.icon-btn { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 10px; width: 40px; height: 40px; color: #ffffff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.lang-text { font-size: 13px; font-weight: 600; padding: 0 8px; }

/* Desktop Screen */
#desktop-screen {
  height: 100vh;
  width: 100vw;
  background: linear-gradient(135deg, #2b5876 0%, #4e4376 100%);
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}

/* Desktop Icons */
.desktop-icons {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  height: calc(100vh - 44px);
  width: max-content;
}

.desktop-icon {
  width: 86px;
  height: 86px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.desktop-icon:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
}

.icon-img-box {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.gh-icon svg { width: 32px; height: 32px; }
.desktop-icon span { font-size: 12px; color: #ffffff; text-shadow: 0px 1px 3px rgba(0, 0, 0, 0.8); text-align: center; }

/* Desktop Context Menu */
.context-menu {
  position: absolute;
  width: 160px;
  background: rgba(30, 30, 30, 0.9);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 99999;
}

.context-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  color: #fff;
}

.context-item:hover { background: rgba(255, 255, 255, 0.15); }
.ctx-icon { width: 16px; height: 16px; fill: currentColor; }

/* Windows / WebOS OS UI */
.app-window {
  position: absolute;
  width: 760px;
  height: 500px;
  top: 80px;
  left: 180px;
  background: var(--window-bg);
  color: var(--window-text);
  border-radius: 12px;
  border: 1px solid var(--window-border);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(20px);
  z-index: 100;
}

/* Splash Screen (1-Second Delay Overlay) */
.window-splash {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #111111;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  z-index: 999;
}

.splash-logo { font-size: 48px; }
.splash-title { font-size: 18px; font-weight: 300; letter-spacing: 1px; }

/* Window Titlebar */
.window-header {
  height: 38px;
  background: rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  cursor: move;
}

.window-title-box { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.window-actions { display: flex; align-items: center; gap: 6px; }

/* Symmetric Rounded Square Control Buttons */
.win-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: rgba(150, 150, 150, 0.15);
  color: var(--window-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
}

.win-btn:hover { background: rgba(150, 150, 150, 0.3); }

/* Close Button strictly Red */
.win-btn.btn-close {
  background: #e81123;
  color: #ffffff;
}

.win-btn.btn-close:hover {
  background: #f42535;
}

/* Explorer Ribbon */
.explorer-ribbon {
  background: var(--ribbon-bg);
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  transition: max-height 0.25s ease;
  overflow: hidden;
}

.explorer-ribbon.collapsed .ribbon-toolbar { display: none; }

.ribbon-tabs {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.04);
  padding: 0 8px;
  font-size: 12px;
  gap: 4px;
}

.ribbon-tab { 
  padding: 6px 14px; 
  cursor: pointer; 
  border-radius: 4px 4px 0 0;
}

.ribbon-tab.active { 
  background: var(--ribbon-bg); 
  font-weight: 600; 
  border-top: 2px solid #0078d7; 
}
/* Begin Popup Menu Styling */
#begin-menu {
  position: absolute;
  bottom: 48px;
  left: 8px;
  width: 200px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 10000;
}
.begin-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: #1a1a1a;
  cursor: pointer;
  transition: background 0.15s ease;
}
.begin-menu-item:hover {
  background-color: rgba(75, 21, 130, 0.1);
  color: #4b1582;
}

/* Shutdown Screen Overlay */
#shutdown-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #3c1570;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  font-family: 'Segoe UI', sans-serif;
}
/* Symmetric File Button Fix */
.ribbon-file-btn,
.ribbon-tab.file-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  height: 28px;
  min-width: 60px;
  border-radius: 4px;
  box-sizing: border-box;
  text-align: center;
  font-weight: 600;
  background: #0078d7;
  color: #ffffff;
  border: none;
  margin: 2px 4px;
}

.ribbon-file-btn:hover,
.ribbon-tab.file-tab:hover {
  background: #005a9e;
}

.ribbon-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  font-size: 11px;
}

.ribbon-group { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; padding: 4px 8px; border-radius: 4px; }
.ribbon-group:hover { background: rgba(0, 0, 0, 0.08); }
.ribbon-icon { font-size: 20px; }
.ribbon-toggle-btn { margin-left: auto; cursor: pointer; padding: 4px 8px; font-size: 12px; }

/* Window Body */
.window-body { flex: 1; display: flex; overflow: hidden; }

/* Explorer Layout */
.explorer-sidebar {
  width: 180px;
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  padding: 12px 8px;
  font-size: 12px;
}

.sidebar-section { margin-bottom: 16px; }
.sidebar-title { font-weight: 600; color: #888; font-size: 11px; margin-bottom: 6px; padding-left: 6px; }
.sidebar-item { padding: 6px 8px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.sidebar-item:hover { background: rgba(0,0,0,0.06); }

.explorer-content { flex: 1; padding: 16px; overflow-y: auto; }
.section-heading { font-size: 13px; font-weight: 600; margin-bottom: 12px; color: #0078d7; border-bottom: 1px solid rgba(0,0,0,0.1); padding-bottom: 4px; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; margin-bottom: 24px; }
.folder-card, .drive-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(0,0,0,0.03);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 6px;
  cursor: pointer;
}

.folder-card:hover, .drive-card:hover { background: rgba(0, 0, 0, 0.08); }
.card-icon { font-size: 28px; }
.card-details { display: flex; flex-direction: column; }
.card-title { font-size: 12px; font-weight: 500; }
.card-sub { font-size: 10px; color: #777; }

/* Store View */
.store-container { width: 100%; padding: 20px; overflow-y: auto; }
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-top: 16px; }
.app-card {
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.app-card-icon { font-size: 36px; }
.app-card-title { font-size: 14px; font-weight: 600; }
.install-btn {
  background: #107C41;
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

.install-btn.installed { background: #555; cursor: default; }

/* Web/Iframe View */
.web-frame { width: 100%; height: 100%; border: none; }

/* Taskbar Adjustments & Symmetrical Padding */
#taskbar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 44px;
  background: rgba(30, 30, 30, 0.25);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 10000;
}

.taskbar-left { display: flex; align-items: center; height: 100%; gap: 6px; }
#start-btn { background: transparent; border: none; height: 36px; width: 40px; border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
#start-btn:hover { background: rgba(255, 255, 255, 0.15); }
.start-logo-svg { width: 20px; height: 20px; }

.pinned-apps { display: flex; align-items: center; height: 100%; gap: 4px; }
.taskbar-app-btn {
  width: 40px;
  height: 36px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.taskbar-app-btn:hover { background: rgba(255, 255, 255, 0.15); }

/* Taskbar Running State */
.taskbar-app-btn.running {
  background: rgba(255, 255, 255, 0.12);
}

.taskbar-app-btn.active::after,
.taskbar-app-btn.running::after {
  content: '';
  position: absolute;
  bottom: 2px;
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: #ffffff;
}

/* Highlighted Square Outline for Minimized Apps */
.taskbar-app-btn.minimized {
  border: 2px solid #3b82f6 !important;
  background: rgba(59, 130, 246, 0.2);
  border-radius: 6px;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.taskbar-app-btn.minimized::after {
  background: #3b82f6;
}

.taskbar-app-btn img { width: 22px; height: 22px; }

/* Gray Settings Icon ONLY on the Taskbar */
.taskbar-app-btn[data-app="settings"] img {
  filter: grayscale(100%);
  opacity: 0.85;
}

/* Custom Colors for Icons */
.icon-blue img { filter: invert(38%) sepia(85%) saturate(2280%) hue-rotate(203deg) brightness(101%) contrast(102%); }
.icon-yellow img { filter: invert(80%) sepia(50%) saturate(1000%) hue-rotate(350deg) brightness(100%) contrast(100%); }
.icon-green img { filter: invert(48%) sepia(79%) saturate(447%) hue-rotate(93deg) brightness(98%) contrast(92%); }

#system-tray { display: flex; align-items: center; height: 100%; gap: 4px; }
.tray-btn { background: transparent; border: none; color: #ffffff; height: 36px; padding: 0 8px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 11px; cursor: pointer; }
.tray-btn:hover { background: rgba(255, 255, 255, 0.15); }
.tray-btn svg { width: 16px; height: 16px; }

.tray-clock { display: flex; flex-direction: column; justify-content: center; align-items: flex-end; font-size: 11px; color: #ffffff; line-height: 1.2; padding: 2px 8px; border-radius: 6px; cursor: pointer; }
.tray-clock:hover { background: rgba(255, 255, 255, 0.15); }

/* Personalize Modal Content */
.personalize-box { padding: 20px; display: flex; flex-direction: column; gap: 16px; width: 100%; }
.theme-options, .wallpaper-options { display: flex; gap: 12px; }
.theme-btn, .wall-btn { padding: 8px 16px; border-radius: 6px; border: 1px solid rgba(0,0,0,0.2); background: rgba(0,0,0,0.05); color: var(--window-text); cursor: pointer; }
.theme-btn:hover, .wall-btn:hover { background: #0078d7; color: #fff; }