:root {
  --paper: #f3ede2;
  --paper-deep: #e8e0d2;
  --card: #fffaf2;
  --ink: #1c2a32;
  --ink-soft: #4a5a64;
  --mute: #7a8790;
  --line: rgba(28, 42, 50, 0.1);
  --amber: #c9843a;
  --amber-soft: #f6e4c4;
  --leaf: #5f8a66;
  --leaf-soft: #dce8d8;
  --rose: #c56b5c;
  --rose-soft: #f4d8d2;
  --sea: #3e7a8c;
  --sea-soft: #d5e7ec;
  --gold: #d4a44a;
  --shadow: 0 18px 50px rgba(80, 62, 32, 0.08);
  --radius: 22px;
  --safe-b: env(safe-area-inset-bottom, 16px);
  --safe-t: env(safe-area-inset-top, 16px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }

#app {
  height: 100%;
  max-width: 430px;
  margin: 0 auto;
  position: relative;
  background: var(--paper);
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.screen.active { display: flex; }

h1, h2, h3, .serif { font-family: Fraunces, Georgia, serif; font-weight: 500; letter-spacing: -0.03em; }
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--amber);
  font-weight: 600;
}
.page-h { font-size: 32px; line-height: 1.05; margin: 8px 0 12px; }
.lede { font-size: 17px; line-height: 1.45; color: var(--ink-soft); }
.lede.tight { margin-bottom: 16px; }

.hero { position: relative; flex: 1; min-height: 0; }
.hero.short { flex: 0 0 34%; min-height: 180px; }
.hero img { width: 100%; height: 100%; object-fit: cover; }
.veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(28,42,50,0.08) 0%, rgba(28,42,50,0.18) 40%, rgba(28,42,50,0.58) 100%);
}
.hero-copy {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 28px 22px calc(22px + var(--safe-b));
  color: #fffaf2;
}
.hero-copy .eyebrow { color: #f3d7a6; }
.hero-copy h1 { font-size: 46px; line-height: 0.95; margin: 8px 0 12px; }
.hero-copy .lede { color: rgba(255,250,242,0.92); margin-bottom: 18px; }

.topbar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  z-index: 2;
}
.topbar.paper-bar {
  position: relative;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.mark {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; box-shadow: 0 4px 16px rgba(28,42,50,0.18);
}
.ghost-btn, .ghost-label {
  font-size: 13px; letter-spacing: 0.04em;
  color: #fffaf2; padding: 8px 10px; min-width: 64px;
}
.ghost-btn.ink, .paper-bar .ghost-btn, .ghost-label.ink, .bar-title.ink { color: var(--ink); }
.ghost-label { opacity: 0.85; text-align: center; }
.bar-title { font-size: 18px; color: #fffaf2; }
.paper-bar .bar-title { color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: #fffaf2; color: var(--ink);
  border-radius: 999px; padding: 14px 22px;
  font-size: 16px; font-weight: 600;
  box-shadow: var(--shadow);
}
.btn.wide { width: 100%; margin-bottom: 10px; }
.btn.dark { background: var(--ink); color: #fffaf2; }
.btn.ghost {
  background: transparent; color: inherit;
  border: 1px solid currentColor; box-shadow: none; opacity: 0.92;
}
.hero-copy .btn.ghost { color: #fffaf2; border-color: rgba(255,250,242,0.45); }

.scroll {
  flex: 1;
  overflow-y: auto;
  padding: 22px 22px calc(28px + var(--safe-b));
  -webkit-overflow-scrolling: touch;
}

.why-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
}
.why-card h3 { font-size: 20px; margin-bottom: 6px; }
.why-card p { color: var(--ink-soft); font-size: 15px; line-height: 1.45; }

.room-list { display: flex; flex-direction: column; gap: 10px; }
.room-card {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px;
  text-align: left;
}
.room-card img {
  width: 72px; height: 72px; object-fit: cover; border-radius: 14px;
}
.room-card h3 { font-size: 20px; }
.room-card p { font-size: 13px; color: var(--ink-soft); }
.room-card .state {
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--amber); font-weight: 600; padding-right: 8px;
}
.room-card.locked { opacity: 0.45; }
.room-card.lit .state { color: var(--leaf); }

.kit-titlewrap { text-align: center; }
.kit-title { font-family: Fraunces, Georgia, serif; font-size: 18px; }
.kit-sub { font-size: 12px; color: var(--ink-soft); }
.moves {
  min-width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--amber-soft);
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-family: Fraunces, Georgia, serif;
  font-size: 20px;
}
.moves.low { background: var(--rose-soft); }

.goals {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  padding: 10px 16px 0;
}
.goal-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px; font-weight: 600;
}
.goal-chip.done { background: var(--leaf-soft); }
.goal-chip .swatch {
  width: 18px; height: 18px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}

