:root {
  color-scheme: dark;
  --bg: #100d0d;
  --bg-2: #171111;
  --panel: rgba(31, 24, 23, .86);
  --panel-solid: #211918;
  --panel-soft: rgba(255,255,255,.035);
  --line: rgba(238, 213, 180, .14);
  --line-strong: rgba(238, 213, 180, .26);
  --text: #f4eee7;
  --muted: #a99b91;
  --dim: #766b64;
  --gold: #d7ad77;
  --gold-bright: #f1d4a6;
  --gold-dark: #866344;
  --rose: #a86e69;
  --danger: #e48b83;
  --success: #9dc39f;
  --radius: 22px;
  --shadow: 0 24px 80px rgba(0,0,0,.32);
  font-family: "Vazirmatn", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; overflow-x: hidden; background: radial-gradient(ellipse at 50% -18%, rgba(128,78,56,.19), transparent 49%), linear-gradient(150deg,#100d0d 0%,#15100f 54%,#100c0c 100%); }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }
::selection { color: #1b1411; background: var(--gold-bright); }

.ambient { position: fixed; z-index: 0; pointer-events: none; border-radius: 50%; filter: blur(80px); opacity: .14; }
.ambient-one { width: 230px; height: 230px; top: 20%; right: -170px; background: #9b553e; }
.ambient-two { width: 250px; height: 250px; bottom: 4%; left: -180px; background: #b28a5a; opacity: .1; }
.topbar, .app-shell, .site-footer { position: relative; z-index: 1; }
.topbar { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 18px 0 12px; display:flex; align-items:center; justify-content:space-between; gap:16px; }
.brand { display:flex; align-items:center; gap:10px; direction:ltr; }
.brand-mark { width:39px; height:39px; display:grid; place-items:center; position:relative; border:1px solid rgba(235,202,157,.42); border-radius:13px; font-family:"DM Sans",sans-serif; font-size:23px; color:var(--gold-bright); background:linear-gradient(145deg,rgba(233,194,139,.14),rgba(255,255,255,.015)); box-shadow:inset 0 0 18px rgba(220,173,118,.08); }
.brand-mark span { position:absolute; top:2px; right:4px; font-size:9px; color:#f4d8ac; }
.brand-copy { display:grid; gap:1px; color:var(--gold-bright); line-height:1; letter-spacing:2px; }
.brand-copy strong { font:700 12px "DM Sans",sans-serif; }
.brand-copy small { font:500 8px "DM Sans",sans-serif; letter-spacing:2.5px; color:var(--muted); }
.topbar-right { display:flex; align-items:center; gap:10px; }
.mode-pill { border:1px solid var(--line); background:rgba(255,255,255,.025); color:var(--muted); border-radius:999px; padding:7px 10px; display:flex; align-items:center; gap:7px; font-size:10px; white-space:nowrap; }
.mode-pill i { width:6px; height:6px; border-radius:50%; background:#c5a06e; box-shadow:0 0 10px currentColor; }
.mode-pill.cloud i { background:#91bd94; }
.mode-pill.local i { background:#d5a36d; }
.admin-link { color:#b9a99a; font-size:11px; padding:8px 11px; border:1px solid var(--line); border-radius:999px; transition:.2s ease; }
.admin-link:hover { color:var(--gold-bright); border-color:var(--line-strong); background:rgba(255,255,255,.04); }

.app-shell { width:min(920px, calc(100% - 28px)); margin:0 auto; min-height:calc(100vh - 106px); min-height:calc(100dvh - 106px); display:flex; flex-direction:column; justify-content:center; padding:24px 0 35px; }
.loading-screen { display:grid; place-items:center; gap:18px; min-height:55vh; color:var(--muted); font-size:13px; }
.loading-orbit { width:48px; height:48px; border:1px solid var(--line-strong); border-radius:50%; display:grid; place-items:center; animation:spin 5s linear infinite; }
.loading-orbit span { width:7px; height:7px; border-radius:50%; background:var(--gold-bright); box-shadow:0 0 18px var(--gold); }
@keyframes spin { to { transform:rotate(360deg); } }

.progress-wrap { width:min(610px,100%); margin:0 auto 22px; }
.progress-meta { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:9px; color:var(--muted); font-size:11px; }
.progress-meta strong { color:var(--gold-bright); font-weight:500; }
.progress-track { height:3px; border-radius:9px; background:rgba(255,255,255,.075); overflow:hidden; direction:ltr; }
.progress-fill { height:100%; width:0; border-radius:inherit; background:linear-gradient(90deg,#956d4b,#efd0a0); box-shadow:0 0 12px rgba(220,181,130,.4); transition:width .5s cubic-bezier(.2,.8,.2,1); }
.step-dots { display:flex; justify-content:space-between; gap:5px; margin-top:10px; direction:ltr; }
.step-dot { flex:1; height:3px; background:rgba(255,255,255,.07); border-radius:5px; }
.step-dot.done { background:rgba(220,184,137,.7); }
.step-dot.current { background:var(--gold-bright); box-shadow:0 0 10px rgba(240,211,168,.36); }

.stage-card { width:min(720px,100%); margin:0 auto; border:1px solid var(--line); border-radius:28px; background:linear-gradient(145deg,rgba(38,29,27,.93),rgba(24,18,18,.96)); box-shadow:var(--shadow), inset 0 1px rgba(255,255,255,.025); overflow:hidden; animation:stage-in .42s cubic-bezier(.2,.7,.2,1) both; }
@keyframes stage-in { from { opacity:0; transform:translateY(12px) scale(.993); } to { opacity:1; transform:translateY(0) scale(1); } }
.stage-inner { padding:clamp(20px,4.4vw,38px); }
.eyebrow { display:flex; align-items:center; gap:8px; color:var(--gold); font:600 10px "DM Sans",sans-serif; letter-spacing:2px; text-transform:uppercase; margin-bottom:12px; }
.eyebrow::before { content:""; width:19px; height:1px; background:var(--gold-dark); }
.stage-title { font-size:clamp(23px,5.1vw,38px); line-height:1.55; font-weight:600; letter-spacing:-.7px; margin:0; color:#f6eee5; }
.stage-subtitle { color:var(--muted); line-height:2; font-size:13px; margin:7px 0 24px; max-width:560px; }
.stage-actions { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:17px clamp(20px,4.4vw,38px); border-top:1px solid rgba(239,216,190,.09); background:rgba(0,0,0,.12); }
.stage-actions .actions-right { display:flex; gap:9px; margin-right:auto; }
.btn { min-height:47px; display:inline-flex; align-items:center; justify-content:center; gap:9px; padding:0 20px; border:1px solid transparent; border-radius:14px; cursor:pointer; font-size:13px; font-weight:600; transition:transform .18s ease,background .18s ease,border .18s ease,box-shadow .18s ease; }
.btn:active { transform:scale(.975); }
.btn-primary { color:#211711; background:linear-gradient(135deg,#f0d7b1,#c49b6a); box-shadow:0 8px 22px rgba(199,155,105,.16); }
.btn-primary:hover { box-shadow:0 11px 26px rgba(199,155,105,.25); filter:brightness(1.04); }
.btn-secondary { color:#dfd3c7; background:rgba(255,255,255,.045); border-color:var(--line); }
.btn-secondary:hover { border-color:var(--line-strong); background:rgba(255,255,255,.07); }
.btn-quiet { color:var(--muted); background:transparent; padding-inline:12px; }
.btn-quiet:hover { color:var(--text); }
.btn-block { width:100%; }
.btn-small { min-height:36px; border-radius:10px; padding:0 12px; font-size:11px; }
.btn:disabled { opacity:.45; cursor:not-allowed; transform:none; }

.welcome-stage { min-height:540px; display:grid; place-items:center; text-align:center; position:relative; padding:35px 22px; overflow:hidden; background:radial-gradient(ellipse at 50% 49%,rgba(160,105,66,.16),transparent 54%); }
.welcome-stage::before,.welcome-stage::after { content:""; position:absolute; width:230px; height:230px; border:1px solid rgba(231,198,154,.09); border-radius:50%; animation:breath 5s ease-in-out infinite; }
.welcome-stage::after { width:330px; height:330px; animation-delay:1.2s; }
@keyframes breath { 0%,100% { transform:scale(.9); opacity:.25; } 50% { transform:scale(1.1); opacity:.8; } }
.welcome-content { position:relative; z-index:1; max-width:540px; }
.welcome-kicker { color:var(--gold); font:500 10px "DM Sans",sans-serif; letter-spacing:4px; margin-bottom:22px; }
.welcome-title { font-size:clamp(32px,8vw,60px); line-height:1.42; font-weight:700; margin:0; background:linear-gradient(115deg,#fff1db 18%,#d7ad77 52%,#fff0d3 82%); background-clip:text; -webkit-background-clip:text; color:transparent; text-shadow:0 0 34px rgba(215,173,119,.08); }
.welcome-title span { display:block; font-size:.47em; font-weight:400; color:#d5c1ab; margin-top:8px; background:none; -webkit-text-fill-color:#d5c1ab; }
.welcome-note { color:#b6a69a; font-size:13px; line-height:2; margin:22px auto 28px; max-width:360px; }
.welcome-decoration { width:90px; height:90px; margin:0 auto 25px; display:grid; place-items:center; position:relative; }
.welcome-decoration::before { content:""; position:absolute; inset:0; border:1px solid rgba(231,197,151,.37); border-radius:29px; transform:rotate(45deg); }
.welcome-decoration::after { content:"✦"; position:absolute; color:#f1d5aa; font-size:11px; top:-8px; right:10px; text-shadow:0 0 12px #ddb780; }
.welcome-cake { font-size:39px; filter:drop-shadow(0 8px 15px rgba(202,145,86,.25)); animation:float 3s ease-in-out infinite; }
@keyframes float { 50% { transform:translateY(-7px) rotate(-2deg); } }
.welcome-content .btn { min-width:185px; }
.welcome-footnote { color:var(--dim); margin-top:15px; font-size:10px; }

.field { display:grid; gap:8px; margin-bottom:17px; }
.field label,.field-label { font-size:12px; color:#d9cabe; font-weight:500; }
.field-hint { color:var(--dim); font-size:10px; line-height:1.8; }
.text-input,.text-area,.select-input { width:100%; min-height:50px; border:1px solid var(--line); border-radius:13px; background:rgba(0,0,0,.18); padding:12px 15px; color:var(--text); font-size:14px; transition:border .2s,box-shadow .2s; }
.text-input::placeholder,.text-area::placeholder { color:#796e67; }
.text-input:focus,.text-area:focus,.select-input:focus { outline:none; border-color:rgba(222,181,131,.58); box-shadow:0 0 0 3px rgba(215,173,119,.08); }
.text-area { min-height:130px; resize:vertical; line-height:2; }
.text-input[dir="auto"],.text-area[dir="auto"] { text-align:start; }
.counter { font-size:10px; text-align:left; direction:ltr; color:var(--dim); }
.error-note { color:var(--danger); font-size:11px; margin-top:8px; }

.option-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
.option-card { min-width:0; padding:12px 9px; border:1px solid var(--line); border-radius:14px; text-align:center; background:rgba(255,255,255,.025); cursor:pointer; transition:.18s ease; color:#cbbcb0; }
.option-card:hover { border-color:var(--line-strong); background:rgba(255,255,255,.045); }
.option-card.selected { border-color:rgba(227,190,143,.67); background:rgba(211,166,112,.1); box-shadow:inset 0 0 0 1px rgba(227,190,143,.12); color:#f1dfc7; }
.option-card .option-symbol { display:block; font-size:23px; margin-bottom:7px; }
.option-card strong { display:block; font-size:11px; font-weight:500; }
.option-card small { display:block; color:var(--dim); font-size:9px; margin-top:3px; }

.cake-layout { display:grid; grid-template-columns:minmax(0,1.05fr) minmax(0,.95fr); align-items:center; gap:20px; }
.cake-preview-box { min-height:275px; border:1px solid rgba(233,202,161,.12); border-radius:20px; background:radial-gradient(ellipse at 50% 60%,rgba(181,128,83,.13),transparent 67%),rgba(0,0,0,.13); display:grid; place-items:center; padding:20px; position:relative; overflow:hidden; }
.cake-preview-box::after { content:""; position:absolute; width:210px; height:20px; border-radius:50%; background:rgba(222,183,140,.08); filter:blur(9px); bottom:35px; }
.cake-svg { width:100%; max-width:300px; height:auto; position:relative; z-index:1; filter:drop-shadow(0 18px 20px rgba(0,0,0,.22)); }
.cake-options { display:grid; gap:14px; }
.option-group { display:grid; gap:8px; }
.option-group-title { font-size:11px; color:#d7c8bb; }
.swatches { display:flex; flex-wrap:wrap; gap:8px; }
.swatch { width:31px; height:31px; border-radius:50%; border:2px solid transparent; padding:0; cursor:pointer; box-shadow:inset 0 0 0 1px rgba(255,255,255,.22); }
.swatch.selected { outline:2px solid var(--gold-bright); outline-offset:3px; }
.mini-options { display:flex; flex-wrap:wrap; gap:7px; }
.chip { min-height:35px; padding:0 11px; border:1px solid var(--line); border-radius:10px; background:rgba(255,255,255,.025); color:#c4b5a9; font-size:10px; cursor:pointer; }
.chip.selected { border-color:rgba(231,193,145,.65); background:rgba(215,173,119,.12); color:#f3dec2; }

.message-editor { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:17px; align-items:start; }
.editor-controls { display:grid; gap:13px; }
.control-row { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.control-row label { font-size:11px; color:#d7c8bb; }
.control-row select { max-width:180px; }
.select-input { min-height:40px; padding:8px 10px; font-size:11px; }
.range-input { width:100%; accent-color:var(--gold); }
.color-input { width:40px; height:34px; padding:2px; border:1px solid var(--line); border-radius:9px; background:transparent; }
.message-preview-shell { padding:13px; border:1px solid rgba(230,198,157,.14); border-radius:18px; background:rgba(0,0,0,.16); }
.preview-caption { color:var(--dim); font:500 9px "DM Sans",sans-serif; letter-spacing:1.7px; margin-bottom:10px; text-align:center; }
.message-card { min-height:245px; padding:22px 16px; border:1px solid #b78e5f; border-radius:12px; display:flex; flex-direction:column; justify-content:center; align-items:center; text-align:center; position:relative; overflow:hidden; background:linear-gradient(145deg,#2c211e,#171111); color:#f7e9d8; }
.message-card::before { content:""; position:absolute; inset:6px; border:1px solid rgba(229,190,143,.24); pointer-events:none; border-radius:8px; }
.message-card.frame-double::before { inset:9px; border:3px double rgba(229,190,143,.4); }
.message-card.frame-soft { border-radius:24px; border-color:rgba(224,190,160,.45); }
.message-card.frame-minimal { border-color:rgba(255,255,255,.18); }
.message-card.frame-ornate::after { content:"✦  ✧  ✦"; position:absolute; bottom:12px; font-size:10px; letter-spacing:8px; color:rgba(238,205,163,.65); }
.message-card .message-content { position:relative; z-index:1; width:100%; white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.9; font-size:18px; }
.message-card .message-from { position:relative; z-index:1; font-size:10px; color:rgba(246,219,182,.68); margin-top:15px; }
.message-card .message-star { color:#e4c08e; margin-bottom:14px; font-size:17px; }

.song-card { padding:18px; border:1px solid rgba(230,195,151,.16); border-radius:18px; background:linear-gradient(140deg,rgba(142,94,67,.12),rgba(0,0,0,.12)); }
.song-icon { width:45px; height:45px; border-radius:14px; display:grid; place-items:center; background:rgba(219,180,132,.12); border:1px solid rgba(219,180,132,.2); font-size:20px; margin-bottom:13px; }
.song-note { color:var(--muted); font-size:11px; line-height:1.9; }

.drawing-tools { display:flex; flex-wrap:wrap; align-items:center; gap:7px; margin-bottom:10px; }
.tool-button { min-width:38px; height:38px; display:inline-flex; align-items:center; justify-content:center; gap:6px; padding:0 9px; border:1px solid var(--line); border-radius:10px; color:#d1c2b5; background:rgba(255,255,255,.03); font-size:10px; cursor:pointer; }
.tool-button.selected { border-color:rgba(235,197,150,.7); background:rgba(215,173,119,.12); color:#f3dfc5; }
.tool-button:disabled { opacity:.35; cursor:not-allowed; }
.drawing-colors { display:flex; gap:7px; align-items:center; margin-right:auto; }
.drawing-color { width:25px; height:25px; border:2px solid transparent; border-radius:50%; padding:0; cursor:pointer; box-shadow:inset 0 0 0 1px rgba(255,255,255,.15); }
.drawing-color.selected { outline:2px solid var(--gold-bright); outline-offset:2px; }
.canvas-wrap { border:1px solid rgba(236,206,173,.19); border-radius:16px; overflow:hidden; background:#f7f1e8; touch-action:none; }
#drawing-canvas { display:block; width:100%; height:310px; touch-action:none; cursor:crosshair; background:#f7f1e8; }
.drawing-hint { color:var(--dim); font-size:10px; margin-top:8px; }

.upload-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.upload-card { border:1px dashed rgba(230,198,159,.28); border-radius:16px; padding:17px 13px; background:rgba(255,255,255,.018); min-height:134px; display:flex; flex-direction:column; justify-content:center; align-items:center; gap:8px; text-align:center; cursor:pointer; transition:.2s ease; }
.upload-card:hover { border-color:rgba(230,198,159,.6); background:rgba(215,173,119,.055); }
.upload-card .upload-icon { font-size:25px; color:var(--gold-bright); }
.upload-card strong { font-size:12px; font-weight:500; }
.upload-card small { font-size:9px; color:var(--dim); line-height:1.7; }
.upload-list { display:grid; gap:8px; margin-top:13px; }
.upload-item { display:flex; align-items:center; gap:10px; min-width:0; border:1px solid var(--line); border-radius:12px; padding:8px; background:rgba(0,0,0,.15); }
.upload-thumb { width:50px; height:50px; flex:none; border-radius:9px; object-fit:cover; background:#2a211e; }
.upload-details { flex:1; min-width:0; display:grid; gap:4px; }
.upload-details strong { font-size:10px; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; direction:ltr; text-align:right; }
.upload-details small { font-size:9px; color:var(--dim); }
.remove-upload { width:30px; height:30px; flex:none; border:1px solid var(--line); border-radius:9px; color:#c4a59c; background:transparent; cursor:pointer; }
.record-panel { border:1px solid var(--line); border-radius:15px; padding:13px; margin-top:11px; background:rgba(0,0,0,.12); }
.record-toolbar { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.record-status { font-size:10px; color:var(--muted); margin-right:auto; }
.record-status.recording { color:#e9a29a; }
.record-timer { font:600 13px "DM Sans",sans-serif; color:var(--gold-bright); direction:ltr; }

.review-list { display:grid; gap:9px; }
.review-row { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:12px 13px; border:1px solid var(--line); border-radius:13px; background:rgba(255,255,255,.02); }
.review-label { color:var(--dim); font-size:10px; margin-bottom:4px; }
.review-value { color:#e5d7ca; font-size:12px; line-height:1.8; overflow-wrap:anywhere; }
.review-edit { color:var(--gold); font-size:10px; flex:none; border:0; background:none; cursor:pointer; padding:4px; }
.final-card { text-align:center; padding:30px 20px; border:1px solid rgba(227,190,145,.2); border-radius:20px; background:radial-gradient(ellipse at 50% 40%,rgba(180,126,77,.16),transparent 65%),rgba(0,0,0,.14); }
.final-cake { font-size:70px; line-height:1.3; filter:drop-shadow(0 10px 18px rgba(0,0,0,.25)); animation:float 3s ease-in-out infinite; }
.final-title { font-size:24px; margin:11px 0 6px; color:var(--gold-bright); }
.final-copy { max-width:430px; margin:0 auto; color:var(--muted); line-height:2; font-size:12px; }
.reward-slice { display:inline-grid; place-items:center; width:86px; height:75px; margin:18px auto 0; border:1px solid rgba(235,196,145,.38); border-radius:22px; background:rgba(214,174,124,.08); font-size:39px; animation:reward-pop .7s cubic-bezier(.16,1,.3,1) both; }
@keyframes reward-pop { from { opacity:0; transform:scale(.5) rotate(-18deg); } to { opacity:1; transform:scale(1) rotate(0); } }

.admin-shell { width:min(1080px,100%); margin:0 auto; }
.admin-header { display:flex; align-items:flex-start; justify-content:space-between; gap:15px; margin-bottom:20px; }
.admin-title { font-size:clamp(23px,5vw,34px); margin:0; }
.admin-subtitle { color:var(--muted); font-size:11px; margin-top:5px; }
.admin-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-bottom:17px; }
.stat-card { border:1px solid var(--line); border-radius:15px; padding:15px; background:rgba(255,255,255,.025); }
.stat-card strong { display:block; font:600 26px "DM Sans",sans-serif; color:var(--gold-bright); direction:ltr; text-align:right; }
.stat-card span { font-size:10px; color:var(--muted); }
.admin-toolbar { display:flex; gap:9px; flex-wrap:wrap; align-items:center; padding:12px; border:1px solid var(--line); border-radius:15px 15px 0 0; background:rgba(0,0,0,.12); }
.admin-toolbar .text-input { min-height:39px; max-width:300px; margin-left:auto; }
.submission-list { display:grid; gap:0; border:1px solid var(--line); border-top:0; border-radius:0 0 15px 15px; overflow:hidden; }
.submission-card { padding:15px; background:rgba(255,255,255,.018); border-bottom:1px solid var(--line); }
.submission-card:last-child { border-bottom:0; }
.submission-top { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.submission-name { font-size:14px; font-weight:600; }
.submission-date { color:var(--dim); font-size:10px; direction:ltr; }
.submission-message { color:#d1c2b6; font-size:12px; line-height:1.9; margin:9px 0; overflow-wrap:anywhere; }
.submission-meta { display:flex; flex-wrap:wrap; gap:6px; }
.meta-tag { border:1px solid var(--line); border-radius:999px; padding:4px 8px; font-size:9px; color:var(--muted); }
.submission-actions { display:flex; flex-wrap:wrap; gap:7px; margin-top:12px; }
.submission-actions button { min-height:32px; padding:0 10px; font-size:10px; }
.admin-empty { padding:42px 18px; text-align:center; color:var(--muted); font-size:12px; }
.admin-login { width:min(420px,100%); margin:4vh auto; }
.admin-warning { margin-bottom:15px; border:1px solid rgba(214,170,113,.25); background:rgba(214,170,113,.07); border-radius:13px; padding:11px 13px; color:#cfb28f; font-size:10px; line-height:1.9; }
.admin-detail { margin-top:12px; border:1px solid var(--line); background:rgba(0,0,0,.14); border-radius:13px; padding:12px; display:grid; gap:10px; }
.admin-media-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(105px,1fr)); gap:9px; }
.admin-media { border:1px solid var(--line); border-radius:10px; overflow:hidden; background:#171111; }
.admin-media img { display:block; width:100%; aspect-ratio:1/1; object-fit:cover; }
.admin-media audio { display:block; width:100%; max-width:100%; height:35px; }
.admin-media small { display:block; padding:6px; color:var(--muted); font-size:9px; overflow-wrap:anywhere; }
.admin-settings { margin-top:18px; padding:16px; border:1px solid var(--line); border-radius:15px; background:rgba(255,255,255,.018); }
.admin-settings h3 { margin:0 0 12px; font-size:13px; }
.preview-mode-note { color:var(--muted); font-size:10px; line-height:1.9; margin:7px 0 0; }

.toast-region { position:fixed; z-index:20; bottom:calc(18px + env(safe-area-inset-bottom)); left:50%; transform:translateX(-50%); width:min(440px,calc(100% - 28px)); display:grid; gap:8px; pointer-events:none; }
.toast { padding:12px 15px; border:1px solid var(--line-strong); border-radius:13px; background:#2a211e; color:#f1e4d7; box-shadow:0 12px 35px rgba(0,0,0,.35); font-size:11px; line-height:1.7; animation:toast-in .25s ease both; }
.toast.error { border-color:rgba(228,139,131,.4); }
.toast.success { border-color:rgba(157,195,159,.38); }
@keyframes toast-in { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.site-footer { width:min(920px,calc(100% - 30px)); margin:0 auto; padding:12px 0 22px; display:flex; align-items:center; justify-content:center; gap:13px; color:#6f6259; font:500 8px "DM Sans",sans-serif; letter-spacing:2px; direction:ltr; }
.site-footer span:nth-child(2) { color:var(--gold-dark); }
.hidden { display:none !important; }

@media (max-width:680px) {
  .topbar { width:calc(100% - 26px); padding-top:13px; }
  .brand-mark { width:35px; height:35px; border-radius:11px; }
  .brand-copy strong { font-size:10px; }
  .brand-copy small { font-size:7px; }
  .mode-pill { font-size:0; padding:8px; }
  .mode-pill i { width:7px; height:7px; }
  .admin-link { font-size:10px; padding:8px 9px; }
  .app-shell { width:calc(100% - 20px); min-height:calc(100dvh - 100px); padding:17px 0 28px; justify-content:flex-start; }
  .progress-wrap { margin-bottom:15px; }
  .stage-card { border-radius:21px; }
  .stage-inner { padding:21px 17px; }
  .stage-actions { padding:13px 15px calc(13px + env(safe-area-inset-bottom)); }
  .btn { min-height:48px; padding:0 15px; font-size:12px; border-radius:13px; }
  .welcome-stage { min-height:calc(72dvh - 20px); padding:24px 15px; }
  .welcome-title { font-size:clamp(31px,9vw,47px); }
  .welcome-note { font-size:12px; }
  .cake-layout { grid-template-columns:1fr; gap:13px; }
  .cake-preview-box { min-height:225px; padding:10px; }
  .cake-svg { max-width:245px; }
  .cake-options { grid-template-columns:1fr 1fr; gap:12px; }
  .cake-options .option-group:first-child { grid-column:1/-1; }
  .message-editor { grid-template-columns:1fr; }
  .message-preview-shell { order:-1; }
  .message-card { min-height:185px; }
  .option-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; }
  .option-card { padding:10px 5px; }
  .option-card .option-symbol { font-size:20px; }
  .option-card strong { font-size:10px; }
  #drawing-canvas { height:270px; }
  .upload-card { min-height:125px; }
  .admin-stats { grid-template-columns:repeat(2,1fr); gap:8px; }
  .stat-card { padding:12px; }
  .stat-card strong { font-size:23px; }
  .admin-header { flex-direction:column; }
  .admin-toolbar .text-input { max-width:none; flex-basis:100%; }
  .admin-toolbar { gap:7px; }
  .site-footer { font-size:7px; letter-spacing:1.4px; padding-bottom:calc(18px + env(safe-area-inset-bottom)); }
}
@media (max-width:370px) {
  .topbar { width:calc(100% - 20px); }
  .brand { gap:7px; }
  .topbar-right { gap:6px; }
  .admin-link { padding:7px 8px; }
  .stage-inner { padding:18px 13px; }
  .stage-actions { padding-inline:12px; }
  .btn { padding-inline:12px; }
  .cake-options { grid-template-columns:1fr; }
  .cake-options .option-group:first-child { grid-column:auto; }
}
@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { scroll-behavior:auto !important; animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; }
}

.canvas-wrap:fullscreen { width:100vw; height:100dvh; border:0; border-radius:0; display:grid; place-items:center; background:#f7f1e8; }
.canvas-wrap:fullscreen #drawing-canvas { width:100%; height:100%; max-height:100dvh; }

.local-mode-banner { width:min(720px,100%); margin:0 auto 13px; padding:9px 12px; border:1px solid rgba(217,173,119,.22); border-radius:12px; background:rgba(217,173,119,.06); color:#c9ae8e; font-size:10px; line-height:1.9; text-align:center; }


/* ARMAN BIRTHDAY — graphite / silver refinement */
:root {
  color-scheme: dark;
  --bg:#101113; --bg-2:#17191c; --panel:rgba(29,31,35,.9); --panel-solid:#202226;
  --panel-soft:rgba(255,255,255,.045); --line:rgba(218,222,228,.13); --line-strong:rgba(225,229,235,.27);
  --text:#f0f1f2; --muted:#a5a9af; --dim:#777d85; --gold:#b9bec5; --gold-bright:#edf0f3; --gold-dark:#747b84;
  --rose:#9298a0; --danger:#e48b83; --success:#9dc39f; --shadow:0 28px 90px rgba(0,0,0,.42);
  background:var(--bg); color:var(--text);
}
body { background:radial-gradient(ellipse at 50% -22%,rgba(180,188,198,.10),transparent 52%),linear-gradient(145deg,#101113 0%,#17191c 52%,#0d0e10 100%); }
.ambient-one,.ambient-two { background:#aeb5bf; opacity:.07; }
.brand-mark { border-color:rgba(220,225,232,.34); color:#f1f3f5; background:linear-gradient(145deg,rgba(230,234,240,.12),rgba(255,255,255,.015)); box-shadow:inset 0 0 18px rgba(220,225,232,.05); }
.brand-mark span,.welcome-decoration::after { color:#e4e8ed; text-shadow:0 0 12px rgba(225,230,238,.3); }
.brand-copy,.progress-meta strong,.stage-title { color:#f0f1f3; }
.mode-pill i { background:#c5cbd3; }
.progress-fill { background:linear-gradient(90deg,#777e88,#eef1f4); box-shadow:0 0 12px rgba(220,226,234,.25); }
.step-dot.done,.step-dot.current { background:#cbd0d7; box-shadow:0 0 10px rgba(220,226,234,.18); }
.stage-card { background:linear-gradient(145deg,rgba(35,37,41,.97),rgba(22,24,27,.98)); border-color:rgba(222,226,232,.14); }
.eyebrow,.welcome-kicker { color:#bfc5cd; }
.eyebrow::before { background:#7e858e; }
.btn-primary { color:#17191c; background:linear-gradient(135deg,#f0f2f5,#aeb4bd); box-shadow:0 8px 22px rgba(200,207,216,.10); }
.btn-primary:hover { box-shadow:0 11px 26px rgba(200,207,216,.18); }
.btn-secondary { color:#e0e3e7; }
.welcome-stage { background:radial-gradient(ellipse at 50% 49%,rgba(190,198,208,.10),transparent 57%); }
.welcome-stage::before,.welcome-stage::after { border-color:rgba(225,230,238,.10); }
.welcome-title { background:linear-gradient(115deg,#fff 15%,#bfc5ce 52%,#f4f5f7 85%); background-clip:text; -webkit-background-clip:text; }
.welcome-title span { color:#c3c8cf; -webkit-text-fill-color:#c3c8cf; }
.welcome-note,.stage-subtitle { color:#aeb3ba; }
.welcome-decoration::before { border-color:rgba(220,226,234,.3); }
.text-input,.text-area,.select-input { background:rgba(7,8,10,.34); border-color:rgba(220,225,232,.15); }
.field label,.field-label,.control-row label { color:#d5d9de; }
.stage-actions { border-top-color:rgba(225,230,238,.09); background:rgba(0,0,0,.18); }
.cake-preview-box { min-height:300px; border-color:rgba(220,226,234,.16); background:radial-gradient(ellipse at 50% 62%,rgba(198,205,214,.12),transparent 67%),linear-gradient(145deg,rgba(255,255,255,.035),rgba(0,0,0,.22)); }
.cake-preview-box::after { background:rgba(215,221,230,.12); }
.cake-svg { max-width:330px; filter:drop-shadow(0 22px 24px rgba(0,0,0,.42)); }
.option-group { padding:11px 12px; border:1px solid rgba(220,225,232,.09); border-radius:14px; background:rgba(255,255,255,.018); }
.option-group-title { color:#d8dce1; font-weight:600; }
.swatch.selected { outline-color:#e6e9ed; }
.chip { color:#cbd0d6; border-color:rgba(220,225,232,.15); background:rgba(255,255,255,.035); }
.chip.selected { border-color:rgba(226,231,238,.58); background:rgba(220,226,234,.12); color:#f3f5f7; }
.range-input { accent-color:#d4d9e0; }
.message-editor { gap:20px; }
.editor-controls { padding:14px; border:1px solid rgba(220,225,232,.11); border-radius:17px; background:rgba(255,255,255,.022); }
.message-preview-shell { padding:15px; border-color:rgba(220,225,232,.16); background:linear-gradient(145deg,rgba(255,255,255,.045),rgba(0,0,0,.22)); }
.preview-caption { color:#aeb5be; letter-spacing:2px; }
.message-card { min-height:280px; padding:32px 24px; border:1px solid rgba(225,230,238,.42); border-radius:5px; background:radial-gradient(circle at 50% 0%,rgba(255,255,255,.11),transparent 55%),linear-gradient(145deg,#34383e,#202328 65%,#17191d); color:#f1f2f4; box-shadow:0 18px 34px rgba(0,0,0,.24),inset 0 1px rgba(255,255,255,.12); }
.message-card::before { inset:10px; border:1px solid rgba(232,236,242,.24); border-radius:2px; }
.message-card.frame-double::before { inset:14px; border:3px double rgba(232,236,242,.34); }
.message-card.frame-soft { border-radius:18px; }
.message-card.frame-minimal::before { display:none; }
.message-card.frame-ornate::after { color:rgba(230,235,242,.65); }
.message-card .message-content { line-height:2.05; letter-spacing:.1px; }
.message-card .message-from { color:rgba(229,233,239,.68); border-top:1px solid rgba(230,235,242,.17); padding-top:11px; min-width:46%; }
.message-card .message-star { color:#e2e6eb; }
.final-card { border-color:rgba(220,226,234,.18); background:radial-gradient(ellipse at 50% 40%,rgba(190,198,208,.10),transparent 65%),rgba(0,0,0,.16); }
.final-title { color:#e3e7ec; }
.reward-slice { border-color:rgba(220,226,234,.32); background:rgba(214,220,228,.07); }
.toast { background:#292d33; color:#f1f3f5; }
.local-mode-banner { border-color:rgba(220,226,234,.18); background:rgba(220,226,234,.045); color:#c4cbd3; }
@media (max-width:680px) {
  .cake-preview-box { min-height:245px; }
  .cake-svg { max-width:275px; }
  .editor-controls { padding:11px; }
  .message-card { min-height:220px; padding:26px 19px; }
}
.cake-preview-kicker,.cake-preview-foot { position:absolute; z-index:2; color:#9da4ad; font:600 8px "DM Sans",sans-serif; letter-spacing:2.2px; }
.cake-preview-kicker { top:15px; left:17px; }
.cake-preview-foot { bottom:13px; right:17px; font-size:7px; letter-spacing:1.6px; }
.editor-heading { display:grid; gap:5px; padding:2px 0 12px; border-bottom:1px solid rgba(220,225,232,.1); }
.editor-heading span { color:#9da5af; font:600 8px "DM Sans",sans-serif; letter-spacing:2px; }
.editor-heading strong { color:#e6e9ed; font-size:14px; }
.editor-heading small { color:#8d949d; font-size:10px; line-height:1.8; }

/* Cake studio: detailed silver-finish cake preview */
.cake-preview-box {
  min-height: 340px;
  padding: 38px 14px 28px;
  border-color: rgba(220,226,234,.2);
  background:
    radial-gradient(ellipse at 50% 70%, rgba(201,210,220,.16), transparent 58%),
    linear-gradient(155deg, rgba(255,255,255,.055), rgba(7,9,12,.3));
}
.cake-preview-box::before {
  content: "";
  position: absolute;
  width: 78%;
  height: 1px;
  bottom: 56px;
  left: 11%;
  background: linear-gradient(90deg, transparent, rgba(225,230,237,.25), transparent);
}
.cake-preview-box::after {
  width: 230px;
  height: 22px;
  bottom: 40px;
  background: rgba(204,214,225,.17);
  filter: blur(13px);
}
.cake-svg {
  width: min(100%, 390px);
  max-width: 390px;
  max-height: 326px;
  overflow: visible;
  z-index: 1;
  filter: drop-shadow(0 22px 24px rgba(0,0,0,.4));
}
.cake-candle { transform-box: fill-box; transform-origin: 50% 100%; }
.candle-flame { transform-origin: 50% 100%; animation: candle-flicker 1.8s ease-in-out infinite alternate; }
@keyframes candle-flicker { from { transform: scale(.92) rotate(-2deg); opacity: .88; } to { transform: scale(1.06) rotate(2deg); opacity: 1; } }
.cake-front-label text { font-weight: 700; }

/* Letter studio: real stationery presets and a structured letter preview */
.message-templates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.message-template {
  min-width: 0;
  display: grid;
  justify-items: stretch;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(220,225,232,.13);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
  color: #dce1e7;
  text-align: right;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.message-template:hover { border-color: rgba(220,226,234,.34); background: rgba(255,255,255,.05); }
.message-template:active { transform: scale(.98); }
.message-template.selected {
  border-color: rgba(226,232,240,.72);
  background: rgba(220,226,234,.09);
  box-shadow: inset 0 0 0 1px rgba(226,232,240,.1), 0 5px 16px rgba(0,0,0,.12);
}
.message-template > strong { font-size: 10px; font-weight: 700; }
.message-template > small { color: #969ea8; font-size: 8px; line-height: 1.5; }
.template-mini {
  height: 56px;
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid rgba(235,239,244,.28);
  border-radius: 5px;
  background: #252a30;
}
.template-mini::before,.template-mini::after { content: ""; position: absolute; left: 15%; right: 15%; height: 2px; border-radius: 5px; background: rgba(239,242,246,.55); }
.template-mini::before { top: 20px; }
.template-mini::after { top: 27px; left: 23%; right: 23%; opacity: .5; }
.template-mini i { position: absolute; top: 8px; left: 15%; right: 15%; height: 1px; background: rgba(239,242,246,.4); }
.template-mini b { position: absolute; top: 13px; left: 38%; right: 38%; height: 3px; border-radius: 4px; background: rgba(239,242,246,.8); }
.template-mini em { position: absolute; bottom: 8px; right: 15%; width: 22%; height: 1px; background: rgba(239,242,246,.45); }
.template-mini small { position: absolute; bottom: 8px; left: 15%; width: 17%; height: 1px; background: rgba(239,242,246,.3); }
.template-mini-paper { background: #e6e1d8; border-color: #b7b2aa; }
.template-mini-paper::before,.template-mini-paper::after,.template-mini-paper i,.template-mini-paper em,.template-mini-paper small { background: rgba(46,51,57,.48); }
.template-mini-paper b { background: #3a4046; }
.template-mini-editorial { background: #cfd5da; border-radius: 1px; border: 2px double #515a63; }
.template-mini-editorial::before { left: 9%; right: 33%; top: 29px; background: #30373f; }
.template-mini-editorial::after { left: 9%; right: 23%; top: 36px; background: #6a737d; }
.template-mini-editorial i { left: 9%; right: 9%; top: 8px; background: #68717b; }
.template-mini-editorial b { left: 9%; right: 53%; top: 15px; background: #30373f; }
.template-mini-editorial em,.template-mini-editorial small { background: #68717b; }
.template-mini-midnight { background: linear-gradient(135deg,#14181e,#303741); }
.template-mini-midnight::before,.template-mini-midnight::after,.template-mini-midnight i,.template-mini-midnight em,.template-mini-midnight small { background: rgba(230,235,242,.38); }
.template-mini-archive { background: #b9c0c7; border-style: dashed; border-color: #737d87; }
.template-mini-archive::before,.template-mini-archive::after,.template-mini-archive i,.template-mini-archive em,.template-mini-archive small { background: rgba(38,45,52,.5); }
.template-mini-archive b { background: #343c45; }
.editor-heading-words { margin-top: 6px; }
.editor-heading-style { margin-top: 3px; }
.message-text-area { min-height: 155px; }
.message-preview-shell { min-width: 0; }
.message-card {
  min-height: 310px;
  padding: 24px 23px 20px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 13px;
  border-radius: 8px;
  text-align: right;
  isolation: isolate;
}
.message-card::before { inset: 9px; border-radius: 3px; border-color: rgba(232,237,243,.22); }
.message-card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(230,235,242,.2);
  color: currentColor;
  opacity: .72;
  font: 600 8px "DM Sans", sans-serif;
  letter-spacing: 2px;
  direction: ltr;
}
.message-top-star { font-size: 14px; }
.message-card-kicker { font: 600 8px "DM Sans", sans-serif; letter-spacing: 1.6px; opacity: .62; text-align: center; }
.message-heading {
  position: relative;
  z-index: 1;
  width: 100%;
  margin: 0;
  font-size: clamp(17px, 3vw, 22px);
  line-height: 1.7;
  font-weight: 700;
  text-align: inherit;
  overflow-wrap: anywhere;
}
.message-card .message-content {
  flex: 1;
  min-width: 0;
  display: block;
  line-height: 2.05;
  letter-spacing: 0;
  text-align: inherit;
  overflow-wrap: anywhere;
}
.message-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(230,235,242,.2);
}
.message-card .message-from {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  color: currentColor;
  opacity: .76;
  font-size: 10px;
  line-height: 1.8;
}
.message-footer-mark { font-size: 15px; opacity: .6; }
.message-card.template-paper { border: 1px solid rgba(43,49,56,.42); box-shadow: 0 16px 30px rgba(0,0,0,.22), inset 0 0 0 5px rgba(255,255,255,.18); }
.message-card.template-paper::before { border-color: rgba(49,54,60,.25); }
.message-card.template-paper .message-card-topline,.message-card.template-paper .message-footer { border-color: rgba(49,54,60,.2); }
.message-card.template-paper .message-card-kicker,.message-card.template-paper .message-from { opacity: .72; }
.message-card.template-editorial { border-radius: 2px; box-shadow: 0 16px 30px rgba(0,0,0,.2); }
.message-card.template-editorial::before { inset: 7px; border: 2px double rgba(37,43,50,.44); border-radius: 0; }
.message-card.template-editorial .message-card-topline { border-bottom-color: rgba(37,43,50,.35); }
.message-card.template-editorial .message-footer { border-top-color: rgba(37,43,50,.35); }
.message-card.template-midnight { border-color: rgba(225,232,240,.28); background-image: radial-gradient(ellipse at 50% 0%,rgba(220,228,238,.12),transparent 58%),linear-gradient(145deg,#191e25,#11151a) !important; box-shadow: 0 18px 34px rgba(0,0,0,.32), inset 0 1px rgba(255,255,255,.12); }
.message-card.template-midnight::before { inset: 12px; border-color: rgba(224,231,239,.16); }
.message-card.template-archive { border-style: dashed; border-width: 2px; box-shadow: inset 0 0 0 6px rgba(255,255,255,.11), 0 15px 28px rgba(0,0,0,.18); }
.message-card.template-archive::before { inset: 12px; border-style: dashed; border-color: rgba(37,44,51,.34); }
.message-card.template-custom { border-color: rgba(230,235,242,.42); }
.preview-hint { margin-top: 10px; color: #9098a2; text-align: center; font-size: 9px; line-height: 1.7; }
@media (max-width:680px) {
  .cake-preview-box { min-height: 265px; padding: 34px 8px 24px; }
  .cake-svg { max-width: 320px; max-height: 260px; }
  .cake-options { grid-template-columns: 1fr 1fr; }
  .message-templates { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .message-template { padding: 7px; }
  .message-template > strong { font-size: 9px; }
  .message-template > small { font-size: 8px; }
  .message-card { min-height: 260px; padding: 22px 18px 17px; }
}
@media (max-width:370px) {
  .message-templates { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .message-card { min-height: 245px; padding-inline: 16px; }
}
