:root {
  --paper: #f6f0e4;
  --paper-deep: #ebe3d4;
  --card: #fffaf2;
  --ink: #1c2a32;
  --ink-soft: #4a5a64;
  --mute: #7a8790;
  --line: rgba(28, 42, 50, 0.1);
  --sea: #3e7a8c;
  --sea-soft: #d5e7ec;
  --sand: #e8d7b8;
  --coral: #d4725a;
  --coral-soft: #f6ddd6;
  --leaf: #5f8a66;
  --leaf-soft: #dce8d8;
  --amber: #c9843a;
  --amber-soft: #f6e4c4;
  --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;
}

.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.55) 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 { font-size: 17px; line-height: 1.45; 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 { 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.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); }

.story-body {
  flex: 1;
  overflow: auto;
  padding: 22px 22px calc(24px + var(--safe-b));
  background: var(--paper);
}
.story-body h2 { font-size: 32px; line-height: 1.1; margin: 8px 0 14px; }
.lede.tight { font-size: 17px; color: var(--ink-soft); margin-bottom: 18px; line-height: 1.45; }
.story-text p {
  font-size: 18px; line-height: 1.55; color: var(--ink);
  margin-bottom: 14px;
}
.story-text p.fine { font-size: 15px; color: var(--ink-soft); }

.kit-titlewrap { text-align: center; }
.kit-title { font-family: Fraunces, Georgia, serif; font-size: 18px; }
.kit-sub { font-size: 12px; color: var(--mute); margin-top: 2px; }
.energy {
  min-width: 48px; height: 36px;
  border-radius: 999px;
  background: var(--amber-soft); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}

.orders {
  display: flex; gap: 8px;
  padding: 10px 12px 6px;
  overflow-x: auto;
  flex-shrink: 0;
}
.order {
  flex: 1 0 118px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 10px 12px;
  min-height: 86px;
}
.order.ready { border-color: var(--leaf); background: var(--leaf-soft); }
.order .who { font-size: 12px; color: var(--mute); letter-spacing: 0.06em; text-transform: uppercase; }
.order .ask { font-size: 14px; margin-top: 4px; font-weight: 600; line-height: 1.3; }
.order .need { margin-top: 8px; display: flex; gap: 6px; font-size: 20px; }
.order .need span { opacity: 0.35; }
.order .need span.have { opacity: 1; }

.board-wrap {
  flex: 1;
  min-height: 0;
  padding: 6px 12px 8px;
  display: flex;
}
.board {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 7px;
}
.cell {
  background: #efe6d4;
  border-radius: 16px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.cell.gen { background: var(--sea-soft); }
.cell.selected {
  box-shadow: 0 0 0 3px var(--sea);
  transform: translateY(-2px);
  background: #fffaf2;
}
.cell.hint {
  box-shadow: 0 0 0 3px var(--amber);
}
.cell .ico { font-size: 26px; line-height: 1; }
.cell .lvl {
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-soft); margin-top: 3px; font-weight: 600;
}
.cell.empty .ico, .cell.empty .lvl { display: none; }
.cell.pulse { animation: pop 0.28s ease; }
@keyframes pop {
  0% { transform: scale(0.86); }
  70% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.kit-dock {
  padding: 4px 16px calc(12px + var(--safe-b));
  background: var(--paper);
}
.hint {
  font-size: 14px; color: var(--ink-soft); line-height: 1.4;
  min-height: 38px;
}
.dock-row { display: flex; gap: 8px; margin-top: 6px; }
.dock-row .btn { flex: 1; padding: 11px 10px; font-size: 14px; color: var(--ink); border-color: var(--line); }

.palettes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.palette {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 14px 16px; text-align: left;
}
.palette.on { border-color: var(--sea); box-shadow: 0 0 0 2px var(--sea-soft); }
.swatch {
  width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0;
}
.palette h3 { font-size: 18px; }
.palette p { font-size: 14px; color: var(--ink-soft); }

.toast {
  position: absolute; left: 50%; bottom: 88px; transform: translateX(-50%);
  background: var(--ink); color: #fffaf2;
  padding: 10px 16px; border-radius: 999px; font-size: 14px;
  z-index: 20; pointer-events: 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); } }
