/* AarivOS - built from the Hack Club webOS jam, customized. */
:root {
  --ink: #0d1220;
  --panel: #141b2e;
  --panel-2: #1b2440;
  --line: #2a3558;
  --text: #e8ecf8;
  --dim: #97a3c4;
  --accent: #f5a742;
  --accent-2: #7aa2ff;
  --shadow: 0 18px 50px rgba(3, 6, 18, .55);
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font: 14px/1.5 -apple-system, "SF Pro Text", system-ui, sans-serif;
  color: var(--text);
  overflow: hidden;
  background: var(--ink);
}

/* Boot */
#boot {
  position: fixed; inset: 0; z-index: 999;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(120% 120% at 50% 0%, #1a2340 0%, var(--ink) 60%);
  transition: opacity .5s ease;
}
#boot.done { opacity: 0; pointer-events: none; }
.boot-star { font-size: 34px; color: var(--accent); animation: twinkle 1.2s ease infinite alternate; }
.boot-name { letter-spacing: .35em; font-weight: 600; text-transform: uppercase; font-size: 12px; color: var(--dim); }
.boot-bar { width: 130px; height: 3px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.boot-bar span { display: block; height: 100%; width: 40%; background: var(--accent); animation: load 1.1s ease-in-out infinite alternate; }
@keyframes twinkle { from { opacity: .5; transform: scale(.92); } to { opacity: 1; transform: scale(1.05); } }
@keyframes load { from { width: 12%; } to { width: 86%; } }

/* Desktop */
#desktop { position: fixed; inset: 0; }
#wall { position: absolute; inset: 0; background: radial-gradient(130% 130% at 80% 10%, #2c2160 0%, transparent 55%),
        radial-gradient(120% 120% at 15% 90%, #17395c 0%, transparent 50%), linear-gradient(160deg, #0d1220 0%, #131a30 100%);
        transition: background .4s ease; }
#wall.alt-1 { background: radial-gradient(120% 120% at 20% 20%, #5c2a4a 0%, transparent 55%), linear-gradient(160deg, #170f1d, #241531); }
#wall.alt-2 { background: radial-gradient(120% 120% at 80% 80%, #134b3e 0%, transparent 55%), linear-gradient(160deg, #0a1712, #10281f); }

#topbar {
  position: absolute; top: 0; left: 0; right: 0; height: 34px; z-index: 5000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; font-size: 12.5px;
  background: rgba(10, 14, 26, .72); backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(122, 162, 255, .12);
}
.tb-left { display: flex; gap: 10px; align-items: baseline; }
.tb-left strong { color: var(--accent); letter-spacing: .04em; }
#tb-app { color: var(--dim); }
#tb-clock { font-variant-numeric: tabular-nums; color: var(--dim); }

/* Icons */
#icons {
  position: absolute; top: 46px; left: 10px; bottom: 12px;
  display: flex; flex-direction: column; flex-wrap: wrap; align-content: flex-start; gap: 6px;
  width: 120px;
}
.icon {
  width: 92px; padding: 8px 4px 7px; border-radius: 10px; text-align: center; cursor: default;
  border: 1px solid transparent;
}
.icon .glyph { width: 44px; height: 44px; margin: 0 auto 5px; border-radius: 11px;
  display: grid; place-items: center; font-size: 22px;
  background: var(--panel-2); box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 4px 12px rgba(0,0,0,.35); }
.icon .label { font-size: 11px; color: var(--text); text-shadow: 0 1px 3px rgba(0,0,0,.8); word-break: break-word; }
.icon.selected { background: rgba(122, 162, 255, .16); border-color: rgba(122, 162, 255, .45); }
.icon.selected .glyph { background: var(--accent); color: var(--ink); }

