/* ADHD Simulator — desk + terminal mini game */

:root {
  --desk: #2a211c;
  --desk-edge: #1a1410;
  --wood: #3d2f28;
  --wood-hi: #4a3a31;
  --bg: #14100e;
  --ink: #f0e6d8;
  --ink-soft: #c4b5a4;
  --mute: #8a7a6c;
  --ember: #e8a87c;
  --sage: #8faf9a;
  --danger: #e07a6a;
  --term-bg: #0c1210;
  --term-fg: #b8e0c8;
  --term-dim: #5a7a68;
  --term-user: #e8d4a8;
  --term-sys: #7ab8a0;
  --sticky: #f5e6a8;
  --sticky-ink: #2a2418;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --sans: "Outfit", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ——— Boot / end ——— */
.boot,
.end {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(232, 168, 124, 0.12), transparent 55%),
    var(--bg);
}

.boot-card,
.end-card {
  max-width: 32rem;
  width: 100%;
}

.boot-kicker {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
}

.boot h1,
.end h2 {
  margin: 0 0 1rem;
  font-weight: 500;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.02em;
}

.boot-lede {
  margin: 0 0 1.5rem;
  color: var(--ink-soft);
  line-height: 1.65;
  font-size: 1.02rem;
}

.boot-lede strong {
  color: var(--ember);
  font-weight: 500;
}

.boot-goal {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  color: var(--mute);
}

.boot-goal input {
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #1c1714;
  border: 1px solid rgba(240, 230, 216, 0.12);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  outline: none;
}

.boot-goal input:focus {
  border-color: rgba(232, 168, 124, 0.45);
  box-shadow: 0 0 0 3px rgba(232, 168, 124, 0.12);
}

.boot-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.boot-hint {
  margin: 1.25rem 0 0;
  font-size: 0.78rem;
  color: var(--mute);
  line-height: 1.5;
}

.boot-back {
  color: var(--mute);
  text-decoration: none;
  font-size: 0.9rem;
}

.boot-back:hover {
  color: var(--ink-soft);
}

.btn {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 500;
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.35rem;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn.primary {
  background: var(--ember);
  color: #1a120c;
}

.btn.primary:hover {
  filter: brightness(1.06);
}

.btn.ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid rgba(240, 230, 216, 0.18);
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
}

.btn.ghost:hover {
  border-color: rgba(240, 230, 216, 0.35);
  color: var(--ink);
}

/* ——— Game shell ——— */
.game {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #100d0b;
}

.hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 0.65rem 1rem;
  background: rgba(10, 8, 7, 0.92);
  border-bottom: 1px solid rgba(240, 230, 216, 0.08);
  z-index: 20;
  position: relative;
}

.hud-left {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 10rem;
  flex: 1 1 12rem;
}

.hud-title {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: var(--ember);
  font-weight: 600;
}

.hud-goal {
  font-size: 0.82rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 28rem;
}

.hud-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.1rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}

.stat-label {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
}

.stat-val {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  min-width: 1.5ch;
}

.pressure {
  min-width: 6.5rem;
}

.pressure-bar {
  width: 6.5rem;
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(240, 230, 216, 0.1);
  overflow: hidden;
}

.pressure-bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sage), var(--ember), var(--danger));
  transition: width 0.35s ease;
}

/* Scene */
.scene {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
  background:
    radial-gradient(ellipse 50% 40% at 70% 20%, rgba(232, 168, 124, 0.09), transparent 60%),
    radial-gradient(ellipse 40% 35% at 15% 30%, rgba(80, 60, 40, 0.25), transparent 55%),
    linear-gradient(180deg, #1a1512 0%, #120f0d 45%, #0e0b09 100%);
}

.desk-surface {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28%;
  background:
    linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.2) 8%),
    repeating-linear-gradient(
      90deg,
      var(--wood) 0px,
      var(--wood-hi) 3px,
      var(--wood) 8px,
      #352820 14px,
      var(--wood) 22px
    );
  box-shadow: inset 0 12px 28px rgba(0, 0, 0, 0.35);
  border-top: 3px solid #4a382e;
  z-index: 1;
}

