/* ============================================================
   HamstersarusOS — design tokens
   Aesthetic: lavender "Tokyo Night" desktop rice + Y2K scrapbook.
   Graph-paper wallpaper is pure CSS (no image needed).
   ============================================================ */

:root {
  /* wallpaper (light lavender graph paper) */
  --wall:       #bcb8e0;
  --wall-2:     #a9a6d6;
  --grid-line:  rgba(40, 30, 70, 0.10);
  --grid-size:  34px;

  /* windows (dark Tokyo Night) */
  --win-bg:     #1a1b26;
  --win-bg-2:   #24283b;
  --win-border: #bb9af7;
  --ink:        #c0caf5;
  --muted:      #565f89;

  /* neon accents */
  --purple: #bb9af7;
  --blue:   #7aa2f7;
  --cyan:   #7dcfff;
  --green:  #9ece6a;
  --orange: #ff9e64;
  --pink:   #f7768e;
  --accent: var(--purple);

  /* fonts */
  --font-display:  "Press Start 2P", monospace;
  --font-terminal: "VT323", monospace;
  --font-mono:     "JetBrains Mono", ui-monospace, monospace;

  --top-bar-h: 34px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Lock the page to the viewport so nothing can scroll/shift
   (e.g. arrow keys in the 2048 game must never move the page). */
html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  font-family: var(--font-mono);
  color: var(--ink);
}

.hidden { display: none !important; }

/* --- shared: graph-paper wallpaper --- */
.welcome,
.desktop {
  height: 100vh;
  background-color: var(--wall);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
}

/* ============================================================
   Window chrome (reused by welcome card + every future app)
   ============================================================ */
.window {
  background: var(--win-bg);
  border: 1.5px solid var(--win-border);
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4),
              0 8px 30px rgba(20, 10, 40, 0.45),
              0 0 18px rgba(187, 154, 247, 0.25);   /* faint neon glow */
  overflow: hidden;
}

.title-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.7rem;
  background: var(--win-bg-2);
  border-bottom: 1px solid rgba(187, 154, 247, 0.35);
  font-size: 0.8rem;
  color: var(--muted);
  user-select: none;
}

.title-bar-dots { display: flex; gap: 5px; }
.title-bar-dots i {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted); display: block;
}
.title-bar-dots i:nth-child(1) { background: var(--pink); }
.title-bar-dots i:nth-child(2) { background: var(--orange); }
.title-bar-dots i:nth-child(3) { background: var(--green); }

.title-bar { user-select: none; }
.title-bar-text { letter-spacing: 0.5px; }

.title-bar-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.2rem;
  cursor: pointer;
}
.title-bar-close:hover { color: var(--pink); }

.window-body { padding: 1rem; }

/* Floating desktop windows (created by js/windows.js) */
.window--floating {
  position: absolute;
  min-width: 240px;
  max-width: 360px;
}
.window--floating .title-bar { cursor: grab; }
.window--floating .title-bar:active { cursor: grabbing; }

/* ============================================================
   Welcome screen
   ============================================================ */
.welcome { display: grid; place-items: center; }

.welcome-stack {
  display: grid;
  gap: 1.4rem;
  justify-items: center;
  text-align: center;
}

.logo {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 4vw, 2.4rem);
  line-height: 1.4;
  color: var(--win-bg);
  text-shadow: 3px 3px 0 var(--purple), 6px 6px 0 rgba(26, 27, 38, 0.25);
}
.logo-os { color: var(--pink); }

/* neofetch-style intro */
.fetch {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  font-family: var(--font-terminal);
  font-size: 1.3rem;
  text-align: left;
}
.fetch-mascot {
  font-size: 3.2rem;
  filter: drop-shadow(0 0 8px rgba(187, 154, 247, 0.6));
}
.fetch-info { list-style: none; line-height: 1.5; }
.fetch-info .k {
  display: inline-block;
  width: 4.5ch;
  color: var(--cyan);
}

.enter-btn {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.55rem 1.6rem;
  color: var(--win-bg);
  background: var(--purple);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(187, 154, 247, 0.55);
  transition: transform 0.08s ease, filter 0.15s ease;
}
.enter-btn:hover { filter: brightness(1.08); }
.enter-btn:active { transform: translateY(1px); }

/* ============================================================
   Desktop + top bar
   ============================================================ */
.desktop { position: relative; overflow: hidden; }