/* Windows */
#windows { position: absolute; inset: 34px 0 0 0; }
.window {
  position: absolute; min-width: 280px; min-height: 170px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
}
.window.focused { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.handle {
  height: 34px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 10px;
  background: var(--panel-2); cursor: grab; user-select: none;
  border-bottom: 1px solid var(--line);
}
.handle:active { cursor: grabbing; }
.dots { display: flex; gap: 6px; }
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot.close { background: #ff6057; }
.dot.min { background: #ffbd2e; }
.dot.z { background: #28c840; }
.handle .title { font-size: 12.5px; color: var(--dim); flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.body { flex: 1; overflow: auto; padding: 12px; }

/* Apps */
.notes-area { width: 100%; height: 100%; min-height: 130px; resize: none;
  background: transparent; color: var(--text); border: 0; outline: none; font: inherit; }
.saved-flash { font-size: 11px; color: var(--accent); height: 14px; }

.term { font: 12.5px/1.55 ui-monospace, "SF Mono", Menlo, monospace; }
.term .out { white-space: pre-wrap; color: var(--dim); }
.term .out b { color: var(--accent); }
.term-row { display: flex; gap: 6px; }
.term-row .ps { color: var(--accent); }
.term-row input { flex: 1; background: transparent; border: 0; outline: none; color: var(--text); font: inherit; }

.filelist { display: flex; flex-direction: column; gap: 2px; }
.filerow { display: flex; justify-content: space-between; padding: 7px 9px; border-radius: 8px; cursor: default; }
.filerow:hover { background: var(--panel-2); }
.filerow .name { color: var(--text); }
.filerow .meta { color: var(--dim); font-size: 12px; }
.path { font-size: 11.5px; color: var(--accent); margin-bottom: 8px; font-family: ui-monospace, monospace; }

.settings { display: flex; flex-direction: column; gap: 14px; }
.settings label { display: flex; justify-content: space-between; align-items: center; color: var(--dim); }
.settings select { background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 8px; }

canvas.paint { background: #0a0e1a; border-radius: 8px; border: 1px solid var(--line);
  touch-action: none; cursor: crosshair; display: block; }
.paint-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.paint-tools input[type=color] { width: 34px; height: 26px; border: 0; background: none; padding: 0; }
.paint-tools button { background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 12px; }
.paint-tools button:hover { border-color: var(--accent); }

/* Text Editor */
.editor-wrap { display: flex; flex-direction: column; height: 100%; gap: 4px; }
.editor-bar { display: flex; gap: 8px; }
.editor-name { flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); padding: 5px 9px; font: inherit; outline: none; }
.editor-name:focus { border-color: var(--accent); }
.editor-wrap .notes-area { flex: 1; height: auto; min-height: 120px; }

/* Shared button (new apps) */
.btn { background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 12px; cursor: pointer; font-size: 12px; }
.btn:hover { border-color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.rec-on { background: #ff6057; border-color: #ff6057; color: #fff; }

/* Music */
.music-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.music-row select { background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 8px; outline: none; }
.piano { position: relative; height: 132px; margin-top: 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2); overflow: hidden; }
.pkey { position: absolute; top: 0; bottom: 0; display: flex; align-items: flex-end; justify-content: center;
  padding: 0 0 6px; font-family: inherit; font-size: 10px; color: var(--dim);
  background: linear-gradient(#fdfcff, #d8ddf1); border: 1px solid var(--line); border-radius: 0;
  cursor: pointer; }
.pkey:hover { background: #eef1fc; }
.pkey:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -2px; z-index: 3; }
.pkey.down, .pkey:active { background: var(--accent); color: var(--ink); }
.pkey.black { bottom: auto; height: 62%; background: linear-gradient(#333e66, #18203c);
  border-color: #0b101f; z-index: 2; }
.pkey.black.down, .pkey.black:active { background: var(--accent-2); }
.music-note { margin-top: 10px; font-size: 11px; color: var(--dim); }

/* System Monitor */
.mon-row { display: grid; grid-template-columns: 36px 1fr 42px; gap: 8px; align-items: center; }
.mon-label { font-size: 10px; letter-spacing: .14em; color: var(--dim); }
.mon-bar { height: 12px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.mon-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.mon-val { font: 12px ui-monospace, "SF Mono", Menlo, monospace; text-align: right; font-variant-numeric: tabular-nums; }
.mon-stats { display: flex; gap: 10px; margin: 14px 0 12px; }
.mon-stat { flex: 1; display: flex; flex-direction: column; gap: 2px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.mon-k { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.mon-v { font: 500 15px/1.2 ui-monospace, "SF Mono", Menlo, monospace; color: var(--accent); font-variant-numeric: tabular-nums; }
.mon-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.proc { font-size: 11px; color: var(--dim); background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; }

#dock-hint { position: absolute; bottom: 8px; right: 12px; font-size: 11px; color: rgba(151, 163, 196, .55); }

@media (prefers-reduced-motion: reduce) {
  .boot-star, .boot-bar span { animation: none; }
}
