* {
  box-sizing: border-box;
}

:root {
  --bg: #101116;
  --panel: #191a22;
  --panel2: #22232d;
  --panel3: #292a36;
  --accent: #9b8cff;
  --text: #f2f1f7;
  --muted: #9999aa;
  --border: rgba(255,255,255,.09);
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, sans-serif;
}

button, input {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* ARRANQUE */

#boot {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #0d0e13;
  z-index: 9999;
}

.boot-logo {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -2px;
}

.boot-logo span,
.brand span {
  color: var(--accent);
}

.boot-line {
  width: 190px;
  height: 4px;
  background: #292936;
  border-radius: 10px;
  margin-top: 35px;
  overflow: hidden;
}

#bootProgress {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .3s;
}

#bootText {
  color: var(--muted);
  font-size: 12px;
  margin-top: 12px;
}

/* ESCRITORIO */

#desktop {
  height: 100vh;
  background:
    radial-gradient(ellipse at 75% 25%, rgba(105,83,180,.19), transparent 45%),
    radial-gradient(ellipse at 15% 85%, rgba(55,65,120,.15), transparent 40%),
    #101116;
}

.topbar {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 17px;
  background: rgba(18,19,26,.9);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.brand {
  color: white;
  font-size: 14px;
  font-weight: bold;
}

#clock {
  color: var(--text);
}

#desktopArea {
  height: calc(100vh - 94px);
  position: relative;
  overflow: hidden;
}

.desktop-shortcuts {
  position: absolute;
  top: 20px;
  left: 20px;
  display: grid;
  grid-template-columns: 82px;
  gap: 12px;
  z-index: 1;
}

.shortcut {
  width: 76px;
  min-height: 75px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 11px;
}

.shortcut:hover {
  background: rgba(255,255,255,.07);
  border-color: var(--border);
}

.shortcut-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg,#343342,#242530);
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--accent);
  font-size: 19px;
  font-weight: bold;
}

/* VENTANAS */

#windowLayer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  isolation: isolate;
}

.os-window {
  position: absolute;
  width: min(760px, calc(100vw - 35px));
  height: min(510px, calc(100vh - 125px));
  min-width: 300px;
  min-height: 220px;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #171820;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 12px;
  box-shadow: 0 22px 70px rgba(0,0,0,.48);
  pointer-events: auto;
}

.window-titlebar {
  height: 43px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 16px;
  background: #20212a;
  border-bottom: 1px solid var(--border);
  cursor: grab;
  user-select: none;
}

.window-title {
  font-size: 12px;
  font-weight: bold;
}

.window-controls {
  display: flex;
  gap: 7px;
}

.window-controls button {
  width: 25px;
  height: 25px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #bbb;
}

.window-controls button:hover {
  background: rgba(255,255,255,.1);
}

.window-controls .close:hover {
  background: #c54d5b;
  color: white;
}

.window-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 17px;
}

.window-content.no-padding {
  padding: 0;
}

/* BARRA INFERIOR */

.taskbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  background: rgba(20,21,29,.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.start-button {
  height: 36px;
  padding: 0 15px;
  background: #302d43;
  border: 1px solid rgba(155,140,255,.25);
  border-radius: 8px;
  font-weight: bold;
  color: #c8bfff;
}

#taskButtons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  overflow: auto;
}

.task-button {
  height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 7px;
  color: #c7c6d0;
  font-size: 11px;
  white-space: nowrap;
}

.task-button.active {
  background: var(--panel3);
  border-color: var(--border);
  color: white;
}

.taskbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

#powerButton {
  border: 0;
  background: transparent;
  font-size: 19px;
  color: #ccc;
}

/* MENÚ INICIO */

.start-menu {
  position: absolute;
  z-index: 5000;
  bottom: 65px;
  left: 12px;
  width: 310px;
  max-height: min(520px, calc(100vh - 90px));
  padding: 18px;
  background: rgba(27,28,38,.98);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: 0 18px 55px rgba(0,0,0,.5);
}

