@font-face {
  font-family: 'IranSans';
  src: url('/fonts/IRANSansWeb(FaNum).woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IranSans';
  src: url('/fonts/IRANSansWeb_Bold.woff') format('woff');
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f4e3d4;
  --bg-2: #edcfc0;
  --ink: #2a1f1a;
  --ink-2: #6a4438;
  --muted: #a08474;
  --accent: #c43a5e;
  --accent-2: #8a4a8c;
  --highlight: #f7c7a0;
  --blush: #ec9aa6;
  --silk: #e8c9d4;
  --perfume: #c98aa8;
  --paper: rgba(255, 255, 255, .35);
  --paper-strong: rgba(255, 255, 255, .58);
  --danger: #9e2f46;
  --ok: #32775f;
  --shadow: 4px 5px 0 var(--ink);
  --soft-shadow: 0 18px 50px rgba(42, 31, 26, .12);
  --radius: 16px;
  --radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(236,154,166,.22), transparent 26rem),
    radial-gradient(circle at 80% 86%, rgba(138,74,140,.10), transparent 24rem),
    var(--bg);
  color: var(--ink);
  font-family: 'IranSans', Vazirmatn, Tahoma, Arial, sans-serif;
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.app-root {
  width: 100%;
  min-height: 100svh;
  display: flex;
  justify-content: center;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100svh;
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(135deg, rgba(255,255,255,.12) 0 25%, transparent 25% 50%, rgba(255,255,255,.10) 50% 75%, transparent 75%) 0 0 / 28px 28px,
    var(--bg);
  box-shadow: var(--soft-shadow);
  overflow: hidden;
}
.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .28;
  background-image:
    radial-gradient(var(--ink) .55px, transparent .55px),
    radial-gradient(var(--accent) .45px, transparent .45px);
  background-size: 18px 18px, 27px 27px;
  background-position: 0 0, 7px 9px;
  mix-blend-mode: multiply;
  z-index: -1;
}

.screen {
  min-height: 100svh;
  padding: calc(18px + var(--safe-top)) 16px calc(22px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: pageIn .2s ease both;
}
.screen.tight { gap: 10px; }
.screen.scrollable { overflow-y: auto; padding-bottom: calc(90px + var(--safe-bottom)); }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
}
.header.center .header-title { text-align: center; }
.header-title { flex: 1; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.brand-mini {
  font-size: 13px;
  color: var(--ink-2);
  letter-spacing: .2px;
}

.title-hand {
  font-weight: 900;
  letter-spacing: -.9px;
  line-height: 1.2;
  font-size: clamp(28px, 8.6vw, 44px);
}
.title-hand.small { font-size: 24px; }
.title-hand.mid { font-size: 31px; }
.accent { color: var(--accent); }
.accent-2 { color: var(--accent-2); }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }

.squiggle {
  width: var(--w, 84px);
  height: 9px;
  display: block;
  margin-top: 4px;
  background: url("data:image/svg+xml,%3Csvg width='120' height='9' viewBox='0 0 120 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 6C13 0 21 0 32 6C43 12 51 12 62 6C73 0 81 0 92 6C103 12 111 12 118 6' stroke='%23c43a5e' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.kiss {
  width: var(--s, 38px);
  height: var(--s, 38px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: rotate(var(--r, -13deg));
  color: var(--accent);
  font-size: calc(var(--s, 38px) * .82);
  filter: saturate(.95);
}
.kiss::before { content: "💋"; }
.ribbon {
  display: inline-block;
  height: 11px;
  width: var(--w, 128px);
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(196,58,94,.75), rgba(236,154,166,.55), transparent);
  transform: rotate(var(--r, -2deg));
}
.tape {
  position: absolute;
  width: var(--w, 64px);
  height: 22px;
  background: rgba(236,154,166,.55);
  border: 1px solid rgba(42,31,26,.08);
  transform: rotate(var(--r, -8deg));
  border-radius: 3px;
  z-index: 3;
}
.stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px double currentColor;
  color: var(--c, var(--accent));
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: .5px;
  transform: rotate(var(--r, -5deg));
  background: rgba(244,227,212,.78);
}

