/* Afrina Cake Studio — brand tokens first; everything else reads from them. */
:root {
  /* Afrina Sweets: warm black + antique gold (logo), Persian turquoise (gift boxes), ivory */
  --bg: #FBF6EE;
  --bg-2: #F3EADB;
  --surface: #FFFFFF;
  --surface-2: #FAF4EA;
  --ink: #221A21;
  --ink-2: #5B4F55;
  --ink-3: #8E8187;
  --line: #EADFCD;
  --brand: #221A21;
  --brand-ink: #F8EBCB;
  --brand-2: #D9C08A;
  --brand-3: #F5ECDA;
  --accent: #B8985A;
  --accent-ink: #7F6330;
  --teal: #0098B0;
  --teal-ink: #00758A;
  --teal-3: #E2F4F6;
  --gold: #B8985A;
  --gold-2: #E9D29A;
  --mint: #5FBF98;
  --sky: #0098B0;
  --warn: #9A5A12;
  --warn-bg: #FFF3E0;
  --block: #A4213A;
  --block-bg: #FDECEF;
  --shadow: 0 1px 2px rgba(34, 26, 33, .06), 0 10px 30px -10px rgba(34, 26, 33, .22);
  --shadow-lg: 0 2px 6px rgba(34, 26, 33, .08), 0 30px 60px -20px rgba(34, 26, 33, .35);
  --radius: 22px;
  --display: "Fraunces", Georgia, serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --script: "Dancing Script", cursive;

  --afi-ink: #3A2420;
  --afi-body-hi: #FFF9F0; --afi-body-lo: #F3E2C9;
  --afi-icing-hi: #7FD6E0; --afi-icing-lo: #0098B0; --afi-icing-top: #B5EAF0;
  --afi-board-hi: #F0D9A0; --afi-board-lo: #A88850;
  --afi-cheek: #FF9FB2; --afi-ribbon: #EBDDBE;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17121A; --bg-2: #211A23; --surface: #241C26; --surface-2: #2C232E;
    --ink: #FBF3E6; --ink-2: #E2D3C2; --ink-3: #A99A9F; --line: #3B3040;
    --brand: #E3C47F; --brand-ink: #1B1418; --brand-2: #7A6334; --brand-3: #33291F;
    --accent: #E3C47F; --accent-ink: #E9CD8C; --teal: #3CC7DA; --teal-ink: #6FD8E6; --teal-3: #12343A;
    --gold: #E3C47F; --warn: #FFB870; --warn-bg: #3A2A16; --block: #FF8FA3; --block-bg: #3C1A22;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 30px -10px rgba(0, 0, 0, .6);
    --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17121A; --bg-2: #211A23; --surface: #241C26; --surface-2: #2C232E;
    --ink: #FBF3E6; --ink-2: #E2D3C2; --ink-3: #A99A9F; --line: #3B3040;
    --brand: #E3C47F; --brand-ink: #1B1418; --brand-2: #7A6334; --brand-3: #33291F;
    --accent: #E3C47F; --accent-ink: #E9CD8C; --teal: #3CC7DA; --teal-ink: #6FD8E6; --teal-3: #12343A;
    --gold: #E3C47F; --warn: #FFB870; --warn-bg: #3A2A16; --block: #FF8FA3; --block-bg: #3C1A22;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.eyebrow { font-size: 13px; letter-spacing: .16em; text-transform: uppercase; font-weight: 800; color: var(--accent-ink); margin: 0; }

/* background decoration */
.bg-deco { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; }
.b1 { width: 520px; height: 520px; background: #F3E3BE; top: -160px; left: -140px; animation: drift 18s ease-in-out infinite; }
.b2 { width: 460px; height: 460px; background: #FCE3E8; bottom: -180px; right: 10%; animation: drift 22s ease-in-out infinite reverse; }
.b3 { width: 360px; height: 360px; background: #D3F0F3; top: 30%; right: -120px; animation: drift 26s ease-in-out infinite; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .blob { opacity: .18; } }
@keyframes drift { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(40px, 30px); } }
.sprinkle { position: absolute; width: 16px; height: 16px; opacity: .5; background: var(--accent) !important; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); animation: twinkle 4s ease-in-out infinite; }
.sprinkle:nth-child(odd) { animation-delay: 1.3s; width: 11px; height: 11px; }
@keyframes twinkle { 0%, 100% { opacity: .2; transform: scale(.8) rotate(0); } 50% { opacity: .65; transform: scale(1.1) rotate(20deg); } }
.s1 { background: var(--sky); top: 14%; left: 47%; transform: rotate(30deg); }
.s2 { background: var(--gold-2); top: 70%; left: 6%; transform: rotate(-20deg); }
.s3 { background: var(--mint); top: 86%; left: 52%; transform: rotate(60deg); }
.s4 { background: var(--brand-2); top: 22%; left: 3%; transform: rotate(80deg); }
.s5 { background: var(--sky); top: 92%; left: 90%; transform: rotate(-40deg); }
.s6 { background: var(--gold-2); top: 8%; left: 88%; transform: rotate(15deg); }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 3vw, 36px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand-logo { height: 44px; width: auto; }
.brand-word { font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand-word em { font-style: italic; color: var(--accent-ink); font-weight: 600; }
.brand-pill { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 6px 12px; border-radius: 99px; background: var(--brand-3); color: var(--accent-ink); white-space: nowrap; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.icon-btn, .team-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 99px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 700; font-size: 15px;
  text-decoration: none; transition: transform .15s ease, border-color .15s ease, color .15s ease;
}
.icon-btn:hover, .team-link:hover { transform: translateY(-1px); border-color: var(--brand-2); color: var(--accent-ink); }
.icon-btn svg, .team-link svg { width: 20px; height: 20px; }
.icon-btn[aria-pressed="false"] .wave { opacity: 0; }
.icon-btn[aria-pressed="false"] { color: var(--ink-3); }
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 5px; border-radius: 99px; background: var(--surface); border: 1.5px solid var(--line); font-weight: 800; font-size: 15px; color: var(--ink-2); }
.user-chip .initial { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font-family: var(--display); font-size: 16px; }
.invite-card { text-align: left; }
.invite-card h2 { margin-bottom: 14px; }
.inv-form { display: grid; gap: 12px; }
.inv-form label { display: grid; gap: 6px; font-weight: 800; font-size: 14px; letter-spacing: .04em; color: var(--ink-2); }
.inv-form input, .inv-form textarea { font: inherit; font-size: 18px; font-weight: 600; letter-spacing: 0; padding: 12px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); outline: none; resize: vertical; }
.inv-form input:focus, .inv-form textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 4px var(--teal-3); }
.inv-form .modal-actions { justify-content: flex-start; margin-top: 6px; }
.inv-result { margin-top: 14px; font-weight: 800; font-size: 16px; border-radius: 14px; }
.inv-result.ok { padding: 12px 16px; background: var(--teal-3); color: var(--teal-ink); }
.inv-result.err { padding: 12px 16px; background: var(--block-bg); color: var(--block); }
.guest { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.guest span { grid-column: 1; color: var(--ink-2); font-size: 15px; }
.guest small { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--ink-3); font-weight: 700; }
.lang-btn .code { font-weight: 800; min-width: 22px; text-align: center; font-size: 16px; }
.text-input[dir="rtl"] { text-align: right; }