.start-heading {
  font-size: 19px;
  font-weight: bold;
  margin-bottom: 15px;
}

#appSearch,
.text-input {
  width: 100%;
  padding: 11px;
  color: white;
  background: #111219;
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
}

#appSearch:focus,
.text-input:focus {
  border-color: var(--accent);
}

.app-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 13px;
  overflow: auto;
  max-height: 330px;
}

.app-entry {
  text-align: left;
  padding: 12px 9px;
  background: #242530;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 12px;
}

.app-entry:hover {
  background: #30313e;
  border-color: var(--border);
}

.start-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
}

.start-bottom button {
  background: transparent;
  border: 0;
  color: var(--text);
}

/* APLICACIONES */

.section-title {
  margin: 0 0 14px;
  font-size: 19px;
}

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

.action-button {
  padding: 9px 13px;
  background: #37324f;
  border: 1px solid rgba(155,140,255,.25);
  border-radius: 7px;
  color: #ddd6ff;
  font-size: 12px;
}

.action-button:hover {
  background: #494166;
}

.file-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.file-list {
  display: grid;
  gap: 5px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  background: #20212a;
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
}

.file-row:hover {
  background: #2b2c38;
}

.file-symbol {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: #343044;
  color: #c6baff;
  border-radius: 7px;
  font-weight: bold;
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-info strong {
  display: block;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.file-info small {
  color: var(--muted);
  font-size: 10px;
}

.store-card {
  padding: 14px;
  margin-bottom: 9px;
  background: #22232d;
  border: 1px solid var(--border);
  border-radius: 9px;
}

.store-card h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.store-card p {
  color: var(--muted);
  font-size: 11px;
}

.browser-address {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
  padding: 10px;
  background: #20212a;
}

.browser-address input {
  flex: 1;
  min-width: 0;
}

.browser-frame {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  min-height: 0;
  border: 0;
  background: white;
}

.browser-frame.hidden {
  display: none !important;
}

.empty-state {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 35px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

@media(max-width:600px) {
  .desktop-shortcuts {
    grid-template-columns: repeat(2, 75px);
  }

  .os-window {
    width: calc(100vw - 12px);
    height: calc(100vh - 110px);
    min-width: 0;
  }

  .taskbar {
    padding: 0 7px;
  }
}

/* LUIS OS 2.2 — ajustes de estabilidad y accesibilidad */
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.os-window.focused {
  border-color: rgba(155,140,255,.42);
  box-shadow: 0 24px 75px rgba(0,0,0,.56), 0 0 0 1px rgba(155,140,255,.08);
}

.window-titlebar {
  touch-action: none;
}

#windowLayer {
  isolation: isolate;
}

#startMenu {
  display: flex;
  flex-direction: column;
}

#appList {
  min-height: 0;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #454252 transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-thumb {
  background: #454252;
  border-radius: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 600px) {
  .topbar {
    padding: 0 10px;
    gap: 8px;
  }

  .topbar #topTitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .taskbar-right {
    gap: 7px;
  }

  .task-button {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .start-menu {
    width: min(310px, calc(100vw - 24px));
  }
}

/* LUIS OS 2.4 — navegador y accesos rápidos */
.browser-shortcuts {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 10px 9px;
  background: #20212a;
}

.browser-shortcut {
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 7px;
  padding: 6px 11px;
  background: #292a35;
  color: var(--text, #f1f1f5);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.browser-shortcut:hover {
  background: #3a3949;
  border-color: var(--accent, #9b8cff);
}

.browser-hint {
  flex: 0 0 auto;
  padding: 7px 11px;
  color: var(--muted, #a3a3b0);
  background: #191a22;
  font-size: 11px;
  line-height: 1.45;
}

.browser-shortcut:focus-visible {
  outline: 2px solid var(--accent, #9b8cff);
  outline-offset: 2px;
}
