/* Shared styles, tuned for Apple Watch (≈162–205 CSS px wide, OLED black). */
:root {
  --bg: #000;
  --fg: #fff;
  --muted: #8e8e93;
  --card: #1c1c1e;
  --accent: #30d158;
  --danger: #ff453a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, "SF Compact Rounded", system-ui, sans-serif;
}

/* ---------- Hub ---------- */
.hub {
  padding: max(8px, env(safe-area-inset-top)) 8px max(16px, env(safe-area-inset-bottom));
  max-width: 440px;
  margin: 0 auto;
}
.hub h1 {
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  margin: 4px 0 2px;
}
.hub .sub {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 8px;
}
.chips {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -8px 8px;
  padding: 0 8px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  border: 0;
  border-radius: 14px;
  background: var(--card);
  color: var(--fg);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
}
.chip.on { background: var(--accent); color: #000; }
.tile .crown { font-size: 10px; opacity: 0.7; }
.list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
@media (min-width: 300px) {
  .list { grid-template-columns: 1fr 1fr; }
}
.tile {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border-radius: 16px;
  padding: 8px 10px;
  color: var(--fg);
  text-decoration: none;
  min-height: 48px;
  transition: transform 0.1s;
}
.tile:active { transform: scale(0.96); }
.tile .ico {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.tile .name { font-size: 14px; font-weight: 600; line-height: 1.1; }
.tile .desc { font-size: 10px; color: var(--muted); line-height: 1.2; margin-top: 1px; }
.tile .best { font-size: 10px; color: var(--accent); margin-top: 1px; }

/* ---------- Game shell ---------- */
body.game {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
canvas.full {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.back {
  position: absolute;
  top: max(4px, env(safe-area-inset-top));
  left: 6px;
  z-index: 30;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: var(--fg);
  font-size: 17px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.hud {
  position: absolute;
  top: max(6px, env(safe-area-inset-top));
  right: 8px;
  z-index: 10;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px #000;
  pointer-events: none;
  text-align: right;
}
.hud small { display: block; font-size: 10px; font-weight: 500; color: var(--muted); }

.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px;
  text-align: center;
}
.overlay h2 { font-size: 20px; font-weight: 800; }
.overlay p { font-size: 12px; color: var(--muted); line-height: 1.3; }
.overlay .big { font-size: 28px; font-weight: 800; color: var(--fg); font-variant-numeric: tabular-nums; }
.btn {
  appearance: none;
  border: 0;
  border-radius: 22px;
  background: var(--accent);
  color: #000;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 9px 26px;
  margin-top: 4px;
}
.btn:active { opacity: 0.7; }
.btn.alt { background: #2c2c2e; color: var(--fg); }
.hidden { display: none !important; }

/* ---------- Digital Crown (see W.crown) ---------- */
body.game.crown { position: static; overflow-y: scroll; scrollbar-width: none; }
body.game.crown::-webkit-scrollbar { display: none; }
body.crown canvas.full, body.crown .hud, body.crown .back, body.crown .overlay,
body.crown #area, body.crown .fixed { position: fixed; }
#crown-spacer { height: 200000px; width: 1px; pointer-events: none; }

.btn.random { display: block; text-align: center; text-decoration: none; margin: 2px auto 8px; padding: 9px 0; width: 100%; max-width: 260px; background: linear-gradient(135deg, #bf5af2, #0a84ff); color: #fff; }