/* layout */
.studio {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(380px, .9fr);
  gap: clamp(18px, 2.4vw, 34px);
  max-width: 1480px; margin: 0 auto;
  padding: clamp(14px, 2vw, 28px) clamp(16px, 3vw, 36px) 28px;
  height: calc(100vh - 73px); height: calc(100dvh - 73px);
}

/* conversation column */
.convo {
  display: flex; flex-direction: column; min-height: 0;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  border: 1px solid var(--line); border-radius: 30px; box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  overflow: hidden;
}
.stage {
  position: relative; display: flex; align-items: center; gap: 18px;
  padding: 18px 24px 14px;
  background: linear-gradient(180deg, var(--surface-2), transparent);
  border-bottom: 1px dashed var(--line);
}
.stage-mascot { width: 118px; height: 134px; flex: none; filter: drop-shadow(0 10px 18px rgba(0, 152, 176, .18)); cursor: pointer; }
.stage-name { font-family: var(--display); font-size: 34px; font-weight: 800; line-height: 1; }
.stage-role { color: var(--ink-2); font-size: 16px; margin: 4px 0 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-weight: 700; font-size: 15px; color: var(--ink-2); }
.status-pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0 rgba(124, 203, 168, .6); }
.status-pill[data-state="listening"] .dot { background: var(--teal); color: var(--teal); animation: ping 1.2s infinite; }
.status-pill[data-state="thinking"] .dot { background: var(--gold); color: var(--gold); animation: ping 1.2s infinite; }
.status-pill[data-state="talking"] .dot { background: var(--teal); color: var(--teal); animation: ping 1s infinite; }
.status-pill[data-state="baking"] .dot { background: #F08A3C; animation: ping .8s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 currentColor; } 100% { box-shadow: 0 0 0 10px transparent; } }
.mode-switch {
  position: absolute; top: 18px; right: 22px; display: grid; grid-template-columns: 1fr 1fr; padding: 5px;
  border-radius: 99px; background: var(--surface); border: 1.5px solid var(--line); box-shadow: var(--shadow);
}
.mode-switch button { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; background: none; padding: 10px 20px; border-radius: 99px; font-weight: 800; font-size: 16px; color: var(--ink-2); transition: color .25s; }
.mode-switch button svg { width: 19px; height: 19px; }
.mode-switch button[aria-pressed="true"] { color: var(--brand-ink); }
.mode-thumb { position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc(50% - 5px); border-radius: 99px; background: var(--brand);
  transition: transform .35s cubic-bezier(.3, 1.3, .5, 1); box-shadow: 0 6px 14px -6px rgba(34, 26, 33, .6); }
.mode-switch[data-mode="chat"] .mode-thumb { transform: translateX(100%); }
.msg.me.live .bubble { background: transparent; color: var(--ink); border: 2px dashed var(--accent); }
.msg.me.live .bubble span:empty::before { content: "Listening…"; color: var(--ink-3); font-style: italic; }
.msg.me.live .bubble span::after { content: ""; display: inline-block; width: 2px; height: 1.1em; margin-left: 3px; vertical-align: -3px; background: var(--teal); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.msg.from-afi .bubble:empty::after { content: "•••"; letter-spacing: 3px; color: var(--accent); animation: bounce 1s infinite; display: inline-block; }
.live-caption {
  position: absolute; right: 22px; bottom: 14px; max-width: 46%;
  font-family: var(--display); font-style: italic; font-size: 20px; color: var(--teal-ink); text-align: right;
  opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s;
}
.live-caption.on { opacity: 1; transform: none; }

.messages { flex: 1; overflow-y: auto; padding: 22px 24px 10px; scroll-behavior: smooth; }
.msg { display: flex; gap: 12px; margin: 0 0 16px; animation: rise .35s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.msg .avatar { width: 40px; height: 46px; flex: none; margin-top: 2px; }
.msg .bubble {
  max-width: min(640px, 86%); padding: 14px 20px; border-radius: 22px; font-size: 19px; line-height: 1.5;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 0 rgba(58, 27, 38, .03);
}
.msg.from-afi .bubble { border-top-left-radius: 8px; }
.msg.me { justify-content: flex-end; }
.msg.me .bubble { background: var(--brand); color: var(--brand-ink); border-color: transparent; border-top-right-radius: 8px; }
.msg.me .bubble img { border-radius: 14px; margin-bottom: 8px; max-height: 220px; }
.msg .bubble.typing { display: inline-flex; gap: 6px; padding: 18px 20px; }
.typing i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: bounce 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-6px); opacity: 1; } }
.tool-note { display: inline-flex; align-items: center; gap: 8px; margin: -6px 0 14px 52px; font-size: 15px; font-weight: 700; color: var(--ink-3); }
.tool-note::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--brand-2); border-top-color: var(--teal); animation: spin .8s linear infinite; }
.tool-note.done::before { animation: none; border-color: var(--mint); background: var(--mint); }
@keyframes spin { to { transform: rotate(360deg); } }
.msg.error .bubble { background: var(--block-bg); border-color: transparent; color: var(--block); }

