/* ════════════════════════════════════════════════════════════════════════
   APP-STUDIO.CSS — Fill and Wonder Coloring App (public/app.html)
   Mobile-first. Self-contained (does not load styles.css) so the app can be
   bundled into a native WebView without the storefront stylesheet.
   ════════════════════════════════════════════════════════════════════════ */

:root {
  --paper: #FAF7F2;
  --card: #FFFFFF;
  --cream: #FFF9EE;
  --sand: #E9DFCF;
  --slate: #263240;
  --slate-2: #364A5E;
  --muted: #5F6B78;
  --amber: #F2A93B;
  --amber-dark: #C97F12;
  --amber-soft: #FDF0D8;
  --teal: #2A9D9A;
  --teal-soft: #E3F3F0;
  --coral: #E4573D;
  --coral-soft: #FCE6E1;
  --danger: #B83A3A;
  --display: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
  --body: 'Jost', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r-sm: 12px;
  --r: 14px;
  --r-lg: 16px;
  --shadow: 0 6px 22px rgba(38, 50, 64, .08);
  --shadow-lg: 0 18px 50px rgba(38, 50, 64, .18);
  --tap: 44px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --header-h: 58px;
  --tabbar-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; background: var(--paper); color: var(--slate); }
body {
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* Bilingual: same convention as the storefront */
body[data-lang="es"] .lang-en { display: none !important; }
body:not([data-lang="es"]) .lang-es { display: none !important; }

h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; line-height: 1.15; }

:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--slate); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus { left: 0; }

/* ─────────────── Header ─────────────── */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: calc(var(--header-h) + var(--safe-t));
  padding: var(--safe-t) calc(16px + var(--safe-r)) 0 calc(16px + var(--safe-l));
  background: rgba(250, 247, 242, .94);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--sand);
}
.app-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-height: var(--tap); }
.app-brand img { width: 32px; height: 32px; }
.app-brand-text { font-family: var(--display); font-weight: 600; font-size: 1.2rem; letter-spacing: .2px; }
.app-brand-text em { font-style: normal; color: var(--amber-dark); }
.app-header-actions { display: flex; align-items: center; gap: 8px; }
.lang-toggle, .shop-link {
  min-width: var(--tap); min-height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--sand);
  background: var(--card); text-decoration: none; font-weight: 600; font-size: .9rem; cursor: pointer;
}
.shop-link svg { width: 18px; height: 18px; }
.lang-toggle:hover, .shop-link:hover { border-color: var(--amber); }

/* ─────────────── Main + views ─────────────── */
.app-main {
  padding: 18px calc(16px + var(--safe-r)) calc(var(--tabbar-h) + var(--safe-b) + 28px) calc(16px + var(--safe-l));
  max-width: 1180px; margin: 0 auto; outline: none;
}
.view-head { margin: 4px 2px 16px; }
.view-head h1 { font-size: 1.75rem; }
.view-sub { margin: 6px 0 0; color: var(--muted); }

/* Filter tabs: horizontally scrollable chip row */
.filter-tabs {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; margin: 0 -2px 6px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tab {
  flex: 0 0 auto; min-height: var(--tap); padding: 0 16px; border-radius: 999px;
  border: 1.5px solid var(--sand); background: var(--card); font-weight: 500; cursor: pointer; white-space: nowrap;
}
.filter-tab.active { background: var(--slate); border-color: var(--slate); color: #fff; }

/* Card grid: 2 columns phones, 3 tablets, 4 desktop */
.page-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (min-width: 600px) { .page-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; } }
@media (min-width: 1024px) { .page-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; } }

