html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #fafafa;
  font-family: 'Inter', system-ui, sans-serif;
  overscroll-behavior: none;
}

#app {
  position: fixed;
  inset: 0;
  cursor: grab;
}
#app.dragging { cursor: grabbing; }
#app.hover-screen { cursor: pointer; }
#app.focused { cursor: default; }

/* CSS3D layer below, WebGL above with a punched hole over the screen */
#css3d { position: absolute; inset: 0; z-index: 1; }
#webgl { position: absolute; inset: 0; z-index: 2; pointer-events: none; }

/* The live SohamOS element mapped onto the monitor */
.screen-page {
  width: 1240px;
  height: 720px;
  overflow: hidden;
  background: #0b0d12;
  border-radius: 4px;
  pointer-events: none; /* interactive only when the camera is locked on */
}
.screen-page.interactive { pointer-events: auto; }

#hint { transition: opacity 0.6s ease; }

/* draw the eye to the tour button for the first few seconds */
#tourBtn.tour-glow { animation: tour-glow 1.4s ease-in-out infinite; }
@keyframes tour-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55), 0 8px 20px rgba(0,0,0,0.15); }
  50% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0), 0 8px 24px rgba(245, 158, 11, 0.35); }
}

/* ============================ SohamOS ============================ */

.os {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  color: #c9d1d9;
  /* charcoal wallpaper: faint dot grid + whisper of blaugrana */
  background:
    radial-gradient(circle at 20% 15%, rgba(0, 77, 152, 0.14), transparent 45%),
    radial-gradient(circle at 85% 90%, rgba(165, 0, 68, 0.12), transparent 45%),
    radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px) 0 0 / 26px 26px,
    #0b0d12;
  user-select: none;
}
.os, .os * { box-sizing: border-box; }
.os a { color: #58a6ff; text-decoration: none; }
.os a:hover { text-decoration: underline; }

/* ---- menu bar ---- */
.os-menubar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 14px;
  background: rgba(13, 16, 23, 0.75);
  backdrop-filter: blur(10px);
  font-size: 12px;
  color: #aeb6c2;
  z-index: 500;
}
.os-menubar .os-logo { font-weight: 800; color: #e6e9ef; letter-spacing: 0.02em; }
.os-menubar .spacer { flex: 1; }
.os-menubar .os-clock { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; }
.os-menubar svg { display: block; opacity: 0.8; }

/* ---- dock ---- */
.os-dock {
  position: absolute;
  bottom: 10px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  backdrop-filter: blur(14px);
  z-index: 500;
}
.os-dock button {
  position: relative;
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  border-radius: 11px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.os-dock button:hover { transform: translateY(-6px) scale(1.12); background: rgba(255, 255, 255, 0.13); }
.os-dock button svg { width: 30px; height: 30px; display: block; border-radius: 7px; }
.os-dock button.open::after {
  content: '';
  position: absolute;
  bottom: -5px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: #9fb0c3;
}

/* ---- windows ---- */
.os-win {
  position: absolute;
  display: none;
  flex-direction: column;
  background: rgba(19, 22, 30, 0.97);
  border: 1px solid #2a2f3c;
  border-radius: 9px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.os-win.open { display: flex; }
.os-win.opening { animation: os-pop 0.18s ease; }
@keyframes os-pop {
  from { transform: scale(0.96); opacity: 0.4; }
  to { transform: scale(1); opacity: 1; }
}
.os-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  background: #1a1e28;
  border-bottom: 1px solid #262b37;
  cursor: grab;
  flex: 0 0 auto;
}
.os-titlebar:active { cursor: grabbing; }
.os-titlebar .dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; }
.os-titlebar .dot.close { background: #ff5f57; cursor: pointer; }
.os-titlebar .dot.min { background: #febc2e; }
.os-titlebar .dot.max { background: #28c840; }
.os-titlebar .title {
  flex: 1;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #8b93a3;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
}
.os-body { flex: 1; overflow: auto; min-height: 0; }
.os-body::-webkit-scrollbar { width: 6px; }
.os-body::-webkit-scrollbar-thumb { background: #333a48; border-radius: 3px; }

/* ---- terminal ---- */
.term { display: flex; flex-direction: column; height: 100%; background: #0d1017; }
.term-out {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.term-out::-webkit-scrollbar { width: 6px; }
.term-out::-webkit-scrollbar-thumb { background: #333a48; border-radius: 3px; }
.term .t-green { color: #3fb950; }
.term .t-blue { color: #58a6ff; }
.term .t-gold { color: #e3b341; }
.term .t-red { color: #f85149; }
.term .t-dim { color: #6a7383; }
.term .t-white { color: #e6e9ef; }
.term .t-garnet { color: #ff5c8a; }
.term-inputrow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
}
.term-inputrow input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #e6e9ef;
  font: inherit;
  caret-color: #3fb950;
}
.term-chips {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px 14px 10px;
  border-top: 1px solid #1b2029;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: #6a7383;
}
.term-chips button {
  background: #171c26;
  border: 1px solid #262d3a;
  border-radius: 5px;
  color: #9fb0c3;
  font: inherit;
  padding: 3px 9px;
  cursor: pointer;
}
.term-chips button:hover { border-color: #3fb950; color: #3fb950; }
.cursor-blink { display: inline-block; width: 7px; height: 14px; background: #3fb950; vertical-align: -2px; animation: blink 1.1s steps(1) infinite; }
.os.live .cursor-blink { display: none; } /* real input caret takes over when focused */
@keyframes blink { 50% { opacity: 0; } }

/* ---- files (code editor) ---- */
.files { display: flex; height: 100%; font-size: 12.5px; }
.files-tree {
  flex: 0 0 178px;
  border-right: 1px solid #232937;
  padding: 10px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: #9fb0c3;
  background: #10131b;
}
.files-tree .dir { padding: 5px 14px; cursor: pointer; white-space: nowrap; }
.files-tree .dir:hover { background: #1a2030; }
.files-tree .dir.active { background: #1d2536; color: #e6e9ef; }
.files-tree .leaf { padding: 3px 14px 3px 30px; color: #6a7383; }
.files-view { flex: 1; overflow-y: auto; padding: 16px 20px; }
.files-view::-webkit-scrollbar { width: 6px; }
.files-view::-webkit-scrollbar-thumb { background: #333a48; border-radius: 3px; }
.files-view h1 { font-size: 16px; margin: 0 0 2px; color: #e6e9ef; }
.files-view .stack { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: #e3b341; margin-bottom: 10px; }
.files-view ul { margin: 8px 0; padding-left: 18px; }
.files-view li { margin: 5px 0; line-height: 1.5; color: #aeb6c2; }
.files-view b { color: #e6e9ef; font-weight: 600; }
.bench { margin: 12px 0 4px; font-family: 'JetBrains Mono', monospace; font-size: 10.5px; }
.bench .row { display: flex; align-items: center; gap: 8px; margin: 5px 0; }
.bench .lbl { flex: 0 0 118px; color: #8b93a3; text-align: right; }
.bench .bar { height: 12px; border-radius: 3px; background: linear-gradient(90deg, #004D98, #58a6ff); min-width: 3px; }
.bench .val { color: #e6e9ef; }

/* ---- git log ---- */
.gitlog { padding: 14px 18px; font-family: 'JetBrains Mono', monospace; font-size: 12px; line-height: 1.6; }
.gitlog .cmd { color: #6a7383; margin-bottom: 10px; }
.commit { display: flex; gap: 10px; }
.commit .graph { color: #3fb950; width: 14px; flex: 0 0 auto; }
.commit .body { padding-bottom: 12px; }
.commit .hash { color: #e3b341; }
.commit .ref { color: #3fb950; }
.commit .msg { color: #e6e9ef; }
.commit .meta { color: #6a7383; font-size: 11px; }
.commit ul { margin: 6px 0 0; padding-left: 16px; color: #9fb0c3; font-family: 'Inter', sans-serif; font-size: 11.5px; }
.commit li { margin: 3px 0; line-height: 1.45; }

/* ---- notes ---- */
.notes { padding: 18px 22px; font-size: 12.5px; line-height: 1.6; color: #aeb6c2; }
.notes h1 { font-size: 17px; color: #e6e9ef; margin: 0 0 4px; }
.notes h2 { font-size: 12px; color: #e3b341; font-family: 'JetBrains Mono', monospace; margin: 16px 0 6px; text-transform: uppercase; letter-spacing: 0.08em; }
.notes .pill { display: inline-block; margin: 2px 3px 2px 0; padding: 2px 9px; border: 1px solid #2a2f3c; border-radius: 99px; font-size: 11px; color: #9fb0c3; }

/* ---- mail ---- */
.mail { display: flex; flex-direction: column; height: 100%; font-size: 12.5px; }
.mail .field { display: flex; gap: 8px; padding: 8px 14px; border-bottom: 1px solid #232937; color: #8b93a3; }
.mail .field b { color: #aeb6c2; font-weight: 600; flex: 0 0 58px; }
.mail .field input { flex: 1; background: transparent; border: none; outline: none; color: #e6e9ef; font: inherit; }
.mail textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  padding: 12px 14px;
  color: #c9d1d9;
  font: inherit;
  line-height: 1.55;
}
.mail .mail-actions { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid #232937; }
.mail .send {
  background: #1f6feb;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.mail .send:hover { background: #388bfd; }
.mail .alt { font-size: 11.5px; color: #6a7383; }

/* ---- spotify mini ---- */
.spot { display: flex; gap: 12px; padding: 14px; align-items: center; }
.spot .art {
  width: 64px; height: 64px;
  border-radius: 8px;
  flex: 0 0 auto;
  overflow: hidden;
  background: #3b3bd1;
}
.spot .art canvas { width: 100%; height: 100%; display: block; }
.spot .meta { flex: 1; min-width: 0; }
.spot .song { font-weight: 700; font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spot .artist { font-size: 11px; color: #9fb0c3; margin: 2px 0 8px; }
.spot .bar { height: 4px; border-radius: 2px; background: #2a2f3c; position: relative; }
.spot .bar i { position: absolute; inset: 0 70% 0 0; background: #1db954; border-radius: 2px; }
.spot .times { display: flex; justify-content: space-between; font-size: 9.5px; color: #6a7383; margin-top: 4px; font-family: 'JetBrains Mono', monospace; }

/* ---- match widget ---- */
.match { padding: 0 0 12px; text-align: center; font-family: 'JetBrains Mono', monospace; }
.match .strip { height: 6px; background: repeating-linear-gradient(90deg, #004D98 0 22px, #A50044 22px 44px); }
.match .comp { font-size: 10px; color: #6a7383; margin: 10px 0 4px; letter-spacing: 0.14em; }
.match .score { font-size: 26px; font-weight: 700; color: #e6e9ef; }
.match .score small { font-size: 12px; color: #8b93a3; margin: 0 8px; }
.match .scorers { font-size: 10.5px; color: #e3b341; margin-top: 6px; }