/* choices */
.choices { margin: -4px 0 18px 52px; animation: rise .4s .05s both; }
.choices .q { font-size: 14px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 99px;
  background: var(--surface); border: 1.5px solid var(--line); font-weight: 700; font-size: 17px; color: var(--ink);
  transition: transform .15s ease, border-color .15s, background .15s, box-shadow .15s;
}
.chip:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 18px -10px var(--accent); }
.chip.sel { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.chip .ico { font-size: 20px; line-height: 1; }
.chip .sw { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--line); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.card-opt {
  text-align: left; padding: 0; border-radius: 18px; overflow: hidden; background: var(--surface); border: 1.5px solid var(--line);
  transition: transform .18s ease, box-shadow .18s, border-color .18s;
}
.card-opt:hover { transform: translateY(-3px) rotate(-.3deg); box-shadow: var(--shadow); border-color: var(--brand-2); }
.card-opt.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--brand-3); }
.card-opt .img { aspect-ratio: 4 / 3; background: var(--surface-2) center / cover no-repeat; display: grid; place-items: center; font-size: 42px; }
.card-opt .cap { padding: 10px 14px 12px; }
.card-opt b { display: block; font-size: 17px; }
.card-opt small { display: block; color: var(--ink-2); font-size: 14.5px; line-height: 1.35; margin-top: 2px; }
.swatches { display: flex; flex-wrap: wrap; gap: 14px; }
.swatch-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; padding: 4px; width: 92px; }
.swatch-opt .disc { width: 58px; height: 58px; border-radius: 50%; border: 4px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line), var(--shadow); transition: transform .18s; }
.swatch-opt:hover .disc { transform: scale(1.08) rotate(-6deg); }
.swatch-opt.sel .disc { box-shadow: 0 0 0 3px var(--accent), var(--shadow); }
.swatch-opt span { font-size: 14.5px; font-weight: 700; text-align: center; line-height: 1.2; color: var(--ink-2); }
.picker { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.picker input[type="date"] { font: inherit; font-size: 18px; padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 99px; padding: 4px; }
.stepper button { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--brand-3); color: var(--accent-ink); font-size: 22px; font-weight: 800; }
.stepper output { min-width: 64px; text-align: center; font-family: var(--display); font-size: 26px; font-weight: 800; }
.go-btn { padding: 11px 20px; border-radius: 99px; border: 0; background: var(--ink); color: var(--bg); font-weight: 800; }
.choices.used { opacity: .55; pointer-events: none; }

