:root {
  --night: #11131c;
  --paper: #f2ece1;
  --muted: #959ba9;
  --faint: #5d6372;
  --lamp: #ff9f45;
  --ink: #1d120b;
  --display: "Futura-CondensedExtraBold", "Futura Condensed ExtraBold", "Jost", Futura, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--night);
  color: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  overflow: hidden;
}

#sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }

#app {
  position: relative;
  z-index: 1;
  max-width: 520px;
  height: 100%;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 8px) 16px calc(env(safe-area-inset-bottom) + 10px);
}

.screen { height: 100%; display: flex; flex-direction: column; }
.hidden { display: none !important; }

h1, h2 {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: condensed;
  margin: 0;
  line-height: 0.95;
}

/* Glass: blur what is behind, a light edge on top, a soft shadow below */
.glass {
  background: rgba(255, 255, 255, 0.075);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  backdrop-filter: blur(18px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -1px 0 rgba(255, 255, 255, 0.04), 0 10px 28px rgba(0, 0, 0, 0.35);
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  transition: transform 0.12s ease-out, filter 0.12s;
}
button:active { transform: scale(0.97); filter: brightness(1.15); }
button:disabled { opacity: 0.35; }

svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 0 22px;
  border-radius: 18px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 700;
  background: linear-gradient(180deg, #ffc27a 0%, #ff9f45 48%, #ef8628 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -2px 6px rgba(160, 60, 0, 0.25), 0 12px 32px rgba(255, 159, 69, 0.28);
}
.cta .meta { font-size: 15px; font-weight: 600; opacity: 0.75; }
#next.cta { justify-content: center; }
.wide { width: 100%; }

.btn { min-height: 50px; border-radius: 18px; font-weight: 600; font-size: 16px; }

/* Home */
#hero { width: min(100%, 46vh); aspect-ratio: 1; margin-top: 2vh; }
#home h1 { font-size: clamp(56px, 17vw, 76px); margin-top: 24px; }
.lead { color: var(--muted); font-size: 17px; margin: 6px 0 0; max-width: 300px; }
.homeButtons { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding-bottom: 6px; }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 18px;
  border-radius: 24px;
  text-align: left;
}
.rowText { display: flex; flex-direction: column; gap: 2px; }
.rowText b { font-size: 18px; }
.rowText small, .streak small { color: var(--muted); font-size: 13px; }
.streak { display: flex; flex-direction: column; align-items: flex-end; }
.streak b { font-family: var(--display); font-weight: 800; font-stretch: condensed; font-size: 34px; line-height: 1; color: var(--faint); }
.streak b.lit { color: var(--lamp); }
.tip { color: var(--muted); font-size: 14px; text-align: center; margin: 0; }

/* Game */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.circle { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.circle.small { width: 32px; height: 32px; }
.circle.small svg { width: 14px; height: 14px; }
.title { text-align: center; }
.title h2 { font-size: 30px; }
.title small { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.rules { color: var(--muted); font-size: 12.5px; text-align: center; margin: 8px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.boardWrap { flex: 1; display: grid; place-items: center; min-height: 0; padding: 8px 0; }
#board { width: min(100%, 52vh); aspect-ratio: 1; touch-action: none; border-radius: 10px; box-shadow: 0 22px 40px rgba(0, 0, 0, 0.55); }
.hintArea { height: 96px; display: grid; place-items: center; }
.hint { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 8px 10px 12px; border-radius: 22px; }
#hintFace { width: 38px; height: 38px; flex: none; }
.hint p { margin: 0; font-size: 15px; font-weight: 500; flex: 1; line-height: 1.3; }
.tools { display: flex; gap: 10px; padding-top: 6px; }
.tool {
  flex: 1;
  min-height: 60px;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
}
.tool em { font-style: normal; color: var(--lamp); }

/* Sheets */
.scrim { position: fixed; inset: 0; z-index: 5; background: rgba(8, 9, 14, 0.45); }
.sheet {
  position: fixed;
  z-index: 6;
  left: 10px;
  right: 10px;
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  max-width: 500px;
  margin: 0 auto;
  padding: 26px 22px 14px;
  border-radius: 34px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(17, 19, 28, 0.55);
  animation: rise 0.42s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes rise { from { transform: translateY(40px) scale(0.96); opacity: 0; } }
.sheet h2 { font-size: 40px; }
.stats { display: flex; gap: 24px; }
.stats small { display: block; color: var(--muted); font-size: 13px; }
.stats b { font-family: var(--display); font-weight: 800; font-stretch: condensed; font-size: 34px; font-variant-numeric: tabular-nums; }
.note { margin: 0; color: var(--lamp); font-weight: 600; font-size: 15px; }
.muted { color: var(--muted); margin: 0; font-size: 15px; }
dl { margin: 0; }
dt { font-family: var(--display); font-weight: 800; font-stretch: condensed; font-size: 24px; margin-top: 8px; }
dd { margin: 0 0 4px; color: var(--muted); font-size: 15px; }

.toast {
  position: fixed;
  z-index: 7;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 110px);
  transform: translateX(-50%);
  width: min(90vw, 420px);
  padding: 14px 18px;
  border-radius: 20px;
  font-size: 15px;
  text-align: center;
}

@media (prefers-reduced-transparency: reduce) {
  .glass { background: #1b1e2a; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet { animation: none; }
}