.mug {
  position: absolute;
  bottom: 18%;
  left: 6%;
  width: 42px;
  height: 48px;
  background: #c4b8a8;
  border-radius: 4px 4px 8px 8px;
  z-index: 3;
  box-shadow: 2px 4px 0 rgba(0, 0, 0, 0.25);
}

.mug::before {
  content: "";
  position: absolute;
  right: -12px;
  top: 10px;
  width: 14px;
  height: 20px;
  border: 3px solid #c4b8a8;
  border-left: none;
  border-radius: 0 10px 10px 0;
}

.mug span {
  position: absolute;
  top: -14px;
  left: 8px;
  width: 8px;
  height: 14px;
  border-radius: 50%;
  background: rgba(200, 200, 200, 0.2);
  box-shadow: 10px -4px 0 2px rgba(200, 200, 200, 0.15);
  animation: steam 3s ease-in-out infinite;
}

@keyframes steam {
  0%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  50% {
    opacity: 0.7;
    transform: translateY(-6px);
  }
}

.notebook {
  position: absolute;
  bottom: 16%;
  right: 8%;
  width: 90px;
  height: 64px;
  background: #e8dfd0;
  border-radius: 2px;
  transform: rotate(8deg);
  z-index: 2;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.2);
}

.notebook::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 12px;
  right: 10px;
  bottom: 12px;
  background: repeating-linear-gradient(
    transparent 0,
    transparent 7px,
    rgba(100, 80, 60, 0.15) 7px,
    rgba(100, 80, 60, 0.15) 8px
  );
}

.lamp {
  position: absolute;
  top: 4%;
  right: 12%;
  width: 16px;
  height: 50px;
  background: #3a3028;
  border-radius: 2px;
  z-index: 2;
}

.lamp::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 28px;
  background: #c9a66b;
  border-radius: 40% 40% 8% 8%;
  box-shadow: 0 0 40px 12px rgba(232, 168, 124, 0.25);
}

.lamp-glow {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(232, 168, 124, 0.18), transparent 70%);
  pointer-events: none;
}

/* Monitor */
.monitor {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: min(720px, 92vw);
  z-index: 5;
}

.monitor-bezel {
  background: linear-gradient(160deg, #2e2824, #1a1614 40%, #12100e);
  border-radius: 14px;
  padding: 14px 14px 18px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 24px 48px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.monitor-screen {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: var(--term-bg);
  aspect-ratio: 16 / 11;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5);
}

.crt-scan {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 4;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.07) 2px,
    rgba(0, 0, 0, 0.07) 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.5;
}

.terminal {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  font-family: var(--mono);
  font-size: clamp(0.72rem, 1.6vw, 0.85rem);
  color: var(--term-fg);
  z-index: 2;
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.65rem;
  background: rgba(0, 0, 0, 0.45);
  border-bottom: 1px solid rgba(184, 224, 200, 0.08);
  flex-shrink: 0;
}

.term-dots {
  display: flex;
  gap: 5px;
}

.term-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5a5048;
}

.term-dots i:nth-child(1) {
  background: #e07a6a;
}
.term-dots i:nth-child(2) {
  background: #e8c06a;
}
.term-dots i:nth-child(3) {
  background: #6aba7a;
}

.term-title {
  flex: 1;
  color: var(--term-dim);
  font-size: 0.72em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.term-meta {
  font-size: 0.68em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sage);
}

.term-meta.derailed {
  color: var(--danger);
}

.term-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.65rem 0.75rem;
  line-height: 1.55;
  scroll-behavior: smooth;
}

.term-body::-webkit-scrollbar {
  width: 6px;
}
.term-body::-webkit-scrollbar-thumb {
  background: rgba(184, 224, 200, 0.15);
  border-radius: 3px;
}

.line {
  margin: 0 0 0.55rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.line.sys {
  color: var(--term-sys);
}
.line.user {
  color: var(--term-user);
}
.line.bot {
  color: var(--term-fg);
}
.line.dim {
  color: var(--term-dim);
}
.line .tag {
  opacity: 0.55;
  margin-right: 0.35rem;
}

.cursor-blink::after {
  content: "▋";
  animation: blink 1s step-end infinite;
  color: var(--term-fg);
  margin-left: 1px;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.term-input-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.65rem;
  border-top: 1px solid rgba(184, 224, 200, 0.1);
  background: rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.term-input-row .prompt {
  color: var(--ember);
  font-weight: 600;
}

.term-input-row input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--term-fg);
  font: inherit;
  caret-color: var(--ember);
}

