:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --front-a: #11151b;
  --front-b: #0e1217;
  --front-c: #151a22;
  --front-d: #10151c;
  /* Fallback flip-back; JS assigns Grok theme-picker accents per tile */
  --back: #1084FE;
  --accent-white: #E8ECF2;
  --accent-brown: #A56A3A;
  --accent-red: #FF263C;
  --accent-orange: #FF6700;
  --accent-amber: #FF9800;
  --accent-green: #00C972;
  --accent-teal: #00BCA6;
  --accent-blue: #1084FE;
  --accent-purple: #9159FE;
  --accent-pink: #FF309B;
  --accent-gray: #777777;
  --border: rgba(198, 207, 222, 0.1);
  --egg: #a6adba;
  --egg-hover: #d8deeb;
  --gap: 2px;
  --tile: 48px;
  --flip-ms: 420ms;
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--egg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  /* none: finger swipe owns the gesture for tile trail (not page scroll) */
  touch-action: none;
}

.grid {
  position: fixed;
  inset: 0;
  display: grid;
  gap: var(--gap);
  padding: var(--gap);
  perspective: 900px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.tile {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  transform-style: preserve-3d;
  transition: transform var(--flip-ms) cubic-bezier(0.22, 0.61, 0.36, 1);
  cursor: pointer;
  will-change: transform;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.tile.flipped {
  transform: rotateY(180deg);
}

.face {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.face.front {
  background: var(--front-a);
}

.tile:nth-child(3n) .face.front { background: var(--front-b); }
.tile:nth-child(5n) .face.front { background: var(--front-c); }
.tile:nth-child(7n) .face.front { background: var(--front-d); }

.face.back {
  background: var(--back);
  transform: rotateY(180deg);
}

.egg {
  position: fixed;
  right: 12px;
  bottom: 10px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 11px;
  letter-spacing: 0.04em;
  opacity: 0.45;
  transition: opacity 180ms ease;
  pointer-events: none;
}

.egg:hover,
.egg:focus-within {
  opacity: 0.9;
}

.egg-mail {
  color: inherit;
  text-decoration: none;
  pointer-events: auto;
  border-bottom: 1px solid transparent;
}

.egg-mail:hover,
.egg-mail:focus-visible {
  color: var(--egg-hover);
  border-bottom-color: currentColor;
  outline: none;
}

.egg-sep { opacity: 0.7; }

@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; }
}