.page-card {
  position: relative; display: flex; flex-direction: column; text-align: left;
  padding: 0; border: 1.5px solid var(--sand); border-radius: var(--r-lg); background: var(--card);
  box-shadow: var(--shadow); overflow: hidden; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.page-card:hover { transform: translateY(-2px); border-color: var(--amber); box-shadow: var(--shadow-lg); }
.page-card:active { transform: scale(.98); }
.page-thumb { position: relative; aspect-ratio: 1 / 1; background: #fff; border-bottom: 1.5px solid var(--sand); }
.page-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.page-card.locked .page-thumb img { opacity: .72; }
/* A short story card: its cover (object-fit: cover); a locked Club item gets a soft placeholder instead of an image. */
.page-card.book-card .page-thumb img { object-fit: cover; padding: 0; }
.book-placeholder { position: absolute; inset: 18%; border-radius: 12px; border: 3px solid var(--sand);
  background: repeating-linear-gradient(135deg, #FFF6E5 0 14px, #FDEFD8 14px 28px); }
.page-info { padding: 10px 12px 12px; min-height: 58px; }
.page-title { font-family: var(--display); font-weight: 500; font-size: 1rem; line-height: 1.2; }
.page-meta { color: var(--muted); font-size: .82rem; margin-top: 2px; }

.badges { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; gap: 6px; pointer-events: none; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; line-height: 1.4;
}
.badge svg { width: 13px; height: 13px; stroke-width: 2.5; }
.badge-free { background: var(--teal); color: #fff; }
.badge-new { background: var(--coral); color: #fff; }
.badge-lock { background: var(--slate); color: #fff; margin-left: auto; }
.badge-owned { background: var(--amber); color: var(--slate); }
.badge-done { background: var(--teal-soft); color: var(--teal); }
.star-mark { position: absolute; right: 8px; bottom: 8px; color: var(--amber); }
.star-mark svg { fill: var(--amber); stroke: var(--amber-dark); width: 24px; height: 24px; }

.empty-state {
  grid-column: 1 / -1; text-align: center; padding: 38px 20px; background: var(--card);
  border: 1.5px dashed var(--sand); border-radius: var(--r-lg); color: var(--muted);
}
.empty-state h3 { color: var(--slate); font-size: 1.15rem; margin-bottom: 6px; }
.empty-state .btn { margin-top: 14px; }

/* ─────────────── Daily ─────────────── */
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 18px; }
.day-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 64px; border-radius: var(--r-sm); border: 1.5px solid var(--sand); background: var(--card);
  font-size: .78rem; color: var(--muted); cursor: pointer; padding: 6px 0;
}
.day-cell b { font-family: var(--display); font-size: 1.1rem; color: var(--slate); font-weight: 600; }
.day-cell.today { border-color: var(--amber); background: var(--amber-soft); }
.day-cell.future { opacity: .5; cursor: default; }
.day-cell .day-dot { width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.day-cell.colored .day-dot { background: var(--teal); }
.day-cell.selected { outline: 3px solid var(--slate); outline-offset: 1px; }

.daily-card {
  display: grid; gap: 18px; background: var(--card); border: 1.5px solid var(--sand);
  border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow);
}
@media (min-width: 760px) { .daily-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; padding: 24px; } }
.daily-art { position: relative; aspect-ratio: 1/1; background: #fff; border-radius: var(--r); border: 1.5px solid var(--sand); overflow: hidden; }
.daily-art img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.daily-kicker { color: var(--amber-dark); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; font-size: .8rem; }
.daily-card h2 { font-size: 1.6rem; margin: 6px 0 8px; }
.daily-card p { margin: 0 0 16px; color: var(--muted); }
.streak { margin-top: 12px; color: var(--teal); font-weight: 600; }

/* ─────────────── Library ─────────────── */
.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px;
  background: var(--amber-soft); border: 1.5px solid var(--sand); border-radius: 999px; margin-bottom: 16px;
}
.seg-btn {
  min-height: var(--tap); border: 0; border-radius: 999px; background: transparent; font-weight: 600;
  cursor: pointer; padding: 0 10px; color: var(--muted);
}
.seg-btn.active { background: var(--card); color: var(--slate); box-shadow: 0 2px 8px rgba(38, 50, 64, .12); }
.segmented.small { max-width: 320px; margin: 10px 0 0; }

.owned-books { margin-bottom: 18px; }
.owned-books h2 { font-size: 1.1rem; margin-bottom: 10px; }
.owned-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.owned-book {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 8px 14px 8px 8px;
  background: var(--card); border: 1.5px solid var(--sand); border-radius: var(--r);
}
.owned-cover { width: 48px; height: 48px; border-radius: 10px; background: var(--amber-soft); display: grid; place-items: center; overflow: hidden; }
.owned-cover img { width: 100%; height: 100%; object-fit: cover; }
.owned-book small { display: block; color: var(--muted); }

/* ─────────────── Account ─────────────── */
.card {
  background: var(--card); border: 1.5px solid var(--sand); border-radius: var(--r-lg);
  padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.card-title { font-size: 1.15rem; }
.card p { margin: 6px 0 0; color: var(--muted); }
.card .btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.club-card { background: linear-gradient(135deg, var(--amber-soft), var(--teal-soft)); }
.club-status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; margin-top: 8px; }
.club-status.on { color: var(--teal); }
.club-when { color: var(--muted); font-size: .9rem; margin: 6px 0 0; }
.row-link { display: flex; align-items: center; justify-content: space-between; min-height: var(--tap); text-decoration: none; font-weight: 500; }
.fine-print { font-size: .8rem; color: var(--muted); text-align: center; margin: 10px 0 0; }

/* ─────────────── Buttons ─────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border-radius: var(--r-sm);
  border: 1.5px solid var(--sand); background: var(--card); font-weight: 600; cursor: pointer;
  text-decoration: none; text-align: center;
}
.btn:hover { border-color: var(--slate-2); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--slate); }
.btn.primary:hover { background: #F5B755; }
.btn.teal { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.danger { color: var(--danger); border-color: #EBC9C9; }
.btn.danger.primary, .btn.primary.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn svg { width: 20px; height: 20px; }

/* ─────────────── Bottom tab bar ─────────────── */
.tab-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 4px calc(8px + var(--safe-r)) calc(4px + var(--safe-b)) calc(8px + var(--safe-l));
  background: rgba(255, 255, 255, .97); border-top: 1px solid var(--sand);
  box-shadow: 0 -6px 20px rgba(38, 50, 64, .06);
}
.tab-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; text-decoration: none; color: var(--muted); font-size: .76rem; font-weight: 600;
  border-radius: var(--r-sm);
}
.tab-item svg { width: 24px; height: 24px; }
.tab-item.active { color: var(--slate); }
.tab-item.active svg { color: var(--amber-dark); stroke-width: 2.4; }
@media (min-width: 900px) {
  .tab-bar { left: 50%; right: auto; transform: translateX(-50%); bottom: calc(12px + var(--safe-b)); width: 520px;
             border: 1px solid var(--sand); border-radius: 999px; padding: 4px 10px; }
  .tab-item { flex-direction: row; gap: 8px; font-size: .9rem; }
}

/* ─────────────── Coloring Studio ─────────────── */
.studio {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column;
  background: var(--paper); height: 100vh; height: 100dvh;
}
.studio-top {
  display: flex; align-items: center; gap: 8px;
  padding: calc(6px + var(--safe-t)) calc(10px + var(--safe-r)) 6px calc(10px + var(--safe-l));
  background: var(--card); border-bottom: 1px solid var(--sand);
}
.studio-title-wrap { flex: 1; min-width: 0; }
.studio-title { font-family: var(--display); font-weight: 600; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.studio-status { font-size: .78rem; color: var(--muted); min-height: 1em; }
.studio-story {
  background: var(--card); border-bottom: 1px solid var(--sand);
  padding: 8px calc(14px + var(--safe-r)) 10px calc(14px + var(--safe-l));
  max-height: 9em; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.studio-story[hidden] { display: none; }
.studio-story-text {
  margin: 0 auto; max-width: 46rem; text-align: center;
  font-family: var(--display); font-size: 1.125rem; font-weight: 700; line-height: 1.4; color: var(--slate);
}
.story-nav { display: flex; gap: 6px; flex: 0 0 auto; }
.story-nav[hidden] { display: none; }
.icon-btn {
  width: var(--tap); height: var(--tap); flex: 0 0 auto; display: inline-grid; place-items: center;
  border-radius: 50%; border: 1.5px solid var(--sand); background: var(--card); cursor: pointer; padding: 0;
}
.icon-btn:hover:not([disabled]) { border-color: var(--slate-2); }
.icon-btn[disabled] { opacity: .4; cursor: default; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 16px;
  border-radius: 999px; border: 0; background: var(--teal); color: #fff; font-weight: 600; cursor: pointer;
}

.studio-stage {
  position: relative; flex: 1; min-height: 0; overflow: hidden;
  touch-action: none; /* no scrolling, pinch-zoom of the page or rubber-banding while coloring */
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  background:
    radial-gradient(circle at 1px 1px, rgba(38, 50, 64, .07) 1px, transparent 0) 0 0 / 18px 18px,
    var(--paper);
  cursor: crosshair;
}
.studio-stage.panning { cursor: grabbing; }
.canvas-wrap {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform;
  background: #fff; border-radius: 6px; box-shadow: var(--shadow-lg);
}
.canvas-wrap .layer { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 6px; }
.canvas-wrap .layer.line { pointer-events: none; }
/* Built-in pages: the SVG itself sits on top; multiply turns its white to "see-through" and keeps lines vector-crisp at any zoom. */
.canvas-wrap .layer.vector { mix-blend-mode: multiply; -webkit-user-drag: none; }
.stage-loading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(250, 247, 242, .7); }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--sand); border-top-color: var(--amber); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.zoom-controls {
  position: absolute; right: calc(10px + var(--safe-r)); top: 10px; display: flex; flex-direction: column; gap: 8px;
}
.icon-btn.small svg { width: 20px; height: 20px; }

.studio-bottom {
  background: var(--card); border-top: 1px solid var(--sand);
  padding: 8px calc(10px + var(--safe-r)) calc(8px + var(--safe-b)) calc(10px + var(--safe-l));
}
.palette { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.swatch {
  position: relative; flex: 0 0 auto; width: var(--tap); height: var(--tap); border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--sand); cursor: pointer; padding: 0;
}
.swatch.light { box-shadow: 0 0 0 1.5px #C9BFAE; }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 3px var(--slate); transform: scale(1.06); }
.swatch[aria-checked="true"]::after {
  content: ''; position: absolute; inset: 11px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .9);
}
.swatch.light[aria-checked="true"]::after { border-color: rgba(38, 50, 64, .55); }
.swatch-custom {
  position: relative; flex: 0 0 auto; width: var(--tap); height: var(--tap); border-radius: 50%; overflow: hidden;
  background: conic-gradient(#E4573D, #F2A93B, #F7D046, #7CC46A, #2A9D9A, #4C7BD9, #9B6BD3, #E4573D);
  box-shadow: 0 0 0 1.5px var(--sand); cursor: pointer;
}
.swatch-custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.swatch-custom[aria-checked="true"] { box-shadow: 0 0 0 3px var(--slate); }
.swatch-custom .plus { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 20px; text-shadow: 0 1px 2px rgba(0,0,0,.4); pointer-events: none; }

.toolbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tool-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap);
  border-radius: var(--r-sm); border: 1.5px solid var(--sand); background: var(--paper); font-weight: 600; cursor: pointer; font-size: .9rem;
}
.tool-btn:hover { border-color: var(--slate-2); }
@media (min-width: 900px) {
  .studio-bottom { display: flex; align-items: center; gap: 16px; }
  .palette { flex: 1; padding-bottom: 4px; }
  .toolbar { flex: 0 0 auto; width: 380px; }
}

/* ─────────────── Modals ─────────────── */
.modal-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(38, 50, 64, .45); animation: fade .15s ease; }
.modal {
  position: fixed; z-index: 80; background: var(--card); color: var(--slate);
  box-shadow: var(--shadow-lg); overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.modal h2 { font-size: 1.45rem; margin-bottom: 6px; padding-right: 40px; }
.modal-close {
  position: absolute; top: 10px; right: 10px; width: var(--tap); height: var(--tap); display: grid; place-items: center;
  border-radius: 50%; border: 0; background: var(--paper); cursor: pointer;
}
/* Bottom sheet on phones, centered card on bigger screens */
.sheet-modal {
  left: 0; right: 0; bottom: 0; max-height: calc(100dvh - var(--safe-t) - 24px); max-height: calc(100vh - var(--safe-t) - 24px);
  border-radius: 22px 22px 0 0; padding: 22px calc(18px + var(--safe-r)) calc(20px + var(--safe-b)) calc(18px + var(--safe-l));
  animation: rise .22s ease;
}
.dialog-modal {
  left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px));
  border-radius: var(--r-lg); padding: 22px; animation: fade .15s ease; text-align: center;
}
.dialog-modal h2 { padding-right: 0; }
.dialog-modal p { color: var(--muted); margin: 6px 0 18px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dialog-actions.stack { grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .sheet-modal {
    left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%);
    width: min(520px, calc(100vw - 40px)); max-height: calc(100vh - 40px); border-radius: var(--r-lg); padding: 26px; animation: fade .15s ease;
  }
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Short story: its pages, to pick one */
.sheet-modal .story-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; overflow-y: auto; max-height: 56vh; padding: 2px; }
.sheet-modal .story-pages .page-card { box-shadow: none; }