/* composer */
.composer {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px 16px;
  border-top: 1px solid var(--line); background: var(--surface);
}
.text-input {
  flex: 1; min-width: 0; font: inherit; font-size: 19px; padding: 15px 20px; border-radius: 99px;
  border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
.text-input:focus { border-color: var(--teal); box-shadow: 0 0 0 4px var(--teal-3); }
.comp-btn, .send-btn { width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--ink-2); flex: none; }
.comp-btn svg, .send-btn svg { width: 24px; height: 24px; }
.send-btn { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.mic-btn {
  position: relative; width: 64px; height: 64px; border-radius: 50%; border: 0; flex: none;
  background: radial-gradient(circle at 30% 28%, #F4E2B0, #C9A764 55%, #9C7A3E);
  color: #221A21; display: grid; place-items: center; box-shadow: 0 10px 24px -8px rgba(156, 122, 62, .9), inset 0 1px 0 rgba(255, 255, 255, .6);
  transition: transform .15s ease;
}
.mic-btn:hover { transform: scale(1.05); }
.mic-btn svg { width: 28px; height: 28px; position: relative; z-index: 1; }
.mic-btn .ring { position: absolute; inset: -6px; border-radius: 50%; border: 3px solid var(--teal); opacity: 0; }
.mic-btn.live .ring { animation: ripple 1.3s ease-out infinite; }
.mic-btn.live { background: radial-gradient(circle at 30% 28%, #8FE1EA, #0098B0 60%, #00758A); color: #fff; }
@keyframes ripple { 0% { transform: scale(.9); opacity: .9; } 100% { transform: scale(1.5); opacity: 0; } }
.attach-chip { position: relative; width: 52px; height: 52px; flex: none; }
.attach-chip img { width: 52px; height: 52px; object-fit: cover; border-radius: 14px; border: 2px solid var(--accent); }
.attach-chip button { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); font-weight: 800; line-height: 1; }

/* cake panel */
.cake-panel {
  min-height: 0; overflow-y: auto; border-radius: 30px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-lg); position: relative;
}
.panel-handle { display: none; }
.panel-body { padding: 24px 26px 28px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.cake-title { font-family: var(--display); font-size: clamp(28px, 2.4vw, 36px); line-height: 1.1; font-weight: 800; margin: 6px 0 0; letter-spacing: -.01em; }
.progress-ring { position: relative; width: 64px; height: 64px; flex: none; }
.progress-ring svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.progress-ring circle { fill: none; stroke-width: 5; }
.progress-ring .track { stroke: var(--teal-3); }
.progress-ring .bar { stroke: var(--teal); stroke-linecap: round; stroke-dasharray: 113.1; stroke-dashoffset: 113.1; transition: stroke-dashoffset .6s cubic-bezier(.2, .9, .3, 1); }
.progress-ring span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 19px; }

.cake-stage {
  position: relative; margin: 18px 0 8px; border-radius: 24px; min-height: 340px;
  background:
    radial-gradient(ellipse 60% 40% at 50% 92%, rgba(34, 26, 33, .10), transparent 70%),
    radial-gradient(ellipse at 50% 30%, #FFFFFF, var(--surface-2) 70%);
  border: 1px solid var(--line); overflow: hidden; perspective: 900px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cake-stage { background: radial-gradient(ellipse at 50% 30%, #3C2430, #241419 75%); } }
.sketch { padding: 18px 26px 6px; }
.sketch-svg { width: 100%; height: auto; max-height: 420px; }
.sketch-svg .flame { animation: flicker .5s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes flicker { from { transform: scale(1, 1); } to { transform: scale(.9, 1.12) rotate(3deg); } }
.sketch.morph { animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { 0% { transform: scale(.96); opacity: .6; } 100% { transform: none; opacity: 1; } }
.photo { margin: 0; padding: 14px; }
.photo img { width: 100%; border-radius: 18px; box-shadow: var(--shadow-lg); animation: develop 1s ease both; }
@keyframes develop { from { filter: blur(14px) saturate(.4); opacity: 0; transform: scale(1.03); } to { filter: none; opacity: 1; transform: none; } }
.photo figcaption { font-size: 14.5px; color: var(--ink-2); padding: 10px 4px 0; }
.photo .tag { display: inline-block; font-weight: 800; color: var(--accent-ink); margin-right: 6px; }
.view-toggle { position: absolute; top: 12px; right: 12px; z-index: 3; display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 3px; box-shadow: var(--shadow); }
.view-toggle button { border: 0; background: none; padding: 7px 14px; border-radius: 99px; font-weight: 800; font-size: 14px; color: var(--ink-2); }
.view-toggle button.on { background: var(--brand); color: var(--brand-ink); }
.thumbs { display: flex; gap: 8px; padding: 0 14px 14px; }
.thumbs img { width: 58px; height: 58px; object-fit: cover; border-radius: 12px; border: 2px solid transparent; cursor: pointer; opacity: .75; }
.thumbs img.on { border-color: var(--accent); opacity: 1; }

/* baking */
.bake-overlay { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(4px); animation: rise .3s ease; }
.oven { width: 190px; }
.oven-top { height: 30px; background: #E9DED6; border: 3px solid var(--afi-ink); border-bottom: 0; border-radius: 18px 18px 0 0; display: flex; gap: 12px; align-items: center; padding: 0 18px; }
.oven-top span { width: 14px; height: 14px; border-radius: 50%; background: var(--teal); border: 2px solid var(--afi-ink); }
.oven-top span:nth-child(2) { background: var(--gold); } .oven-top span:nth-child(3) { background: var(--mint); }
.oven-door { background: #F7EFE9; border: 3px solid var(--afi-ink); border-radius: 0 0 18px 18px; padding: 16px; }
.oven-window { position: relative; height: 104px; border-radius: 12px; background: #2B1A20; border: 3px solid var(--afi-ink); overflow: hidden; }
.oven-glow { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 100%, rgba(255, 150, 60, .75), transparent 70%); animation: glow 1.2s ease-in-out infinite alternate; }
@keyframes glow { from { opacity: .55; } to { opacity: 1; } }
.oven-cake { position: absolute; left: 50%; bottom: 10px; width: 92px; height: 52px; margin-left: -46px; border-radius: 10px 10px 6px 6px; background: linear-gradient(#F4C27A, #D99A4E); border: 3px solid var(--afi-ink); transform-origin: bottom; animation: rise-cake 2.6s ease-in-out infinite; z-index: 1; }
@keyframes rise-cake { 0% { transform: scaleY(.5); } 60%, 100% { transform: scaleY(1); } }
.baking-text { font-family: var(--display); font-size: 24px; font-weight: 700; font-style: italic; color: var(--ink); min-height: 32px; text-align: center; }
.baking-bar { width: 220px; height: 8px; border-radius: 99px; background: var(--teal-3); overflow: hidden; }
.baking-bar span { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, var(--teal), var(--gold)); border-radius: 99px; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }

/* specs */
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 0; }
.spec { padding: 12px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; transition: background .3s, transform .3s; }
.spec.wide { grid-column: span 2; }
.spec dt { font-size: 12.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 2px; }
.spec dd { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.spec.empty dd { color: var(--ink-3); font-weight: 600; font-style: italic; }
.spec.fresh { animation: fresh 1.4s ease; }
@keyframes fresh { 0% { background: var(--teal-3); transform: scale(1.03); } 100% { background: var(--surface-2); transform: none; } }
.spec .swrow { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.spec .swrow i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.spec .msg-text { font-family: var(--script); font-size: 24px; font-weight: 700; color: var(--accent-ink); }
.spec .ok { font-size: 13px; font-weight: 800; color: #2F8F64; margin-left: 6px; }
.spec .place { font-size: 14px; font-weight: 700; color: var(--ink-2); margin-top: 2px; }

.notes { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.note { padding: 11px 14px; border-radius: 14px; font-size: 15.5px; line-height: 1.4; background: var(--surface-2); border-left: 4px solid var(--sky); }
.note.warn { background: var(--warn-bg); border-left-color: var(--warn); }
.note.block { background: var(--block-bg); border-left-color: var(--block); color: var(--block); font-weight: 700; }

.estimate { margin-top: 16px; padding: 18px 20px; border-radius: 20px; background: linear-gradient(135deg, #221A21, #3E3138); color: #FBF3E6; box-shadow: var(--shadow-lg); border: 1px solid #B8985A55; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .estimate { background: linear-gradient(135deg, #4A2533, #2E1820); } }
.estimate .eyebrow { color: var(--gold-2); }
.est-head { display: flex; justify-content: space-between; align-items: center; }
.est-toggle { border: 1px solid rgba(255, 255, 255, .3); background: none; color: #fff; border-radius: 99px; padding: 4px 12px; font-size: 14px; font-weight: 700; }
.est-total { font-family: var(--display); font-weight: 800; margin-top: 4px; display: flex; align-items: baseline; gap: 8px; }
.est-total span { font-size: 20px; opacity: .8; }
.est-total b { font-size: 44px; line-height: 1; }
.est-sub { font-size: 15.5px; opacity: .85; margin-top: 4px; }
.est-lines { list-style: none; padding: 12px 0 0; margin: 12px 0 0; border-top: 1px solid rgba(255, 255, 255, .18); font-size: 15.5px; }
.est-lines li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }

/* welcome */
.welcome { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(10px); }
.welcome.leaving { animation: fade-out .45s ease forwards; }
@keyframes fade-out { to { opacity: 0; visibility: hidden; } }
.welcome-card {
  display: grid; grid-template-columns: 300px 1fr; gap: 28px; align-items: center;
  max-width: 920px; width: 100%; padding: clamp(24px, 4vw, 48px); border-radius: 36px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  animation: rise .6s cubic-bezier(.2, .9, .3, 1.2);
}
.welcome-mascot { width: 100%; aspect-ratio: 220 / 250; filter: drop-shadow(0 20px 30px rgba(0, 152, 176, .22)); }
.welcome h2 { font-family: var(--display); font-size: clamp(38px, 5vw, 60px); line-height: 1.02; margin: 10px 0 14px; font-weight: 800; letter-spacing: -.02em; }
.welcome h2 span { font-style: italic; color: var(--accent-ink); font-weight: 700; }
.welcome .lead { font-size: 20px; color: var(--ink-2); margin: 0 0 24px; }
.welcome-actions, .modal-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; gap: 10px; padding: 16px 28px; border-radius: 99px; font-size: 19px; font-weight: 800;
  text-decoration: none; transition: transform .15s ease, box-shadow .15s;
}
.btn-primary { border: 0; background: var(--brand); color: var(--brand-ink); box-shadow: 0 14px 30px -12px rgba(34, 26, 33, .7), inset 0 0 0 1.5px #B8985A66; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -12px rgba(34, 26, 33, .8), inset 0 0 0 1.5px #B8985A; }
.btn-primary svg { width: 24px; height: 24px; }
.btn-ghost { border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); }
.btn-ghost:hover { border-color: var(--brand-2); }
.welcome-points { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-wrap: wrap; gap: 10px 22px; color: var(--ink-2); font-weight: 700; font-size: 16px; }
.welcome-points span { margin-right: 6px; }

/* modals */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(23, 18, 26, .6); backdrop-filter: blur(8px); animation: rise .3s ease; }
.modal-card { position: relative; width: min(620px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: clamp(22px, 4vw, 38px); border-radius: 32px; background: var(--surface); box-shadow: var(--shadow-lg); text-align: center; animation: rise .5s cubic-bezier(.2, .9, .3, 1.3); }
.modal-card h2 { font-family: var(--display); font-size: clamp(30px, 4vw, 42px); line-height: 1.08; margin: 8px 0 18px; font-weight: 800; }
.modal-actions { justify-content: center; margin-top: 18px; }
.fine { color: var(--ink-2); font-size: 15.5px; margin: 14px 0 0; }
.tilt { border-radius: 24px; transform-style: preserve-3d; transition: transform .2s ease; }
.tilt img { width: 100%; max-height: 58vh; object-fit: contain; border-radius: 24px; box-shadow: var(--shadow-lg); animation: develop 1.2s ease both; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
.seal { width: 92px; height: 92px; margin: 0 auto 6px; }
.seal svg { width: 100%; height: 100%; }
.seal circle { fill: var(--mint); stroke: #2F8F64; stroke-width: 3; animation: pop .6s cubic-bezier(.2, 1.6, .4, 1); transform-origin: center; }
.seal path { fill: none; stroke: #fff; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .6s .3s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.order-grid { display: grid; grid-template-columns: 180px 1fr; gap: 18px; text-align: left; align-items: center; }
.order-img img { border-radius: 18px; box-shadow: var(--shadow); }
.order-facts { display: grid; gap: 6px; font-size: 16.5px; }
.order-facts b { font-weight: 800; }
.bc-chip { display: inline-flex; align-items: center; gap: 10px; margin-top: 18px; padding: 10px 16px; border-radius: 14px; background: #EAF3FB; color: #0F4C81; font-weight: 800; font-size: 15.5px; }
.bc-chip .sim { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; background: #fff; color: #8a6a12; border-radius: 99px; padding: 2px 8px; }

/* setup card when keys are missing */
.setup { margin: 4px 0 16px 52px; padding: 18px 20px; border-radius: 20px; background: var(--warn-bg); border: 1px solid var(--line); font-size: 16.5px; }
.setup h3 { font-family: var(--display); margin: 0 0 6px; font-size: 22px; }
.setup code { background: var(--surface); padding: 1px 6px; border-radius: 6px; font-size: 14.5px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .studio { grid-template-columns: minmax(0, 1fr) 360px; }
  .specs { grid-template-columns: 1fr; } .spec.wide { grid-column: auto; }
}
@media (max-width: 900px) {
  body { font-size: 17px; }
  .studio { display: block; height: auto; padding: 0; }
  .convo { border-radius: 0; border: 0; height: calc(100dvh - 65px - 74px); box-shadow: none; }
  .stage { padding: 12px 16px 10px; gap: 12px; }
  .stage-mascot { width: 74px; height: 84px; }
  .stage-name { font-size: 26px; }
  .stage-role { font-size: 14px; margin: 2px 0 6px; }
  .stage { flex-wrap: wrap; }
  .mode-switch { position: relative; top: auto; right: auto; order: 3; width: 100%; margin-top: 4px; }
  .mode-switch button { padding: 9px 12px; font-size: 15px; }
  .live-caption { position: static; max-width: none; font-size: 17px; text-align: left; }
  .messages { padding: 16px 16px 8px; }
  .msg .bubble { font-size: 17.5px; max-width: 88%; }
  .choices, .tool-note, .setup { margin-left: 0; }
  .msg .avatar { display: none; }
  .composer { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); gap: 8px; }
  .comp-btn, .send-btn { width: 46px; height: 46px; }
  .mic-btn { width: 56px; height: 56px; }
  .text-input { font-size: 17px; padding: 13px 16px; }
  .cake-panel {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; border-radius: 26px 26px 0 0; max-height: 74px; overflow: hidden;
    transition: max-height .45s cubic-bezier(.2, .9, .3, 1); box-shadow: 0 -12px 30px -12px rgba(34, 26, 33, .3);
  }
  .cake-panel.open { max-height: 88dvh; overflow-y: auto; }
  .panel-handle { display: flex; width: 100%; align-items: center; gap: 12px; padding: 12px 16px; border: 0; background: var(--surface); text-align: left; position: sticky; top: 0; z-index: 5; }
  .panel-handle svg { width: 24px; height: 24px; margin-left: auto; transition: transform .3s; }
  .cake-panel.open .panel-handle svg { transform: rotate(180deg); }
  .mini-sketch { width: 50px; height: 50px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
  .mini-sketch svg { width: 48px; height: 48px; }
  .handle-text b { display: block; font-family: var(--display); font-size: 19px; }
  .handle-text small { color: var(--ink-2); font-size: 14px; font-weight: 700; }
  .panel-body { padding: 4px 16px 28px; }
  .topbar { padding: 10px 16px; }
  .brand-word { font-size: 21px; }
  .brand-pill, .team-link span, .icon-btn .label, .user-chip .uname { display: none; }
  .user-chip { padding: 3px; }
  .welcome-card { grid-template-columns: 1fr; text-align: center; gap: 4px; }
  .welcome-mascot { width: 180px; margin: 0 auto; }
  .welcome-actions, .welcome-points { justify-content: center; }
  .order-grid { grid-template-columns: 1fr; }
  .order-img img { max-width: 240px; margin: 0 auto; }
}
@media (max-width: 420px) {
  .brand-logo { height: 34px; }
  .welcome .lead { font-size: 17px; }
  .btn-primary, .btn-ghost { padding: 14px 22px; font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