.top-bar {
  height: var(--top-bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  background: rgba(26, 27, 38, 0.82);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(187, 154, 247, 0.4);
  color: var(--ink);
  font-size: 0.85rem;
}

.top-bar-brand { font-weight: 700; }

.clock {
  font-family: var(--font-terminal);
  font-size: 1.25rem;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
}

/* --- Desktop toast / notification --- */
.toast {
  position: absolute;
  top: calc(var(--top-bar-h) + 12px);
  right: 12px;
  padding: 0.6rem 0.9rem;
  background: var(--win-bg);
  border: 1px solid var(--win-border);
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.85rem;
  box-shadow: 0 6px 20px rgba(20, 10, 40, 0.4), 0 0 14px rgba(187, 154, 247, 0.25);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  z-index: 9999;
}
.toast.show { opacity: 1; transform: translateX(0); }

/* --- Desktop icons --- */
.icons {
  list-style: none;
  position: absolute;
  top: calc(var(--top-bar-h) + 1rem);
  bottom: 1rem;
  left: 1rem;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;          /* wrap into a 2nd column if there are many icons */
  align-content: flex-start;
  gap: 0.4rem;
}

.icon {
  width: 80px;
  padding: 0.5rem 0.3rem;
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  text-align: center;
}

.icon:hover {
  background: rgba(26, 27, 38, 0.30);
  border-color: rgba(187, 154, 247, 0.45);
}

.icon.selected {
  background: rgba(26, 27, 38, 0.45);
  border-color: var(--purple);
  box-shadow: 0 0 12px rgba(187, 154, 247, 0.4);
}

.icon-glyph {
  font-size: 2rem;
  filter: drop-shadow(0 1px 2px rgba(20, 10, 40, 0.4));
}

.icon-label {
  font-family: var(--font-terminal);
  font-size: 1.05rem;
  color: var(--win-bg);
  line-height: 1;
}

/* ============================================================
   Placeholder app content (real apps arrive in Parts 4-5)
   ============================================================ */
.app-about { display: grid; gap: 0.7rem; max-width: 300px; }
.app-about-head { display: flex; align-items: center; gap: 0.7rem; }
.app-about-avatar {
  font-size: 2.6rem;
  filter: drop-shadow(0 0 6px rgba(187, 154, 247, 0.6));
}
.app-about h2 { font-size: 1.1rem; color: var(--purple); }
.app-about-tag {
  font-family: var(--font-terminal);
  font-size: 1rem;
  color: var(--cyan);
}
.app-about-bio { font-size: 0.85rem; line-height: 1.5; }
.app-about-cols { display: flex; gap: 1rem; }
.app-about-cols > div { flex: 1; }
.app-about-cols h3 { font-size: 0.8rem; margin-bottom: 0.3rem; color: var(--pink); }
.app-about-cols ul { list-style: none; display: grid; gap: 0.2rem; }
.app-about-cols li { font-size: 0.8rem; padding-left: 0.9rem; position: relative; }
.app-about-cols li::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: var(--purple);
  font-size: 0.7rem;
}

.app-notes {
  width: 250px;
  height: 150px;
  resize: none;
  padding: 0.6rem;
  background: var(--win-bg-2);
  color: var(--ink);
  border: 1px solid rgba(187, 154, 247, 0.35);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.app-notes:focus { outline: 1px solid var(--purple); }

.app-music { display: grid; gap: 0.5rem; text-align: center; min-width: 180px; }
.app-music-art { font-size: 3rem; }
.app-music-art.spin { animation: spin 3s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.app-music-track {
  font-family: var(--font-terminal);
  font-size: 1.2rem;
  color: var(--cyan);
}
.app-music-controls { display: flex; justify-content: center; gap: 0.7rem; }
.app-music-controls button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--ink);
}
.app-music-controls button:hover { color: var(--purple); }

.app-gallery { font-size: 2rem; letter-spacing: 0.4rem; line-height: 1.6; max-width: 220px; }

.app-trash { font-family: var(--font-terminal); font-size: 1.2rem; }

/* ============================================================
   Portfolio apps
   ============================================================ */
.app-note { font-size: 0.7rem; color: var(--muted); font-style: italic; }