/* Paywall */
.paywall-art { display: flex; gap: 6px; margin-bottom: 10px; }
.paywall-art .dot { width: 14px; height: 14px; border-radius: 50%; }
.dot.amber { background: var(--amber); } .dot.teal { background: var(--teal); } .dot.coral { background: var(--coral); }
.paywall-sub { color: var(--muted); margin: 0 0 12px; }
.perks { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; }
.perks li { position: relative; padding-left: 28px; }
.perks li::before {
  content: ''; position: absolute; left: 4px; top: 5px; width: 14px; height: 8px;
  border-left: 3px solid var(--teal); border-bottom: 3px solid var(--teal); transform: rotate(-45deg);
}
.plans { display: grid; gap: 12px; }
@media (min-width: 480px) { .plans { grid-template-columns: 1fr 1fr; } }
.plan {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 16px;
  border: 2px solid var(--sand); border-radius: var(--r); background: var(--paper);
}
.plan.best { border-color: var(--amber); background: var(--amber-soft); }
.plan-flag {
  position: absolute; top: -11px; right: 12px; background: var(--coral); color: #fff; font-size: .7rem; font-weight: 700;
  letter-spacing: .6px; text-transform: uppercase; padding: 3px 9px; border-radius: 999px;
}
.plan-name { font-family: var(--display); font-weight: 600; font-size: 1.1rem; }
.plan-price { font-family: var(--display); font-size: 1.6rem; font-weight: 600; }
.plan-price small { font-family: var(--body); font-size: .9rem; color: var(--muted); font-weight: 500; }
.plan-note { color: var(--muted); font-size: .86rem; min-height: 2.4em; }
.plan .btn { margin-top: 8px; width: 100%; }
.paywall-status {
  margin-top: 14px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--teal-soft); color: var(--slate); font-size: .92rem;
}
.paywall-status.error { background: var(--coral-soft); }
.restore-link { display: flex; align-items: center; justify-content: center; min-height: var(--tap); margin-top: 10px; font-weight: 600; color: var(--teal); text-align: center; }

