:root {
  --bg-deep: #dfdcd3;
  --paper: #ffffff;
  --paper-dim: #f0f0f0;
  --ink: #000000;
  --accent: #ff5500;
  --font-display: 'Fraunces', serif;
  --font-ui: 'Space Grotesk', sans-serif;
}

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

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg-deep);
  background-image: radial-gradient(var(--ink) 1px, transparent 1px);
  background-size: 20px 20px;
}

img, svg {
  max-width: 100% !important;
  height: auto !important;
  object-fit: contain;
}

.fog, .stars, .city, .paper-grain, .wp-preview, #floatingFace { 
  display: none !important; 
}

#boot {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 24px;
  background: var(--accent);
  color: var(--paper);
  animation: bootFade 0.5s cubic-bezier(0.8, 0, 0, 1) forwards;
  animation-delay: 0.5s;
}

#bootLabel {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  text-transform: uppercase;
  border-bottom: 4px solid var(--paper);
}

#bootStatus {
  font-size: 0.9rem;
  margin-top: 6px;
  font-weight: 700;
}

.boot-face {
  width: 48px !important;
  height: 48px !important;
  margin-bottom: 12px;
  filter: grayscale(100%) contrast(200%);
}

@keyframes bootFade {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-100%); opacity: 0; visibility: hidden; pointer-events: none; }
}

#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
  z-index: 1000;
}

#osName {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.85rem;
  color: var(--paper);
  background: var(--ink);
  padding: 2px 8px;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

#statusText {
  font-weight: 700;
  font-size: 0.75rem;
}

#musicToggle {
  background: var(--paper);
  border: 2px solid var(--ink);
  font-family: var(--font-ui);
  font-weight: bold;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 1px 6px;
}

#musicToggle.active {
  background: var(--accent);
  color: var(--paper);
}

#timeElement {
  font-weight: bold;
  font-size: 0.85rem;
}

#desktopApps {
  position: fixed;
  top: 50px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  z-index: 10;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.icon {
  background: var(--paper);
  border: 2px solid var(--ink);
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}

.icon:hover {
  background: var(--accent);
  color: var(--paper);
}

.icon-glyph svg {
  width: 16px !important;
  height: 16px !important;
}

.icon-label {
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.window {
  display: none;
  position: absolute;
  top: 56px;
  left: 16px;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 140px);
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  z-index: 100;
  flex-direction: column;
}

.window.window-open {
  display: flex;
}

.windowheader {
  background: var(--accent);
  border-bottom: 2px solid var(--ink);
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: move;
  user-select: none;
}

.headertext {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--paper);
  margin: 0;
  text-transform: uppercase;
}

.closebutton {
  width: 18px;
  height: 18px;
  background: var(--paper);
  border: 2px solid var(--ink);
  cursor: pointer;
  font-weight: bold;
  font-size: 0.75rem;
  line-height: 1;
}

.closebutton:hover {
  background: var(--ink);
  color: var(--paper);
}

.window-content {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.window-content img {
  max-width: 120px !important;
  margin: 0 auto;
}

.welcome-content h1, 
.thinker-quote, 
.timer-display,
#noteTitleInput,
#oracleAnswer,
.thought-text {
  font-family: var(--font-display);
  font-weight: 700;
}

h1 {
  font-size: 1.4rem;
  line-height: 1.1;
}

p {
  line-height: 1.3;
  font-size: 0.85rem;
}

.lede {
  font-size: 0.95rem;
  font-weight: bold;
}

button[type="button"]:not(.dock-btn):not(.closebutton):not(#osName):not(#musicToggle) {
  background: var(--paper);
  border: 2px solid var(--ink);
  padding: 4px 10px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}

button[type="button"]:not(.dock-btn):not(.closebutton):not(#osName):not(#musicToggle):hover {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
  background: var(--paper-dim);
}

#dock {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  z-index: 5000;
  max-width: calc(100vw - 24px);
  overflow-x: auto;
}

.dock-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  background: var(--paper);
  border: 2px solid var(--ink);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.dock-btn img {
  max-width: 20px !important;
  max-height: 20px !important;
}

.dock-btn:hover {
  background: var(--accent);
  color: var(--paper);
}

.dock-sep {
  width: 2px;
  height: 20px;
  background: var(--ink);
  flex-shrink: 0;
}

#ctxMenu {
  display: none; 
  position: fixed;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  flex-direction: column;
  z-index: 10000;
  min-width: 140px;
}

#ctxMenu.open {
  display: flex !important;
}

#ctxMenu button {
  background: none;
  border: none;
  border-bottom: 1px solid var(--ink);
  padding: 6px 10px;
  text-align: left;
  font-weight: bold;
  font-size: 0.75rem;
  cursor: pointer;
  box-shadow: none !important;
}

#ctxMenu button:last-child {
  border-bottom: none;
}

#ctxMenu button:hover {
  background: var(--accent);
  color: var(--paper);
}

#noteTitleInput, #noteEditor {
  border: 2px solid var(--ink);
  padding: 6px;
  font-family: var(--font-ui);
  width: 100%;
}

#noteTitleInput { font-size: 0.95rem; }
#noteEditor { min-height: 100px; resize: vertical; font-size: 0.85rem; }

.timer-display {
  font-size: 2.2rem;
  text-align: center;
}

#termOut {
  background: var(--ink);
  color: var(--paper);
  padding: 10px;
  min-height: 120px;
  font-family: monospace;
  font-size: 0.75rem;
}

#termForm {
  display: flex;
  background: var(--ink);
  padding: 0 10px 10px 10px;
}

.term-prompt {
  color: var(--accent);
  margin-right: 6px;
  font-family: monospace;
  font-size: 0.75rem;
}

#termIn {
  background: transparent;
  border: none;
  color: var(--paper);
  font-family: monospace;
  flex-grow: 1;
  outline: none;
  font-size: 0.75rem;
}

@media (max-width: 768px) {
  #statusText {
    display: none;
  }

  #desktopApps {
    top: auto;
    bottom: 64px;
    right: 8px;
    left: 8px;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    max-height: 90px;
  }

  .window {
    top: 46px !important;
    left: 8px !important;
    width: calc(100vw - 16px) !important;
    max-height: calc(100vh - 120px);
  }

  #dock {
    bottom: 8px;
    padding: 4px;
    gap: 4px;
  }

  .dock-btn {
    width: 30px;
    height: 30px;
  }
}

.games-content {
  min-height: 390px;
}

.game-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.game-tab {
  flex: 1;
}

.game-tab.active {
  background: var(--accent) !important;
  color: var(--paper);
}

.game-panel {
  display: none;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.game-panel.active {
  display: flex;
}

.game-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
}

.game-score {
  font-weight: 700;
}

#snakeCanvas {
  width: 300px;
  height: 300px;
  max-width: 100%;
  border: 2px solid var(--ink);
  background: var(--paper-dim);
  image-rendering: pixelated;
}

#tttBoard {
  display: grid;
  grid-template-columns: repeat(3, 70px);
  grid-template-rows: repeat(3, 70px);
  gap: 4px;
}

.ttt-cell {
  width: 70px;
  height: 70px;
  background: var(--paper);
  border: 2px solid var(--ink);
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  cursor: pointer;
}

.ttt-cell:hover {
  background: var(--paper-dim);
}

#reactionBox {
  width: 280px;
  height: 150px;
  border: 2px solid var(--ink);
  background: var(--paper-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

#reactionBox.ready {
  background: var(--accent);
  color: var(--paper);
}

#reactionBox.too-early {
  background: var(--ink);
  color: var(--paper);
}

.reaction-score {
  font-weight: 700;
}