.term-input-row input::placeholder {
  color: var(--term-dim);
}

.term-input-row .send {
  background: transparent;
  border: 1px solid rgba(184, 224, 200, 0.2);
  color: var(--term-dim);
  border-radius: 4px;
  font: inherit;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
}

.term-input-row .send:hover {
  color: var(--term-fg);
  border-color: rgba(184, 224, 200, 0.4);
}

.monitor-stand {
  width: 48px;
  height: 36px;
  margin: 0 auto;
  background: linear-gradient(90deg, #1a1614, #2a2420, #1a1614);
  clip-path: polygon(20% 0, 80% 0, 100% 100%, 0 100%);
}

.monitor-base {
  width: 140px;
  height: 10px;
  margin: 0 auto;
  background: #2a2420;
  border-radius: 4px 4px 2px 2px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* Thoughts */
.thoughts {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

.thought {
  pointer-events: auto;
  position: absolute;
  width: min(240px, 72vw);
  background: var(--sticky);
  color: var(--sticky-ink);
  padding: 0.85rem 0.9rem 0.75rem;
  border-radius: 2px;
  box-shadow:
    2px 4px 12px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(0, 0, 0, 0.06);
  font-family: var(--sans);
  font-size: 0.88rem;
  line-height: 1.4;
  transform-origin: center top;
  animation: thought-in 0.35s cubic-bezier(0.2, 1.2, 0.4, 1) both;
  z-index: 1;
}

.thought.urgent {
  background: #f5c4a8;
  box-shadow:
    2px 4px 16px rgba(224, 122, 106, 0.35),
    0 0 0 1px rgba(180, 60, 40, 0.15);
}

.thought.leaving {
  animation: thought-out 0.25s ease forwards;
}

@keyframes thought-in {
  from {
    opacity: 0;
    transform: scale(0.85) rotate(var(--rot, -2deg)) translateY(-12px);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(var(--rot, -2deg)) translateY(0);
  }
}

@keyframes thought-out {
  to {
    opacity: 0;
    transform: scale(0.9) rotate(var(--rot, -2deg)) translateY(-8px);
  }
}

.thought-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.55;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.thought-text {
  margin: 0 0 0.75rem;
  font-weight: 500;
}

.thought-actions {
  display: flex;
  gap: 0.4rem;
}

.thought-actions button {
  flex: 1;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: none;
  border-radius: 4px;
  padding: 0.4rem 0.35rem;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.1s ease;
}

.thought-actions button:active {
  transform: scale(0.96);
}

.thought-actions .ignore {
  background: rgba(42, 36, 24, 0.12);
  color: var(--sticky-ink);
}

.thought-actions .ignore:hover {
  background: rgba(42, 36, 24, 0.2);
}

.thought-actions .follow {
  background: #2a2418;
  color: var(--sticky);
}

.thought-actions .follow:hover {
  background: #1a1610;
}

/* Footer */
.game-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.55rem 1rem;
  font-size: 0.78rem;
  color: var(--mute);
  border-top: 1px solid rgba(240, 230, 216, 0.08);
  background: rgba(10, 8, 7, 0.95);
  z-index: 20;
}

.thread-stack {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
  opacity: 0.75;
}

/* End stats */
.end-stats {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.end-stats li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(240, 230, 216, 0.1);
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.end-stats li strong {
  font-family: var(--mono);
  color: var(--ink);
  font-weight: 500;
}

.end-note {
  color: var(--mute);
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0 0 1.5rem;
}

/* Mobile */
@media (max-width: 640px) {
  .mug,
  .notebook,
  .lamp {
    display: none;
  }

  .monitor {
    top: 42%;
    width: 96vw;
  }

  .monitor-bezel {
    padding: 10px 10px 12px;
  }

  .desk-surface {
    height: 22%;
  }

  .thought {
    width: min(200px, 78vw);
    font-size: 0.82rem;
  }
}