/* Artwork sheet */
.art-preview { background: #fff; border: 1.5px solid var(--sand); border-radius: var(--r); aspect-ratio: 1/1; max-height: 42vh; margin: 8px auto 14px; overflow: hidden; }
.art-preview img { width: 100%; height: 100%; object-fit: contain; }
.art-meta { color: var(--muted); margin: 0 0 14px; }
.sheet-actions { display: grid; gap: 10px; }
@media (min-width: 480px) { .sheet-actions { grid-template-columns: 1fr 1fr; } .sheet-actions .btn.primary { grid-column: 1 / -1; } }

/* Celebration */
.celebrate { overflow: hidden; }
.confetti i {
  position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 3px; animation: drop 1.6s ease-in forwards;
}
.confetti i:nth-child(1) { left: 12%; background: var(--amber); }
.confetti i:nth-child(2) { left: 28%; background: var(--teal); animation-delay: .15s; }
.confetti i:nth-child(3) { left: 46%; background: var(--coral); animation-delay: .05s; }
.confetti i:nth-child(4) { left: 62%; background: #7CC46A; animation-delay: .25s; }
.confetti i:nth-child(5) { left: 78%; background: #4C7BD9; animation-delay: .1s; }
.confetti i:nth-child(6) { left: 90%; background: var(--amber); animation-delay: .3s; }
@keyframes drop { to { transform: translateY(220px) rotate(260deg); opacity: 0; } }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px); z-index: 90;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--slate); color: #fff; padding: 12px 18px; border-radius: var(--r-sm);
  max-width: calc(100vw - 32px); width: max-content; text-align: center; font-weight: 500;
  transition: opacity .2s ease, transform .2s ease; box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.studio-open .toast { bottom: calc(150px + var(--safe-b)); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