.board-wrap {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 8px 12px;
  min-height: 0;
}
.board {
  width: min(100%, 392px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 5px;
  background: var(--paper-deep);
  border-radius: 18px;
  padding: 8px;
  touch-action: manipulation;
}
.cell {
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  user-select: none;
  position: relative;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.18s ease;
  box-shadow: 0 2px 0 rgba(28,42,50,0.06);
}
.cell.sel {
  transform: scale(1.08);
  box-shadow: 0 0 0 3px var(--ink);
  z-index: 2;
}
.cell.pop { transform: scale(0.2); opacity: 0; }
.cell.special::after {
  content: "";
  position: absolute; inset: 4px;
  border: 2px solid rgba(255,250,242,0.75);
  border-radius: 10px;
  pointer-events: none;
}
.cell.frost { box-shadow: inset 0 0 0 3px rgba(255,255,255,0.7); }
.cell.crate { outline: 3px dashed rgba(28,42,50,0.28); outline-offset: -4px; }

.t0 { background: #f3d27a; }
.t1 { background: #e8b4a4; }
.t2 { background: #9fbfa4; }
.t3 { background: #8eb4c4; }
.t4 { background: #d9c4e0; }
.t5 { background: #e8c98a; }

.kit-dock {
  padding: 8px 16px calc(12px + var(--safe-b));
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.hint { font-size: 13px; color: var(--ink-soft); text-align: center; margin-bottom: 8px; min-height: 18px; }
.dock-row { display: flex; gap: 8px; }
.tool {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 6px;
  text-align: center;
}
.tool span { display: block; font-weight: 600; font-size: 14px; }
.tool small { color: var(--mute); font-size: 11px; }
.tool.on { box-shadow: 0 0 0 2px var(--ink); }
.tool.used { opacity: 0.4; }

.palettes { display: grid; gap: 10px; margin-bottom: 18px; }
.palette {
  display: grid; grid-template-columns: 56px 1fr;
  gap: 12px; align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  text-align: left;
}
.palette .chip {
  width: 56px; height: 40px; border-radius: 10px;
}
.palette.on { box-shadow: 0 0 0 2px var(--ink); }
.palette h3 { font-size: 18px; }
.palette p { font-size: 13px; color: var(--ink-soft); }

.toast {
  position: absolute; left: 20px; right: 20px; bottom: calc(24px + var(--safe-b));
  background: var(--ink); color: #fffaf2;
  border-radius: 16px; padding: 14px 16px;
  text-align: center; font-size: 15px;
  z-index: 20;
}
.toast[hidden] { display: none; }

/* Web additions */
.hero img.mark, .topbar img.mark { width: 36px; height: 36px; flex: 0 0 36px; }
.studio-line { margin-top: 14px; font-size: 12px; color: #7a7468; text-align: center; }
.studio-line a { color: inherit; }
.studio-line.light { color: rgba(255,250,242,.8); }
.soft-pay { margin-top: 14px; padding: 14px; border-radius: 16px; background: rgba(255,250,242,.14); border: 1px solid rgba(255,250,242,.35); backdrop-filter: blur(6px); }
.soft-pay strong { display: block; color: #fffaf2; font-size: 15px; }
.soft-pay span { display: block; color: rgba(255,250,242,.88); font-size: 13.5px; margin-top: 4px; line-height: 1.4; }
.soft-pay .btn { margin-top: 10px; }
.soft-note { display: block; font-style: normal; font-size: 12px; margin-top: 8px; color: rgba(255,250,242,.85); }
@media (min-width: 700px) { body { background: #e9e1d2; } #app { box-shadow: 0 30px 80px rgba(60,50,30,.18); } }