/* Projects */
.app-projects { display: grid; gap: 0.7rem; width: 300px; max-height: 62vh; overflow-y: auto; }
.proj-card {
  display: grid;
  gap: 0.3rem;
  padding: 0.7rem 0.8rem;
  background: var(--win-bg-2);
  border: 1px solid rgba(187, 154, 247, 0.25);
  border-radius: 8px;
}
.proj-card h3 { font-size: 0.95rem; color: var(--purple); }
.proj-card p { font-size: 0.8rem; line-height: 1.4; }
.proj-tech { font-family: var(--font-terminal); font-size: 1rem; color: var(--cyan); }
.proj-links { display: flex; gap: 0.9rem; margin-top: 0.2rem; }
.proj-links a { font-size: 0.8rem; color: var(--pink); text-decoration: none; }
.proj-links a:hover { text-decoration: underline; }

/* Skills (proficiency bars via lvl-1 … lvl-5 classes) */
.app-skills { display: grid; gap: 0.6rem; width: 240px; }
.skill { display: grid; gap: 0.25rem; }
.skill-name { font-size: 0.8rem; }
.skill-bar {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: rgba(187, 154, 247, 0.15);
  position: relative;
  overflow: hidden;
}
.skill-bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 4px;
  background: var(--purple);
}
.skill-bar.lvl-1::after { width: 20%; }
.skill-bar.lvl-2::after { width: 40%; }
.skill-bar.lvl-3::after { width: 60%; }
.skill-bar.lvl-4::after { width: 80%; }
.skill-bar.lvl-5::after { width: 100%; }

/* Resume */
.app-resume { display: grid; gap: 0.7rem; width: 280px; max-height: 62vh; overflow-y: auto; }
.app-resume section { display: grid; gap: 0.2rem; }
.app-resume h3 { font-size: 0.85rem; color: var(--pink); }
.app-resume p, .app-resume li { font-size: 0.8rem; line-height: 1.4; }
.app-resume ul { padding-left: 1rem; }
.btn {
  justify-self: start;
  padding: 0.45rem 0.8rem;
  background: var(--purple);
  color: var(--win-bg);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }

/* Contact */
.app-contact { display: grid; gap: 0.55rem; width: 240px; }
.contact-link {
  padding: 0.5rem 0.7rem;
  background: var(--win-bg-2);
  border: 1px solid rgba(187, 154, 247, 0.25);
  border-radius: 7px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.85rem;
}
.contact-link:hover { border-color: var(--purple); color: var(--purple); }

/* ============================================================
   2048 (advanced app) — purple themed
   ============================================================ */
.g2048 { display: grid; gap: 0.6rem; width: 280px; }
.g2048-top { display: flex; justify-content: space-between; align-items: center; }
.g2048-score { font-family: var(--font-terminal); font-size: 1.15rem; color: var(--cyan); }
.g2048-score b { color: var(--ink); }
.g2048-new {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--win-bg);
  background: var(--purple);
  border: none;
  border-radius: 5px;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
}
.g2048-new:hover { filter: brightness(1.08); }

.g2048-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  background: #2a2440;
  border-radius: 8px;
}
.g2048-cell {
  min-width: 0;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(187, 154, 247, 0.1);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.2rem;
  color: #2a2440;
}
.g2048-cell[data-v="0"]    { color: transparent; }
.g2048-cell[data-v="2"]    { background: #ded9f5; color: #3a2f5c; }
.g2048-cell[data-v="4"]    { background: #cbbdf3; color: #3a2f5c; }
.g2048-cell[data-v="8"]    { background: #bb9af7; color: #fff; }
.g2048-cell[data-v="16"]   { background: #a87df2; color: #fff; }
.g2048-cell[data-v="32"]   { background: #9866ee; color: #fff; }
.g2048-cell[data-v="64"]   { background: #8650e6; color: #fff; }
.g2048-cell[data-v="128"]  { background: #7a3fd8; color: #fff; font-size: 1.05rem; }
.g2048-cell[data-v="256"]  { background: #6c2fc8; color: #fff; font-size: 1.05rem; }
.g2048-cell[data-v="512"]  { background: #5e23b8; color: #fff; font-size: 1.05rem; }
.g2048-cell[data-v="1024"] { background: #7a2fa8; color: #fff; font-size: 0.9rem; }
.g2048-cell[data-v="2048"] {
  background: #ff79c6;
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 0 14px rgba(255, 121, 198, 0.7);
}

.g2048-msg {
  text-align: center;
  font-family: var(--font-terminal);
  font-size: 1.2rem;
  color: var(--pink);
  min-height: 1.2rem;
}
.g2048-hint { text-align: center; font-size: 0.7rem; color: var(--muted); }
