:root {
  /* Size of one art pixel in CSS px; main.js keeps it in sync with the canvas scale. */
  --px: 4px;
  --b: max(2px, var(--px));
  --ink: #2a1d14;
  --paper: #f7eedb;
  --paper-shade: #e2d0ad;
  --accent: #b4532a;
  --muted: #7a6450;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #343030;
}

body {
  font-family: 'Pixelify Sans', ui-monospace, Menlo, monospace;
  color: var(--ink);
  -webkit-font-smoothing: none;
}

#stage {
  position: fixed;
  left: 0;
  top: 0;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  cursor: default;
}
#stage[data-cursor='grab'] { cursor: grab; }
#stage[data-cursor='grabbing'] { cursor: grabbing; }
#stage[data-cursor='pointer'] { cursor: pointer; }
#stage:focus-visible { outline: 3px dashed #fff; outline-offset: -8px; }

/* Pixel-notched border: four one-axis shadows leave the corners empty. */
.pixel-box,
.hint,
.card {
  background: var(--paper);
  box-shadow:
    0 calc(-1 * var(--b)) 0 0 var(--ink),
    0 var(--b) 0 0 var(--ink),
    calc(-1 * var(--b)) 0 0 0 var(--ink),
    var(--b) 0 0 0 var(--ink),
    0 calc(var(--b) * 3) 0 0 rgb(0 0 0 / 0.28);
}

.skip {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 10;
  padding: 8px 14px;
  color: var(--ink);
  font-size: 16px;
  text-decoration: none;
  background: var(--paper);
  box-shadow: 0 0 0 3px var(--ink);
}
.skip:focus { top: 16px; }

/* Subdued corner controls; safe-area insets keep them clear of notches in landscape. */
.corner {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  z-index: 4;
  display: flex;
  gap: 10px;
}
.pill {
  padding: 2px 9px 4px;
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  color: var(--muted);
  background: rgb(247 238 219 / 0.6);
  border: 0;
  box-shadow:
    0 -2px 0 0 rgb(42 29 20 / 0.45),
    0 2px 0 0 rgb(42 29 20 / 0.45),
    -2px 0 0 0 rgb(42 29 20 / 0.45),
    2px 0 0 0 rgb(42 29 20 / 0.45);
  opacity: 0.75;
  cursor: pointer;
}
.pill[hidden] { display: none; }
.season::before { content: '\21BB\00a0'; }
.shake::before { content: '\224B\00a0'; }
/* Solid: the season button always, the shake toggle when on. "shake: off" stays dimmed so
   it reads as the off state of a toggle. */
.season,
.pill:hover,
.pill:focus-visible,
.shake[aria-pressed='true'] {
  color: var(--ink);
  background: var(--paper);
  opacity: 1;
  outline: none;
}
.season:hover,
.shake[aria-pressed='true']:hover {
  background: var(--paper-shade);
}
.pill:disabled {
  cursor: default;
  opacity: 0.5;
}

.hint {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 2;
  margin: 0;
  padding: 3px 12px 5px;
  font-size: clamp(16px, calc(var(--px) * 4.2), 24px);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%);
  transition: opacity 0.2s steps(3);
}
.hint.show {
  opacity: 1;
  animation: bob 0.9s steps(2, jump-none) infinite;
}
@keyframes bob {
  0%, 100% { transform: translate(-50%, -100%); }
  50% { transform: translate(-50%, calc(-100% - var(--b))); }
}

.card {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 3;
  width: min(340px, calc(100vw - 32px));
  padding: 18px 22px 14px;
  visibility: hidden;
}
.card.show {
  visibility: visible;
  animation: pop 0.45s steps(5, jump-none) both;
}
.card.instant { animation: none; }
@keyframes pop {
  0% { transform: translateY(14px) scale(0.6); opacity: 0; }
  60% { transform: translateY(-4px) scale(1.04); opacity: 1; }
  100% { transform: none; opacity: 1; }
}

.card h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-size: clamp(24px, calc(var(--px) * 6), 34px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.01em;
}
.card h1 img {
  width: 1.05em;
  height: 1.05em;
  image-rendering: pixelated;
}

.contact-line {
  margin: 0;
  font-size: clamp(17px, calc(var(--px) * 3.8), 22px);
}
.card a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.card a:hover,
.card a:focus-visible {
  color: var(--paper);
  background: var(--accent);
  text-decoration: none;
  outline: none;
}

.again {
  margin: 12px 0 0;
  padding: 2px 0;
  font: inherit;
  font-size: 15px;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
}
.again:hover,
.again:focus-visible {
  color: var(--ink);
  text-decoration: underline;
  outline: none;
}

/* ?sensors readout */
.sensors {
  position: fixed;
  left: calc(8px + env(safe-area-inset-left));
  bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 5;
  margin: 0;
  padding: 6px 8px;
  font: 11px/1.35 ui-monospace, Menlo, monospace;
  color: #e8f0e0;
  background: rgb(0 0 0 / 0.72);
  white-space: pre;
}

@media (prefers-reduced-motion: reduce) {
  .hint.show,
  .card.show { animation: none; }
}
