:root {
  --ink: #1A1A1A;
  --pine: #305032;
  --gold: #C19A50;
  --cream: #F3E6C4;
  --paper: #F3EEDF;
  --bg: #1A1A1A;
  --fg: #F3E6C4;
  --panel: #241c14;
  --line: rgba(193, 154, 80, .85);
  --desk: #2a2118;
}
html[data-theme="light"] {
  --bg: #F3EEDF;
  --fg: #1A1A1A;
  --panel: #fffaf0;
  --line: #305032;
  --desk: #d9c7a2;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--desk);
  color: var(--fg);
  font-family: Georgia, "Iowan Old Style", Palatino, "Palatino Linotype", serif;
}
body {
  display: flex;
  justify-content: center;
}
#app {
  width: min(100vw, 480px);
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}
button, .linkish {
  font-family: inherit;
  background: var(--pine);
  color: var(--cream);
  border: 2px solid var(--gold);
  border-radius: 12px;
  min-height: 48px;
  padding: 10px 14px;
  font-size: 17px;
  cursor: pointer;
  text-align: center;
}
button:active { transform: scale(.98); }
button:disabled { opacity: .45; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: 12px 14px 16px;
}
.screen.on { display: flex; }
#screen-title, #screen-how, #screen-daily, #screen-scores, #screen-store, #screen-settings { overflow: auto; }
#screen-play { padding: 10px 12px; }
a.hub-link {
  color: var(--gold);
  font-size: 15px;
  text-decoration: underline;
  background: none;
  border: 0;
  padding: 0;
  min-height: 0;
}
.hub-row { margin: 0 0 8px; }
html[data-theme="light"] a.hub-link { color: var(--pine); }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.brand {
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--gold);
  font-weight: 700;
}
h1 {
  font-size: 34px;
  line-height: 1.02;
  margin: 2px 0 6px;
  color: var(--fg);
}
h2 { margin: 0 0 8px; font-size: 26px; color: var(--fg); }
h3 { margin: 14px 0 6px; font-size: 16px; color: var(--gold); }
html[data-theme="light"] h3 { color: var(--pine); }
.tag { margin: 0 0 4px; font-size: 16px; }
.fine { font-size: 14px; margin: 8px 0 0; }
#titleArt {
  width: 100%;
  height: auto;
  border-radius: 16px;
  border: 3px solid var(--pine);
  display: block;
  background: #1A1A1A;
}
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.menu-grid .wide { grid-column: 1 / -1; }
.theme-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 8px 0 12px;
}
.choice[aria-pressed="true"] {
  background: var(--gold);
  color: #1A1A1A;
  border-color: var(--pine);
}
#hud {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
#goalText { flex: 1; font-size: 16px; }
#scoreText { font-variant-numeric: tabular-nums; font-size: 16px; }
#hud button, #pauseBtn, #hudMute {
  min-height: 40px;
  padding: 6px 10px;
  font-size: 14px;
}
#boardWrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
#board { touch-action: none; background: transparent; }
#previews {
  display: flex;
  gap: 8px;
  align-items: stretch;
  justify-content: space-between;
  padding: 6px 0 4px;
}
.pv {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  min-width: 96px;
  padding: 4px 8px 8px;
  border: 3px solid var(--gold);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .22), 0 2px 0 rgba(26, 26, 26, .16);
}
.pv canvas {
  width: 88px;
  height: 56px;
  border-radius: 8px;
  background: rgba(26, 26, 26, .16);
}
html[data-theme="light"] .pv canvas { background: rgba(48, 80, 50, .08); }
.stat-card {
  flex: 1;
  align-items: stretch;
  justify-content: center;
  min-width: 108px;
  gap: 4px;
  text-align: left;
}
.stat-card div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  font-size: 13px;
}
.stat-card b { font-variant-numeric: tabular-nums; }
.intro-card { text-align: center; }
#winBird {
  width: 160px;
  height: 88px;
  display: block;
  margin: 0 auto 2px;
}
#pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  touch-action: none;
}
#pad button { font-size: 18px; }
.icon-btn {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  transition: transform .08s ease;
}
.icon-btn svg {
  width: 28px;
  height: 28px;
  display: block;
}
.icon-btn:active,
.icon-btn.is-down {
  transform: translateY(2px) scale(.94);
}
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 26, .78);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 5;
}
html[data-theme="light"] .overlay { background: rgba(243, 238, 223, .88); }
.overlay.on { display: flex; }
.panel {
  background: var(--panel);
  color: var(--fg);
  border: 2px solid var(--gold);
  border-radius: 16px;
  padding: 16px;
  width: min(100%, 400px);
  max-height: min(100%, 640px);
  overflow: auto;
}
.panel .stack { display: flex; flex-direction: column; gap: 8px; }
.stars { font-size: 34px; letter-spacing: 4px; color: var(--gold); margin: 6px 0; }
.stars .pop { display: inline-block; animation: pop .35s ease both; }
@keyframes pop {
  0% { transform: scale(.2); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .stars .pop { animation: none; }
  button:active, .icon-btn.is-down { transform: none; }
  .icon-btn { transition: none; }
}
#levelList { overflow: auto; flex: 1; min-height: 0; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.lvl {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 72px;
  padding: 8px;
}
.lvl .n { font-size: 12px; opacity: .85; }
.lvl .nm { font-size: 13px; text-align: left; line-height: 1.2; }
.lvl .st { color: var(--gold); font-size: 12px; letter-spacing: 1px; }
input {
  font-family: inherit;
  font-size: 18px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 2px solid var(--pine);
  background: #fff;
  color: #1A1A1A;
  min-height: 48px;
  width: 100%;
}
.row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.small { font-size: 15px; line-height: 1.4; }
.q { font-size: 28px; margin: 8px 0; }
a { color: var(--gold); }
html[data-theme="light"] a { color: var(--pine); }
#btnPrivacy {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--cream);
}
.tools { display: flex; gap: 8px; margin-top: 8px; }
.tools button { min-height: 40px; padding: 6px 12px; font-size: 15px; }
.sku {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  margin: 8px 0;
}
.sku b { display: block; }
.scoreline { padding: 4px 0; border-bottom: 1px solid var(--line); }
body.sheet { display: block; height: auto; overflow: auto; background: var(--bg); color: var(--fg); }
body.sheet #app {
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: visible;
  padding-bottom: 32px;
}
body.sheet main { padding: 18px 18px 24px; }
body.sheet h1 { font-size: 30px; }
body.sheet h2 { font-size: 22px; margin-top: 22px; }
body.sheet p, body.sheet li { font-size: 16px; line-height: 1.45; }
body.sheet ul { padding-left: 18px; }
@media (max-height: 700px) {
  h1 { font-size: 28px; }
  #pad { gap: 6px; }
  #pad button { min-height: 42px; font-size: 16px; }
  .screen { padding-top: 8px; }
}
