:root {
  --ink: #111111;
  --ink-dim: rgba(17, 17, 17, 0.55);
  --ink-faint: rgba(17, 17, 17, 0.32);
  --line: rgba(17, 17, 17, 0.12);
  --panel: rgba(255, 255, 255, 0.9);
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.13);
  --wall: #f1f0ee;   /* neutral wall behind the framed canvas */
  --space-1: #0d0f1f; /* deep space, near */
  --space-2: #05060d; /* deep space, far */
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background: var(--wall);
  color: var(--ink);
  font-family: "Inter", sans-serif;
  font-weight: 300;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---------- Always-drawable canvas -------------------------------------- */
/* ---------- Gallery: a framed canvas hung on the wall ------------------ */
.gallery-area {
  flex: 0 0 auto; /* sizes to the frame; deep space fills what's left */
  display: flex;
  justify-content: center;
  align-items: flex-start; /* top-align the frame */
  padding: 12px 16px 8px;
}

/* The frame. width/height are set by JS to keep the fixed board aspect
   (contain-fit inside the gallery area). */
.gallery {
  position: relative;
  overflow: hidden;
  background: #ffffff;
  /* Same color as the inner .app-board border, so the two frames match. */
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 8px;
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.16), 0 3px 10px rgba(0, 0, 0, 0.07);
}

/* Inner stage: fixed board coordinates, scaled to fill the frame. The canvas
   AND the tiles live here and scale together, so a drawing over a tile stays
   over that tile on every device. */
.stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 1440px;
  height: 2400px;
  transform-origin: top left;
  transform: scale(var(--stage-scale, 1));
}

/* Canvas fills the stage at a fixed resolution; the transform scales it.
   image-rendering:pixelated keeps pixels crisp and square at any scale. */
#board {
  position: absolute;
  inset: 0;
  width: 1440px;
  height: 2400px;
  display: block;
  z-index: 0;
  pointer-events: auto;
  cursor: crosshair;
  touch-action: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ---------- Header ------------------------------------------------------ */
.site-header {
  flex: 0 0 auto;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: lowercase;
}

.header-left {
  display: inline-flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
}

.brand {
  color: var(--ink);
  font-weight: 500;
}

.header-link {
  color: var(--ink-dim);
  transition: color 0.15s ease;
}

.header-link:hover {
  color: var(--ink);
}

/* ---------- The launcher: centered app grid (fills the stage) ---------- */
.hub {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Top-aligned: tiles sit a fixed distance from the top; the space that
     grows/shrinks with the screen is below them. */
  justify-content: flex-start;
  gap: 34px;
  padding: 120px 24px 24px;
  pointer-events: none;
}

.hub-tagline {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 12.5px;
  letter-spacing: 1.5px;
  color: var(--ink-faint);
  text-align: center;
}

/* A "mounting board" behind the posters: an opaque matte with a border gives
   the tiles (and the tagline) a clean, protected margin, so a drawing that
   covers the whole canvas stops at this frame instead of crowding the tiles. */
.app-board {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  max-width: 1320px;
  padding: 26px 30px 30px;
  background: #ffffff;
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 26px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.06);
}

.apps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px 30px;
  max-width: 1400px;
}

/* Each app is a graphical rectangle "poster" + label. */
.app {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 340px;
  text-align: center;
  transition: transform 0.18s ease;
}

.app:hover {
  transform: translateY(-4px);
}

.app.soon {
  cursor: default;
  opacity: 0.5;
}

.app.soon:hover {
  transform: none;
}

.app-art {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 22px;
  overflow: hidden;
  background: #eee;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.19);
  transition: box-shadow 0.18s ease;
}

.app:hover .app-art {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.26);
}

.app-art svg,
.app-art .app-art-fallback {
  display: block;
  width: 100%;
  height: 100%;
}

.app-art-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.92);
  font-family: "Inter", sans-serif;
  font-weight: 200;
  font-size: 82px;
}

.app-label {
  font-family: "Inter", sans-serif;
  font-weight: 400;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: 0.2px;
}

.app-sub {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--ink-faint);
  margin-top: -9px;
}

/* ---------- Always-on draw control bar (subtle, bottom-right) ----------- */
.draw-bar {
  position: fixed;
  z-index: 20;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  max-width: calc(100vw - 40px);
}

.tool-btn {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--ink-dim);
  background: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 12px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.tool-btn:hover {
  color: var(--ink);
  border-color: var(--ink-faint);
}

.tool-btn.active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.draw-note {
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  letter-spacing: 0.5px;
  color: var(--ink-dim);
  white-space: nowrap;
}

/* Shared-canvas ink well: paint level (drains as you draw, reloads when empty).
   The liquid is tinted with your NEXT stroke's color, previewing it. */
.ink-well {
  position: relative;
  width: 66px;
  height: 88px;
  flex: 0 0 auto;
  border: 3px solid var(--ink-faint);
  border-top: none;
  border-radius: 0 0 15px 15px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.06);
}

.ink-liquid {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  background: #3f7d5a;
  border-top: 1px solid rgba(0, 0, 0, 0.18); /* waterline, so pale colors still read */
  transition: height 0.15s ease, background 0.15s ease;
}

.ink-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 15px;
  font-weight: 500;
  color: #fff;
  mix-blend-mode: difference; /* readable on any liquid color */
  pointer-events: none;
}

.draw-presence {
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  letter-spacing: 0.5px;
  color: #3f7d5a;
  white-space: nowrap;
}

/* ---------- Deep space: the footer below the frame --------------------- */
.deep-space {
  flex: 0 0 auto; /* a section below the frame; scroll down to reach it */
  min-height: 340px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 26px 24px;
  background:
    radial-gradient(1200px 320px at 50% -30%, #1c2044 0%, transparent 70%),
    linear-gradient(180deg, var(--space-1) 0%, var(--space-2) 100%);
  color: rgba(255, 255, 255, 0.75);
}

/* A faint scatter of stars. */
.deep-space::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 12% 40%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 24% 72%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 42% 28%, rgba(255, 255, 255, 0.65), transparent),
    radial-gradient(1px 1px at 57% 76%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 70% 44%, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(1px 1px at 83% 24%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 91% 64%, rgba(255, 255, 255, 0.55), transparent);
  opacity: 0.9;
  pointer-events: none;
}

.handles {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 26px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  letter-spacing: 1px;
}

.handles a {
  color: rgba(255, 255, 255, 0.72);
  transition: color 0.15s ease;
}

.handles a:hover {
  color: #fff;
}

.deep-caption {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.4);
}

/* Only chrome (fixed to the viewport) is responsive. The stage itself never
   reflows — it just scales — so the tiles stay identical on every device. */
@media (max-width: 620px) {
  .draw-bar {
    bottom: 12px;
    right: 12px;
  }
  .draw-note {
    display: none;
  }
}