.card, .note, .choice-card, .story-bubble, .result-card, .modal-card {
  position: relative;
  border: 2px dashed var(--ink);
  border-radius: var(--radius-sm);
  background: var(--paper);
}
.card {
  padding: 14px;
}
.card.solid { border-style: solid; }
.card.thick { border-width: 2.6px; }
.card.fill { background: var(--paper-strong); }
.card.accented { border-color: var(--accent); background: rgba(196,58,94,.09); }
.note {
  padding: 12px;
  background: var(--highlight);
  box-shadow: 2px 3px 0 rgba(42,31,26,.25);
  transform: rotate(var(--r, -1deg));
}

.btn {
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  border-radius: 13px;
  padding: 11px 14px;
  min-height: 43px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: transform .12s ease, filter .12s ease, background .12s ease;
  user-select: none;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn.primary { background: var(--ink); color: var(--bg); box-shadow: 3px 4px 0 rgba(42,31,26,.55); }
.btn.accent { background: var(--accent); color: #fff7f1; border-color: var(--ink); box-shadow: 3px 4px 0 rgba(42,31,26,.55); }
.btn.ghost { border-style: dashed; background: rgba(255,255,255,.2); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.small { min-height: 32px; padding: 6px 10px; border-radius: 9px; font-size: 12px; }
.btn.full { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.input-stack { display: flex; flex-direction: column; gap: 6px; }
.label { color: var(--ink-2); font-size: 12px; font-weight: 800; }
.input, .textarea, .select {
  width: 100%;
  border: 2px dashed var(--ink);
  border-radius: 10px;
  background: rgba(255,255,255,.24);
  color: var(--ink);
  padding: 12px;
  outline: none;
  min-height: 42px;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.9; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(196,58,94,.11); }
.input::placeholder, .textarea::placeholder { color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.flex-1 { flex: 1; }

.pill {
  border: 1.7px dashed var(--ink);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(255,255,255,.18);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.pill.selected { background: var(--accent); color: var(--bg); border-style: solid; border-color: var(--accent); }
.pill.plum.selected { background: var(--accent-2); border-color: var(--accent-2); }

.mode-card, .choice-card {
  width: 100%;
  padding: 14px;
  border-width: 2.4px;
  background: rgba(255,255,255,.3);
  cursor: pointer;
  transition: transform .14s ease, background .14s ease, border-color .14s ease;
  text-align: right;
}
.mode-card:active, .choice-card:active { transform: rotate(var(--r, 0deg)) scale(.99); }
.choice-card.active { border-style: solid; border-color: var(--accent); background: rgba(196,58,94,.1); }
.icon-sticker, .avatar {
  width: var(--s, 38px);
  height: var(--s, 38px);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--sticker, var(--silk));
  border: 1.8px solid var(--ink);
  font-weight: 900;
  box-shadow: 1.5px 2px 0 rgba(42,31,26,.3);
  flex: 0 0 auto;
}
.avatar { background: var(--sticker, var(--highlight)); font-size: 15px; }
.divider { border-top: 1.5px dashed var(--muted); opacity: .75; margin: 2px 0; }

.bottom-fixed {
  position: sticky;
  bottom: 0;
  margin: auto -16px calc(-22px - var(--safe-bottom));
  padding: 12px 16px calc(14px + var(--safe-bottom));
  background: linear-gradient(180deg, transparent, var(--bg) 20%, var(--bg));
  z-index: 12;
}
.bottom-actions { display: flex; gap: 8px; align-items: center; }
.bottom-actions .btn { flex: 1; }

.home-hero { margin-top: 6px; position: relative; }
.home-hero .kiss { position: absolute; left: 6px; top: -10px; }
.tagline { color: var(--ink-2); font-size: 13px; line-height: 1.9; }
.footer-nav {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  color: var(--ink-2);
  font-weight: 800;
}
.footer-nav button { background: none; border: 0; color: inherit; padding: 8px; font-weight: 900; }

.theme-preview { font-size: 12px; line-height: 1.8; color: var(--ink-2); }
.progress-dots { display: flex; gap: 5px; }
.progress-dots span { width: 18px; height: 5px; border-radius: 999px; background: rgba(160,132,116,.35); }
.progress-dots span.active { background: var(--accent); }

.story-feed {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 2px 2px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
}
.story-bubble {
  padding: 10px;
  max-width: 86%;
  line-height: 1.85;
  font-size: 13px;
  border-style: solid;
  background: rgba(122,74,140,.08);
}
.story-bubble.me { align-self: flex-end; background: rgba(196,58,94,.1); border-color: rgba(196,58,94,.7); }
.story-bubble.other { align-self: flex-start; border-color: rgba(138,74,140,.7); }
.story-author { font-size: 11px; font-weight: 900; color: var(--accent-2); margin-bottom: 3px; }
.story-bubble.me .story-author { color: var(--accent); text-align: right; }
.opening-card { border-color: var(--accent); background: rgba(247,199,160,.23); line-height: 1.8; }
.writer-box { margin-top: auto; }
.word-count { color: var(--muted); font-size: 12px; font-weight: 800; }
.cover-screen {
  justify-content: center;
  background: repeating-linear-gradient(45deg, var(--bg) 0 11px, var(--bg-2) 11px 22px);
}
.cover-card { max-width: 340px; margin: 0 auto; text-align: center; padding: 22px; background: rgba(244,227,212,.95); }
.eye-mark {
  width: 78px; height: 78px; margin: 18px auto;
  border: 2px dashed var(--ink);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
  background: rgba(255,255,255,.25);
}

.archive-card { cursor: pointer; }
.archive-card .preview { color: var(--ink-2); font-size: 13px; line-height: 1.6; margin-top: 5px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 3px; }
.tab { border: 1.6px dashed var(--ink); background: rgba(255,255,255,.18); color: var(--ink); border-radius: 999px; padding: 6px 11px; font-weight: 900; white-space: nowrap; }
.tab.active { background: var(--ink); color: var(--bg); border-style: solid; }

.share-card-preview {
  aspect-ratio: 4 / 5;
  border: 2.4px solid var(--ink);
  border-radius: 18px;
  background: linear-gradient(150deg, #fff4e8, var(--bg) 60%, var(--silk));
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.share-quote { background: rgba(255,255,255,.55); border-radius: 12px; padding: 12px; line-height: 1.8; font-size: 14px; text-align: center; }

.pay-plan { text-align: center; cursor: pointer; }
.pay-plan.active { border-style: solid; border-color: var(--accent); background: rgba(196,58,94,.12); }
.price { font-size: 28px; font-weight: 900; line-height: 1.15; }

.settings-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 3px;
  border-bottom: 1.4px dashed var(--muted);
}
.settings-row:last-child { border-bottom: none; }
.toggle {
  width: 39px; height: 22px; border: 2px solid var(--ink); border-radius: 999px; background: var(--bg-2); position: relative;
}
.toggle::before { content: ""; position: absolute; width: 15px; height: 15px; top: 1.5px; right: 2px; border-radius: 50%; border: 1.4px solid var(--ink); background: var(--bg); transition: transform .15s; }
.toggle.on { background: var(--accent); }
.toggle.on::before { transform: translateX(-16px); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(42,31,26,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 99;
  animation: fadeIn .16s ease both;
}
.modal-card {
  width: min(100%, 420px);
  padding: 18px;
  background: var(--bg);
  box-shadow: var(--shadow);
  text-align: center;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(92%, 440px);
  background: var(--ink);
  color: var(--bg);
  border-radius: 13px;
  padding: 11px 13px;
  text-align: center;
  z-index: 120;
  font-weight: 800;
  box-shadow: 0 12px 30px rgba(42,31,26,.22);
  animation: toastIn .16s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

.empty-state { text-align: center; color: var(--muted); padding: 28px 12px; line-height: 1.8; }
.hidden { display: none !important; }

@media (min-width: 760px) {
  .app-root { padding: 18px 0; align-items: flex-start; }
  .app-shell { min-height: calc(100svh - 36px); border-radius: 24px; }
  .screen { min-height: calc(100svh - 36px); }
}

@media (max-width: 360px) {
  .screen { padding-left: 12px; padding-right: 12px; }
  .grid-2 { gap: 7px; }
  .btn { padding-inline: 10px; }
  .story-bubble { max-width: 94%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.reaction-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 150;
  overflow: hidden;
}
.reaction-particle {
  position: absolute;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 8px 18px rgba(42,31,26,.18));
  animation: reactionPop 1.05s cubic-bezier(.16,.82,.26,1) forwards;
  will-change: transform, opacity;
}
@keyframes reactionPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.35) rotate(0deg); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(0deg); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.75) rotate(var(--rot)); }
}
.reaction-btn {
  position: relative;
  overflow: visible;
  transition: transform .18s ease, background .18s ease;
}
.reaction-btn.reacted {
  transform: scale(1.26) rotate(-5deg);
  background: rgba(255,255,255,.65);
  border-style: solid;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background: var(--muted);
  box-shadow: 0 0 0 2px rgba(255,255,255,.35);
}
.status-dot.on {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(50,119,95,.16);
}
.pill.solid {
  border-style: solid;
  background: rgba(255,255,255,.32);
}
textarea[disabled] {
  opacity: .72;
  background: rgba(255,255,255,.14);
}

/* ══ Splash Screen ══ */
.splash-screen {
  justify-content: space-between;
  padding: calc(28px + var(--safe-top)) 20px calc(28px + var(--safe-bottom));
  overflow: hidden;
}
.splash-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  justify-content: center;
}
.splash-kisses {
  display: flex;
  gap: 4px;
  align-items: flex-end;
}

/* ══ Lace corners ══ */
.lace-corner {
  position: absolute;
  width: 80px;
  height: 80px;
  pointer-events: none;
  z-index: 1;
  background-image: radial-gradient(circle, var(--accent) 1.5px, transparent 1.5px);
  background-size: 10px 10px;
  opacity: .35;
  border-radius: 4px;
}
.lc-tl { top: 10px; left: 10px; mask-image: radial-gradient(ellipse at top left, black 55%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse at top left, black 55%, transparent 75%); }
.lc-tr { top: 10px; right: 10px; mask-image: radial-gradient(ellipse at top right, black 55%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse at top right, black 55%, transparent 75%); }
.lc-bl { bottom: 10px; left: 10px; mask-image: radial-gradient(ellipse at bottom left, black 55%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse at bottom left, black 55%, transparent 75%); }
.lc-br { bottom: 10px; right: 10px; mask-image: radial-gradient(ellipse at bottom right, black 55%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse at bottom right, black 55%, transparent 75%); }

/* ══ Onboarding step card animation ══ */
.card.accented { border-style: solid; border-color: var(--accent); background: rgba(196,58,94,.09); }

/* ══ Fix: result-card style ══ */
.result-card { padding: 14px; }

/* ══ Home hero ribbon accent ══ */
.home-hero .accent { display: inline; }

/* ══ Bigger opening text in game ══ */
.opening-card p { font-size: 13px; line-height: 1.85; color: var(--ink-2); margin: 0; }

/* ══ Turn indicator (inline in online room) ══ */
.turn-indicator {
  background: linear-gradient(90deg, rgba(196,58,94,.15), rgba(196,58,94,.08));
  border: 1.6px solid var(--accent);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 900;
  color: var(--accent);
  text-align: center;
  animation: turnPulse 2s ease infinite;
}
@keyframes turnPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196,58,94,.25); }
  50% { box-shadow: 0 0 0 6px rgba(196,58,94,0); }
}

/* ══ Turn banner (floating top) ══ */
.turn-banner {
  position: fixed;
  top: calc(12px + var(--safe-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: min(94%, 500px);
  background: var(--ink);
  color: var(--bg);
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 200;
  font-weight: 900;
  box-shadow: 0 12px 32px rgba(42,31,26,.28), 4px 5px 0 var(--accent);
  animation: bannerIn .3s cubic-bezier(.18,.89,.32,1.28) both;
}
@keyframes bannerIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-18px) scale(.94); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.turn-banner-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
  flex-shrink: 0;
}
.turn-banner-close:hover { color: var(--bg); }

/* ══ Share card preview improvements ══ */
.share-card-preview .kiss { margin-bottom: 6px; }
