:root{
  --bg:#0d0e11;--ink:#121419;--panel:rgba(10,14,22,.78);--panel-2:#1b1d23;--line:#3a3326;
  --gold:#d4af6a;--gold-2:#f0d9a0;--gold-dim:#8f7646;--text:#efe6d2;--muted:#a59a83;
  --red:#a3241b;--red-2:#c8382b;--red-dark:#5e130e;--parchment:#e8d3a2;--parchment-2:#c9a868;
  --wood:#5fbf72;--fire:#e2493c;--earth:#e8a92a;--metal:#f3ecdb;--water:#4f8fe6;
  --serif:"Cormorant Garamond","Palatino Linotype",Palatino,"Book Antiqua",Georgia,"Songti SC","Noto Serif CJK SC",serif;
  --kai:"Kaiti SC","STKaiti",KaiTi,"BiauKai","Songti SC",serif;
  color-scheme:dark;font-family:var(--serif);color:var(--text);background:var(--bg);
  font-synthesis:none;-webkit-text-size-adjust:100%;
}
*{box-sizing:border-box}
html,body{height:100%}
/* Moonlit landscape fills every screen: wide art for landscape, tall art for portrait. */
body{margin:0;overflow:hidden;background:#0b1019 url(/static/img/bg-wide.jpg) center center/cover no-repeat}
@media (max-aspect-ratio:1/1){body{background-image:url(/static/img/bg-tall.jpg);background-position:center bottom}}
button,input,textarea{font:inherit;color:inherit}
button{cursor:pointer}
button:disabled{cursor:not-allowed;opacity:.5}
:focus-visible{outline:2px solid var(--gold-2);outline-offset:2px}
[hidden]{display:none!important}
svg{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* Gold fret-corner frame used on cards, buttons and dialogs. */
.frame{border:12px solid transparent;border-image:url(/static/img/frame.svg) 16 / 12px stretch}

/* One-page shell: only the feed scrolls. */
.app{height:100dvh;display:flex;flex-direction:column;max-width:1180px;margin:0 auto;padding:0 12px max(10px,env(safe-area-inset-bottom))}

/* Header */
.bar{position:relative;display:flex;flex-direction:column;align-items:center;gap:10px;margin:0 -12px;padding:max(12px,env(safe-area-inset-top)) 12px 12px}
.brand{display:flex;align-items:center;gap:12px}
.brand h1{margin:0;font-size:38px;font-weight:700;font-style:italic;letter-spacing:.5px;line-height:1;
  background:linear-gradient(180deg,#fff2cc 10%,var(--gold) 60%,#a9823f);-webkit-background-clip:text;background-clip:text;color:transparent;
  filter:drop-shadow(0 2px 2px rgba(0,0,0,.6))}
.seal{display:inline-flex;align-items:center;justify-content:center;width:30px;padding:4px 0;border-radius:4px;background:linear-gradient(#b52a1f,#8a1a12);
  color:#f6e2b0;font-family:var(--kai);font-size:17px;line-height:1.05;text-align:center;box-shadow:0 0 0 1px #e0b26a inset,0 2px 6px rgba(0,0,0,.5)}
.seal.small{width:34px;height:34px;padding:0;border-radius:50%;font-size:18px}
.bar-actions{display:flex;gap:10px;justify-content:center;flex-wrap:wrap}
.pills{display:flex;gap:10px;width:100%;max-width:640px;align-items:center}

.chip{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:34px;padding:0 14px;border-radius:999px;
  border:1px solid var(--gold-dim);background:rgba(13,14,17,.7);color:var(--text);font-size:15px;white-space:nowrap}
.chip svg{color:var(--gold)}
.chip:hover:not(:disabled){border-color:var(--gold);background:rgba(40,34,22,.8)}
.chip.framed{border-radius:8px;border:1.5px solid var(--gold);box-shadow:inset 0 0 0 2px rgba(13,14,17,.9),inset 0 0 0 3px rgba(212,175,106,.45)}
#account-button{max-width:220px}
#account-label{overflow:hidden;text-overflow:ellipsis}

.pill{display:inline-flex;align-items:center;gap:8px;height:40px;padding:0 14px;border-radius:8px;font-size:18px;font-weight:600;white-space:nowrap}
.pill.viewers{flex:none;border:1.5px solid var(--gold);background:rgba(13,14,17,.85);box-shadow:inset 0 0 0 2px #0d0e11,inset 0 0 0 3px rgba(212,175,106,.45)}
.pill.viewers svg{color:var(--gold-2)}
.pill.status{position:relative;flex:1;min-width:0;justify-content:center;margin:0 18px;border-radius:4px;
  background:linear-gradient(180deg,#f2e0b4,var(--parchment) 45%,var(--parchment-2));color:#8b1d14;font-style:italic;font-size:19px;
  box-shadow:0 0 0 1px #7b5d2b,0 3px 8px rgba(0,0,0,.45)}
.pill.status::before,.pill.status::after{content:'';position:absolute;bottom:-1px;width:40px;height:22px;background:url(/static/img/cloud.svg) center bottom/contain no-repeat}
.pill.status::before{left:-26px}
.pill.status::after{right:-26px;transform:scaleX(-1)}
.pill.status svg{color:#8b1d14;width:20px;height:20px}
.pill.status span{overflow:hidden;text-overflow:ellipsis}
.pill.status.live{background:linear-gradient(180deg,#d1463a,var(--red) 55%,#7b170f);color:#fbe6b8;box-shadow:0 0 0 1px var(--gold),0 3px 10px rgba(163,36,27,.45)}
.pill.status.live svg{color:#fbe6b8}

.body{flex:1;min-height:0;display:flex;flex-direction:column;gap:10px;padding-top:6px}

/* Chart */
.chart-card,.chat,.queue-card{-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}
.chart-card{display:flex;gap:14px;padding:6px;flex:none;background:var(--panel);background-clip:padding-box}
.chart-grid{display:grid;grid-template-columns:repeat(3,1fr);width:168px;flex:none;aspect-ratio:1;border-width:10px;border-image-width:10px;background:#08090b;background-clip:padding-box}
.palace{display:flex;align-items:center;justify-content:center;border:0;border-right:1px solid #4a3f2b;border-bottom:1px solid #4a3f2b;background:#101114;
  font-family:var(--kai);font-size:30px;padding:0;line-height:1;text-shadow:0 0 10px currentColor,0 2px 2px #000}
.palace:nth-child(3n){border-right:0}.palace:nth-child(n+7){border-bottom:0}
.palace.wood{color:var(--wood);background:#0d1a11}.palace.fire{color:var(--fire);background:#22100d}.palace.earth{color:var(--earth);background:#1b150a}
.palace.metal{color:var(--metal)}.palace.water{color:var(--water);background:#0b1424}.palace.center{color:var(--metal);text-shadow:0 2px 2px #000}
.palace:hover:not(:disabled),.palace.selected{filter:brightness(1.5);box-shadow:inset 0 0 0 1px var(--gold)}
.palace:disabled{opacity:1}
.chart-meta{display:flex;flex-direction:column;gap:7px;min-width:0;flex:1;font-size:17px;color:var(--text)}
.chart-meta h2{position:relative;margin:0 0 6px;padding-bottom:8px;font-size:26px;font-style:italic;color:var(--gold-2);font-weight:700}
.chart-meta h2::after{content:'';position:absolute;left:0;bottom:0;width:80%;height:4px;border-radius:50%;background:linear-gradient(90deg,var(--gold),rgba(212,175,106,0))}
.chart-meta p{margin:0;display:flex;align-items:center;gap:10px;white-space:nowrap}
.chart-meta p svg{width:20px;height:20px;color:var(--gold)}
#chart-next b{display:inline-block;margin-left:2px;padding:1px 12px 1px 6px;color:#fff1d0;font-weight:600;
  background:linear-gradient(90deg,#c8382b,#a3241b 70%,rgba(163,36,27,.0));clip-path:polygon(0 12%,100% 0,92% 50%,100% 100%,2% 90%)}
.palace-detail{font-size:14px;color:var(--muted);line-height:1.45}
.chart-meta p.palace-detail{display:block}
.toggle-chart{margin-top:auto;align-self:center;padding:0 22px}
.show-chart{align-self:center;flex:none}

/* Chat */
.chat-col{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column}
.chat{flex:1;min-height:0;display:flex;flex-direction:column;padding:4px 2px;background:var(--panel);background-clip:padding-box}
.feed{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;display:flex;flex-direction:column;gap:16px;padding:6px 8px 10px;
  scrollbar-width:thin;scrollbar-color:var(--gold-dim) transparent}
.older{align-self:center;flex:none}
.chat{position:relative}
.to-end{position:absolute;right:14px;bottom:12px;z-index:2;width:40px;height:40px;padding:0;border-radius:50%;display:flex;align-items:center;justify-content:center;
  border:1.5px solid var(--gold);background:rgba(13,14,17,.88);color:var(--gold-2);box-shadow:inset 0 0 0 2px #0d0e11,0 3px 10px rgba(0,0,0,.6)}
.to-end svg{width:22px;height:22px;stroke-width:2.4}
.to-end:hover{background:#2a2216}
.empty{margin:auto;text-align:center;color:var(--muted);font-size:17px;font-style:italic}
.empty span{font-size:34px;color:var(--gold)}
.turn{display:flex;flex-direction:column;gap:12px}
.msg{display:grid;grid-template-columns:34px minmax(0,1fr);gap:4px 12px}
.avatar{grid-row:span 2;width:34px;height:34px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:15px;color:#fff;
  box-shadow:0 0 0 1.5px var(--gold-dim)}
.avatar.agent{background:linear-gradient(#b52a1f,#8a1a12);color:#f6e2b0;font-family:var(--kai);font-size:18px;box-shadow:0 0 0 1.5px var(--gold)}
.who{font-weight:700;font-size:16px;color:var(--gold-2);display:flex;gap:8px;align-items:baseline;min-width:0}
.who time{font-weight:400;font-size:12px;color:var(--muted)}
.agent-name{color:var(--gold);font-size:15px;font-weight:700;font-style:italic;margin-bottom:4px}
.bubble{justify-self:start;max-width:100%;background:rgba(36,32,25,.75);border:1px solid #4a3f2b;border-radius:4px 14px 14px 14px;padding:9px 14px;
  font-size:18px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere}
.msg.agent .bubble{background:transparent;border:0;padding:0;font-size:19px;line-height:1.55;color:#f3ead6}
.topic-tag{display:inline-block;margin-right:8px;padding:0 8px;border-radius:999px;border:1px solid var(--gold-dim);color:var(--gold);font-size:13px;font-style:italic;vertical-align:2px}
.bubble.thinking{color:var(--muted);font-style:italic}
.dots::after{content:'';display:inline-block;width:1.2em;text-align:left;animation:dots 1.2s steps(4,end) infinite}
@keyframes dots{0%{content:''}25%{content:'.'}50%{content:'..'}75%{content:'...'}}
.bubble.markdown{white-space:normal}
.markdown .md-p{margin:0 0 .7em}
.markdown .md-h{margin:.9em 0 .35em;color:var(--gold-2);font-weight:700;line-height:1.3}
.markdown .md-h1{font-size:1.2em}.markdown .md-h2{font-size:1.1em}.markdown .md-h3{font-size:1em}
.markdown .md-list{margin:0 0 .7em;padding-left:1.4em}
.markdown .md-list li{margin:.2em 0}
.markdown .md-hr{border:0;border-top:1px solid var(--gold-dim);margin:.9em 0}
.markdown strong{color:#fff3d6;font-weight:700}
.markdown code{font-family:ui-monospace,Menlo,monospace;font-size:.85em;background:rgba(0,0,0,.3);padding:0 4px;border-radius:4px}
.markdown > :first-child{margin-top:0}.markdown > :last-child{margin-bottom:0}
.api-cost{grid-column:2;margin-top:6px;color:var(--muted);font-size:12px;line-height:1.4;font-family:ui-monospace,Menlo,monospace;overflow-wrap:anywhere;min-width:0}
.api-cost-toggle,.api-step{all:unset;display:block;cursor:pointer;color:inherit;font:inherit;padding:2px 0;overflow-wrap:anywhere}
.api-cost-toggle:hover,.api-step:hover,.api-step.selected{color:var(--gold-2)}
.api-cost-toggle:focus-visible,.api-step:focus-visible{outline:1px solid var(--gold-dim);outline-offset:2px}
.api-steps{margin:4px 0 0 12px;border-left:1px solid var(--gold-dim);padding-left:10px}
.api-note{margin:2px 0;font-style:italic}
.agent-versions{grid-column:2;margin-top:4px;color:var(--muted);font-size:12px;line-height:1.4;font-family:ui-monospace,Menlo,monospace;overflow-wrap:anywhere;min-width:0}
.agent-versions .api-step:disabled{cursor:default}
.agent-regenerate{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin:6px 0}
.agent-regenerate select,.agent-regenerate button{font:inherit;font-size:12px;padding:4px 8px;border-radius:6px;border:1px solid var(--gold-dim);background:transparent;color:inherit;min-width:0}
.agent-regenerate select option{color:#111}
.agent-regenerate button{cursor:pointer;color:var(--gold-2)}
.agent-regenerate button:disabled{opacity:.5;cursor:wait}
.agent-answer{margin:4px 0 10px;padding:10px 12px;border-left:2px solid var(--gold-dim);font-family:inherit;font-size:14px;line-height:1.55;color:var(--text,inherit)}
.api-bodies{margin:4px 0 8px}
.api-body-title{color:var(--gold);margin-top:6px}
.api-body{margin:2px 0 0;max-height:360px;overflow:auto;background:rgba(0,0,0,.35);border:1px solid #4a3f2b;border-radius:6px;padding:8px;
  font-size:11px;line-height:1.45;white-space:pre-wrap;overflow-wrap:anywhere;color:#e6dcc6}
.error-text{color:#ff8a7a;font-size:14px;margin:6px 0 0;white-space:normal}
.tag{font-size:11px;font-weight:700;color:#1a1208;background:var(--gold);border-radius:3px;padding:0 5px;letter-spacing:.5px}
/* Learner / Achiever: the answer style the asker had, outlined so it reads apart from "You". */
.tag.style-tag{background:transparent;border:1px solid currentColor;font-weight:600}
.tag.style-learner{color:#8fb8e0}
.tag.style-achiever{color:#7fc47f}
.divider{display:flex;align-items:center;gap:10px;color:var(--gold-dim);font-size:13px;font-style:italic;letter-spacing:.6px}
.divider::before,.divider::after{content:'';height:1px;flex:1;background:linear-gradient(90deg,transparent,var(--gold-dim),transparent)}
.choice{margin-top:8px;padding:10px 12px;border:1px solid var(--gold-dim);border-radius:8px;white-space:normal;background:rgba(13,14,17,.6)}
.choice h3{margin:0 0 8px;font-size:16px;color:var(--gold-2)}
.choice.in-answer{margin:12px 0}
.choice.in-answer:first-child{margin-top:0}
.choice.in-answer h3{margin-bottom:4px}
.choice.in-answer p{margin:0}
.choice-options{display:flex;flex-wrap:wrap;gap:6px}
.choice-options .chip{height:auto;min-height:32px;padding:6px 12px;white-space:normal;text-align:left}
.choice-options .chip.readonly{cursor:default;opacity:.7}
.choice p{margin:8px 0 0;font-size:14px;color:var(--muted)}
.notice{flex:none;margin:4px 6px 8px;padding:8px 12px;border-radius:6px;border:1px solid #7b5d2b;background:#2a1f0c;color:#f6d998;font-size:15px}

/* Dock: watch / in queue / asking / answering */
.dock{--ask-inset:14px;flex:none;padding-top:4px;max-width:760px;width:100%;margin:0 auto}
.ask-button{position:relative;width:100%;height:56px;border:0;border-radius:10px;
  background:linear-gradient(180deg,#d4473a,var(--red) 50%,#6e150f);color:#fbe6b8;font-size:24px;font-weight:700;font-style:italic;
  display:flex;align-items:center;justify-content:center;gap:12px;
  box-shadow:inset 0 0 0 2px var(--gold),inset 0 0 0 4px var(--red-dark),inset 0 0 0 5px rgba(240,217,160,.55),0 4px 14px rgba(0,0,0,.5);
  text-shadow:0 1px 2px rgba(0,0,0,.6)}
.ask-button:hover:not(:disabled){filter:brightness(1.12)}
.ask-button svg{width:24px;height:24px;stroke-width:2}
.dock .ask-button::before,.dock .ask-button::after{content:'';position:absolute;bottom:-1px;width:48px;height:26px;background:url(/static/img/cloud.svg) center bottom/contain no-repeat}
.dock .ask-button::before{left:-14px}
.dock .ask-button::after{right:-14px;transform:scaleX(-1)}
.dock .ask-button{width:calc(100% - 2 * var(--ask-inset));margin:0 var(--ask-inset)}
#write-button{font-size:20px;animation:pulse 1.6s ease-in-out infinite}
@keyframes pulse{50%{box-shadow:inset 0 0 0 2px var(--gold),inset 0 0 0 4px var(--red-dark),inset 0 0 0 5px rgba(240,217,160,.55),0 0 22px rgba(226,73,60,.65)}}
.queue-card{display:flex;align-items:center;gap:12px;padding:4px 6px;background:var(--panel);background-clip:padding-box}
.queue-card div{flex:1;min-width:0;display:flex;flex-direction:column}
.queue-card b{font-size:19px;font-style:italic;color:var(--gold-2)}
.queue-card b,.queue-card div span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.queue-card div span{font-size:14px;color:var(--muted)}
.queue-number{flex:none;min-width:52px;height:46px;padding:0 6px;display:flex;align-items:center;justify-content:center;border-radius:6px;
  background:linear-gradient(180deg,#f2e0b4,var(--parchment-2));color:#8b1d14;font-size:24px;font-weight:700;box-shadow:0 0 0 1px #7b5d2b}
.queue-card .chip{padding:0 12px}
@media (max-width:480px){.queue-card{gap:8px}.queue-card b{font-size:17px}.queue-card .chip{padding:0 9px;height:32px;font-size:14px}.queue-number{min-width:44px;height:42px;font-size:21px}}
.next-card{display:flex;flex-wrap:wrap;gap:10px;padding:0 14px}
.next-card .plaque{flex:1;height:56px;border-radius:10px;border:1.5px solid var(--gold);background:linear-gradient(#24221d,#0f0f10);font-size:20px;font-style:italic;font-weight:700;
  color:var(--gold-2);box-shadow:inset 0 0 0 2px #0d0e11,inset 0 0 0 3px rgba(212,175,106,.45),0 3px 8px rgba(0,0,0,.5)}
.dock .next-card .ask-button{flex:1.6;width:auto;margin:0;font-size:21px;padding:0 10px;white-space:nowrap}
.dock .next-card .ask-button::before,.dock .next-card .ask-button::after{display:none}
.next-hint{flex-basis:100%;margin:0;text-align:center;font-size:14px;font-style:italic;color:var(--muted)}
.feedback{margin:8px 4px 0;font-size:15px;color:var(--muted);text-align:center}
.feedback:empty{display:none}
.feedback.error{color:#ff8a7a}

/* Dialogs: the same tinted glass as the chat panel, over the landscape art */
dialog{width:min(560px,calc(100% - 24px));max-height:calc(100dvh - 24px);overflow:auto;padding:30px 26px 70px;color:var(--text);
  border:16px solid transparent;border-image:url(/static/img/frame.svg) 16 / 16px stretch;
  background:linear-gradient(var(--panel),var(--panel)),url(/static/img/bg-tall.jpg) center top/cover no-repeat,#0b1019;background-clip:padding-box}
dialog::backdrop{background:rgba(5,5,7,.72);backdrop-filter:blur(3px)}
dialog h2{margin:0;text-align:center;font-size:34px;font-style:italic;font-weight:700;
  background:linear-gradient(180deg,#fff2cc 10%,var(--gold) 70%);-webkit-background-clip:text;background-clip:text;color:transparent}
.subtitle{margin:6px 0 0;text-align:center;font-style:italic;font-size:18px;color:#e6dcc5}
.ornament{display:flex;align-items:center;gap:8px;margin:12px auto 18px;width:70%;color:var(--gold);font-size:12px}
.ornament::before,.ornament::after{content:'';flex:1;height:1px;background:linear-gradient(90deg,transparent,var(--gold))}
.ornament::after{background:linear-gradient(90deg,var(--gold),transparent)}
.close-dialog{position:absolute;right:8px;top:8px;width:42px;height:42px;display:flex;align-items:center;justify-content:center;border-radius:50%;
  border:1.5px solid var(--gold);background:rgba(13,14,17,.8);color:var(--gold-2)}
.close-dialog svg{width:22px;height:22px;stroke-width:2.4}
.close-dialog:hover{background:#2a2216}
.field{position:relative}
#question{display:block;width:100%;min-height:150px;resize:vertical;padding:14px 16px 30px;border:1.5px solid var(--gold-dim);border-radius:12px;
  background:rgba(10,11,14,.9);font-family:system-ui,-apple-system,"Segoe UI",sans-serif;font-size:17px;line-height:1.45;outline:0}
#question:focus{border-color:var(--gold)}
#question::placeholder{color:#7d7666;font-style:italic}
.counter{position:absolute;right:14px;bottom:8px;font-size:14px;color:var(--muted);font-family:system-ui,sans-serif}
.counter.full{color:#ff8a7a}
.dialog-actions{display:flex;gap:14px;margin-top:24px}
.dialog-actions .plaque{flex:1;height:52px;border-radius:8px;border:1.5px solid var(--gold);background:linear-gradient(#24221d,#0f0f10);font-size:22px;
  box-shadow:inset 0 0 0 2px #0d0e11,inset 0 0 0 3px rgba(212,175,106,.45),0 3px 8px rgba(0,0,0,.5)}
.dialog-actions .plaque{display:flex;align-items:center;justify-content:center;gap:10px}
.dialog-actions .plaque .cancel-icon{width:20px;height:20px;stroke-width:2.2}
.dialog-actions .ask-button{flex:1.8;height:52px;font-size:21px;font-style:normal;white-space:nowrap;padding:0 10px}
#ask-dialog .feedback{margin-top:12px}
.muted{color:var(--muted);font-size:16px;line-height:1.5}
dialog label{display:block;font-size:15px;font-weight:600;margin:14px 0 6px}
dialog input[type=email],dialog input[type=text]{width:100%;height:48px;border:1.5px solid var(--gold-dim);border-radius:10px;background:rgba(10,11,14,.9);padding:0 14px;
  font-family:system-ui,sans-serif;font-size:16px;outline:0}
dialog input:focus{border-color:var(--gold)}
dialog form>.ask-button{margin-top:16px;height:50px;font-size:20px}
.code-actions{display:flex;justify-content:space-between;margin-top:10px}
.link{border:0;background:none;color:var(--gold);font-size:15px;padding:4px 0;text-decoration:underline;text-underline-offset:3px}
.rules{padding-left:22px;margin:0 0 12px;display:flex;flex-direction:column;gap:10px;font-size:17px;line-height:1.5;color:#e6dcc5}
.rules b{color:var(--gold-2)}

/* Desktop: chart column on the left, chat on the right. */
@media (min-width:860px){
  .app{padding:0 24px 16px}
  .bar{margin:0 calc(50% - 50vw);padding:16px 24px 14px}
  .brand h1{font-size:44px}
  .pills{max-width:700px}
  .body{flex-direction:row;gap:18px}
  .chart-card{flex-direction:column;width:290px;align-self:flex-start;padding:8px;max-height:100%;overflow-y:auto;scrollbar-width:none}
  .chart-grid{width:100%}
  .palace{font-size:40px}
  .toggle-chart{margin-top:12px}
  .show-chart{writing-mode:vertical-rl;height:auto;padding:16px 8px;align-self:flex-start}
}
/* Mobile: small avatar inline with the name, full-width bodies, slim margins. */
@media (max-width:859px){
  .app{padding:0 4px max(8px,env(safe-area-inset-bottom))}
  .bar{margin:0 -4px;padding-left:4px;padding-right:4px}
  .bar-actions{gap:6px;flex-wrap:nowrap;max-width:100%}
  .bar-actions .chip{padding:0 10px;gap:6px;font-size:14px;min-width:0}
  #account-button{flex:0 1 auto}
  .bar-actions .toggle-chart{margin:0;align-self:auto}
  .chat{border-width:7px;border-image-width:7px;padding:2px 0}
  /* Reserve the scrollbar's width on both sides so left and right gaps match. */
  .feed{gap:14px;padding:4px 6px 8px;scrollbar-gutter:stable both-edges}
  .msg{grid-template-columns:auto minmax(0,1fr);gap:5px 7px;align-items:center}
  .avatar{grid-row:auto;width:22px;height:22px;font-size:11px}
  .avatar.agent{font-size:13px}
  .agent-name{margin:0}
  .msg .bubble{grid-column:1/-1;font-size:17px;padding:8px 10px}
  .api-cost{grid-column:1/-1}
  .msg.agent .bubble{font-size:18px;padding:0 2px}
  .dock{--ask-inset:10px}
}
@media (min-width:860px) and (max-height:820px){
  .chart-card{width:230px}.palace{font-size:32px}.chart-meta{font-size:15px;gap:4px}.chart-meta h2{font-size:22px}
}
@media (max-width:420px){
  .brand h1{font-size:32px}
  .chart-grid{width:140px}.palace{font-size:24px}.chart-meta{font-size:15px;gap:5px;overflow:hidden}.chart-meta p{gap:7px}.chart-meta h2{font-size:22px}
  .pill.status{font-size:16px;margin:0 14px}
  dialog{padding:24px 16px 60px}dialog h2{font-size:30px}.subtitle{font-size:16px}
  .dialog-actions{gap:10px}.dialog-actions .plaque,.dialog-actions .ask-button{font-size:17px;gap:8px}.dialog-actions .ask-button svg{width:20px;height:20px}
}
@media (max-height:700px) and (max-width:859px){
  .chart-grid{width:130px}.palace{font-size:22px}.chart-meta{font-size:15px;gap:4px}
}
@media (prefers-reduced-motion:reduce){.dots::after{animation:none;content:'...'}#write-button{animation:none}}

/* Day theme, 06:00–17:59 on the viewer's clock (set by theme.js): sunlit
   landscape, deep-blue glass panels; gold frames and red buttons unchanged. */
:root[data-theme=day]{--panel:rgba(16,36,64,.74);--day-glass:rgba(18,40,70,.84)}
[data-theme=day] body{background-color:#6fa3d6;background-image:url(/static/img/bg-day-wide.jpg)}
@media (max-aspect-ratio:1/1){[data-theme=day] body{background-image:url(/static/img/bg-day-tall.jpg)}}
[data-theme=day] .chip,[data-theme=day] .pill.viewers,[data-theme=day] .to-end,[data-theme=day] .close-dialog,[data-theme=day] .choice{background:var(--day-glass)}
[data-theme=day] .chip.framed{box-shadow:inset 0 0 0 2px rgba(16,36,64,.95),inset 0 0 0 3px rgba(212,175,106,.45)}
[data-theme=day] .pill.viewers,[data-theme=day] .to-end{box-shadow:inset 0 0 0 2px #10243f,inset 0 0 0 3px rgba(212,175,106,.45),0 3px 10px rgba(0,0,0,.35)}
[data-theme=day] .chip:hover:not(:disabled),[data-theme=day] .to-end:hover{background:rgba(32,62,102,.92)}
[data-theme=day] .next-card .plaque,[data-theme=day] .dialog-actions .plaque{background:linear-gradient(#1e3d66,#10243f);box-shadow:inset 0 0 0 2px #0c1c33,inset 0 0 0 3px rgba(212,175,106,.45),0 3px 8px rgba(0,0,0,.35)}
[data-theme=day] dialog{background:linear-gradient(var(--panel),var(--panel)),url(/static/img/bg-day-tall.jpg) center top/cover no-repeat,#1c3a62;background-clip:padding-box}
[data-theme=day] #question,[data-theme=day] dialog input[type=email],[data-theme=day] dialog input[type=text]{background:rgba(8,20,38,.9)}
[data-theme=day] .brand h1{filter:drop-shadow(0 1px 1px rgba(0,0,0,.85)) drop-shadow(0 0 8px rgba(10,28,54,.9)) drop-shadow(0 0 18px rgba(10,28,54,.55))}
/* Text drawn straight on the bright art needs a shadow to stay readable. */
[data-theme=day] .feedback,[data-theme=day] .next-hint{color:#fff;text-shadow:0 1px 3px rgba(0,0,0,.85)}

/* Readable nine-palace chart: its square never collapses with viewport height. */
.app{max-width:1660px;overflow-x:clip}
.chart-card{flex-direction:column;gap:16px;width:clamp(580px,42vw,700px);min-width:580px;padding:8px;max-height:100%;overflow-y:auto;scrollbar-width:thin}
.chart-meta{flex:none;gap:7px;font-size:17px;overflow:visible}
.chart-meta h2{font-size:27px}
.chart-meta p{white-space:normal;flex-wrap:wrap;line-height:1.35}
.chart-meta p.palace-detail{font-size:14px;line-height:1.5}
.toggle-chart{position:absolute;right:12px;top:12px;margin:0;padding:0 12px}
.chart-card{position:relative}
.chart-meta h2{padding-right:135px}
.chart-scroll{flex:none;width:100%;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--gold-dim) transparent}
.chart-grid{width:100%;min-width:600px;min-height:600px;aspect-ratio:1/1;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(3,minmax(0,1fr));background:#eadbb8;border-color:transparent}
.palace{position:relative;min-width:0;min-height:0;display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:5px;padding:10px 8px 8px;line-height:1.3;text-align:left;font-family:system-ui,-apple-system,'Segoe UI',sans-serif;font-size:16px;text-shadow:none;color:#201c16!important;border-color:#b19050;background:radial-gradient(ellipse at center,#faf5e6,#eadbb8)!important}
.palace:hover:not(:disabled),.palace.selected{filter:none;box-shadow:inset 0 0 0 2px #9b7025;background:#fbf4dc!important}
.palace-heading{align-self:center;border-radius:20px;background:#63563d;color:#fff6da;padding:2px 14px;font-family:var(--kai);font-size:18px;line-height:1.2;white-space:nowrap}
.palace.wood .palace-heading{background:#416d2c}.palace.fire .palace-heading{background:#a12d21}.palace.earth .palace-heading{background:#846021}.palace.water .palace-heading{background:#245c76}.palace.metal .palace-heading{background:#575853}
.palace-fields{display:flex;flex-direction:column;gap:3px;margin-top:1px}
.palace-field{display:grid;grid-template-columns:42px minmax(0,1fr);gap:5px;align-items:baseline}
.palace-field-label{font-size:11px;color:#766345;line-height:1.4}
.palace-field-value{font-size:16px;font-weight:600;line-height:1.35;overflow-wrap:anywhere}
.palace-stems{display:flex;flex-direction:column;gap:2px;padding-top:5px;border-top:1px solid #cdbb92}
.palace-stem-value{font-size:14px;font-weight:500;line-height:1.35;overflow-wrap:anywhere}
.palace.center{text-shadow:none;align-items:center;justify-content:center;gap:6px;color:#73634b!important}
.palace-center-cn{position:relative;font-family:var(--kai);font-size:48px}.palace-center-name{position:relative;font-family:var(--serif);font-size:19px}
.palace.center{position:relative;overflow:hidden}
/* Keep 中 close to its label (about a third of the old spacing). */
.palace.center{gap:0}.palace-center-cn{line-height:1}.palace-center-name{line-height:1;margin-top:3px}
.palace-bagua{position:absolute;inset:6%;width:88%;height:88%;fill:#d9ccae;stroke:none;opacity:.75;pointer-events:none}
.palace-loading{font-size:13px;color:#766345;margin:auto 0;text-align:center}
.chart-dialog{width:min(780px,calc(100vw - 16px));max-width:none;max-height:calc(100dvh - 16px);padding:12px 8px 14px;border-width:10px;border-image-width:10px;overflow:auto}
.chart-dialog .close-dialog{top:8px;right:8px;z-index:1}
.chart-dialog .chart-card{width:100%;min-width:0;max-height:none;padding:0;border:0;background:transparent;overflow:visible;backdrop-filter:none}
.chart-dialog .chart-meta{font-size:16px;padding:4px 46px 0 4px}
.chart-dialog .chart-meta h2{padding-right:0;font-size:26px}
.chart-dialog .chart-meta p{gap:8px}
.chart-dialog .chart-scroll{max-height:calc(100dvh - 230px);min-height:160px}
.chart-scroll-hint{margin:12px 3px 0;font:13px/1.5 system-ui,sans-serif;color:var(--muted)}
.bar-actions .show-chart{writing-mode:horizontal-tb;align-self:auto;height:34px;padding:0 12px}
@media(min-width:1100px){.chart-scroll-hint{display:none}}
@media(max-width:1099px){.body{flex-direction:column}.chart-dialog .palace{padding:10px 8px 8px;font-size:16px}.chart-dialog .chart-grid{width:100%;min-width:600px;min-height:600px}}
@media(max-width:420px){.bar-actions .show-chart{padding:0 8px;gap:5px}.chart-dialog .chart-meta{font-size:15px}.chart-dialog .chart-meta p svg{width:17px;height:17px}}

/* Fit the desktop square to both available dimensions, never crop its last row. */
.chart-dialog #hide-chart{display:none}
@media(min-width:1100px){
  .body>.chart-card{height:100%;max-height:100%;overflow:hidden}
  .body>.chart-card .chart-scroll{position:relative;flex:1;min-height:0;overflow:hidden}
  .body>.chart-card .chart-grid{position:absolute;left:50%;top:50%;width:600px;height:600px;min-width:600px;min-height:600px;transform:translate(-50%,-50%) scale(var(--chart-scale,0));transform-origin:center}
}
@media(min-width:1100px){
  .body>.chart-card{gap:8px}
  .body>.chart-card .chart-meta{flex-direction:row;flex-wrap:wrap;column-gap:18px;row-gap:7px}
  .body>.chart-card .chart-meta h2{flex-basis:100%;padding-right:135px}
  .body>.chart-card .palace-detail{flex-basis:100%}
}

/* Traditional palace positions: star/deity/door left, stem plates right, structures below. */
.palace:not(.center){display:grid;grid-template-columns:minmax(0,1fr);justify-content:stretch;grid-template-rows:minmax(0,1fr);padding:8px}
/* Chart frame in the earth-element brown; palaces are display only (no click/hover state). */
.chart-grid.frame{border-image-source:url(/static/img/frame-earth.svg)}
.chart-grid .palace{cursor:default}
.chart-grid .palace:hover:not(:disabled){filter:none;box-shadow:none;background:radial-gradient(ellipse at center,#faf5e6,#eadbb8)!important}
/* Star, Deity, Heaven stems at the top; good formations left and bad right in the middle;
   direction (Void/Horse above it), Door, Earth stems at the bottom. */
/* Equal columns keep Deity and Door centred in every palace. */
.palace-symbol-layout{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:auto minmax(0,1fr) auto;
  grid-template-areas:"star deity heaven" "good . bad" "dir door earth";column-gap:6px;min-height:0;height:100%}
.at-star{grid-area:star}.at-deity{grid-area:deity}.at-heaven{grid-area:heaven}
.at-good{grid-area:good;align-items:flex-start}.at-bad{grid-area:bad}
.palace-bad-area{display:flex;flex-direction:column;align-items:flex-end;gap:4px;align-self:stretch;min-height:0}
/* Bad formations fill the middle band on the right, centred. */
.palace-bad-area .palace-formations{align-items:flex-end;flex:1;justify-content:center}
.palace-bad-area .palace-formations:empty{display:none}
.at-dir{grid-area:dir}.at-door{grid-area:door}.at-earth{grid-area:earth}
.at-loading{grid-area:2/1/3/4;align-self:center}
.palace-symbol-layout>.palace-symbol-row,.palace-symbol-layout>.palace-stem-plate{align-self:start}
.palace-symbol-layout>.palace-symbol-row{justify-self:center;align-items:center}
.palace-symbol-layout>.at-door,.palace-symbol-layout>.at-earth{align-self:end}
.palace-place{display:flex;flex-direction:column;align-items:flex-start;gap:4px;align-self:end;justify-self:start}
.palace-heading{padding:2px 9px}
.palace-markers{display:flex;flex-direction:row;align-items:center;gap:3px;flex:none}
.palace-markers:empty{display:none}
.palace-marker{display:inline-flex;align-items:center;justify-content:center;width:23px;height:23px;border-radius:50%;font:700 14px/1 var(--kai);color:#fff6da;box-shadow:0 0 0 1px #d8c08a}
.palace-marker.void{background:#3d3a35}.palace-marker.horse{background:#9a5a1c}
.palace-symbol-name{white-space:nowrap}
/* Every symbol: Chinese on top, English (or Pinyin for stems) below. */
.palace-symbol-row{display:flex;flex-direction:column;align-items:flex-start;gap:1px;min-width:0;color:#17140f}
.palace-symbol-cn{font:700 26px/1.05 var(--kai)}
.palace-symbol-name{font:12px/1.15 system-ui,sans-serif;overflow-wrap:anywhere}
.palace-symbol-row.auspicious,.palace-stem-symbol.auspicious{color:#ab211b}
.palace-stem-plate{display:flex;justify-content:flex-end;min-width:0;justify-self:end}
/* A second stem goes to the left of the first, at 75% size. */
.palace-stem-pair{display:flex;flex-direction:row-reverse;align-items:flex-end;gap:3px}
.palace-stem-symbol{display:flex;flex-direction:column;align-items:center;color:#17140f;gap:1px}
.palace-stem-cn{font:500 26px/1.05 var(--kai)}
.palace-stem-pinyin{font:12px/1.15 system-ui,sans-serif;color:inherit}
.palace-stem-symbol+.palace-stem-symbol .palace-stem-cn{font-size:19.5px}
.palace-stem-symbol+.palace-stem-symbol .palace-stem-pinyin{font-size:9px}
.palace-formations{display:flex;flex-direction:column;justify-content:center;align-self:center;gap:3px;min-width:0;min-height:0;overflow:visible;white-space:nowrap}
.palace-formation{flex:none;color:#873a24;font:600 9.6px/1.25 system-ui,-apple-system,'Segoe UI',sans-serif}
.palace-formation.bad{color:#17140f}
@media(max-width:1099px){.chart-dialog .palace:not(.center){padding:8px}}

/* Two chart header rows and a centered, bounded chat when the desktop chart is hidden. */
.chart-header-row{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;flex-basis:100%;min-width:0}
.chart-meta .chart-header-row p{font-size:15px;gap:6px;line-height:1.4;min-width:0}
.chart-time-row p{white-space:nowrap;flex-wrap:nowrap}
/* Both header rows share two equal columns so Next Chart lines up with Day Pillar. */
.chart-time-row,.chart-pillar-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
.chart-header-row p{justify-content:flex-start}
.chart-header-row strong{font-weight:600;white-space:nowrap;color:var(--gold-2)}
.chart-dialog .chart-meta{padding:4px 4px 0}
.chart-dialog .chart-meta h2{padding-right:44px}
@media(min-width:1100px){
  /* Show Chart sits beside the chat, separated by the body gap. */
  .body.chart-hidden{justify-content:center}
  .body.chart-hidden .chat-col{flex:0 1 85%;width:85%;max-width:85%;margin-inline:0}
  .body.chart-hidden>.show-chart{position:static;align-self:flex-start}
}
@media(max-width:480px){
  .chart-dialog .chart-date{display:none}
  .chart-dialog .chart-header-row{gap:8px}
  .chart-dialog .chart-header-row p{font-size:12px;gap:4px}
  .chart-dialog .chart-header-row p svg{width:14px;height:14px}
  .chart-dialog #chart-next b{padding:1px 6px 1px 4px}
}

/* Chat history: a square button overlaid on the chat's top-right corner opens this chart's question list. */
.history-button{position:absolute;right:14px;top:10px;z-index:5;width:40px;height:40px;padding:0;border-radius:6px;display:flex;align-items:center;justify-content:center;
  border:1.5px solid var(--gold);background:rgba(13,14,17,.88);color:var(--gold-2);box-shadow:inset 0 0 0 2px #0d0e11,0 3px 10px rgba(0,0,0,.6);cursor:pointer}
.history-button[hidden]{display:none}
.history-button svg{width:20px;height:20px}
.history-button:hover{background:#2a2216}
[data-theme=day] .history-button{background:var(--day-glass);box-shadow:inset 0 0 0 2px #10243f,inset 0 0 0 3px rgba(212,175,106,.45),0 3px 10px rgba(0,0,0,.35)}
.history-dialog{padding-bottom:26px}
.history-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.history-row{width:100%;display:flex;align-items:center;gap:10px;min-width:0;padding:9px 12px;border:1px solid #4a3f2b;border-radius:8px;
  background:rgba(36,32,25,.75);color:var(--text);font:16px/1.3 system-ui,-apple-system,'Segoe UI',sans-serif;text-align:left;cursor:pointer}
.history-row:hover,.history-row:focus-visible{border-color:var(--gold);background:#2a2216}
.history-id{flex:none;color:var(--gold-2);font-weight:600}
.history-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.history-row time{flex:none;font-size:13px;color:var(--muted)}
.history-empty{text-align:center}

/* Rooms: language choice (GMT+7), other-language placeholders, and the unsupported-timezone screen. */
.language-dialog{padding-bottom:30px}
dialog.required .close-dialog{display:none}
.language-options{display:flex;gap:12px;margin-top:18px}
.language-options .ask-button{flex:1;height:52px;font-size:20px}
.language-options .ask-button.selected{box-shadow:0 0 0 2px var(--gold-2)}
.turn.other-language{display:block}
.other-language-note{margin:0;padding:8px 12px;border:1px dashed #6b5a3a;border-radius:8px;color:var(--muted);font-size:15px;font-style:italic}
.other-language-note b{font-style:normal;color:var(--gold-2);margin-right:2px}
.history-row.other-language .history-text{color:var(--muted);font-style:italic}
.history-row.other-language{cursor:default;opacity:.75}
.history-row.other-language:hover{border-color:#4a3f2b;background:rgba(36,32,25,.75)}
.room-denied{min-height:100dvh;display:flex;align-items:center;justify-content:center;padding:24px 16px;text-align:center;color:var(--text);font-size:19px}
.room-denied-card{display:flex;flex-direction:column;align-items:center;gap:10px;max-width:560px;padding:26px 24px;background:var(--panel);background-clip:padding-box;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}
.room-denied[hidden],.app[hidden]{display:none}
.room-denied h1{margin:0;font-size:40px;font-style:italic;color:var(--gold-2)}
.room-denied p{margin:0;max-width:520px}
.change-name{display:flex;margin:4px auto 0}
.name-dialog{padding-bottom:30px}
/* Chat title ("Interpretation" / "Luận đoán"), styled like the chart title; smaller on mobile. */
.chat-title{display:block;position:relative;flex:none;margin:0;font-size:22px;font-style:italic;font-weight:700;color:var(--gold-2)}
@media (min-width:860px){.chat-title{font-size:26px}}
/* Profile / sign-in popup actions: change name and language. */
.profile-actions{display:flex;justify-content:center;flex-wrap:wrap;gap:10px;margin-top:10px}
.language-switch[hidden]{display:none}

/* Heading: agent name over a smaller title, together as tall as the seal beside them. */
.brand{align-items:stretch}
.brand h1.brand-title{display:flex;flex-direction:column;justify-content:center;gap:2px;font-size:26px;line-height:1.05}
#brand-name{font-size:26px}
#brand-desc{font-size:15px;font-weight:600;letter-spacing:.3px}
@media (min-width:860px){.brand h1.brand-title{font-size:26px}}
@media (max-width:420px){.brand h1.brand-title{font-size:24px}#brand-name{font-size:24px}#brand-desc{font-size:14px}}

/* Next-chart countdown under the chat title when the chart is hidden (or in a popup on mobile). */
.chat-next{flex:none;display:flex;align-items:center;gap:6px;margin:-2px 12px 8px;font-size:15px;color:var(--text)}
.chat-next[hidden]{display:none}
.chat-next b{display:inline-block;padding:1px 12px 1px 6px;color:#fff1d0;font-weight:600;
  background:linear-gradient(90deg,#c8382b,#a3241b 70%,rgba(163,36,27,.0));clip-path:polygon(0 12%,100% 0,92% 50%,100% 100%,2% 90%)}
/* "New chart" notice shown to everyone when the chart window changes. */
.chart-updated-dialog{padding-bottom:28px;text-align:center}
.chart-updated-dialog .ask-button{margin:18px auto 0;min-width:160px;height:48px;font-size:19px}
/* Mobile chart popup: the 600px chart is scaled to the popup's width instead of scrolling. */
@media(max-width:1099px){
  .chart-dialog .chart-scroll{position:relative;aspect-ratio:1/1;max-height:none;min-height:0;overflow:hidden}
  .chart-dialog .chart-grid{position:absolute;left:0;top:0;width:600px;height:600px;min-width:600px;min-height:600px;
    transform:scale(var(--chart-scale,1));transform-origin:0 0}
  .chart-scroll-hint{display:none}
}
/* Reserve message space above the dock so feedback never moves the action. */
.dock-feedback-slot{height:20px;display:flex;align-items:center;justify-content:center;padding:0 14px}
@media(max-width:640px){.dock-feedback-slot{height:36px}}
.dock .feedback:not(:empty){display:block;max-height:100%;overflow-y:auto;margin:0;padding:0 8px;border-radius:4px;background:rgba(10,11,14,.78);color:#f3ead6;font-size:14px;line-height:18px}
.dock .feedback.error:not(:empty){color:#ffb4a8}

/* Chat header: title with the next-chart countdown inline on its right (when the chart is hidden). */
.chat-head{flex:none;display:flex;align-items:center;flex-wrap:wrap;gap:4px 18px;margin:4px 64px 8px 10px}
.chat-head .chat-next{margin:0}
.chat-head{position:relative;padding-bottom:8px}
.chat-head::after{content:'';position:absolute;left:0;bottom:0;width:80%;height:4px;border-radius:50%;background:linear-gradient(90deg,var(--gold),rgba(212,175,106,0))}
@media (max-width:859px){.chat-head{margin:4px 54px 6px 8px;padding-bottom:6px}.chat-head .chat-next{font-size:14px}}

/* Qimen terms (directions, deities, stars, doors, stems, Ba Gua) in the agent's answers. */
.qimen-term{color:#F0D9A0}

#billing-interval { width: 100%; padding: 10px; margin: 8px 0 12px; background: #18191d; color: #f3e2bc; border: 1px solid #82704a; border-radius: 6px; }
.credit-badge{display:inline-flex;align-items:center;gap:9px;min-height:38px;padding:7px 13px;border:1px solid var(--line);border-radius:10px;background:var(--ink);color:var(--text);font:600 17px/1 Arial,sans-serif;font-variant-numeric:tabular-nums}
svg.credits-icon{width:17px;height:17px;fill:currentColor;stroke:none}
#ask-disclosure,#ask-forecast-description{font-size:15px;line-height:1.6;color:var(--muted)}
#ask-forecast-description{margin:0 0 14px}
#ask-disclosure .privacy-link{display:inline;padding:0;margin:0;font:inherit;color:var(--gold-2);text-decoration:underline;text-underline-offset:3px;white-space:normal}
.question-types{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-auto-rows:1fr;gap:8px;border:0;padding:0;margin:16px 0}
.question-type-choice{position:relative;display:flex;min-width:0;margin:0;cursor:pointer}
.question-type-choice input{position:absolute;opacity:0;width:1px;height:1px;margin:0}
.question-type-choice span{display:flex;align-items:center;justify-content:center;width:100%;min-width:0;padding:8px 6px;text-align:center;overflow-wrap:anywhere;border:1px solid var(--gold-dim);border-radius:7px;background:var(--panel-2);color:var(--text);font-size:15px;line-height:1.3}
.question-type-choice input:checked + span{background:var(--gold);color:var(--ink);border-color:var(--gold-2);box-shadow:inset 0 0 0 1px var(--gold-2)}
.question-type-choice input:focus-visible + span{outline:2px solid var(--gold-2);outline-offset:3px}
.question-type-choice:hover span{border-color:var(--gold-2)}
#send-button{gap:8px;padding:0 14px}
.submit-cost{display:inline-flex;align-items:center;gap:5px;flex:none;font:600 15px/1 Arial,sans-serif;font-variant-numeric:tabular-nums}
#send-button .credits-icon{width:15px;height:15px}
@media(max-width:480px){
  .question-types{gap:6px}
  .question-type-choice span{padding:7px 3px;font-size:13px}
  #send-button{font-size:17px;min-width:0;white-space:normal;flex-wrap:nowrap;gap:6px;padding:0 8px}
  #send-label{min-width:0}
  #ask-dialog h2{font-size:26px;padding-inline:20px}
  #send-button > svg{display:none}
  .submit-cost{font-size:13px}
}



/* Compact pricing uses the same gold, ink and serif palette as the room. */
#billing-dialog { width: min(940px, calc(100% - 24px)); max-width: 940px; padding: 26px; border: 1px solid var(--gold-dim); border-image: none; border-radius: 16px; background: var(--ink); color: var(--text); }
[data-theme=day] #billing-dialog { background: var(--ink); }
#billing-dialog h2 { margin: 0 36px 16px; color: var(--gold-2); font-family: var(--serif); font-size: 30px; }
#billing-mode { position: absolute; top: 14px; left: 18px; margin: 0; color: var(--muted); font: 11px/1.3 Arial, sans-serif; }
#billing-mode:empty, #billing-feedback:empty { display: none; }
#billing-dialog #billing-feedback { margin: 8px 0; font-size: 14px; }
.billing-toggle { display: flex; align-items: center; justify-content: center; gap: 12px; position: relative; width: fit-content; margin: 0 auto 20px; color: var(--text); font-size: 16px; cursor: pointer; }
#billing-interval { position: absolute; width: 44px; height: 26px; left: 50%; top: 50%; transform: translate(-50%, -50%); opacity: 0; margin: 0; cursor: pointer; }
.billing-toggle-track { width: 44px; height: 26px; border-radius: 20px; background: var(--panel-2); border: 1px solid var(--gold-dim); pointer-events: none; }
.billing-toggle-track::after { content: ''; display: block; width: 18px; height: 18px; margin: 3px; border-radius: 50%; background: var(--gold); transition: transform .15s ease; }
#billing-interval:checked + .billing-toggle-track { background: var(--gold-dim); }
#billing-interval:checked + .billing-toggle-track::after { transform: translateX(18px); background: var(--gold-2); }
#billing-interval:focus-visible + .billing-toggle-track { outline: 2px solid var(--gold-2); outline-offset: 3px; }
.billing-plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.billing-plan { display: flex; flex-direction: column; min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.billing-plan-pro { border-color: var(--gold-dim); }
#billing-dialog .billing-plan-name { margin: 0 0 18px; font: 700 24px/1.2 var(--serif); color: var(--gold-2); }
.billing-allowance { display: flex; flex-direction: column; gap: 4px; min-height: 58px; }
.billing-allowance strong { font-size: 18px; line-height: 1.3; font-weight: 600; }
.billing-allowance > span { color: var(--muted); font-size: 15px; }
.billing-questions { list-style: none; margin: 10px 0 0; padding: 8px 0 0; border-top: 1px solid var(--gold-dim); display: grid; gap: 4px; font-size: 14px; }
.billing-questions li { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.billing-questions b { color: var(--gold-2); white-space: nowrap; }
.billing-questions b small { font-weight: 400; color: var(--muted); font-size: 12px; }
.billing-questions span { text-align: right; }
.info-term { position: relative; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: inherit; text-decoration: underline dotted; text-decoration-color: var(--gold-dim); text-underline-offset: 3px; cursor: pointer; }
.info-term:hover, .info-term[aria-expanded="true"] { text-decoration-style: solid; text-decoration-color: currentColor; }
.billing-plan .info-term-tip { display: none; position: absolute; z-index: 5; top: calc(100% + 6px); left: -8px; width: 230px; padding: 8px 10px; border: 1px solid var(--gold-dim); border-radius: 8px; background: var(--panel); box-shadow: 0 6px 18px rgba(0,0,0,.45); color: var(--text); font: 400 13px/1.4 system-ui, sans-serif; font-style: normal; text-align: left; white-space: normal; cursor: default; }
.info-term[aria-expanded="true"] .info-term-tip { display: block; }
.billing-questions span { color: var(--muted); }
.billing-price { display: flex; align-items: baseline; gap: 6px; margin: 18px 0 2px; }
.billing-price strong { color: var(--gold-2); font-size: 38px; font-weight: 600; line-height: 1; }
.billing-price span { color: var(--muted); font-size: 15px; }
#billing-dialog .billing-charge-period { min-height: 18px; margin: 4px 0 20px; color: var(--muted); font-size: 14px; }
.billing-plan-button { margin-top: auto; width: 100%; padding: 10px; border: 1px solid var(--gold-dim); border-radius: 7px; background: transparent; color: var(--gold-2); font: 600 16px/1.2 var(--serif); cursor: pointer; }
.billing-plan-pro .billing-plan-button { background: var(--gold); color: var(--ink); }
.billing-plan-button:disabled { cursor: default; opacity: .5; }
.billing-plan-sub { display: block; margin-top: 3px; font: 500 13px/1.2 var(--serif); opacity: .85; }
.billing-plan-actions { display: grid; gap: 7px; margin-top: auto; grid-column: 1 / -1; grid-row: 5; }
.billing-trial-note { margin: 0; color: var(--muted); font-size: 12px; }
#billing-portal { display: block; margin: 14px auto 0; }
/* Side-by-side cards share row tracks (subgrid), so the question list, price and button
   line up across Explorer / Practitioner / Master whatever the feature list length. */
@media (min-width: 651px) {
  .billing-plans { row-gap: 0; }
  .billing-plan { display: grid; grid-row: span 7; grid-template-rows: subgrid; }
  /* Buttons level across cards, trial notes below. margin-top: 0 because an auto margin would push a card
     without a note (Explorer's Current plan) to the bottom of the row the other cards' notes make taller. */
  .billing-plan-actions { grid-row: auto; align-self: start; margin-top: 0; }
}
@media (max-width: 650px) {
  #billing-dialog { padding: 22px 16px 16px; }
  #billing-dialog h2 { font-size: 26px; margin-bottom: 14px; }
  #billing-mode { top: 9px; left: 12px; font-size: 9px; }
  .billing-toggle { margin-bottom: 16px; }
  .billing-plans { grid-template-columns: 1fr; gap: 10px; }
  .billing-plan { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 14px; align-items: start; }
  #billing-dialog .billing-plan-name { grid-column: 1; grid-row: 1; margin: 0; font-size: 20px; }
  .billing-allowance { grid-column: 1; grid-row: 2 / 4; min-height: 0; gap: 2px; }
  .billing-allowance strong { font-size: 15px; }
  .billing-allowance > span { font-size: 13px; }
  /* Same order as the desktop cards: name/credits, AI guides, questions, button, trial note. */
  .billing-access { grid-row: 4; margin: 8px 0 2px; }
  .billing-questions { grid-column: 1 / -1; grid-row: 5; margin-top: 4px; padding-top: 6px; font-size: 12.5px; }
  .billing-plan-actions { grid-row: 6; margin-top: 7px; }
  .billing-price { grid-column: 2; grid-row: 1; margin: 0; justify-content: flex-end; gap: 3px; }
  .billing-price strong { font-size: 27px; }
  .billing-price span { font-size: 12px; }
  #billing-dialog .billing-charge-period { grid-column: 2; grid-row: 2; min-height: 0; margin: 0; font-size: 11px; text-align: right; }
  .billing-plan-button { padding: 8px; font-size: 14px; }
}
@media (max-height: 560px) and (min-width: 651px) {
  #billing-dialog { padding: 16px; }
  #billing-dialog h2 { margin-bottom: 10px; font-size: 26px; }
  .billing-toggle { margin-bottom: 12px; }
  .billing-plan { padding: 14px; }
  #billing-dialog .billing-plan-name { margin-bottom: 10px; }
  .billing-price { margin-top: 8px; }
  #billing-dialog .billing-charge-period { margin-bottom: 10px; }
}
@media (max-width: 650px) and (max-height: 650px) {
  #billing-dialog { padding: 18px 12px 12px; }
  #billing-dialog h2 { font-size: 23px; margin-bottom: 10px; }
  .billing-toggle { margin-bottom: 12px; font-size: 15px; }
  .billing-plans { gap: 8px; }
  .billing-plan { padding: 10px; gap: 3px 8px; }
  #billing-dialog .billing-plan-name { font-size: 18px; }
  .billing-allowance strong { font-size: 14px; }
  .billing-allowance > span { font-size: 12px; }
  .billing-price strong { font-size: 24px; }
  .billing-plan-button { padding: 6px; margin-top: 5px; }
}

/* Company links stay outside the room shell, including for unsupported timezones. */
body.app-page { display: flex; flex-direction: column; height: auto; min-height: 100dvh; overflow-y: auto; overflow-x: hidden; background-attachment: fixed; }
.app-page .app { flex: none; min-height: 0; height: 100dvh; width: 100%; }
.app-page .room-denied { flex: none; min-height: 100dvh; }
.site-footer { flex: none; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 24px; width: 100%; margin: 0 auto; padding: 8px 12px max(10px, env(safe-area-inset-bottom)); color: var(--muted); font: 12px/1.5 Arial, sans-serif; text-align: center; }
.site-footer nav { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 18px; }
.site-footer a { display: inline-block; padding: 5px 0; color: var(--text); text-decoration: none; text-underline-offset: 4px; }
.site-footer a:hover, .site-footer a[aria-current=page] { color: var(--gold-2); text-decoration: underline; }
body.info-page { height: auto; min-height: 100dvh; overflow: auto; display: flex; flex-direction: column; background-attachment: fixed; }
.info-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; width: min(960px, 100%); margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 24px 20px; }
.info-header a { color: var(--gold-2); text-decoration: none; }
.info-header a:hover { text-decoration: underline; text-underline-offset: 5px; }
.info-brand { font-size: 30px; font-weight: 700; }
.info-header > a:last-child { font: 13px/1.5 Arial, sans-serif; text-align: right; }
.info-main { width: min(912px, calc(100% - 32px)); margin: 0 auto 24px; padding: clamp(18px, 4vw, 52px); background: var(--ink); background-clip: padding-box; }
.info-eyebrow { margin: 0 0 16px; color: var(--gold); font: 11px/1.5 Arial, sans-serif; letter-spacing: 2px; }
.info-main h1 { margin: 0; color: var(--gold-2); font-size: clamp(34px, 6vw, 52px); line-height: 1.12; }
.info-subtitle { margin: 16px 0 28px; color: var(--muted); font: 14px/1.6 Arial, sans-serif; }
.info-content { color: var(--text); font: 16px/1.8 Arial, sans-serif; overflow-wrap: anywhere; }
.info-content section { margin-top: 32px; }
.info-content h2 { margin: 0 0 12px; color: var(--gold-2); font: 700 26px/1.25 var(--serif); }
.info-content p { margin: 0 0 16px; }
.info-content li { margin-bottom: 12px; }
.info-content ul { padding-left: 22px; }
.info-content a { color: var(--gold-2); text-underline-offset: 3px; }
.info-content .info-slogan { margin-bottom: 24px; color: var(--gold-2); font: italic 32px/1.3 var(--serif); }
.info-page .site-footer { margin-top: auto; padding-top: 0; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.skip-link { position: absolute; top: 8px; left: 12px; z-index: 100; transform: translateY(-200%); padding: 10px 14px; color: var(--text); background: var(--ink); }
.skip-link:focus { transform: none; }
@media (max-width: 500px) {
  .site-footer { gap: 0 16px; padding-top: 2px; font-size: 10px; }
  .site-footer nav { gap: 0 14px; }
  .info-header { padding-left: 20px; padding-right: 20px; }
  .info-main { padding: 20px 12px; }
  .info-content { font-size: 14px; line-height: 1.8; }
}

/* Profile card: avatar and name, with the current plan aligned to the right. */
.account-controls{display:flex;align-items:center;gap:8px;min-width:0}
#account-button.profile-button{display:flex;align-items:center;gap:12px;min-width:0;max-width:340px;height:34px;padding:4px 12px;border:1px solid #303030;border-radius:10px;background:#141414;color:#ededed;font:500 16px/1.2 system-ui,-apple-system,sans-serif;text-align:left}
#account-button.profile-button:hover{border-color:#555;background:#1b1b1b}
.profile-avatar{display:flex;align-items:center;justify-content:center;flex:none;width:24px;height:24px;overflow:hidden;border-radius:50%;background:#e9dfc7;color:#302b24}
.profile-avatar .avatar{display:flex;align-items:center;justify-content:center;width:24px;height:24px;margin:0;border-radius:50%;font:600 13px/1 system-ui,sans-serif;color:#fff}
#account-label{flex:1;min-width:0;white-space:nowrap}
.profile-plan{flex:none;margin-left:12px;color:#999;font-size:14px;font-weight:400;white-space:nowrap}
.account-controls .credit-badge{flex:none;height:34px;min-height:34px;padding-block:4px}
@media(max-width:640px){
  .bar-actions{flex-wrap:wrap;row-gap:8px}
  .account-controls{flex:1 0 100%;width:100%;max-width:360px;justify-content:center;padding:0 6px}
  #account-button.profile-button{flex:1;gap:9px;max-width:100%;font-size:15px;padding:4px 10px}
  .profile-plan{margin-left:4px;font-size:12px}
  .account-controls .credit-badge{gap:7px;padding:4px 10px;font-size:16px}
}

/* Uploaded avatars retain initials underneath as a failed-image fallback. */
.avatar{position:relative;overflow:hidden}
.avatar img{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:cover;border-radius:inherit}
.avatar-help{max-width:340px;margin:8px auto 0;font-size:13px}

/* Live room summary: audience, actual queue, current asker and the next two. */
.queue-overview{display:grid;grid-template-columns:150px minmax(190px,1fr) minmax(210px,1.2fr) auto;align-items:center;gap:16px;width:100%;max-width:1280px;margin:4px auto 0;padding:12px 16px;border:1.5px solid var(--gold);border-radius:14px;background:linear-gradient(180deg,rgba(13,19,24,.94),rgba(10,14,20,.88));box-shadow:inset 0 0 0 2px rgba(212,175,106,.12),0 4px 16px rgba(0,0,0,.25)}
.queue-metrics{display:flex;align-items:center;justify-content:space-around;gap:14px}
.queue-metric{min-width:0;text-align:center;color:var(--gold-2)}
.queue-metric>div{display:flex;align-items:center;justify-content:center;gap:6px}
.queue-metric svg{width:20px;height:20px;color:var(--gold)}
.queue-metric strong{font-size:25px;line-height:1.1;font-variant-numeric:tabular-nums}
.queue-metric>span{display:block;margin-top:3px;font-size:12px;white-space:nowrap}
.queue-now,.queue-next{min-width:0;border-left:1px solid var(--gold-dim);padding-left:16px}
.queue-now-label,.queue-next-label{display:block;margin-bottom:5px;color:var(--gold-2);font-size:13px;line-height:1.1}
.queue-now.has-current .queue-now-label{display:inline-block;width:fit-content;padding:3px 10px;border:1px solid var(--gold-dim);border-radius:6px;background:linear-gradient(var(--red-2),var(--red-dark));color:#fbe6b8}
.queue-now .queue-person-name{font-size:21px}
.queue-status-text{display:block;margin-top:4px;color:var(--muted);font-size:12px;line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.queue-now:not(.has-current) .queue-status-text{display:none}
.queue-idle{display:block;color:var(--text);font-size:18px;font-style:italic;line-height:1.3}
#queue-next-people{display:flex;align-items:center;gap:14px;min-width:0}
#queue-next-people>.queue-person{flex:1;min-width:0}
.queue-person{display:flex;align-items:center;gap:8px;min-width:0}
.queue-place{display:flex;align-items:center;justify-content:center;flex:none;width:30px;height:30px;border-radius:50%;background:#d9c9a1;color:#211d17;font:700 14px/1 var(--serif);font-variant-numeric:tabular-nums}
.has-current .queue-place,.is-current .queue-place{background:linear-gradient(#ffe1a1,var(--gold));box-shadow:0 0 14px rgba(212,175,106,.38)}
.queue-person .avatar{display:flex;align-items:center;justify-content:center;flex:none;width:26px;height:26px;border-radius:50%;font:600 13px/1 system-ui,sans-serif;color:white}
.queue-person-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:18px;color:var(--text)}
.queue-you{flex:none;font:10px/1.3 system-ui,sans-serif;color:var(--gold-2)}
.queue-no-next{color:var(--muted);font-size:15px;font-style:italic}
#queue-toggle{flex:none;white-space:nowrap}
#queue-toggle .queue-chevron{width:14px;height:14px;transition:transform .15s ease}
#queue-toggle[aria-expanded=true] .queue-chevron{transform:rotate(180deg)}
.queue-panel{flex:none;display:flex;flex-direction:column;gap:12px;min-height:0;width:280px;height:calc(100% - 80px);padding:10px 4px;background:var(--panel);background-clip:padding-box}
.queue-panel h2{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:7px;flex:none;margin:2px 0 0;padding:0 0 14px;border-bottom:1px solid var(--gold-dim);color:var(--gold-2);font:italic 700 24px/1.2 var(--serif)}
.queue-panel h2 svg{width:24px;height:24px;color:var(--gold)}
#queue-panel-count{font-size:18px}
.queue-list{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;list-style:none;margin:0;padding:0 4px;scrollbar-width:thin;scrollbar-color:var(--gold-dim) transparent}
.queue-entry{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;min-height:55px;padding:10px 6px;border-bottom:1px solid rgba(212,175,106,.2)}
.queue-entry.is-current{margin-bottom:4px;border:1px solid var(--gold-dim);border-radius:8px;background:linear-gradient(110deg,rgba(163,36,27,.7),rgba(94,19,14,.35));box-shadow:inset 0 0 12px rgba(212,175,106,.08)}
.queue-entry>.queue-person{flex:1;min-width:0}
.queue-entry .queue-person-name{font-size:18px}
.queue-phase{flex:none;color:var(--muted);font-size:12px;line-height:1.2}
.queue-entry.is-current .queue-phase{color:var(--gold-2)}
.queue-empty{margin:12px 8px;color:var(--muted);font-size:16px;line-height:1.5;text-align:center;font-style:italic}
#queue-dialog{width:min(420px,calc(100% - 24px));padding:0;border:0;background:transparent;overflow:visible}
#queue-dialog .close-dialog{z-index:1;right:12px;top:12px;width:32px;height:32px}
#queue-dialog .queue-panel{width:100%;height:auto;max-height:calc(100dvh - 40px);min-height:180px;padding:14px 8px}
#queue-dialog .queue-panel h2{padding-right:30px}
#queue-dialog .queue-list{flex:0 1 auto;max-height:calc(100dvh - 150px)}
@media(min-width:1440px){
  .body.queue-open>.chart-card{width:clamp(380px,34vw,560px);min-width:0}
  .body.queue-open.chart-hidden .chat-col{flex:1;width:auto;max-width:none}
}
@media(max-width:1099px){
  .queue-overview{grid-template-columns:125px minmax(170px,1fr) auto;gap:12px}
  .queue-next{grid-column:1/-1;border:0;padding:4px 0 0;display:flex;align-items:center;gap:14px}
  .queue-next-label{margin:0}
  #queue-next-people{flex:1;max-width:420px}
  .queue-metric strong{font-size:22px}
  .queue-now .queue-person-name{font-size:18px}
}
@media(max-width:640px){
  .bar{gap:8px;padding-bottom:8px}
  .queue-overview{grid-template-columns:minmax(0,1fr) auto;gap:6px 10px;margin-top:0;padding:8px 10px;border-radius:10px}
  .queue-metrics{justify-content:flex-start;gap:16px}
  .queue-metric{display:block;text-align:center}
  .queue-metric>span{margin:2px 0 0;font-size:10px;white-space:nowrap}
  .queue-metric strong{font-size:19px}
  .queue-metric svg{width:16px;height:16px}
  #queue-toggle{grid-column:2;grid-row:1;gap:5px;padding:0 8px;font-size:12px}
  #queue-toggle>svg{width:15px;height:15px}
  .queue-now{grid-column:1/-1;display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;column-gap:10px;border-left:0;border-top:1px solid rgba(212,175,106,.2);padding:6px 0 0}
  .queue-now-label{margin:0;font-size:12px}
  .queue-now.has-current .queue-now-label{padding:3px 6px}
  .queue-status-text{grid-column:1/-1;margin-top:3px;font-size:11px}
  .queue-now .queue-person-name,.queue-idle{font-size:16px}
  .queue-next{gap:10px;padding:0}
  .queue-next-label{font-size:12px}
  .queue-person{gap:5px}
  .queue-place{width:25px;height:25px;font-size:13px}
  .queue-person .avatar{width:22px;height:22px;font-size:11px}
  #queue-next-people{gap:10px}
  #queue-next-people .queue-person-name{font-size:15px}
  #queue-next-people .queue-you{display:none}
  .queue-no-next{font-size:13px}
}
@media(min-width:641px) and (max-width:1099px) and (max-height:560px){
  .bar{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:6px 12px;padding-top:8px;padding-bottom:6px}
  .brand h1{font-size:28px}
  .bar-actions{justify-self:end}
  .queue-overview{grid-column:1/-1;margin-top:0;padding-top:8px;padding-bottom:8px}
}

/* Make your own waiting place distinct from the active red asker. */
.queue-entry.is-mine:not(.is-current){border:1px solid var(--gold);border-radius:8px;background:linear-gradient(110deg,rgba(134,86,15,.65),rgba(83,54,11,.35));box-shadow:inset 0 0 15px rgba(212,175,106,.13),0 0 10px rgba(212,175,106,.22)}
.queue-entry.is-mine .queue-person{gap:5px}
.queue-entry.is-mine .queue-person>.avatar{display:none}
.queue-entry.is-mine .queue-place{background:linear-gradient(#ffe7b0,var(--gold));box-shadow:0 0 12px rgba(212,175,106,.4)}
.queue-own-marker{display:flex;align-items:center;flex:none;color:var(--gold-2)}
.queue-own-marker svg{width:15px;height:20px}
.queue-entry.is-mine .queue-phase{max-width:100%;padding:3px 7px;border:1px solid var(--gold-dim);border-radius:999px;background:rgba(34,24,7,.7);color:var(--gold-2);font-size:12px;white-space:nowrap}
.queue-entry.is-mine.is-current{border-color:var(--gold)}

/* Left-aligned brand, right-aligned controls, and a shallower room summary. */
@media(min-width:860px){
  .bar{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:10px 20px;margin:0;padding:12px 0 10px}
  .brand{justify-self:start}
  .brand h1{font-size:clamp(28px,2.6vw,40px)}
  .bar-actions{justify-self:end;justify-content:flex-end;flex-wrap:nowrap}
  .queue-overview{grid-column:1/-1;max-width:none;margin-top:0}
}
@media(min-width:1100px){
  .queue-overview{height:50px;min-height:50px;padding:4px 14px;gap:14px}
  .queue-overview:has(.queue-now.has-current){height:66px}
  .queue-metric strong{font-size:22px}
  .queue-metric>span{margin-top:1px;font-size:11px}
  .queue-now{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:2px 10px}
  .queue-now-label{margin:0;font-size:12px}
  .queue-now.has-current .queue-now-label{padding:3px 7px}
  .queue-now .queue-person-name{font-size:19px}
  .queue-status-text{grid-column:1/-1;margin-top:0;font-size:11px}
  .queue-next-label{margin-bottom:3px;font-size:12px}
  .queue-overview .queue-place{width:26px;height:26px;font-size:13px}
}
@media(min-width:641px) and (max-width:1099px){
  .queue-overview{padding:4px 12px;row-gap:4px}
  .queue-now{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:6px}
  .queue-now-label{margin:0;font-size:12px}
  .queue-status-text{display:none}
  .queue-next{padding-top:0}
  .queue-overview .queue-place{width:25px;height:25px;font-size:13px}
}
@media(max-width:859px){
  .brand{align-self:flex-start}
  .bar-actions{align-self:flex-end;justify-content:flex-end}
}
@media(max-width:640px){
  .account-controls{margin-left:auto;justify-content:flex-end}
  .queue-overview{grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 8px;padding:4px 8px}
  .queue-now{grid-column:1;grid-row:2;display:block;padding:0;border:0}
  .queue-now-label{margin-bottom:3px;font-size:11px}
  .queue-now.has-current .queue-now-label{padding:2px 5px}
  .queue-status-text{display:none}
  .queue-next{grid-column:2;grid-row:2;display:block;align-self:start;padding:0 0 0 8px;border-left:1px solid var(--gold-dim)}
  .queue-next-label{margin-bottom:3px;font-size:11px}
  #queue-next-people{gap:6px}
  #queue-next-people .queue-place{width:20px;height:20px;font-size:11px}
  #queue-next-people .queue-person-name{font-size:13px}
  #queue-next-people .avatar{display:none}
  .queue-idle{font-size:14px;line-height:1.15}
}
@media(max-width:640px){
  .brand h1{font-size:clamp(24px,7.3vw,32px)}
}

/* Header panel and buttons share the chart/interpretation panels' translucency (var(--panel), day and night). */
.queue-overview,.account-controls .credit-badge,#account-button.profile-button,.bar .chip{background:var(--panel)}
.bar .chip:hover:not(:disabled),#account-button.profile-button:hover{background:linear-gradient(rgba(255,255,255,.07),rgba(255,255,255,.07)),var(--panel)}

/* Signed-in profile: just the avatar, the same 34px height as the Rules/credit buttons (name and plan stay in the tooltip/aria-label). */
#account-button.profile-button.signed-in,#account-button.profile-button.signed-in:hover{flex:none;width:34px;height:34px;padding:0;border:0;border-radius:50%;background:none}
#account-button.signed-in #account-label,#account-button.signed-in .profile-plan{display:none}
#account-button.signed-in .profile-avatar,#account-button.signed-in .profile-avatar .avatar{width:34px;height:34px;font-size:15px}
#account-button.signed-in .profile-avatar{box-shadow:0 0 0 1.5px var(--gold),0 2px 8px rgba(0,0,0,.45);transition:box-shadow .15s}
#account-button.signed-in:hover .profile-avatar,#account-button.signed-in:focus-visible .profile-avatar{box-shadow:0 0 0 1.5px var(--gold-2),0 0 12px rgba(212,175,106,.6)}

/* Simpler framed buttons: a single gold outline, no inner border. */
.chip.framed,[data-theme=day] .chip.framed{box-shadow:none}
.history-button,[data-theme=day] .history-button{box-shadow:0 3px 10px rgba(0,0,0,.35)}

/* Compact mobile brand and icon controls; the chart action sits by its title. */
@media(max-width:859px){
  .bar{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:10px 8px}
  .brand{min-width:0;align-self:center;gap:6px}
  .brand h1.brand-title,#brand-name{font-size:clamp(15px,4.2vw,24px);letter-spacing:0}
  #brand-desc{font-size:clamp(10px,2.6vw,13px);letter-spacing:0}
  .brand .seal{flex:none;width:23px;font-size:14px}
  .bar-actions{align-self:center;flex-wrap:nowrap;gap:6px}
  .account-controls{flex:none;width:auto;max-width:none;margin:0;padding:0;gap:6px}
  .bar-actions #rules-button,#account-button.profile-button{flex:none;width:34px;height:34px;min-width:34px;padding:0;justify-content:center}
  .account-controls .credit-badge{flex:none;width:auto;min-width:0;height:34px;padding:0 8px;gap:6px;font-size:15px}
  #credit-balance{display:inline;flex:none;white-space:nowrap}
  #rules-button>span,#account-label,#account-plan{display:none}
  .queue-overview{grid-column:1/-1;width:100%;box-sizing:border-box}
  #queue-toggle{justify-self:end;width:34px;min-width:34px;height:34px;padding:0}
  #queue-toggle-label,#queue-toggle .queue-chevron{display:none}
  #queue-toggle>svg{width:20px;height:20px}
  .chat-head{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 8px}
  .chat-head .chat-title{grid-column:1;grid-row:1}
  .chat-head #show-chart{grid-column:2;grid-row:1;position:static;align-self:center;margin:0;width:34px;min-width:34px;height:34px;padding:0}
  #show-chart>span{display:none}
  .chat-head .chat-next{grid-column:1/-1}
}
@media(min-width:860px) and (max-width:1099px){
  .chat-head #show-chart{position:static;writing-mode:horizontal-tb;height:34px;padding:0 12px;margin:0 0 0 auto}
}

.show-chart-copy{display:flex;flex-direction:column;align-items:flex-start;gap:2px;line-height:1.1}
#show-chart-hours{font-size:11px;opacity:.8;white-space:nowrap}
#show-chart-hours:empty{display:none}
@media(max-width:859px){
  .chat-head{margin-right:8px}
  .chat-head #show-chart{width:auto;min-width:0;height:40px;padding:3px 8px;gap:6px;justify-self:end}
  #show-chart>.show-chart-copy{display:flex;font-size:13px}
  #show-chart>svg{width:18px;height:18px}
  .history-button{top:58px;right:14px;width:30px;height:30px}
  #queue-toggle{margin-right:0}
}

.response-estimate{display:block;margin-top:6px;font-size:13px;font-style:normal;font-variant-numeric:tabular-nums;color:var(--gold-2);opacity:.85}

/* Mobile feedback floats over the chat; keep more room for the conversation. */
@media(max-width:859px){
  .app-page .app{padding-bottom:max(24px,calc(env(safe-area-inset-bottom) + 12px))}
  .dock{position:relative;padding-top:4px}
  .dock-feedback-slot{position:absolute;left:14px;right:14px;bottom:calc(100% + 6px);z-index:5;height:auto;max-height:112px;padding:0;pointer-events:none}
  .dock .feedback:not(:empty){max-height:112px;padding:8px 12px;border:1px solid var(--gold-dim);border-radius:8px;background:rgba(10,11,14,.94);box-shadow:0 3px 12px rgba(0,0,0,.4);pointer-events:auto}
  #queue-toggle{width:auto;min-width:0;padding:0 8px;gap:6px}
  #queue-toggle-label{display:inline;font-size:12px}
}

/* Desktop: clicking a highlighted answer term blinks the matching chart symbol or palace for 3s. */
@media (hover:hover) and (pointer:fine){.qimen-term{cursor:pointer}.qimen-term:hover{text-decoration:underline dotted;text-underline-offset:3px}}
.chart-blink{outline:2px solid var(--red-2);outline-offset:1px;border-radius:3px;animation:chart-blink .6s step-end 5}
.palace.chart-blink{outline-width:3px;outline-offset:-4px}
@keyframes chart-blink{50%{outline-color:transparent}}
@media (prefers-reduced-motion:reduce){.chart-blink{animation:none}}

/* Signed-out users always get a clearly labeled Login action. */
#account-button:not(.signed-in){width:auto;min-width:0;padding:0 10px;gap:6px;border:1.5px solid var(--gold);border-radius:8px;color:var(--text);font:600 15px/1 var(--serif)}
#account-button:not(.signed-in) #account-avatar{display:none}
#account-button:not(.signed-in) #account-label{display:inline;flex:none;overflow:visible}
#account-button .login-icon{width:18px;height:18px;color:var(--gold);flex:none}
#account-button.signed-in .login-icon{display:none}

/* Equal account action widths, including when a translated label wraps. */

.consultation-fields{border:1px solid var(--gold-dim);border-radius:10px;padding:12px;margin:12px 0;min-width:0;text-align:left}
.consultation-fields legend{padding:0 6px;color:var(--gold-2);font-size:18px}
.consultation-fields label{display:block;margin:8px 0 5px;font-size:15px}
.consultation-fields select,.consultation-fields input[type=text],.consultation-fields input[type=date],.consultation-fields input[type=time]{box-sizing:border-box;width:100%;min-width:0;max-width:100%;height:40px;padding:6px 8px;border:1px solid var(--gold-dim);border-radius:6px;color:var(--gold-2);background:#101b23;font:inherit;font-size:16px;color-scheme:dark}
.profile-editor{border:0;padding:10px 0 0;margin:12px 0 0;min-width:0}
.birth-fields{display:grid;grid-template-columns:1fr 1fr;gap:10px;min-width:0}.birth-fields>div{min-width:0}
.consultation-actions{display:flex;align-items:center;gap:15px;margin-top:12px}
.consultation-help{font-size:13px;line-height:1.4;opacity:.85;margin:8px 0}
.consultation-fields .no-floor-plans{display:flex;align-items:center;gap:8px;margin-bottom:12px}
.no-floor-plans input{flex:none;width:18px;height:18px;accent-color:var(--gold)}
#floor-plan-files{display:block;max-width:100%;font-size:13px;color:var(--gold-2)}
.floor-plan-previews{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:8px}
.floor-plan-preview{min-width:0;text-align:center}.floor-plan-preview img{width:100%;height:85px;object-fit:contain;background:#fff;border:1px solid var(--gold-dim);border-radius:6px}
.floor-plan-preview .link{font-size:12px;margin-top:4px}
@media(max-width:420px){.birth-fields{grid-template-columns:1fr}.consultation-fields{padding:9px}.floor-plan-preview img{height:65px}}

#admin-history label { display: grid; gap: .4rem; margin: 1rem 0; }
#admin-history select { width: 100%; min-width: 0; }
.archive-chat { border-top: 1px solid var(--gold, #bba16a); padding: 1rem 0; overflow-wrap: anywhere; }
.archive-prompt { white-space: pre-wrap; font-weight: bold; }
.case-feedback-action { margin-top: .75rem; }
#case-feedback-dialog { padding-bottom: 1rem; }
#case-feedback-dialog textarea {
  display: block; width: 100%; min-height: clamp(9rem, 20dvh, 12rem);
  margin: .4rem 0 .8rem; resize: vertical;
}
.case-feedback-actions { display: grid; gap: .65rem; }
.case-feedback-secondary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
#case-feedback-submit, .case-feedback-option {
  min-height: 48px; padding: .65rem .45rem; border-radius: 9px;
  font: 600 1rem/1.25 system-ui, sans-serif; white-space: normal;
}
#case-feedback-submit { background: var(--gold); color: #111; }
.case-feedback-option { border: 1px solid var(--gold); background: transparent; color: inherit; cursor: pointer; }
.case-feedback-option:hover:not(:disabled) { background: #d4af6a20; }
.case-feedback-decline {
  grid-column: 1 / -1; justify-self: center; min-height: 44px; padding: .45rem;
  border: 0; background: transparent; color: inherit; text-decoration: underline;
  text-underline-offset: .2em; font: inherit; cursor: pointer;
}
.case-feedback-secondary button:disabled { opacity: .6; cursor: default; }
.case-feedback-opt-out {
  display: flex; align-items: center; justify-content: center; gap: .65rem;
  border-top: 1px solid var(--gold-dim); padding-top: 1rem; margin-top: .3rem;
  text-align: center; cursor: pointer;
}
.case-feedback-outcome { white-space: pre-wrap; overflow-wrap: anywhere; }
.case-feedback-questions { padding-inline-start: 1.5rem; }
.case-feedback-questions li + li { margin-top: .4rem; }

/* Keep native iOS date/time controls inside the same aligned field column. */
#person-profile-dialog .profile-editor{padding:0;margin:16px 0 0;border:0}
#person-profile-dialog h2{padding:0 22px;font-size:28px}
#person-profile-dialog input,#person-profile-dialog select{display:block;box-sizing:border-box;width:100%;min-width:0;max-width:100%;height:46px;margin:0;padding:8px 10px;font:inherit;font-size:16px}
#person-profile-dialog input[type=date],#person-profile-dialog input[type=time]{appearance:none;-webkit-appearance:none;overflow:hidden}
#person-profile-dialog input::-webkit-date-and-time-value{text-align:left;min-height:1.2em}
#person-profile-dialog .birth-fields{grid-template-columns:minmax(0,1fr);gap:0}
#person-profile-dialog .consultation-actions{justify-content:space-between;gap:12px}

#app-settings-dialog h2{padding:0 24px}

#question-type{display:block;box-sizing:border-box;width:100%;min-width:0;max-width:100%;height:46px;padding:8px 10px;color:var(--gold-2);background:#101b23;border:1px solid var(--gold-dim);border-radius:6px;font:inherit;font-size:16px}
#premium-types-dialog h2{padding:0 24px;font-size:28px}
#premium-view-plans{width:100%;margin-top:16px}

.question-type-picker{position:relative;margin-bottom:16px}
#question-type[hidden]{display:none}
#question-type-toggle,.type-option{display:flex;align-items:center;gap:12px;box-sizing:border-box;width:100%;min-height:46px;padding:8px 12px;color:var(--gold-2);background:#101b23;border:1px solid var(--gold-dim);border-radius:6px;text-align:left;font:inherit;font-size:16px}
#question-type-toggle{padding-right:34px;position:relative}
#question-type-toggle::after{content:'';position:absolute;right:13px;top:17px;width:7px;height:7px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(45deg)}
.type-option-label{flex:1;min-width:0;overflow-wrap:anywhere}
.type-premium-icon{flex:none;margin-left:auto;font-size:17px}
#question-type-options{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:5;max-height:min(280px,40dvh);overflow:auto;background:#101b23;border:1px solid var(--gold-dim);border-radius:6px;padding:4px;box-shadow:0 8px 24px #0009}
.type-option{border:0;border-radius:4px}
.type-option:hover,.type-option:focus-visible,.type-option[aria-selected=true]{background:#29332e;outline:1px solid var(--gold-dim);outline-offset:-1px}

/* Dialog corner controls: language at the bottom right of sign-in; admin settings as an icon left of Close. */
#auth-dialog .auth-language{position:absolute;right:10px;bottom:10px;margin:0}
.dialog-icon-button{position:absolute;right:58px;top:8px;width:42px;height:42px;display:flex;align-items:center;justify-content:center;padding:0;border-radius:50%;
  border:1.5px solid var(--gold);background:rgba(13,14,17,.8);color:var(--gold-2)}
.dialog-icon-button svg{width:21px;height:21px}
.dialog-icon-button:hover{background:#2a2216}
[data-theme=day] .dialog-icon-button{background:var(--day-glass)}
/* Account tools sit top-left, on the same line as the close button (top:8px). */

/* ---------- Private Room: a darker, gilded chamber ---------- */
.room-switch .room-icon-public,.private-room .room-switch .room-icon-private{display:none}
.private-room .room-switch .room-icon-public{display:block}
.bar .room-switch{border-color:var(--gold-2);color:var(--gold-2)}
.bar .room-switch svg{color:var(--gold-2)}
.private-room .bar .room-switch{background:linear-gradient(180deg,#f6e3a8,#d4af6a 55%,#9c7636);color:#2b1a07;border-color:#f6e3a8;
  box-shadow:0 0 14px rgba(240,217,160,.35)}
.private-room .bar .room-switch svg{color:#2b1a07}
.private-room .bar .room-switch:hover:not(:disabled){background:linear-gradient(180deg,#fff0c4,#e0bd7a 55%,#a98240)}


/* Velvet vignette over the landscape (isolation keeps it above the body background, below content). */
body.private-room{isolation:isolate}
body.private-room::before{content:'';position:fixed;inset:0;z-index:-1;pointer-events:none;
  background:radial-gradient(ellipse 80% 60% at 50% 0%,rgba(122,24,48,.32),transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 110%,rgba(60,8,24,.55),transparent 70%),
    linear-gradient(rgba(10,4,12,.42),rgba(10,4,12,.62))}

.private-room .chat{background:linear-gradient(165deg,rgba(46,14,26,.86),rgba(14,10,20,.9) 45%,rgba(28,10,22,.88));background-clip:padding-box;
  box-shadow:0 0 0 1px rgba(240,217,160,.28),0 0 32px rgba(212,175,106,.22),0 10px 40px rgba(0,0,0,.45)}
.private-room .chat-head::after{height:2px;border-radius:0;background:linear-gradient(90deg,var(--gold-2),var(--gold) 40%,rgba(212,175,106,0))}
.private-room .chat-title{background:linear-gradient(100deg,#b8893f 0%,#fff3cf 30%,#d4af6a 50%,#fff3cf 70%,#b8893f 100%);background-size:200% 100%;
  -webkit-background-clip:text;background-clip:text;color:transparent;letter-spacing:.6px;animation:private-sheen 7s linear infinite}
.private-room .chat-title::before{content:'◆';display:inline-block;margin-right:8px;font-size:.55em;vertical-align:.25em;color:var(--gold);-webkit-text-fill-color:var(--gold)}
@keyframes private-sheen{to{background-position:-200% 0}}
.private-badge{display:inline-flex;align-items:center;gap:6px;padding:3px 10px;border:1px solid rgba(240,217,160,.55);border-radius:999px;
  background:linear-gradient(180deg,rgba(60,22,32,.85),rgba(24,12,18,.85));color:var(--gold-2);font-size:13px;font-style:italic;letter-spacing:.3px;white-space:nowrap}
.private-badge svg{width:13px;height:13px;color:var(--gold-2)}
@media(max-width:859px){.private-badge{grid-column:1/-1;justify-self:start}}
.private-room .empty{color:#d9c9a5}
.private-room .empty span{display:inline-block;color:var(--gold-2);text-shadow:0 0 18px rgba(240,217,160,.6)}

/* Gold-leaf primary buttons and a gilded queue panel. */
.private-room .ask-button{background:linear-gradient(180deg,#f8e7b0,#d9b46e 45%,#a37b3a);color:#2a1606;text-shadow:0 1px 0 rgba(255,240,200,.5);
  box-shadow:inset 0 0 0 2px #fff1c8,inset 0 0 0 4px #8a6428,inset 0 0 0 5px rgba(255,241,200,.6),0 4px 18px rgba(212,175,106,.3),0 4px 14px rgba(0,0,0,.5)}
.private-room .ask-button svg{color:#2a1606}
.private-room .queue-overview{border-color:var(--gold-2);box-shadow:inset 0 0 0 2px rgba(240,217,160,.15),0 0 22px rgba(212,175,106,.18),0 4px 16px rgba(0,0,0,.3)}
.private-room .queue-card{background:linear-gradient(165deg,rgba(46,14,26,.86),rgba(14,10,20,.9));background-clip:padding-box}

/* The ask popup in the Private Room. */
.private-room #ask-dialog{background:linear-gradient(165deg,rgba(46,14,26,.9),rgba(12,8,18,.93) 50%,rgba(30,10,22,.92)),url(/static/img/bg-tall.jpg) center top/cover no-repeat,#120a12;background-clip:padding-box;
  box-shadow:0 0 40px rgba(212,175,106,.25)}
.private-room #ask-dialog #question{border-color:rgba(240,217,160,.55);background:rgba(16,8,14,.92)}
.private-room #ask-dialog .ask-button::before,.private-room #ask-dialog .ask-button::after{display:none}
@media (prefers-reduced-motion:reduce){.private-room .chat-title{animation:none}}

/* App settings: one framed row per worker role. */
.worker-role{border:1px solid var(--gold-dim);border-radius:10px;padding:10px 12px 8px;margin:12px 0;min-width:0}
.worker-role legend{padding:0 6px;color:var(--gold-2);font-size:18px}
.worker-role .consultation-help{margin:0 0 8px}
.worker-role-fields{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.3fr);gap:10px}
.worker-role-fields label{display:grid;gap:4px;min-width:0;margin:0;font-size:14px}
.worker-role select{box-sizing:border-box;width:100%;min-width:0;height:42px;padding:6px 8px;color:var(--gold-2);background:#101b23;border:1px solid var(--gold-dim);border-radius:6px;font:inherit;font-size:15px}
.worker-role select:disabled{opacity:.6}
.worker-applied{margin:6px 0 0;font-size:13px}
/* Visual reading: the same box as the worker roles */
.visual-settings{border:1px solid var(--gold-dim);border-radius:10px;padding:10px 12px 10px;margin:12px 0;min-width:0}
.visual-settings legend{padding:0 6px;color:var(--gold-2);font-size:18px}
.visual-settings .consultation-help{margin:0 0 8px}
.visual-method-field{display:grid;gap:4px;min-width:0;margin:0;font-size:14px}
.visual-settings select{box-sizing:border-box;width:100%;min-width:0;height:42px;padding:6px 8px;color:var(--gold-2);background:#101b23;border:1px solid var(--gold-dim);border-radius:6px;font:inherit;font-size:15px}
.worker-save{margin-top:8px;padding:6px 14px;font-size:14px}
.worker-applied:empty{display:none}
@media(max-width:480px){.worker-role-fields{grid-template-columns:minmax(0,1fr)}}

/* ---------- Private Room: no public queue, the question form sits on the page ---------- */
.private-room .queue-overview,.private-room .queue-panel,.private-room #queue-dialog{display:none!important}
.private-room .dock-view{display:none!important}
.private-room .dock{max-width:none}
.private-composer{position:relative;padding:8px 10px;background:linear-gradient(165deg,rgba(46,14,26,.9),rgba(14,10,20,.93) 55%,rgba(28,10,22,.9));background-clip:padding-box;
  box-shadow:0 0 0 1px rgba(240,217,160,.22),0 0 26px rgba(212,175,106,.18)}
/* Grid: [type][its extra field] on top, [question][Ask] below, messages under them. */
.private-composer #ask-form{display:grid;grid-template-columns:auto auto minmax(0,1fr) auto;
  grid-template-areas:"type subject extra mode" "field field field send" "fb fb fb fb" "status status status status";gap:8px 10px;align-items:center}
.private-composer #ask-form>h2,.private-composer #ask-form>.subtitle,.private-composer #ask-form>.ornament,
.private-composer #ask-disclosure,.private-composer label[for=question-type-toggle],.private-composer .dialog-actions .plaque{display:none}
.private-composer .dialog-actions{display:contents}
:is(.private-composer,#public-question-type) .question-type-picker{grid-area:type;margin:0;max-width:100%}
.private-composer .field{grid-area:field;min-width:0}
.private-composer .private-mode{grid-area:mode}
.private-mode{display:inline-flex;justify-self:end;border:1px solid rgba(240,217,160,.5);border-radius:999px;background:rgba(16,8,14,.9);padding:2px;gap:2px}
.private-mode[hidden]{display:none}
.private-mode-option{position:relative;margin:0;cursor:pointer}
.private-mode-option input{position:absolute;opacity:0;width:1px;height:1px}
.private-mode-option>span{display:inline-flex;align-items:baseline;gap:5px;min-height:26px;padding:3px 12px;border-radius:999px;color:var(--gold-2);font-size:14px;white-space:nowrap}
.private-mode-option small{font-size:11.5px;opacity:.75}
.private-mode-option .mode-icon{align-self:center;width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linejoin:round;stroke-linecap:round;flex:none}
.private-mode-option input:checked+span{background:var(--gold);color:var(--ink)}
.private-mode-option input:checked+span small{opacity:.9}
.private-mode-option input:focus-visible+span{outline:2px solid var(--gold);outline-offset:1px}
.private-composer #ask-feedback{grid-area:fb;margin:0}
.private-composer .composer-status{grid-area:status}
.private-composer #send-button{grid-area:send}
/* Small pill controls shared by the top row. */
:is(.private-composer,#public-question-type) #question-type-toggle,:is(.private-composer,#public-question-type) #person-profile,.private-composer #thread-subject,.private-composer #floor-plan-files::file-selector-button,.private-composer .no-floor-plans{
  min-height:32px;height:32px;border:1px solid rgba(240,217,160,.5);border-radius:999px;background:rgba(16,8,14,.9);color:var(--gold-2);font:inherit;font-size:14px}
:is(.private-composer,#public-question-type) #question-type-toggle{width:auto;padding:3px 30px 3px 12px;gap:8px}
:is(.private-composer,#public-question-type) #question-type-toggle::after{top:10px;right:12px;width:6px;height:6px}
:is(.private-composer,#public-question-type) #question-type-options{top:auto;bottom:calc(100% + 4px);right:auto;min-width:240px}
:is(.private-composer,#public-question-type) .type-option{min-height:38px;font-size:15px}
/* Extra fields for the chosen type, inline beside the type: no box, legend or captions. */
:is(.private-composer,#public-question-type) .consultation-fields{grid-area:extra;display:flex;align-items:center;flex-wrap:wrap;gap:8px;min-width:0;margin:0;padding:0;border:0}
:is(.private-composer,#public-question-type) .consultation-fields legend,:is(.private-composer,#public-question-type) #destiny-details>label,.private-composer #floor-plan-upload-area>label,.private-composer .consultation-help{
  position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
:is(.private-composer,#public-question-type) #person-profile,.private-composer #thread-subject{width:auto;max-width:100%;min-width:180px;padding:0 30px 0 12px}
.private-composer #subject-details{grid-area:subject}
.private-composer #subject-details>label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.private-composer .no-floor-plans{display:inline-flex;align-items:center;gap:6px;margin:0;padding:0 12px;cursor:pointer;white-space:nowrap}
.private-composer .no-floor-plans input{width:15px;height:15px}
.private-composer #floor-plan-upload-area{display:flex;align-items:center;gap:8px;min-width:0}
.private-composer #floor-plan-files{max-width:240px;font-size:13px;color:var(--muted)}
.private-composer #floor-plan-files::file-selector-button{margin-right:8px;padding:0 12px;cursor:pointer}
.private-composer .floor-plan-previews{display:flex;gap:6px;margin:0}
.private-composer .floor-plan-preview{display:flex;align-items:center;gap:4px}
.private-composer .floor-plan-preview img{width:40px;height:32px}
.private-composer .floor-plan-preview .link{margin:0;font-size:12px}
.private-composer #question{min-height:64px;max-height:28dvh;padding:10px 14px 24px;font-size:16px;border-color:rgba(240,217,160,.55);background:rgba(16,8,14,.92)}
.private-composer .counter{bottom:6px;font-size:12px}
/* Ask sits beside the question, as tall as it, with the price under the label. */
.private-composer #send-button{flex-direction:column;align-self:stretch;width:auto;min-width:170px;height:auto;min-height:64px;margin:0;padding:6px 18px;gap:2px;font-size:19px}
.private-composer #send-button::before,.private-composer #send-button::after{display:none}
.private-composer #send-button>svg{display:none}
.private-composer #send-button .submit-cost{display:inline-flex;align-items:center;gap:4px;font-size:13px;font-weight:600;opacity:.85}
.private-composer #send-button .submit-cost svg{width:12px;height:12px}
.composer-status{display:none}
.private-composer .composer-status{display:block;min-width:0;color:#d9c9a5;font-size:14px;font-style:italic}
.private-composer .composer-status:has(#composer-status-text:empty):has(#composer-release[hidden]){display:none}
.private-composer #composer-release{margin-left:6px;font-size:14px}
@media(max-width:640px){
  .private-composer{padding:6px}
  /* Phones: question type, its options and the answer mode in one wrapping row right under the
     chat (full values, never truncated); then the question with Ask, then messages. */
  .private-composer #ask-form{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
  /* Row 1: question type | Spark | Sage. Row 2: question and Ask. */
  .private-composer .question-type-picker{order:1;flex:none}
  .private-composer #question-type-toggle{white-space:nowrap}
  .private-composer .private-mode{order:3;flex:0 0 auto;width:var(--ask-width);box-sizing:border-box;margin-left:auto;display:grid;grid-template-columns:1fr 1fr}
  .private-composer #ask-form::after{content:'';order:4;flex-basis:100%;height:0}
  .private-mode-option>span{justify-content:center;width:100%;box-sizing:border-box;gap:4px;align-items:center}
  .private-mode-option .mode-icon{width:15px;height:15px}
  .private-mode-option small{font-size:13px;font-weight:600}
  .private-mode-option .mode-name,.private-mode-option .mode-cost-word{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
  .private-composer .field{order:5;flex:1 1 0;min-width:0}
  .private-composer #ask-form{--ask-width:138px}
  .private-composer #send-button{order:6;align-self:stretch;flex:0 0 auto;width:var(--ask-width);min-width:0;box-sizing:border-box}
  .private-composer #ask-feedback{order:7;flex-basis:100%}
  .private-composer .composer-status{order:8;flex-basis:100%}
  /* Question type and its options at the foot of the chat: one wrapping row, full values. */
  #chat-params.private-composer{flex:none;display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:6px 8px 4px;background:none;box-shadow:none;border:0}
  #chat-params[hidden]{display:none}
  #chat-params .consultation-fields{flex:0 1 auto;max-width:100%}
  #chat-params #person-profile,#chat-params #thread-subject{min-width:0;max-width:100%;width:auto}
  .private-composer #send-button{min-width:96px;padding:6px 10px;font-size:16px}
  .private-composer #question{min-height:60px}
}

/* Birth date (Year / Month / Day) and time (Hour / Minute): one full-width row each. */
#person-profile-dialog .birth-fields>div{margin-top:8px}
.birth-label{display:block;margin:8px 0 5px;font-size:15px}
.birth-row{display:flex;gap:8px;width:100%;min-width:0}
#person-profile-dialog .birth-row select{flex:1 1 0;width:0;min-width:0;padding:8px 6px}

/* Composer floor plans: an "Upload floor plans" pill (the label) opens the hidden file input;
   "Continue without floor plans" sits to its right. */
.private-composer #fengshui-details>.no-floor-plans{order:2}
.private-composer #floor-plan-upload-area{order:1}
.private-composer #floor-plan-upload-area>label[for=floor-plan-files]{position:static;width:auto;height:32px;overflow:visible;clip:auto;white-space:nowrap;
  display:inline-flex;align-items:center;margin:0;padding:0 14px;border:1px solid rgba(240,217,160,.5);border-radius:999px;background:rgba(16,8,14,.9);color:var(--gold-2);font-size:14px;cursor:pointer}
.private-composer #floor-plan-upload-area>label[for=floor-plan-files]:hover{border-color:var(--gold-2)}
.private-composer #floor-plan-upload-area:focus-within>label[for=floor-plan-files]{outline:2px solid var(--gold-2);outline-offset:2px}
.private-composer #floor-plan-files{position:absolute;width:1px;height:1px;opacity:0;overflow:hidden}

.chart-meta.annual .chart-pillar-row,.chart-meta.annual .chart-time-row p:nth-child(2){display:none}
.annual-history-note{margin:4px 0 12px;text-align:center;color:var(--gold-2);font-size:13px;line-height:1.45}
#public-question-type:not([hidden]){display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:0 var(--ask-inset) 10px}
#ask-dialog label[for=question-type-toggle],.private-composer #ask-forecast-description{display:none}

/* Mobile header: Private Chamber and Rules show a small caption under the icon. */
@media(max-width:859px){
  .bar-actions #rules-button,.bar-actions .room-switch{flex:none;flex-direction:column;width:auto;min-width:44px;height:42px;padding:4px 6px 3px;gap:2px;line-height:1}
  .bar-actions #rules-button>span,.bar-actions .room-switch>span{display:block;font-size:9.5px;letter-spacing:.2px;white-space:nowrap}
  .bar-actions #rules-button svg,.bar-actions .room-switch svg{width:18px;height:18px}
}
@media(max-width:859px){
  .bar-actions .room-switch{height:auto;min-height:42px;max-width:58px}
  .bar-actions .room-switch>span{white-space:normal;text-align:center;line-height:1.05}
}

/* Room switch: full label on desktop, one short word under the icon on phones. */
#room-switch-short{display:none}
@media(max-width:859px){
  .bar-actions .room-switch>#room-switch-label{display:none}
  .bar-actions .room-switch>#room-switch-short{display:block;white-space:nowrap}
  .bar-actions .room-switch{max-width:none}
}

/* Phones: "Only you can see this room" is plain sub-text under the title; together they
   match the Show chart button beside them. */
@media(max-width:859px){
  .private-room .chat-head{row-gap:0}
  .private-room .chat-head .chat-title{grid-column:1;grid-row:1;line-height:1.1;align-self:end}
  .private-room .chat-head .private-badge{grid-column:1;grid-row:2;justify-self:start;align-self:start;padding:0;border:0;border-radius:0;background:none;font-size:12px;line-height:1.25}
  .private-room .chat-head .private-badge svg{width:11px;height:11px}
  .private-room .chat-head #show-chart{grid-row:1/span 2;align-self:center}
}

/* Composer floor plans: paperclip icon, an "N floor plans" link that opens the thumbnail list,
   and no "Continue without floor plans" box (no attachment means none). */
.floor-plan-count{display:none}
.floor-plan-pick svg{display:none}
.private-composer #fengshui-details>.no-floor-plans{display:none}
.private-composer #floor-plan-upload-area{position:relative}
.private-composer #floor-plan-upload-area>label.floor-plan-pick{width:32px;height:32px;padding:0;justify-content:center}
.private-composer .floor-plan-pick svg{display:block;width:17px;height:17px;color:var(--gold-2)}
.private-composer .floor-plan-pick>span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.private-composer .floor-plan-count{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 12px;border:1px solid rgba(240,217,160,.5);border-radius:999px;
  background:rgba(16,8,14,.9);color:var(--gold-2);font:inherit;font-size:14px;white-space:nowrap}
.private-composer .floor-plan-count[hidden]{display:none}
.private-composer .floor-plan-count::after{content:'';width:6px;height:6px;margin-left:2px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:translateY(2px) rotate(-135deg)}
.private-composer .floor-plan-previews{display:none}
.private-composer #floor-plan-upload-area.list-open .floor-plan-previews{position:absolute;left:0;bottom:calc(100% + 6px);z-index:6;display:grid;grid-template-columns:repeat(3,96px);gap:8px;
  padding:8px;border:1px solid var(--gold-dim);border-radius:8px;background:#120b12;box-shadow:0 8px 24px #000a}
.private-composer #floor-plan-upload-area.list-open .floor-plan-preview{flex-direction:column;align-items:stretch;gap:4px}
.private-composer #floor-plan-upload-area.list-open .floor-plan-preview img{width:100%;height:72px}
@media(max-width:480px){.private-composer #floor-plan-upload-area.list-open .floor-plan-previews{grid-template-columns:repeat(3,76px)}.private-composer #floor-plan-upload-area.list-open .floor-plan-preview img{height:58px}}
.private-composer #floor-plan-upload-area.list-open .floor-plan-previews{left:auto;right:0}
/* A Fengshui home's items and sectors: one line each, name · sector, edit and delete icons. */
.home-features-button{display:none}
.private-composer .home-features-button{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:1px solid rgba(240,217,160,.5);
  border-radius:999px;background:rgba(16,8,14,.9);color:var(--gold-2);cursor:pointer;flex:none}
.private-composer .home-features-button[hidden]{display:none}
.private-composer .home-features-button svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linejoin:round}
.home-features{position:absolute;right:0;bottom:calc(100% + 6px);z-index:7;width:min(360px,calc(100vw - 32px));max-height:min(60vh,420px);overflow:auto;
  padding:10px;border:1px solid var(--gold-dim);border-radius:8px;background:#120b12;box-shadow:0 8px 24px #000a;color:var(--gold-2)}
.home-features[hidden]{display:none}
.home-features-title{margin:0 0 6px;font-weight:600}
.home-features ul{list-style:none;margin:0;padding:0;display:grid;gap:2px}
.home-feature{display:flex;align-items:center;gap:6px;min-height:36px;padding:2px 0;border-bottom:1px solid rgba(240,217,160,.12)}
.home-feature:last-child{border-bottom:0}
.home-feature-label{flex:1;min-width:0;display:flex;align-items:baseline;gap:8px}
.home-feature-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.home-feature-sector{flex:none;font-size:13px;opacity:.75;white-space:nowrap}
.home-feature.corrected .home-feature-sector{opacity:1;color:var(--gold)}
.home-feature.corrected .home-feature-sector::after{content:' ✎'}
.home-feature-icon{flex:none;display:inline-flex;align-items:center;justify-content:center;width:30px;height:30px;padding:0;border:0;border-radius:6px;background:transparent;color:inherit;cursor:pointer}
.home-feature-icon:hover,.home-feature-icon:focus-visible{background:rgba(240,217,160,.12)}
.home-feature-icon svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.home-feature-name-input,.home-feature-sector-input{min-width:0;height:30px;padding:0 6px;border:1px solid var(--gold-dim);border-radius:6px;background:#0b060b;color:inherit;font:inherit;font-size:14px}
#home-features .home-feature-name-input{flex:1 1 120px;width:auto;margin:0}
#home-features .home-feature-sector-input{flex:0 1 150px;width:auto;max-width:none;min-height:0;margin:0}
@media(max-width:600px){
  #home-features .home-feature.editing{flex-wrap:wrap;padding:6px 0}
  #home-features .home-feature.editing .home-feature-name-input{flex:1 1 100%}
  #home-features .home-feature.editing .home-feature-sector-input{flex:1 1 0}
}

/* Composer: the question box is exactly two lines (scrolls beyond); Ask matches its height. */
.private-composer #question,.private-composer #question:focus{box-sizing:border-box;height:calc(2.9em + 18px);min-height:0;max-height:none;resize:none;overflow-y:auto;
  padding:9px 64px 9px 14px;font-size:16px;line-height:1.45}
.private-composer .counter{bottom:auto;top:50%;right:12px;transform:translateY(-50%)}
.private-composer #send-button{min-height:0;height:auto;padding:4px 18px;font-size:18px;line-height:1.1}
@media(max-width:640px){.private-composer #question,.private-composer #question:focus{padding-right:56px;font-size:15px}.private-composer #send-button{font-size:15px;padding:4px 10px}}

/* Oracle palaces: several deities and stars stacked in their usual places. */
.palace-symbol-list{display:flex;flex-direction:column;align-items:center;gap:1px;justify-self:center;align-self:start;min-width:0}
.palace-symbol-list .palace-symbol-row{justify-content:center}

/* Public ask popup: sincerity confirmation under the question box. */
.sincere-check{display:flex;align-items:flex-start;gap:10px;margin:10px 0 0;font-size:15px;line-height:1.4;color:#e6dcc5;cursor:pointer}
.sincere-check input{flex:none;width:18px;height:18px;margin:2px 0 0;accent-color:var(--gold)}
.sincere-check b{color:var(--gold-2)}
.private-composer .sincere-check{display:none}
.sincere-check>span{font-weight:400}.sincere-check b{font-weight:700}

/* Chart switching: a small blocking popup with a turning seal. */
.chart-loading-dialog{width:fit-content;min-width:240px;max-width:calc(100% - 32px);padding:22px 28px;text-align:center;overflow:hidden}
.chart-loading-dialog p{margin:12px 0 0;font-size:18px;font-style:italic;color:var(--gold-2)}
.chart-loading-seal{display:inline-flex;align-items:center;justify-content:center;width:46px;height:46px;border-radius:50%;
  background:linear-gradient(#b52a1f,#8a1a12);color:#f6e2b0;font:24px/1 var(--kai);box-shadow:0 0 0 2px var(--gold),0 0 18px rgba(212,175,106,.45);
  animation:chart-loading-turn 1.4s linear infinite}
@keyframes chart-loading-turn{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.chart-loading-seal{animation:none}}

/* Destiny Chart header: title with edit/delete icons; birthday (cake icon) on the second row. */
.chart-meta h2.chart-heading{display:flex;align-items:center;gap:10px}
.chart-profile-actions{display:inline-flex;gap:6px}
.chart-profile-actions[hidden]{display:none}
.chart-icon-button{display:inline-flex;align-items:center;justify-content:center;width:30px;height:30px;padding:0;border:1px solid var(--gold-dim);border-radius:50%;
  background:rgba(13,14,17,.7);color:var(--gold-2);font:inherit}
.chart-icon-button:hover{border-color:var(--gold);background:#2a2216}
.chart-icon-button svg{width:15px;height:15px}
.chart-birth-icon{display:none}
.chart-meta.destiny .chart-next-icon{display:none}
.chart-meta.destiny .chart-birth-icon{display:block}
.delete-profile-dialog{padding-bottom:30px}

/* Oracle palace: two deities across the top, two stars below
   (a single one centred), direction / door / stem along the bottom. */
.palace-symbol-layout.oracle{grid-template-rows:auto auto minmax(0,1fr) auto;row-gap:6px;
  grid-template-areas:"odeity odeity odeity" "ostar ostar ostar" ". . ." "dir door ostem"}
.at-odeity{grid-area:odeity}.at-ostar{grid-area:ostar}.at-ostem{grid-area:ostem}
.palace-symbol-list.row{flex-direction:row;justify-content:space-around;align-items:flex-start;width:100%;justify-self:stretch;gap:4px}
.palace-symbol-layout.oracle>.at-ostem{align-self:end;justify-self:end}
.palace-symbol-layout.oracle>.at-door{justify-self:center}
.palace-center-stems{position:absolute;right:8px;bottom:8px;z-index:1}
.palace-center-stems .palace-stem-pair{flex-direction:row}
.palace-center-stems .palace-stem-symbol+.palace-stem-symbol .palace-stem-cn{font-size:26px}.palace-center-stems .palace-stem-symbol+.palace-stem-symbol .palace-stem-pinyin{font-size:12px}

/* Oracle: the left deity/star group lines up with the direction badge on the left and the
   right group with the Heavenly Stem on the right; a lone one in a side palace goes to the outer side,
   in the middle column it stays centred. */
.palace-symbol-layout.oracle .palace-symbol-row{align-items:center;text-align:center}
.palace-symbol-layout.oracle .palace-symbol-list.row{padding:0}  /* same edge as the direction badge and stem */
.palace-symbol-layout.oracle .palace-symbol-list.row:not(:has(>:only-child)){justify-content:space-between}
.palace-symbol-layout.oracle .palace-symbol-list.row>:first-child:not(:only-child),
.palace-symbol-layout.oracle.side-left .palace-symbol-list.row>:only-child{align-items:flex-start;text-align:left}
.palace-symbol-layout.oracle .palace-symbol-list.row>:last-child:not(:only-child),
.palace-symbol-layout.oracle.side-right .palace-symbol-list.row>:only-child{align-items:flex-end;text-align:right}
.palace-symbol-layout.oracle.side-left .palace-symbol-list.row:has(>:only-child){justify-content:flex-start}
.palace-symbol-layout.oracle.side-right .palace-symbol-list.row:has(>:only-child){justify-content:flex-end}

/* Destiny chart: life-area labels on the left of each palace; the Destiny palace stands out. */
.palace-life-areas{display:flex;flex-direction:column;align-items:flex-start;gap:3px}
.palace-life-area{display:inline-block;max-width:100%;padding:1px 6px;border:1px solid #b5895a;border-radius:4px;background:rgba(255,250,236,.75);
  color:#5b3a12;font:600 11px/1.3 system-ui,sans-serif;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.palace-life-area.destiny{border-color:#ED1C24;background:#ED1C24;color:#fff}
.palace-life-areas{min-width:0;overflow:visible;z-index:1}.palace-life-area{max-width:none;overflow:visible;text-overflow:clip}
/* Many life areas wrap across the left two thirds of the palace instead of one tall column. */
.palace-symbol-layout>.palace-life-areas{grid-column:1/3;flex-direction:row;flex-wrap:wrap;align-content:center;align-self:center;gap:3px;padding-right:4px}
.palace-symbol-layout>.palace-life-areas{justify-content:flex-start;justify-self:start}
/* Life areas as plain text: Destiny in red, the others black. */
.palace-life-area,.palace-life-area.destiny{padding:0;border:0;border-radius:0;background:none;color:#17140f;font:600 12px/1.3 system-ui,sans-serif}
.palace-life-area.destiny{color:#c41e18}
.palace-symbol-layout>.palace-life-areas{column-gap:8px;row-gap:2px}
/* Life areas: one per line, same type as the formations. */
.palace-life-area,.palace-life-area.destiny{font:600 9.6px/1.25 system-ui,-apple-system,"Segoe UI",sans-serif;white-space:nowrap}
.palace-symbol-layout>.palace-life-areas{grid-column:1/2;flex-direction:column;flex-wrap:nowrap;align-items:flex-start;justify-content:center;gap:3px;padding-right:0}

/* Destiny: life areas now sit in the right-hand column, one per line, right-aligned. */
.palace-bad-area .palace-life-areas{flex-direction:column;flex-wrap:nowrap;align-items:flex-end;justify-content:center;gap:3px;text-align:right}
.name-suggestion{grid-column:2;display:flex;flex-wrap:wrap;gap:6px 14px;align-items:center;margin-top:8px;padding:8px 12px;border:1px dashed var(--gold-dim);border-radius:8px;color:var(--gold-2);font-size:15px}
.name-suggestion .link{color:var(--gold);font-weight:700}
#rename-subject-input{width:100%;box-sizing:border-box;margin:8px 0;padding:10px 12px;border:1px solid var(--gold-dim);border-radius:8px;background:var(--panel-2);color:var(--text);font:inherit}
@media (max-width:859px){.name-suggestion{grid-column:1/-1}}

/* The AI says a question belongs to another Fengshui home / activity: offer the switch. */
.switch-suggestion{grid-column:2;display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;margin:4px 0 0;font-size:15px;color:var(--gold-2)}
.switch-suggestion .link{text-align:left;white-space:normal}
#switch-subject-dialog .dialog-actions{flex-wrap:wrap}
#switch-subject-dialog .dialog-actions button{flex:1 1 220px;white-space:normal}

/* Private Chamber: no premium crowns beside the question types. */
.private-composer .type-premium-icon{display:none}

/* App Settings: worker list. */
.worker-list{margin:10px 0 4px}
.worker-list h3{margin:0 0 6px;color:var(--gold-2);font-size:18px;font-weight:600}
.worker-list-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px}
.worker-action{padding:3px 10px;border:1px solid var(--gold-dim);border-radius:6px;background:transparent;color:var(--gold-2);font-size:13px}
.worker-action:hover:not(:disabled){border-color:var(--gold);background:rgba(212,175,106,.12)}
.engine-login{grid-column:2/-1;display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:2px 0 4px}
.engine-login-link{color:var(--gold-2)}
.engine-login .link{font-size:13px}
.engine-login-code{flex:1 1 140px;min-width:0;padding:3px 8px;border:1px solid var(--gold-dim);border-radius:6px;background:rgba(0,0,0,.25);font-size:13px}
.engine-login-error{width:100%;color:#ff9a85}
/* Workers (connections): name and type, the roles using it, health on each machine, actions */
.worker-list-actions{display:flex;gap:6px}
.connection-list{margin:0 0 14px}
.connection-row{padding:8px 10px;border:1px solid var(--gold-dim);border-radius:8px;font-size:14px}
.connection-head{display:grid;grid-template-columns:auto auto minmax(0,1fr) auto;column-gap:8px;align-items:center}
.connection-switch{grid-column:4;display:grid;place-items:center;width:28px;height:28px;padding:0;border:1px solid var(--gold-dim);border-radius:6px;background:transparent;color:var(--gold-2)}
.connection-switch:hover:not(:disabled){border-color:var(--gold);background:rgba(212,175,106,.12)}
.connection-switch svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.connection-name{color:var(--gold-2);font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.connection-type{min-width:0;color:var(--muted);font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.connection-roles{margin:3px 0 0 15px;color:var(--gold);font-size:12.5px}
.connection-row .worker-engines{margin-left:15px}
.connection-actions{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin:6px 0 0 15px;font-size:13px}
.connection-actions .link{font-size:13px}
.connection-actions .danger{color:#ff9a85}
.connection-actions .danger.confirm{font-weight:600}
.engine-login-device{color:var(--text);font-weight:600;letter-spacing:.5px}
.add-connection{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:8px;align-items:end;
  margin:0 0 10px;padding:10px;border:1px dashed var(--gold-dim);border-radius:8px;font-size:14px}
.add-connection label{display:grid;gap:3px;color:var(--muted);font-size:13px}
.add-connection input,.add-connection select{padding:5px 8px;border:1px solid var(--gold-dim);border-radius:6px;background:rgba(0,0,0,.25);color:var(--text)}
.add-worker-dialog .add-connection{border:0;padding:0;margin:14px 0 4px;grid-template-columns:minmax(0,1fr)}
.add-worker-dialog .add-connection input,.add-worker-dialog .add-connection select{height:40px;font-size:15px}
.add-worker-login{margin:14px 0 4px}
.add-worker-status{margin:0 0 10px;line-height:1.45}
.add-worker-login .engine-login{margin:0}
.worker-customize-label{display:inline-flex;align-items:center;gap:6px;margin:2px 0 6px;color:var(--gold-2);font-size:14px;cursor:pointer}
.worker-follows{margin:0 0 4px}
.worker-list ul{list-style:none;margin:0;padding:0;display:grid;gap:6px}
.worker-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;column-gap:8px;row-gap:2px;align-items:center;
  padding:8px 10px;border:1px solid var(--gold-dim);border-radius:8px;font-size:14px}
.worker-dot{width:9px;height:9px;border-radius:50%;background:#8a8a8a}
.worker-row.serving .worker-dot{background:#5fbf72}.worker-row.standby .worker-dot{background:#d9b45a}
.worker-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--gold-2);font-weight:600}
.worker-state{color:var(--muted);white-space:nowrap}
.worker-engines{grid-column:2/-1;list-style:none;margin:4px 0 0;padding:0;display:grid;gap:3px;color:var(--muted);font-size:13px}
.engine-health{display:grid;grid-template-columns:auto auto minmax(0,1fr);column-gap:7px;align-items:center}
.engine-dot{width:8px;height:8px;border-radius:50%;background:#8a8a8a}
.engine-health.ok .engine-dot{background:#5fbf72}.engine-health.warn .engine-dot{background:#d9b45a}
.engine-health.down .engine-dot{background:#e0624f}
.engine-name{color:var(--text,#e8dcc0);white-space:nowrap}
.engine-detail{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.engine-health.down .engine-detail{color:#ff9a85}
.worker-row.offline{opacity:.75}

/* Next to the Master's name: what he is doing now. */
.agent-status{margin-left:10px;font-family:system-ui,sans-serif;font-size:13px;font-style:normal;font-weight:500;color:var(--muted);letter-spacing:.2px}
.agent-status::before{content:'';display:inline-block;width:7px;height:7px;margin-right:6px;border-radius:50%;background:#d9b45a;vertical-align:middle;animation:agent-pulse 1.4s ease-in-out infinite}
@keyframes agent-pulse{50%{opacity:.3}}
@media (prefers-reduced-motion:reduce){.agent-status::before{animation:none}}

/* Auto-translated Q&A from the room's other language. */
.tag.translated{background:transparent;border:1px solid var(--gold-dim);color:var(--muted)}
.translated-note{grid-column:2;margin:4px 0 0;font-size:13px;font-style:italic;color:var(--muted)}

.answer-actions{display:flex;align-items:center;gap:8px;grid-column:2/-1;margin:8px 0;flex-wrap:wrap}
.answer-actions .response-rating{margin:0}
.response-rating{display:flex;align-items:center;gap:8px;grid-column:2/-1;margin:8px 0;flex-wrap:wrap}
.answer-visual{display:inline-flex;align-items:center;justify-content:center;min-width:40px;min-height:36px;padding:5px 9px;border-radius:7px}
.answer-visual svg{width:20px;height:20px}
.rating-button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:40px;min-height:36px;padding:5px 9px;border:1px solid var(--gold-dim);border-radius:7px;background:transparent;color:var(--gold-2);font:inherit;font-size:16px;cursor:pointer}
.rating-button.selected{background:var(--gold);color:var(--ink);border-color:var(--gold-2)}
.rating-button:focus-visible{outline:2px solid var(--gold-2);outline-offset:3px}
.rating-button:disabled{opacity:.5;cursor:default}
.rating-feedback{font-size:13px;color:var(--text)}

#admin-bonus-panel input{box-sizing:border-box;display:block;width:100%;min-width:0;max-width:100%;height:46px;padding:8px;color:var(--gold-2);background:#101b23;border:1px solid var(--gold-dim);border-radius:6px;font:inherit;font-size:16px}
#bonus-confirm-dialog .ask-button{width:100%;margin-top:16px}
#bonus-confirm-dialog h2{padding:0 25px;font-size:28px}
.credit-breakdown{border:1px solid var(--gold-dim);border-radius:8px;padding:8px 12px;margin:12px 0;text-align:left;font-size:14px}
.credit-breakdown p{margin:5px 0}.credit-breakdown .muted{font-size:12px}

.stats-filters{display:grid;grid-template-columns:1.15fr 1fr 1fr;gap:8px;align-items:end;margin-top:16px}
.stats-filters label{min-width:0;margin:0;font-size:13px}
.stats-filters label>span{display:block;margin-bottom:5px}
.stats-filters select,.stats-filters input,#history-room,#history-period{box-sizing:border-box;display:block;width:100%;min-width:0;max-width:100%;height:42px;padding:6px;color:var(--gold-2);background:#101b23;border:1px solid var(--gold-dim);border-radius:6px;font:inherit;font-size:14px;color-scheme:dark}
.stats-filters input{appearance:none;-webkit-appearance:none;overflow:hidden}
.stats-filters input::-webkit-date-and-time-value{text-align:left}
.stats-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin:12px 0}
.stats-metric{display:flex;flex-direction:column;gap:5px;padding:12px;border:1px solid var(--gold-dim);border-radius:8px;min-width:0;overflow-wrap:anywhere}
.stats-metric span,.stats-metric small{font-size:13px;opacity:.8}
.stats-metric strong{font-size:23px;font-weight:600}
.stats-note{font-size:13px;line-height:1.45;opacity:.8;margin:10px 0}
.stats-room{border-top:1px solid var(--gold-dim);margin-top:20px;padding-top:10px;min-width:0}
.stats-room h3{font-size:22px;margin:8px 0}
.stats-chart{width:100%;min-width:0}
.stats-chart svg{display:block;width:100%;height:220px;overflow:visible}
.stats-grid{stroke:currentColor;opacity:.14}
.stats-axis{fill:currentColor;opacity:.8;font-size:11px}
.stats-empty{fill:currentColor;font-size:13px}
.stats-chart circle:focus{stroke:var(--gold-2);stroke-width:3;outline:none}
.stats-legend{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin:6px 0}
.stats-series{display:flex;align-items:center;justify-content:flex-start;gap:6px;min-width:0;min-height:34px;border:1px solid var(--gold-dim);border-radius:6px;padding:6px;color:var(--gold-2);background:transparent;font:inherit;font-size:13px;text-align:left}
.stats-series[aria-pressed=false]{opacity:.4}
.stats-series span:last-child{min-width:0;overflow-wrap:anywhere}
.stats-swatch{width:15px;height:3px;flex:none}
.stats-visibility{display:flex;gap:8px;margin:8px 0 12px}
.stats-visibility .stats-series{flex:1;justify-content:center}
.stats-visibility .public::before,.stats-visibility .private::before{content:'';width:22px;border-top:2px solid currentColor}
.stats-visibility .private::before{border-top-style:dashed}
.stats-table{width:100%;border-collapse:collapse;table-layout:fixed;font-size:13px}
.stats-table th,.stats-table td{border-bottom:1px solid #ad975a44;padding:8px 4px;text-align:right;overflow-wrap:anywhere;vertical-align:top}
.stats-table th:first-child{text-align:left;width:34%}
.stats-table th{font-weight:600}
.stats-table th:first-child{width:30%}
.stats-table thead th:nth-child(n+2):nth-child(-n+4){width:13%}
.stats-table td:last-child,.stats-table thead th:last-child{overflow-wrap:normal;word-break:normal}
@media(max-width:540px){.stats-table{table-layout:auto}.stats-table th,.stats-table td{overflow-wrap:normal;width:auto!important}.stats-table th:first-child{overflow-wrap:anywhere;width:auto}.stats-table td:last-child{font-size:11px;white-space:nowrap}}
.stats-table .stats-sub{display:block;font-weight:400;font-size:11px;opacity:.7;margin-top:2px}
.stats-table tfoot th,.stats-table tfoot td{font-weight:700;border-bottom:0;border-top:2px solid var(--gold-dim)}
.stats-empty-row{text-align:center!important;opacity:.7}
.stats-breakdown{border-top:1px solid var(--gold-dim);margin-top:16px;padding-top:6px;min-width:0}
.stats-breakdown-head{display:flex;align-items:end;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-bottom:8px}
.stats-breakdown-head h3{font-size:22px;margin:8px 0}
.stats-breakdown-head label{margin:0;font-size:13px}
.stats-breakdown-head label>span{display:block;margin-bottom:5px}
#stats-group{height:42px;min-width:180px;padding:6px;color:var(--gold-2);background:#101b23;border:1px solid var(--gold-dim);border-radius:6px;font:inherit;font-size:14px;color-scheme:dark}
@media(max-width:540px){
 .stats-summary{grid-template-columns:repeat(2,minmax(0,1fr))}
 .stats-metric{padding:9px}.stats-metric strong{font-size:20px}
 .stats-legend{grid-template-columns:repeat(2,minmax(0,1fr))}
 .stats-filters{gap:5px;grid-template-columns:1.05fr 1fr 1fr}
 .stats-filters label{font-size:11px}
 .stats-filters input,.stats-filters select,#history-room,#history-period{font-size:12px;padding:4px;height:40px}
 .stats-filters input::-webkit-calendar-picker-indicator{width:10px;padding:0;margin:0}
 .stats-table{font-size:12px}.stats-table th,.stats-table td{padding:8px 3px}
}

.stats-filters:not(.is-custom)>label:first-child{grid-column:1/-1;max-width:320px}
.stats-room>.stats-summary{grid-template-columns:repeat(4,minmax(0,1fr))}
@media(max-width:540px){
 .stats-room .stats-metric{padding:7px 5px}
 .stats-room .stats-metric strong{font-size:16px}
 .stats-room .stats-metric span,.stats-room .stats-metric small{font-size:11px}
}

.bonus-manager{border-top:1px solid var(--gold-dim);margin-top:20px;padding-top:8px}
.bonus-manager h3{margin:10px 0;font-size:23px}
#bonus-link-status{width:100%;min-width:0;height:42px;padding:6px;border:1px solid var(--gold-dim);border-radius:6px;background:#101b23;color:var(--gold-2);font:inherit;font-size:16px}
.bonus-link-row{border:1px solid var(--gold-dim);border-radius:8px;padding:8px 10px;margin:8px 0;text-align:left}
.bonus-link-line{display:flex;align-items:center;gap:8px;min-width:0}
.bonus-link-info{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
.bonus-link-title{display:flex;align-items:center;gap:8px;min-width:0}
.bonus-link-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:16px}
.bonus-link-meta{font-size:12.5px;opacity:.75;overflow-wrap:anywhere}
.bonus-link-actions{display:flex;align-items:center;gap:4px;flex:none}
.bonus-icon{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:1px solid transparent;border-radius:50%;background:none;color:var(--gold-2);cursor:pointer}
.bonus-icon:hover,.bonus-icon:focus-visible{border-color:var(--gold-dim);background:#2a2216}
.bonus-icon:disabled{opacity:.45;cursor:default}
.bonus-icon svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.bonus-icon.danger{color:#f08c80}
@media(max-width:540px){.bonus-link-title{flex-wrap:wrap;gap:4px 6px}.bonus-link-name{white-space:normal;overflow-wrap:anywhere}.bonus-link-actions{gap:0}.bonus-icon{width:30px;height:30px}.bonus-link-row{padding:8px}}
.bonus-link-state{flex:none;font-size:11.5px;line-height:1;border:1px solid;border-radius:20px;padding:3px 8px}
.bonus-link-state.active{color:#59d7ae;border-color:#59d7ae88;background:#59d7ae1a}
.bonus-link-state.expired{color:#f08c80;border-color:#f08c8088;background:#f08c801a}
.bonus-link-state.inactive{color:#e7bd63;border-color:#e7bd6388;background:#e7bd631a}
.bonus-link-state.used{color:#b3b7bd;border-color:#b3b7bd66;background:#b3b7bd14}
.bonus-link-name-form{display:flex;align-items:center;gap:4px;min-width:0}
#admin-bonus-panel .bonus-link-name-form input{flex:1;min-width:0;width:0;height:34px;padding:4px 8px;font-size:15px}
#admin-bonus-panel input.bonus-saved-url{margin-top:6px;height:36px;font-size:13px}
#bonus-new-panel input{box-sizing:border-box;display:block;width:100%;min-width:0;max-width:100%;height:46px;padding:8px;color:var(--gold-2);background:#101b23;border:1px solid var(--gold-dim);border-radius:6px;font:inherit;font-size:16px;color-scheme:dark}
.bonus-new-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:12px}
.bonus-new-grid label{margin:0;min-width:0}
.bonus-new-grid label>span{display:block;margin-bottom:5px}
#bonus-new-panel input[type=date]{appearance:none;-webkit-appearance:none;overflow:hidden}
#bonus-new-panel .ask-button{margin:16px 8px 0 0}
#bonus-new-panel h2,#users-topup-panel h2{margin:0 0 8px;font-size:20px}
.bonus-link-row .feedback{margin:8px 0 0;font-size:13px}

.bonus-manager-heading{display:flex;align-items:center;justify-content:space-between;gap:10px}

#account-credit-breakdown{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;border:0;padding:0;margin:14px 0}
.profile-credit{display:flex;align-items:center;justify-content:center;gap:7px;min-width:0;min-height:44px;padding:8px 6px;border:1px solid var(--gold-dim);border-radius:8px;background:transparent;color:var(--gold-2);font:inherit;cursor:pointer}
.profile-credit-icon{font-size:20px;flex:none}
.profile-credit-number{font-size:18px;min-width:0;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
.profile-credit:focus-visible{outline:2px solid var(--gold-2);outline-offset:3px}
#credit-detail-dialog h2{padding:0 25px;font-size:28px}
.credit-detail-amount{text-align:center;font-size:30px;margin:16px 0}
#credit-detail-expiries p{font-size:14px}

.billing-allowance strong{display:block}

.answer-mode-badge{display:inline-block;margin-left:8px;padding:1px 7px;border:1px solid var(--gold);border-radius:999px;color:var(--gold-2);font:600 11px/1.5 system-ui,sans-serif;vertical-align:middle;white-space:nowrap}


/* Keep status out of the avatar/name grid columns. */
.msg.agent>.avatar{grid-column:1;grid-row:1}
.msg.agent>.agent-name{grid-column:2;grid-row:1;min-width:0;overflow-wrap:anywhere}
.msg.agent>.bubble,.msg.agent>.live-progress{grid-column:2;min-width:0;max-width:100%}
.live-progress{margin:2px 0 8px;font:13px/1.45 system-ui,sans-serif;color:var(--muted)}
.live-status-text{color:var(--gold-2);display:inline;min-width:0;overflow-wrap:anywhere}
.live-status-text::before{content:'';display:inline-block;width:7px;height:7px;margin-right:7px;border-radius:50%;background:#d9b45a;animation:agent-pulse 1.4s ease-in-out infinite}
.live-status-content{min-width:0}
@media(max-width:859px){
  .msg.agent{grid-template-columns:22px minmax(0,1fr)}
  .msg.agent>.bubble,.msg.agent>.live-progress{grid-column:1/-1}
}
@media(prefers-reduced-motion:reduce){.live-status-text::before{animation:none}}

.floor-plan-preview select{width:100%;min-width:0;max-width:100%;font-size:13px}
.answer-image-link{display:block;max-width:100%;margin:10px 0}
.answer-image{display:block;width:auto;max-width:100%;height:auto;border-radius:8px;border:1px solid var(--gold-dim)}
.floor-plan-preview:only-child{grid-column:1/-1}

/* Early Bird access */
.early-bird-dialog form{display:grid;gap:6px;text-align:left}
/* Same look as the dialog's text inputs: height, gold border, dark field. */
.early-bird-dialog select,.early-bird-dialog textarea{width:100%;box-sizing:border-box;
  border:1.5px solid var(--gold-dim);border-radius:10px;background:rgba(10,11,14,.9);color:var(--text);
  font-family:system-ui,sans-serif;font-size:16px;outline:0;color-scheme:dark}
.early-bird-dialog select{height:48px;padding:0 14px}
.early-bird-dialog textarea{min-height:110px;padding:12px 14px;line-height:1.45;resize:vertical}
.early-bird-dialog select:focus,.early-bird-dialog textarea:focus{border-color:var(--gold)}
[data-theme=day] .early-bird-dialog select,[data-theme=day] .early-bird-dialog textarea{background:rgba(8,20,38,.9)}
/* Country picker: type to filter, choose from the list right below the field. */
.combo{position:relative}
.combo input{padding-right:40px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c9a45c' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 14px center;background-size:16px}
.combo-list{position:absolute;left:0;right:0;top:calc(100% + 4px);z-index:5;max-height:240px;overflow:auto;margin:0;padding:4px;list-style:none;
  border:1.5px solid var(--gold);border-radius:10px;background:#0a0b0e;box-shadow:0 10px 24px rgba(0,0,0,.5);
  font-family:system-ui,sans-serif;font-size:16px;text-align:left}
.combo-list li{padding:9px 12px;border-radius:7px;cursor:pointer}
.combo-list li[aria-selected=true],.combo-list li:hover{background:rgba(201,164,92,.18);color:var(--gold-2)}
.combo-list li.empty{cursor:default;color:var(--muted);background:none}
.early-bird-dialog h3{margin:8px 0 4px}
.early-bird-actions{display:flex;justify-content:space-between;align-items:center;margin-top:12px}
.early-bird-summary{display:grid;grid-template-columns:max-content 1fr;gap:4px 12px;margin:10px 0 0;text-align:left;font-size:14px}
.early-bird-summary dt{color:var(--muted)}
.early-bird-summary dd{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
@media(max-width:540px){.early-bird-summary{grid-template-columns:1fr}.early-bird-summary dd{margin-bottom:6px}}
.early-bird-row-title{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 8px}
.early-bird-row-title .muted{overflow-wrap:anywhere}
.early-bird-row .tag{margin-left:auto;font-size:12px;padding:2px 8px;border-radius:999px;border:1px solid var(--gold-dim)}
.early-bird-row .early-bird-approved{color:#7fc47f;border-color:#7fc47f}
.early-bird-row .early-bird-rejected{color:#d98a7a;border-color:#d98a7a}
.early-bird-row-actions{display:flex;gap:8px;margin-top:8px;flex-wrap:wrap}
.early-bird-badge{position:absolute;top:-4px;right:-4px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:#c0392b;color:#fff;font:600 11px/16px system-ui,sans-serif;text-align:center}

/* Private Room top row: the home (Fengshui/Strategy profile) name never pushes into Spark/Sage.
   Its column may shrink, the picker is capped and long names end with an ellipsis. */
.private-composer #ask-form{grid-template-columns:auto minmax(0,auto) minmax(0,1fr) auto}
.private-composer #subject-details,.private-composer .consultation-fields,.private-composer #floor-plan-upload-area{min-width:0}
.private-composer #thread-subject{min-width:0;max-width:170px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}
/* "N floor plans" and the items button always show in full; the home name gives way instead. */
.private-composer #fengshui-details:not([hidden]){min-width:max-content}
.private-composer .floor-plan-count{flex:none;max-width:none;min-width:max-content;overflow:visible;white-space:nowrap}
/* Spark 2 · Sage 5: the price without the word "credits" (the hover text explains each mode). */
.private-mode-option .mode-cost-word{display:none}

/* Mobile Fengshui controls share one line and reserve the jump-to-latest target. */
@media(max-width:640px){
  #chat-params.fengshui-params{flex-wrap:nowrap;gap:6px;padding-right:66px;min-width:0}
  #chat-params.fengshui-params #subject-details{flex:1 1 0;min-width:0;max-width:none}
  #chat-params.fengshui-params #thread-subject{width:100%;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  #chat-params.fengshui-params #fengshui-details{flex:0 0 auto;flex-wrap:nowrap;min-width:0}
  #chat-params.fengshui-params #floor-plan-upload-area{flex-wrap:nowrap;gap:5px}
  #chat-params.fengshui-params .floor-plan-pick{flex:none}
  #chat-params.fengshui-params .floor-plan-count{flex:none;white-space:nowrap;padding-left:8px;padding-right:8px;font-size:12px}
}
@media(max-width:859px){
  .bar{flex:none;min-height:0}
  .private-room.app-page .app{padding-bottom:0}
}
@media(max-width:640px){
  .private-room #private-composer{padding-top:3px;padding-bottom:calc(3px + env(safe-area-inset-bottom))}
  .private-room #private-composer #ask-form{row-gap:3px}
  .private-room .dock{padding-top:2px}
}

/* Full-screen lightbox; the initial image is contained within 85% of the viewport. */
.image-preview-trigger{appearance:none;display:block;min-width:0;max-width:100%;padding:0;border:0;background:none;color:inherit;cursor:zoom-in}
#image-preview-dialog{position:fixed;inset:0;width:100vw;height:100dvh;max-width:none;max-height:none;margin:0;padding:0;border:0;border-image:none;background:transparent;box-shadow:none;overflow:hidden;touch-action:none;overscroll-behavior:contain}
#image-preview-dialog::backdrop{background:rgba(0,0,0,.82);backdrop-filter:none}
#image-preview-dialog>.close-dialog{position:absolute;right:max(12px,env(safe-area-inset-right));top:max(12px,env(safe-area-inset-top));z-index:2;width:44px;height:44px;background:rgba(0,0,0,.65);color:#fff;border:1px solid rgba(255,255,255,.6)}
#image-preview-stage{position:absolute;inset:7.5dvh 7.5vw;display:flex;align-items:center;justify-content:center;overflow:visible;touch-action:none;cursor:grab;outline-offset:-2px}
#image-preview-stage.is-dragging{cursor:grabbing}
#image-preview-image{position:absolute;display:block;flex:none;max-width:none;max-height:none;object-fit:contain;transform-origin:center;user-select:none;-webkit-user-drag:none}
#image-preview-error{color:white;text-align:center}
.image-preview-controls{position:absolute;bottom:max(12px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);z-index:2;display:flex;align-items:center;gap:6px;padding:5px 8px;border-radius:999px;border:1px solid rgba(255,255,255,.35);background:rgba(0,0,0,.75);color:white;font:14px/1.2 system-ui,sans-serif}
.image-preview-controls button{min-width:40px;min-height:40px;border:0;border-radius:50%;padding:4px 8px;background:transparent;color:white;font-size:22px}
.image-preview-controls button:hover{background:rgba(255,255,255,.15)}
.image-preview-controls #image-zoom-fit{border-radius:18px;font-size:14px}
#image-zoom-level{min-width:46px;text-align:center;font-variant-numeric:tabular-nums}

/* The preview stage is a gesture surface, not a framed panel. */
#image-preview-stage:focus,#image-preview-stage:focus-visible{outline:none}
.floor-plan-preview{display:grid;grid-template-columns:minmax(0,1fr) 40px;align-items:center;gap:8px}
.floor-plan-controls{display:flex;flex-direction:column;align-items:center;gap:4px}
.floor-plan-north,.floor-plan-remove{position:relative;display:flex;align-items:center;justify-content:center;width:40px;height:40px;min-height:40px;padding:0;border:1px solid var(--gold-dim);border-radius:50%;background:var(--panel);color:var(--gold-2)}
.floor-plan-north-icon{display:block;font:28px/1 system-ui,sans-serif;pointer-events:none}
.floor-plan-north select{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;padding:0}
.floor-plan-north:focus-within{outline:2px solid var(--gold-2);outline-offset:2px}
.floor-plan-remove{font:28px/1 system-ui,sans-serif;cursor:pointer}
.private-composer #floor-plan-upload-area.list-open .floor-plan-previews{grid-template-columns:minmax(0,1fr);width:min(320px,calc(100vw - 48px));max-width:calc(100vw - 48px)}
.private-composer #floor-plan-upload-area.list-open .floor-plan-preview{display:grid;grid-template-columns:minmax(0,1fr) 40px;gap:8px;align-items:center}
.private-composer #floor-plan-upload-area.list-open .floor-plan-preview img{height:100px}

.floor-plan-north{gap:2px}
.floor-plan-north-icon{font-size:23px}
.floor-plan-north-label{font:600 12px/1 system-ui,sans-serif;pointer-events:none}

/* Give the public question form more horizontal room without widening its frame. */
#ask-dialog{padding-left:13px;padding-right:13px}
@media(max-width:640px){
  #ask-dialog{padding-left:8px;padding-right:8px}
  #ask-dialog #send-button{font-size:clamp(13px,4vw,17px);white-space:nowrap;gap:6px}
  #ask-dialog #send-label{white-space:nowrap}
}

/* One line: the home name shrinks to fit (down to ~90px). Only a composer too small for even
   that puts the home name + floor-plan buttons on their own line, so "N floor plans" is never cut. */
.private-composer #ask-form:has(#subject-details:not([hidden])){grid-template-columns:max-content minmax(90px,max-content) max-content minmax(0,1fr) max-content;
  grid-template-areas:"type subject extra . mode" "field field field field send" "fb fb fb fb fb" "status status status status status"}
.private-composer #ask-form:has(#subject-details:not([hidden])) #thread-subject{width:100%;min-width:0}
.private-composer{container:composer / inline-size}
/* Tighter: Spark/Sage keep their icon and price only (their names stay in the hover text). */
@container composer (max-width: 660px) {
  .private-composer #ask-form:has(#subject-details:not([hidden])) .private-mode .mode-name{display:none}
}
@container composer (max-width: 560px) {
  .private-composer #ask-form:has(#subject-details:not([hidden])){grid-template-columns:max-content minmax(0,1fr) max-content;
    grid-template-areas:"type . mode" "subject extra extra" "field field send" "fb fb fb" "status status status"}
}

#admin-history .stats-filters label{margin:0;display:block}
#admin-history .stats-filters select{width:100%}

.answer-image-link{width:fit-content;max-width:min(100%,var(--answer-image-size,50vmin))}
.answer-image{max-width:100%;max-height:var(--answer-image-size,50vmin);object-fit:contain}

#delete-confirm-title{padding-inline:28px;overflow-wrap:anywhere}
#delete-confirm-message,#delete-subject-name,#delete-profile-name{overflow-wrap:anywhere}

.rating-like-group{display:inline-flex;align-items:stretch}
.rating-like-group .rating-button{border-radius:7px 0 0 7px;border-right:0;min-width:0;padding-right:3px}
.rating-count-button{min-width:0;min-height:36px;padding:5px 9px 5px 3px;border:1px solid var(--gold-dim);border-left:0;border-radius:0 7px 7px 0;background:transparent;color:var(--gold-2);font:inherit;font-size:16px;cursor:pointer}
.rating-count-button:hover{background:rgba(201,164,92,.15)}
.response-likes-users{list-style:none;padding:0;margin:12px 0;display:grid;gap:12px}
.response-likes-users li{display:flex;align-items:center;gap:10px;min-width:0}
.response-likes-users li>span:last-child{overflow-wrap:anywhere}
#response-likes-title{padding-inline:26px}
#response-likes-question{overflow-wrap:anywhere}

/* Public reading controls stay on a single row, including narrow phones. */
#public-question-type:not([hidden]){flex-wrap:nowrap;gap:6px}
#public-question-type .question-type-picker{display:none}
#public-type-buttons{display:flex;flex:none;gap:4px}
#public-type-buttons button{border:1px solid var(--gold-dim);border-radius:18px;background:var(--panel);padding:5px 8px;white-space:nowrap;font-size:14px}
#public-type-buttons button[aria-pressed="true"]{background:var(--gold);color:var(--ink)}
#public-question-type #destiny-details{flex:1;min-width:0;flex-wrap:nowrap}
#public-question-type #person-profile{width:100%;min-width:0;overflow:hidden;text-overflow:ellipsis;font-size:14px;padding-left:8px}
#reading-actions{display:flex;align-items:center;gap:6px;margin-left:auto;flex:none}
#reading-expand{padding:6px;width:32px;height:32px}
.reading-expanded .bar,.reading-expanded .queue-overview,.reading-expanded #queue-panel{display:none!important}
.reading-expanded #body.queue-open>.chart-card{width:clamp(380px,40vw,640px)}
@media(max-width:859px){
  .chat-head #reading-actions{grid-column:2;grid-row:1}
  #reading-actions #show-chart{margin:0}
  #public-type-buttons button,#public-question-type #person-profile{font-size:clamp(11px,3.3vw,14px)}
  #public-type-buttons button{padding:5px 6px}
}

#reading-actions #show-chart{writing-mode:horizontal-tb;position:static;align-self:center;height:40px;padding:3px 8px;margin:0}

.profile-picker{display:flex;align-items:center;justify-content:space-between;gap:6px;width:100%;min-width:0;border:1px solid var(--gold-dim);border-radius:8px;background:#111c24;padding:12px;color:var(--text)}
.profile-picker>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
:is(.private-composer,#public-question-type) .profile-picker{border-radius:999px;background:rgba(8,6,12,.85);font-size:14px;height:32px;padding:0 10px;flex:1}
#public-question-type .profile-picker{font-size:clamp(11px,3.3vw,14px)}
#profile-list-dialog{width:min(540px,calc(100vw - 24px));max-height:85dvh;overflow:auto}
#profile-list-rows{display:flex;flex-direction:column;gap:8px}
.profile-list-row{display:flex;align-items:center;gap:4px;border:1px solid var(--gold-dim);border-radius:9px;min-width:0;padding:4px}
.profile-list-choice{flex:1;min-width:0;text-align:left;border:0;background:transparent;padding:10px 6px;overflow-wrap:anywhere;font-size:17px}
.profile-list-choice[aria-pressed="true"]{color:var(--gold-2);font-weight:bold}
.profile-list-action{display:flex;align-items:center;justify-content:center;flex:none;width:36px;height:40px;padding:6px;border:1px solid var(--gold-dim);border-radius:7px;background:var(--panel)}


/* Keep the complete profile chooser visible; only the saved list scrolls. */
#profile-list-dialog{width:min(760px,calc(100vw - 20px));max-height:calc(100dvh - 20px);padding:16px 20px;overflow:hidden}
#profile-list-dialog[open]{--profile-section-gap:12px;display:flex;flex-direction:column;gap:var(--profile-section-gap)}
.profile-list-header{display:flex;align-items:center;gap:8px;flex:none}
#profile-list-title{order:0;flex:1;min-width:0;margin:0;padding:0;white-space:nowrap;font-size:clamp(20px,4.6vw,34px);line-height:1.2}
#profile-list-dialog .close-dialog{position:static;order:1;flex:none;width:32px;height:32px;padding:6px;margin:0}
.profile-list-intro{text-align:center;margin:0 auto;max-width:580px;font-size:17px;line-height:1.3;flex:none}
.profile-mode-choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:0;flex:none}
.profile-mode-choices>button{position:relative;display:flex;align-items:center;gap:10px;text-align:left;border:1.5px solid var(--gold-dim);border-radius:12px;background:rgba(7,15,24,.65);padding:14px 12px;color:var(--gold-2);min-width:0}
.profile-mode-choices>button[aria-pressed="true"]{border-color:var(--gold-2);box-shadow:0 0 10px rgba(212,175,106,.35),inset 0 0 12px rgba(212,175,106,.08)}
.profile-mode-choices b,.profile-mode-choices strong{display:block;white-space:nowrap}
.profile-mode-choices b{font-size:23px;line-height:1.2}
.profile-mode-choices strong{font-size:17px;margin-top:4px;line-height:1.2}
.profile-mode-icon{width:30px;height:34px;flex:none}
.profile-mode-check{position:absolute;right:6px;top:6px;width:15px;height:15px;display:grid;place-items:center;border:1px solid var(--gold-dim);border-radius:50%;font:12px sans-serif}
[aria-pressed="true"]>.profile-mode-check{background:var(--gold);color:var(--ink)}
#profile-saved-section{display:flex;flex-direction:column;gap:8px;min-height:0;flex:0 1 auto}
.profile-saved-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;flex:none}
.profile-saved-heading h3{font-size:23px;margin:0;white-space:nowrap}
.profile-saved-heading button{white-space:nowrap;text-align:center;height:32px;font-size:16px;padding:4px 8px}
#profile-list-rows{gap:6px;max-height:244px;min-height:0;overflow-y:auto;overscroll-behavior:contain;flex:0 1 auto}
.profile-list-row{height:44px;min-height:44px;flex:none;padding:2px 4px}
.profile-list-choice{padding:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;overflow-wrap:normal;font-size:17px}
.profile-list-action{width:34px;height:36px;padding:6px}
.profile-list-row:has(.profile-list-choice[aria-pressed="true"]){border-color:var(--gold-2);background:rgba(212,175,106,.1)}
#profile-search-wrap{display:block;flex:none}
#profile-list-search{width:100%;height:36px;margin:0;padding:6px 10px;font-size:16px;border:1px solid var(--gold-dim);border-radius:8px;background:#111c24;color:var(--text)}
#profile-list-empty{margin:4px 0;font-size:16px}
#profile-list-continue{flex:none;width:min(380px,100%);height:44px;min-height:44px;margin:4px auto 0;font-size:22px;gap:18px;background:linear-gradient(180deg,#f8e7b0,#d9b46e 45%,#a37b3a);color:#2a1606;text-shadow:0 1px 0 rgba(255,240,200,.5);font-style:normal;box-shadow:inset 0 0 0 2px var(--gold),inset 0 0 0 5px rgba(240,217,160,.55),0 4px 12px rgba(0,0,0,.5)}
@media(max-width:540px){
 #profile-list-dialog{padding:12px 10px;gap:10px}
 #profile-list-dialog[open]{--profile-section-gap:10px}
 .profile-list-intro{font-size:14px}
 .profile-mode-choices{gap:8px}
 .profile-mode-choices>button{display:block;padding:12px 7px 10px}
 .profile-mode-icon{display:none}
 .profile-mode-choices b{font-size:clamp(12px,3.7vw,20px)}
 .profile-mode-choices strong{font-size:clamp(10px,3vw,15px)}
 .profile-saved-heading h3{font-size:clamp(16px,4.5vw,20px)}
 .profile-saved-heading button{font-size:14px;padding:4px 6px}
 .profile-list-choice{font-size:16px}
}
@media(max-height:680px){
 #profile-list-dialog{padding-top:8px;padding-bottom:8px}
 #profile-list-dialog[open]{--profile-section-gap:6px}
 .profile-mode-choices>button{padding-top:8px;padding-bottom:8px}
 #profile-saved-section{gap:5px}
 #profile-list-rows{gap:4px;max-height:196px}
 .profile-list-row{height:36px;min-height:36px}
 .profile-list-action{height:30px;width:32px;padding:5px}
 #profile-list-continue{height:36px;min-height:36px;font-size:20px}
}

/* Triple the gaps above saved profiles and between the list and Continue. */
.profile-mode-choices:not([hidden])+#profile-saved-section{margin-top:calc(2 * var(--profile-section-gap))}
#profile-saved-section:not([hidden])+#profile-list-continue{margin-top:calc(2 * var(--profile-section-gap) + 12px)}

/* Outcome feedback: question and reward cards, clear primary/secondary actions. */
#case-feedback-dialog{width:min(720px,calc(100vw - 24px));max-height:calc(100dvh - 24px);padding:30px 24px 24px;overflow-y:auto}
#case-feedback-title{font-size:clamp(27px,4.7vw,42px);line-height:1.1;margin:16px 30px 10px;padding:0}
#case-feedback-dialog>.close-dialog{top:10px;right:10px;width:34px;height:34px}
.case-feedback-intro{text-align:center;font-size:clamp(17px,2.7vw,24px);line-height:1.3;margin:0 0 24px}
.case-feedback-question-card,.case-feedback-reward-card{display:flex;align-items:center;gap:16px;padding:16px 18px;border:1.5px solid var(--gold);border-radius:14px;background:rgba(18,31,44,.86);font-family:system-ui,sans-serif}
.case-feedback-question-card{margin-bottom:18px}
.case-feedback-question-card>svg,.case-feedback-reward-card>svg{width:38px;height:42px;stroke:var(--gold-2);flex:none}
.case-feedback-question-card>div,.case-feedback-reward-card>div{min-width:0;flex:1}
.case-feedback-question-card b,.case-feedback-reward-card b{display:block;color:var(--gold-2);font-size:17px;line-height:1.3}
#case-feedback-prompt{margin:6px 0 0;padding:0;border:0;font:600 19px/1.4 system-ui,sans-serif;overflow-wrap:anywhere;max-height:140px;overflow-y:auto;overscroll-behavior:contain}
#case-feedback-prompt .case-feedback-questions{margin:0;padding-inline-start:22px}
.case-feedback-reward-card{border-color:var(--gold-dim);margin-bottom:20px}
.case-feedback-reward-card p{margin:5px 0 0;font-size:16px;line-height:1.4}
#case-feedback-form>label{display:block;font:600 19px/1.3 system-ui,sans-serif;color:var(--gold-2);margin-bottom:10px}
.case-feedback-input{position:relative;margin-bottom:20px}
#case-feedback-dialog #case-feedback-outcome{width:100%;height:clamp(110px,18dvh,180px);min-height:110px;max-height:35dvh;margin:0;padding:14px 16px 34px;resize:vertical;border:1.5px solid var(--gold);border-radius:13px;background:rgba(18,31,44,.86);font:17px/1.5 system-ui,sans-serif}
#case-feedback-outcome::placeholder{font-style:italic;color:#a59f93;opacity:1}
#case-feedback-counter{position:absolute;right:16px;bottom:10px;font:14px/1.2 system-ui,sans-serif;color:var(--text);pointer-events:none}
#case-feedback-status:empty{display:none}
#case-feedback-dialog .case-feedback-actions{gap:14px}
#case-feedback-submit{height:54px;font:700 23px/1.2 system-ui,sans-serif;background:linear-gradient(180deg,#ffe09a,#e9b454);color:#15120c;text-shadow:none;box-shadow:inset 0 0 0 2px var(--gold),inset 0 0 0 5px rgba(240,217,160,.7),0 3px 8px #0005}
#case-feedback-dialog .case-feedback-secondary{gap:10px 14px}
#case-feedback-dialog .case-feedback-option{display:flex;align-items:center;justify-content:center;gap:10px;border:1.5px solid var(--gold);border-radius:12px;background:rgba(18,31,44,.8);padding:10px;font-size:17px;min-height:48px}
.case-feedback-option svg{width:25px;height:25px;stroke:var(--gold-2)}
#case-feedback-dialog .case-feedback-decline{font-size:20px;padding:4px;min-height:36px}
#case-feedback-dialog .case-feedback-opt-out{margin:2px 10px 0;padding-top:18px;line-height:1.4;font-size:19px}
.case-feedback-opt-out input{width:22px;height:22px;flex:none;margin:0;accent-color:var(--gold)}
@media(max-width:540px){
 #case-feedback-dialog{padding:24px 12px 16px}
 #case-feedback-title{margin:12px 16px 10px}
 .case-feedback-intro{margin-bottom:18px}
 .case-feedback-question-card,.case-feedback-reward-card{gap:10px;padding:12px}
 .case-feedback-question-card>svg,.case-feedback-reward-card>svg{width:28px;height:32px}
 .case-feedback-question-card b,.case-feedback-reward-card b{font-size:14px}
 #case-feedback-prompt{font-size:16px;max-height:100px}
 .case-feedback-reward-card p{font-size:14px}
 #case-feedback-dialog .case-feedback-option{font-size:14px;gap:6px;padding:8px 5px}
 .case-feedback-option svg{width:20px;height:20px}
 #case-feedback-submit{font-size:20px}
 #case-feedback-dialog .case-feedback-opt-out{font-size:16px;margin-inline:0}
}
@media(max-height:700px){
 #case-feedback-dialog{padding-top:16px;padding-bottom:12px}
 #case-feedback-title{margin-top:8px}
 .case-feedback-intro{margin-bottom:12px}
 .case-feedback-question-card{margin-bottom:12px}
 .case-feedback-reward-card{margin-bottom:12px}
 .case-feedback-input{margin-bottom:12px}
 #case-feedback-dialog .case-feedback-actions{gap:10px}
}

.billing-access{grid-column:1/-1;font:14px/1.4 system-ui,sans-serif;color:var(--text);margin:10px 0}
.billing-access>b{color:var(--gold-2)}
.billing-access li.billing-includes{list-style:none;margin-inline-start:-18px;font-style:italic;color:var(--muted)}
.billing-access ul{margin:5px 0;padding-inline-start:18px}
/* Fit feedback actions into the mobile viewport; lengthy questions scroll inside their card. */
#case-feedback-dialog{max-height:calc(100dvh - 16px);padding:12px 16px;overflow:hidden}
#case-feedback-dialog[open]{display:flex;flex-direction:column;gap:10px}
#case-feedback-title{margin:0 32px 0 0;font-size:clamp(21px,4.5vw,32px);line-height:1.15;flex:none}
#case-feedback-dialog>.close-dialog{width:28px;height:28px;top:8px;right:8px}
.case-feedback-intro{margin:0;font-size:clamp(12px,3.4vw,18px);line-height:1.2;flex:none}
.case-feedback-question-card,.case-feedback-reward-card{padding:10px 12px;gap:10px;margin:0;flex:none}
.case-feedback-question-card>svg,.case-feedback-reward-card>svg{width:25px;height:28px}
.case-feedback-question-card b,.case-feedback-reward-card b{font-size:13px}
#case-feedback-prompt{font-size:14px;line-height:1.3;max-height:72px;margin-top:4px}
.case-feedback-questions li+li{margin-top:4px}
.case-feedback-reward-card p{font-size:12px;line-height:1.3;margin-top:3px}
#case-feedback-form{display:flex;flex-direction:column;gap:8px;min-height:0;flex:1 1 auto;margin:0}
#case-feedback-form>label{font-size:15px;margin:0;flex:none}
.case-feedback-input{margin:0;min-height:76px;flex:1 1 auto}
#case-feedback-dialog #case-feedback-outcome{height:100%;min-height:76px;max-height:140px;font-size:14px;line-height:1.3;padding:10px 12px 28px;resize:none}
#case-feedback-counter{font-size:12px;bottom:8px;right:12px}
#case-feedback-dialog .case-feedback-actions{gap:8px;flex:none}
#case-feedback-submit{height:42px;min-height:42px;font-size:17px;padding:8px}
#case-feedback-dialog .case-feedback-secondary{gap:6px 10px}
#case-feedback-dialog .case-feedback-option{min-height:36px;font-size:clamp(10px,2.9vw,14px);padding:6px 4px;gap:5px}
.case-feedback-option svg{width:18px;height:18px}
#case-feedback-dialog .case-feedback-decline{min-height:28px;font-size:16px;padding:3px}
#case-feedback-dialog .case-feedback-opt-out{font-size:14px;margin:0;padding-top:10px;gap:8px}
.case-feedback-opt-out input{width:18px;height:18px}
@media(max-height:620px){
 #case-feedback-dialog[open]{gap:6px}
 #case-feedback-dialog{padding:8px 10px}
 .case-feedback-question-card,.case-feedback-reward-card{padding:7px 9px}
 #case-feedback-prompt{max-height:50px;font-size:13px}
 #case-feedback-form{gap:6px}
 #case-feedback-dialog .case-feedback-actions{gap:5px}
 #case-feedback-submit{height:36px;min-height:36px}
}
@media(max-height:450px){#case-feedback-dialog{overflow-y:auto}#case-feedback-form{flex:none}.case-feedback-input{height:76px}}

.annual-package-price{margin:0;color:var(--gold-2);font-size:27px;font-weight:bold}
.annual-package-price small{font:14px/1.3 system-ui,sans-serif;font-weight:normal}
#annual-package-dialog .ask-button{height:auto;min-height:48px;font-size:19px;padding:10px}
.package-locked{border-style:dashed!important}

/* Answer style chooser (Learner / Achiever), with an example answer for each. */
.style-dialog{padding-bottom:30px}
.style-example-question{margin:0 0 10px;color:var(--muted);font-size:15px;text-align:center}
.style-example-question i{color:var(--text)}
.style-options{display:grid;gap:10px;margin-bottom:12px}
.style-dialog label.style-option{display:grid;grid-template-columns:auto minmax(0,1fr);gap:6px 10px;margin:0;font-weight:400;padding:12px 14px;border:1px solid var(--line);border-radius:12px;background:var(--panel);cursor:pointer}
.style-option:has(input:checked){border-color:var(--gold);box-shadow:0 0 0 1px var(--gold) inset}
.style-option input{align-self:start;width:18px;height:18px;margin:3px 0 0;accent-color:var(--gold)}
.style-option-head{display:grid;gap:2px}
.style-option-head b{color:var(--gold-2);font-size:19px}
.style-option-head span{color:var(--muted);font-size:14px}
.style-option-example{grid-column:1/-1;padding:8px 10px;border-left:2px solid var(--gold-dim);background:rgba(0,0,0,.18);font-size:14px;line-height:1.5;font-style:italic}
/* The current answer style as a badge. */
.style-badge{display:inline-block;padding:3px 12px;border:1px solid var(--gold);border-radius:999px;
  background:linear-gradient(180deg,rgba(240,217,160,.22),rgba(212,175,106,.08));color:var(--gold-2);
  font-weight:700;font-size:.92em;line-height:1.3;letter-spacing:.2px;vertical-align:middle}

/* Visual reading: the chart full screen, the answer read aloud step by step with captions under it. */
.visual-dialog{width:100vw;height:100dvh;max-width:none;max-height:none;margin:0;padding:10px 12px 12px;border:0;
  display:none;flex-direction:column;gap:8px;background:rgba(8,10,16,.97);color:var(--text)}
.visual-dialog[open]{display:flex}
.visual-dialog::backdrop{background:rgba(0,0,0,.9);backdrop-filter:blur(4px)}
.visual-head{flex:none;display:flex;align-items:center;gap:14px;padding-right:58px;min-height:40px}  /* room for the close button (10px + 42px) plus a gap */
.visual-head h2{margin:0;font-size:24px;font-style:italic;color:var(--gold-2)}
.visual-count{color:var(--muted);font-size:16px}
.visual-head .close-dialog{top:10px;right:10px}
.visual-stage{flex:1;min-height:0;display:flex;justify-content:center}
.visual-stage .chart-card{width:min(100%,1000px);min-width:0;height:100%;max-height:100%;gap:8px;padding:4px;
  border:0;background:transparent;overflow:hidden;backdrop-filter:none}
.visual-stage .chart-scroll{position:relative;flex:1;min-height:0;overflow:hidden}
.visual-stage .chart-grid{position:absolute;left:50%;top:50%;width:600px;height:600px;min-width:600px;min-height:600px;
  transform:translate(-50%,-50%) scale(var(--chart-scale,0));transform-origin:center}
.visual-stage #hide-chart,.visual-stage .chart-scroll-hint{display:none}
.visual-caption{flex:none;margin:0 auto;width:min(100%,1000px);height:14dvh;min-height:0;max-height:14dvh;overflow-y:auto;
  padding:10px 16px;border:1px solid var(--gold-dim);border-radius:10px;background:rgba(18,20,26,.92);
  font-size:clamp(17px,2.2vw,22px);line-height:1.5;text-align:center}
.visual-word{transition:color .15s}
.visual-word.spoken{color:var(--text)}
.visual-word:not(.spoken):not(.current){color:var(--muted)}
.visual-word.current{color:var(--gold-2);text-shadow:0 0 10px rgba(240,217,160,.55)}
.visual-word.qimen-term.spoken,.visual-word.qimen-term.current{color:var(--gold-2);font-weight:700}
/* Play in the exact middle (under the chart's centre); the other buttons grouped on each side. */
.visual-controls{flex:none;display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:14px}
.visual-controls-side{display:flex;align-items:center;gap:14px}
.visual-controls-side.start{justify-content:flex-end}
.visual-controls-side.end{justify-content:flex-start}
.visual-controls button{width:46px;height:46px;padding:10px}
.visual-controls .visual-play{width:58px}
.visual-controls button:disabled{opacity:.35;cursor:default}
/* Symbols named in the current step stay lit; the one just spoken also blinks (.chart-blink). */
.visual-lit{outline:3px solid var(--red-2);outline-offset:2px;border-radius:4px;box-shadow:0 0 16px rgba(200,56,43,.55);
  background-color:rgba(200,56,43,.14)}
.palace.visual-lit{outline-width:4px;outline-offset:-5px}
/* While a step names symbols, the palaces it does not talk about step back. */
.visual-stage .chart-grid.visual-focus .palace{transition:opacity .3s,filter .3s}
.visual-stage .chart-grid.visual-focus .palace:not(.visual-lit):not(:has(.visual-lit)){opacity:.42;filter:saturate(.5)}
@media (prefers-reduced-motion:reduce){.visual-stage .chart-grid.visual-focus .palace{transition:none}}
@media (max-width:859px){
  .visual-dialog{padding:8px 8px 10px;gap:6px}
  .visual-head h2{font-size:19px}
  .visual-count{font-size:14px}
  .visual-caption{font-size:16px;padding:8px 10px;height:14dvh;max-height:14dvh}
  .visual-controls button{width:42px;height:42px}
}

/* Stable scene geometry: narration scrolls without changing chart space. */
.visual-head h2{white-space:nowrap;flex-shrink:0}
.visual-count{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.visual-stage .chart-heading{padding-right:0;white-space:nowrap;font-size:clamp(17px,5vw,30px);line-height:1.15;margin:0}
.visual-stage .chart-meta{flex:none}
@media(max-width:600px){
  .visual-head{gap:8px}
  .visual-head h2{font-size:clamp(15px,4.5vw,19px)}
  .visual-count{font-size:12px}
  #ask-dialog{padding-top:14px;padding-bottom:12px}
  #ask-dialog h2{margin:0;font-size:25px}
  #ask-dialog .subtitle{font-size:14px;margin:4px 0}
  #ask-dialog .ornament{margin:10px auto}
  #ask-disclosure,#ask-forecast-description{font-size:14px;line-height:1.4;margin:10px 0}
  #ask-dialog #question{height:clamp(90px,20dvh,150px);min-height:90px}
  #ask-dialog .sincere-check{font-size:14px;line-height:1.4;margin:10px 0}
  #ask-dialog .dialog-actions{margin-top:12px}
}

#voice-config-dialog,#voice-progress-dialog{width:min(92vw,500px);padding:22px 16px}
#voice-config-title,#voice-progress-title{font-size:clamp(20px,5vw,27px);padding-right:36px;margin:0 0 20px}
/* Saved reading: watch it again for free above the re-generate controls. */
.voice-saved{margin:0 0 6px}
.voice-saved p{margin:0 0 12px}
.voice-saved .ask-button{width:100%}
.voice-or{display:flex;align-items:center;gap:12px;margin:18px 0 4px!important;color:var(--muted);font-style:italic;font-size:15px}
.voice-or::before,.voice-or::after{content:"";flex:1;height:1px;background:linear-gradient(90deg,transparent,var(--gold-dim),transparent)}
/* With a saved reading, re-generate is the secondary action: dark plaque, gold text. */
#voice-config-dialog.has-saved #voice-generate{height:50px;margin-top:4px;font-size:clamp(17px,4.5vw,20px);
  background:linear-gradient(180deg,#22252d,#121419);color:var(--gold-2);
  box-shadow:inset 0 0 0 1.5px var(--gold-dim),0 3px 10px rgba(0,0,0,.4)}
#voice-config-dialog.has-saved #voice-generate:hover:not(:disabled){filter:none;box-shadow:inset 0 0 0 1.5px var(--gold),0 3px 10px rgba(0,0,0,.4)}
/* Voice picker: dark field, gold frame and gold caret, in the dialog's serif. */
#visual-voice{display:block;width:100%;height:50px;margin-top:0;padding:0 44px 0 16px;
  -webkit-appearance:none;appearance:none;cursor:pointer;
  border:1.5px solid var(--gold-dim);border-radius:10px;
  background:rgba(10,11,14,.9) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d4af6a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 14px center/18px no-repeat;
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.6),0 2px 8px rgba(0,0,0,.35);
  color:var(--gold-2);font-family:var(--serif);font-size:19px;font-weight:600;letter-spacing:.2px;
  color-scheme:dark;outline:0;transition:border-color .15s,box-shadow .15s}
#visual-voice:hover{border-color:var(--gold)}
#visual-voice:focus-visible{border-color:var(--gold-2);box-shadow:0 0 0 3px rgba(212,175,106,.25)}
#visual-voice:disabled{opacity:.6;cursor:not-allowed}
#visual-voice option{background:#101b23;color:var(--text);font-family:system-ui,sans-serif;font-size:15px}
[data-theme=day] #visual-voice{background-color:rgba(8,20,38,.9)}
#voice-quota{font-size:15px;line-height:1.5}
#voice-generate,#voice-start{width:100%;margin-top:12px}
/* Play: the same red-and-gold button as Generate, with a filled play triangle. */
#voice-start{margin-top:18px}
#voice-start svg{fill:currentColor;stroke-width:1.2;filter:drop-shadow(0 1px 1px rgba(0,0,0,.5))}
#voice-checklist{list-style:none;padding:0;margin:12px 0;display:grid;gap:14px;font-size:16px}
#voice-checklist li{display:flex;gap:10px;align-items:center}
#voice-checklist .pending{color:var(--muted)}
#voice-checklist .active{color:var(--gold-2)}
#voice-checklist .done{color:var(--text)}

#voice-generate{min-height:62px;padding:14px 12px;font-size:clamp(17px,4.5vw,23px);font-weight:700;justify-content:center}
.visual-interactions{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:8;overflow:visible}
.visual-interactions line{stroke-width:5;stroke-linecap:round;filter:drop-shadow(0 1px 2px #fff)}
.visual-interactions .overcome{stroke:#ae3027;color:#ae3027}
.visual-interactions .generate{stroke:#24704c;color:#24704c}

.visual-stage .chart-profile-actions{display:none!important}

/* My chats: open the visual reading of a past answer. */
.archive-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:10px 0 2px}
.archive-actions>*{margin-top:0;margin-bottom:0}
.archive-visual{display:inline-flex;align-items:center;gap:8px;width:auto;height:38px;margin:0 0 0 auto;padding:0 14px;font-size:15px}
.archive-visual svg{width:18px;height:18px}

/* Visual reading: waiting for the first scenes' voice. */
.visual-loading{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:5;display:flex;align-items:center;gap:14px;
  padding:16px 24px;border:1.5px solid var(--gold-dim);border-radius:12px;background:rgba(10,11,14,.92);color:var(--gold-2);
  font-size:19px;font-style:italic;box-shadow:0 8px 30px rgba(0,0,0,.6)}
.visual-spinner{width:26px;height:26px;border-radius:50%;border:3px solid rgba(212,175,106,.25);border-top-color:var(--gold);
  animation:visual-spin .9s linear infinite}
@keyframes visual-spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.visual-spinner{animation-duration:2.5s}}

/* Visual reading speed: « slower, » faster; the active one shows its speed. */
.visual-controls .visual-speed{width:auto;min-width:46px;gap:4px;padding:10px 12px}
.visual-controls .visual-speed.active{background:rgba(212,175,106,.18);border-color:var(--gold-2)}
.visual-speed-value{align-self:center;min-width:52px;padding:6px 10px;border:1px solid var(--gold-dim);border-radius:999px;
  text-align:center;font-size:16px;font-weight:700;color:var(--gold-2);font-variant-numeric:tabular-nums}
@media (max-width:420px){.visual-controls,.visual-controls-side{gap:8px}.visual-controls .visual-speed{padding:10px 8px}}

/* Voice picker with a Listen button to try the voice. */
.voice-pick{display:flex;gap:10px;align-items:center;margin-top:8px}
.voice-pick #visual-voice{flex:1;min-width:0}
.voice-preview{flex:none;height:50px;padding:0 16px;gap:8px;font-size:17px}
.voice-preview svg{fill:currentColor;stroke-width:1.2}
.voice-preview[aria-pressed="true"]{background:rgba(212,175,106,.18);border-color:var(--gold-2)}
.voice-preview.loading svg{animation:visual-spin 1s linear infinite;fill:none;stroke-width:2}
.voice-preview.loading #voice-preview-icon{d:path("M12 3a9 9 0 1 0 9 9")}
@media (max-width:420px){.voice-preview span{display:none}.voice-preview{padding:0 14px}}

/* The sentence Listen reads, above the voice picker. */
.voice-sample{margin:0 0 16px;padding:10px 14px;border-left:3px solid var(--gold-dim);border-radius:0 8px 8px 0;background:rgba(10,11,14,.55)}
.voice-sample figcaption{margin:0 0 4px;color:var(--muted);font-size:13px;letter-spacing:.6px;text-transform:uppercase}
.voice-sample blockquote{margin:0;color:var(--text);font-style:italic;font-size:16px;line-height:1.45}

/* Useful gods (focus points): a lasting rectangle on the palace and its role name outside the border.
   The badges stay above interaction arrows, palace highlights, and their connector lines. */
.visual-anchors{position:absolute;inset:0;pointer-events:none;z-index:9}
.visual-anchor-box{position:absolute;border-radius:4px;outline:4px solid var(--red-2);outline-offset:-5px;
  box-shadow:inset 0 0 0 6px rgba(240,217,160,.35)}
.visual-anchor-badges{position:absolute;z-index:1;display:flex;gap:6px}
.visual-anchor-box[data-side=left] .visual-anchor-badges{right:100%;top:50%;transform:translate(-18px,-50%);flex-direction:column;align-items:flex-end}
.visual-anchor-box[data-side=right] .visual-anchor-badges{left:100%;top:50%;transform:translate(18px,-50%);flex-direction:column;align-items:flex-start}
.visual-anchor-box[data-side=top] .visual-anchor-badges{bottom:100%;left:50%;transform:translate(-50%,-16px)}
.visual-anchor-box[data-side=bottom] .visual-anchor-badges{top:100%;left:50%;transform:translate(-50%,16px)}
.visual-anchor-badge{position:relative;max-width:190px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:5px 14px;
  border-radius:999px;background:linear-gradient(180deg,#d4473a,var(--red) 55%,#6e150f);color:#fbe6b8;
  font:italic 700 22px/1.1 var(--serif);text-shadow:0 1px 2px rgba(0,0,0,.6);
  box-shadow:inset 0 0 0 1.5px var(--gold),0 3px 10px rgba(0,0,0,.55)}

/* Question lists (Questions / My chats / All chats): the dialog itself does not scroll. Title, close
   button and filters stay put; only the list below them scrolls. */
.history-dialog[open]{display:flex;flex-direction:column;overflow:hidden}
.history-dialog>*{flex:none}
.history-dialog #admin-history:not([hidden]){display:flex;flex-direction:column;flex:1 1 auto;min-height:0}
#admin-history>*{flex:none}
#admin-history>.history-scroll,.history-dialog>#history-list{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;
  margin-right:-12px;padding-right:12px;scrollbar-width:thin}
/* Date range and Timezone room on one row (a custom range or My chats uses the whole row). */
.archive-filter-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;align-items:end;margin-top:16px}
.archive-filter-row:has(.is-custom),.archive-filter-row:has(#archive-room-field[hidden]){grid-template-columns:minmax(0,1fr)}
.archive-filter-row .stats-filters{margin-top:0}
.archive-filter-row .stats-filters:not(.is-custom)>label:first-child{max-width:none}
#admin-history #archive-room-field{display:block;margin:0;font-size:13px}
#admin-history #archive-room-field>span{display:block;margin-bottom:5px}
#admin-history #archive-admin-filters label{margin:12px 0 0}

/* Chat lists: the clock at the top right opens the questions only, to jump to one. */
/* The toolbar holds only the status line; the clock floats over the list's top right corner. */
.archive-toolbar{position:relative;z-index:5}
.archive-toolbar #archive-feedback{margin:6px 0 0}
.archive-toolbar #archive-feedback:empty{margin:0}
.archive-jump{position:absolute;right:0;top:10px;width:42px;height:42px;padding:0;
  background:#0f1219;box-shadow:inset 0 0 0 2px rgba(13,14,17,.9),inset 0 0 0 3px rgba(212,175,106,.45),0 4px 12px rgba(0,0,0,.55)}
.archive-jump[aria-expanded="true"]{background:rgba(212,175,106,.18);border-color:var(--gold-2)}
.archive-jump-menu{position:absolute;right:0;top:58px;z-index:6;width:min(420px,100%);max-height:min(60dvh,420px);overflow-y:auto;
  padding:6px;border:1.5px solid var(--gold-dim);border-radius:12px;background:#0b0e15;box-shadow:0 12px 30px rgba(0,0,0,.6);scrollbar-width:thin}
.archive-jump-menu ol{list-style:none;margin:0;padding:0}
.archive-jump-item{display:grid;grid-template-columns:auto minmax(0,1fr);column-gap:10px;width:100%;padding:8px 10px;border:0;border-radius:8px;
  background:transparent;color:var(--text);text-align:left;font-size:15px}
.archive-jump-item:hover,.archive-jump-item:focus-visible{background:rgba(212,175,106,.14)}
.archive-jump-label{color:var(--gold);font-weight:700;white-space:nowrap}
.archive-jump-prompt{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.archive-jump-who{grid-column:2;color:var(--muted);font-size:13px}
/* No line above the first chat; its heading leaves room for the clock. */
#archive-chats>.archive-chat:first-child{border-top:0;padding-top:12px}
#archive-chats>.archive-chat:first-child>:nth-child(-n+2){padding-right:56px}
/* Confirm the selected reading without pushing the generation controls off-screen. */
#voice-config-dialog{padding:16px 14px;max-height:calc(100dvh - 20px)}
#voice-config-title{font-size:clamp(19px,4.8vw,25px);margin:0 0 12px;padding-right:36px}
.voice-source{padding:8px 10px;margin-bottom:10px;border:1px solid var(--gold-dim);border-radius:8px;background:rgba(10,11,14,.45);min-width:0}
.voice-source h3{margin:0 0 6px;font-size:13px;color:var(--gold-2);font-weight:600}
.voice-source>div{display:grid;grid-template-columns:56px minmax(0,1fr);gap:8px;align-items:start;font-size:13px;line-height:1.35}
.voice-source>div+div{margin-top:4px}
.voice-source b{font-size:12px;color:var(--muted)}
.voice-source p{margin:0;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;overflow-wrap:anywhere}
#voice-source-answer{-webkit-line-clamp:2}
#voice-config-dialog .voice-sample{margin:0 0 10px;padding:6px 10px}
#voice-config-dialog .voice-sample figcaption{font-size:10px;margin-bottom:3px}
#voice-config-dialog .voice-sample blockquote{font-size:12px;line-height:1.35}
#voice-config-dialog label[for=visual-voice]{margin:8px 0 4px;font-size:13px}
#voice-config-dialog #visual-voice{height:44px;font-size:16px;padding-left:10px}
#voice-config-dialog .voice-preview{height:44px;min-height:44px}
#voice-config-dialog #voice-quota{font-size:12px;line-height:1.35;margin:8px 0}
#voice-config-dialog #voice-generate{height:50px;min-height:50px;margin-top:8px;padding:10px;font-size:clamp(16px,4.5vw,21px)}
#voice-config-dialog .voice-saved p{font-size:12px;margin-bottom:5px}
#voice-config-dialog #voice-watch{min-height:44px;height:44px;font-size:17px}
#voice-config-dialog .voice-or{margin:6px 0!important;font-size:12px}
@media(max-height:650px){
 #voice-config-dialog{padding-top:10px;padding-bottom:10px}
 #voice-config-title{font-size:19px;margin-bottom:8px}
 #voice-config-dialog .voice-sample blockquote{font-size:11px;line-height:1.25}
 .voice-source{margin-bottom:6px;padding:6px 8px}
 #voice-config-dialog .voice-sample{margin-bottom:6px}
 #voice-config-dialog #voice-generate{min-height:44px;height:44px;margin-top:5px}
}
#voice-config-dialog .voice-saved{display:flex;align-items:center;gap:8px;margin:0 0 8px}
#voice-config-dialog #voice-saved-info{flex:1;min-width:0;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#voice-config-dialog #voice-watch{width:auto;min-height:38px;height:38px;flex-shrink:0;padding:6px 10px;font-size:14px}
#voice-config-dialog .voice-or{display:none}

/* Download video: the area a video shows (chart + caption) and the button in the header. */
.visual-frame{position:relative;flex:1;min-height:0;display:flex;flex-direction:column;gap:8px;background:rgba(8,10,16,1)}
.visual-record{flex:none;flex-direction:column;margin-left:auto;min-width:66px;height:44px;padding:0 8px;gap:2px;
  font-size:12px;line-height:1;white-space:nowrap}
.visual-record.recording{border-color:var(--gold-2);background:rgba(212,175,106,.16);cursor:progress}
.visual-record.recording svg{animation:visual-rec 1.2s ease-in-out infinite}
@keyframes visual-rec{50%{opacity:.35}}
/* The server's video render view: only the chart and caption fill the frame, nothing moves on its own. */
.video-render .visual-head,.video-render .visual-controls,.video-render .visual-loading{display:none!important}
.video-render .visual-dialog::backdrop{background:#080a10}
.video-render *,.video-render *::before,.video-render *::after{animation:none!important;transition:none!important}
.video-render :focus,.video-render :focus-visible{outline:none!important}

/* Download video options: quality and ratio, then Create video. */
.visual-video-options{position:absolute;top:58px;right:62px;z-index:12;width:min(300px,calc(100vw - 24px));padding:14px;
  border:1.5px solid var(--gold-dim);border-radius:12px;background:#0b0e15;box-shadow:0 12px 30px rgba(0,0,0,.6)}
.vvo-label{margin:0 0 6px;color:var(--muted);font-size:13px;letter-spacing:.5px;text-transform:uppercase}
.vvo-label+.vvo-choices{margin-bottom:14px}
.vvo-choices{display:flex;gap:6px}
.vvo-choices button{flex:1;display:inline-flex;align-items:center;justify-content:center;gap:8px;height:40px;padding:0 8px;
  border:1px solid var(--gold-dim);border-radius:8px;background:transparent;color:var(--text);font:600 16px var(--serif)}
.vvo-choices button:hover{border-color:var(--gold)}
.vvo-choices button[aria-checked="true"]{border-color:var(--gold-2);background:rgba(212,175,106,.2);color:var(--gold-2)}
.vvo-shape{display:inline-block;border:1.5px solid currentColor;border-radius:2px}
.vvo-shape.wide{width:20px;height:11px}
.vvo-shape.tall{width:11px;height:20px}
.vvo-create{height:46px;font-size:19px;margin-top:2px}
@media (max-width:520px){.visual-video-options{right:0}}

/* The account avatar opens a light-dismiss dropdown without blocking the page. */
#account-button{position:relative}
.admin-menu-dot{position:absolute;top:0;right:0;width:10px;height:10px;border-radius:50%;background:#c0392b;box-shadow:0 0 0 2px var(--panel)}
#user-profile-menu{position:fixed;inset:var(--profile-menu-top,60px) var(--profile-menu-right,8px) auto auto;
  width:min(330px,calc(100vw - 16px));max-height:calc(100dvh - var(--profile-menu-top,60px) - 8px);
  margin:0;padding:12px;box-sizing:border-box;overflow:auto;overscroll-behavior:contain;color:var(--text);
  border:1.5px solid var(--gold-dim);border-radius:14px;background:var(--panel-2);box-shadow:0 14px 40px rgba(0,0,0,.5)}
.profile-menu-section{padding:6px 0}
.profile-menu-section + .profile-menu-section{border-top:1px solid var(--gold-dim)}
.profile-menu-section h3{margin:2px 8px 4px;color:var(--gold-2);font:600 13px/1.2 system-ui,sans-serif}
.profile-menu-row{display:flex;align-items:center;gap:12px;width:100%;min-height:44px;padding:6px 8px;border:0;border-radius:8px;
  background:transparent;color:var(--text);font:600 16px var(--serif);text-align:left;cursor:pointer}
.profile-menu-row:hover,.profile-menu-row:focus-visible{background:rgba(212,175,106,.14)}
.profile-menu-row svg,.profile-menu-row>span[aria-hidden]{width:20px;height:20px;flex:none;color:var(--gold-2);text-align:center}
.profile-menu-row .early-bird-badge{position:static;margin-left:auto;order:3}
.profile-menu-detail{margin-left:auto;color:var(--muted)}
/* Profile identity, preferences and balances share one centered layout. */
#account-dialog{--profile-art:url(/static/img/bg-tall.jpg);
  width:min(566px,calc(100vw - 20px));padding:26px clamp(14px,4vw,38px) 30px;box-sizing:border-box;
  border-width:10px;border-image-width:10px;background:
    linear-gradient(180deg,rgba(6,15,23,.28),rgba(6,15,23,.82) 60%,rgba(6,15,23,.68)),
    var(--profile-art) center top/100% auto no-repeat,#0b1723;background-clip:padding-box}
[data-theme=day] #account-dialog{--profile-art:url(/static/img/bg-day-tall.jpg)}
#account-dialog .ornament{margin:10px auto 16px;width:min(75%,280px)}
#account-dialog .close-dialog{width:38px;height:38px}
.account-avatar-preview{display:flex;justify-content:center;margin:0 auto 10px}
.account-avatar-preview .avatar{display:grid;place-items:center;flex:none;width:86px;height:86px;border-radius:50%;
  border:2px solid var(--gold-2);outline:1px solid var(--gold);outline-offset:2px;
  font:600 32px/1 system-ui,sans-serif;color:#fff}
.avatar-upload-actions{text-align:center;margin-bottom:14px}
.profile-details{max-width:340px;margin:0 auto}
.profile-identity-row{display:flex;align-items:center;gap:12px;min-height:38px;margin-top:7px;padding:2px 10px 2px 14px;
  border:1px solid rgba(235,233,225,.43);border-radius:10px;background:rgba(168,174,184,.04);font-size:17px}
.profile-identity-row > svg{width:18px;height:18px;color:var(--gold-2)}
#account-email,#account-name{min-width:0;overflow-wrap:anywhere}
.profile-name-edit{display:grid;place-items:center;flex:none;width:32px;height:32px;margin-left:auto;
  border:0;border-radius:7px;background:transparent;color:var(--gold-2);cursor:pointer}
.profile-name-edit:hover,.profile-name-edit:focus-visible{background:rgba(212,175,106,.14)}
#profile-name-form{flex-wrap:wrap;gap:6px;padding:4px 6px}
#profile-name-input{flex:1 1 110px;min-width:0;margin:0}
.profile-preferences{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(0,1fr) auto;
  align-items:center;gap:7px 12px;margin:15px 0 0;padding:0 4px;color:var(--muted)}
.profile-preferences .style-badge{padding-inline:6px;text-align:center;overflow-wrap:anywhere}
.profile-preferences .link{justify-self:start}
.profile-credits-container{min-width:0;margin:18px 0 0;padding:10px 8px 12px;border:1px solid var(--gold);
  border-radius:12px;background:rgba(14,30,43,.44)}
.profile-credits-container legend{margin-inline:auto;padding:4px 28px;isolation:isolate;position:relative;
  color:var(--gold-2);font-size:18px;font-weight:700;line-height:1.15}
.profile-credits-container legend::before,.profile-credits-container legend::after{content:'';position:absolute;inset:0;z-index:-1;
  clip-path:polygon(10% 0,90% 0,100% 50%,90% 100%,10% 100%,0 50%);background:var(--gold)}
.profile-credits-container legend::after{inset:1.5px;background:#101b25}
#account-dialog #account-credit-breakdown{margin:0;gap:0}
#account-credit-breakdown .profile-credit{min-height:36px;padding:4px;border:0;border-radius:0}
#account-credit-breakdown .profile-credit + .profile-credit{border-left:1px solid var(--gold-dim)}
#account-credit-breakdown .profile-credit-number{font-size:20px}
#account-dialog #account-feedback:empty{display:none}
@media(max-width:480px){
  #account-dialog{padding:18px 12px 20px}
  #account-dialog h2{padding-inline:32px;font-size:28px}
  #account-dialog .ornament{margin-bottom:12px}
  .account-avatar-preview .avatar{width:72px;height:72px;font-size:28px}
  .profile-preferences{gap:7px 8px;font-size:14px}
  .profile-credits-container{margin-top:14px}
}

/* Review case feedback: Review / Events tabs. */
.case-review-tabs{display:flex;gap:6px;margin:14px 0 10px;border-bottom:1px solid var(--gold-dim)}
.case-review-tabs button{padding:8px 16px;border:0;border-bottom:2px solid transparent;background:transparent;color:var(--muted);font:600 16px var(--serif);cursor:pointer}
.case-review-tabs button[aria-selected="true"]{color:var(--gold-2);border-bottom-color:var(--gold)}
.case-events{list-style:none;margin:0;padding:0}
.case-event{padding:10px 0;border-bottom:1px solid rgba(143,118,70,.35)}
.case-event-head{display:flex;justify-content:space-between;gap:10px;align-items:baseline}
.case-event-kind{font-weight:700;color:var(--gold-2)}
.case-event-submitted .case-event-kind,.case-event-reviewed .case-event-kind{color:#9fd8a8}
.case-event-opt_out .case-event-kind,.case-event-declined .case-event-kind{color:#e8a49a}
.case-event-time{color:var(--muted);font-size:13px;white-space:nowrap}
.case-event-who{margin:2px 0 0;color:var(--muted);font-size:14px;overflow-wrap:anywhere}
.case-event-question{margin:4px 0 0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.case-event-detail{margin:6px 0 0;padding:6px 10px;border-left:2px solid var(--gold-dim);font-style:italic;color:var(--text)}

/* A deep link to a private reading: a spinner until the Private Chamber is ready on it (theme.js, app.js).
   Dialogs (sign-in, plans) stay usable above it. */
html.deep-loading .app { visibility: hidden; }
/* The loading screen: seal, the Master's name, "Loading" and what is happening, in the viewer's language. */
.deep-loader { display: none; }
html.deep-loading .deep-loader { display: grid; position: fixed; inset: 0; z-index: 50; place-content: center; justify-items: center; gap: 6px;
  padding: 24px; text-align: center; background: radial-gradient(60% 50% at 50% 45%, rgba(212, 175, 106, 0.12), transparent 70%), var(--bg); }
.deep-loader p { margin: 0; }
.deep-loader [lang] { display: none; }
html[data-deep-lang=en] .deep-loader [lang=en]:not([data-deep]),
html[data-deep-lang=en][data-deep=destiny] .deep-loader [data-deep=destiny][lang=en],
html[data-deep-lang=en][data-deep=strategy] .deep-loader [data-deep=strategy][lang=en],
html[data-deep-lang=en][data-deep=oracle] .deep-loader [data-deep=oracle][lang=en],
html[data-deep-lang=en][data-deep=fengshui] .deep-loader [data-deep=fengshui][lang=en],
html[data-deep-lang=vi] .deep-loader [lang=vi]:not([data-deep]),
html[data-deep-lang=vi][data-deep=destiny] .deep-loader [data-deep=destiny][lang=vi],
html[data-deep-lang=vi][data-deep=strategy] .deep-loader [data-deep=strategy][lang=vi],
html[data-deep-lang=vi][data-deep=oracle] .deep-loader [data-deep=oracle][lang=vi],
html[data-deep-lang=vi][data-deep=fengshui] .deep-loader [data-deep=fengshui][lang=vi] { display: inline; }
.deep-loader-seal { width: 64px; height: 92px; display: grid; place-items: center; margin-bottom: 14px; border-radius: 8px; background: var(--red);
  color: #f6e2b0; font: 600 30px/1.15 var(--kai); box-shadow: inset 0 0 0 2px rgba(246, 226, 176, 0.35), 0 0 30px rgba(212, 175, 106, 0.25);
  animation: deep-pulse 1.8s ease-in-out infinite; }
.deep-loader-name { font: italic 700 clamp(28px, 7vw, 40px)/1.1 var(--serif); background: linear-gradient(#fff2cf, var(--gold) 70%);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.deep-loader-desc { font: italic 600 clamp(17px, 4.2vw, 22px)/1.2 var(--serif); color: var(--gold); margin-bottom: 26px !important; }
.deep-loader-label { font: 700 13px/1 system-ui, sans-serif; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.deep-loader-dots i { display: inline-block; width: 4px; height: 4px; margin-left: 4px; border-radius: 50%; background: currentColor; vertical-align: middle;
  animation: deep-dot 1.2s infinite ease-in-out; }
.deep-loader-dots i:nth-child(2) { animation-delay: 0.2s; } .deep-loader-dots i:nth-child(3) { animation-delay: 0.4s; }
.deep-loader-text { margin-top: 14px !important; font: 400 17px/1.4 system-ui, sans-serif; color: var(--text); }
@keyframes deep-pulse { 0%, 100% { transform: scale(1); box-shadow: inset 0 0 0 2px rgba(246, 226, 176, 0.35), 0 0 18px rgba(212, 175, 106, 0.2); }
  50% { transform: scale(1.05); box-shadow: inset 0 0 0 2px rgba(246, 226, 176, 0.5), 0 0 38px rgba(212, 175, 106, 0.45); } }
@keyframes deep-dot { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .deep-loader-seal, .deep-loader-dots i { animation: none; } }

/* ---------- Visual reading poster (player and downloaded video) ----------
   Portrait stacks the reading and chart. Landscape places them side by side.
   The --u unit scales the poster for both the player and exported video. */
.visual-frame{position:relative;flex:1;min-height:0;display:block;gap:0;container-type:size;overflow:hidden;border-radius:10px;
  background:#0b1019 url(/static/img/bg-tall.jpg) center bottom/cover no-repeat}
@media (min-aspect-ratio:1/1){.visual-frame{background-image:url(/static/img/bg-wide.jpg);background-position:center}}
.visual-frame::before{content:'';position:absolute;inset:0;pointer-events:none;
  background:linear-gradient(180deg,rgba(6,8,14,.5),rgba(6,8,14,.2) 32%,rgba(6,8,14,.3) 62%,rgba(6,8,14,.72))}
.vp-poster{--u:min(1cqw,.5625cqh);position:relative;z-index:1;box-sizing:border-box;height:100%;width:calc(var(--u)*100);margin:0 auto;
  display:flex;flex-direction:column;align-items:center;gap:calc(var(--u)*1.7);padding:calc(var(--u)*3) calc(var(--u)*4) calc(var(--u)*2.4);
  font-family:var(--serif);color:var(--text)}
.vp-footer i{display:block;width:calc(var(--u)*8);height:1px;background:linear-gradient(90deg,rgba(212,175,106,0),var(--gold))}
.vp-footer i:last-child{transform:scaleX(-1)}
.vp-title{flex:none;display:flex;align-items:center}
.vp-video-title{display:flex;align-items:center;gap:calc(var(--u)*2.3);
  font-size:calc(var(--u)*5);font-weight:700;font-style:italic;line-height:1.1;color:var(--gold-2)}
.vp-video-title > span:first-child{padding:calc(var(--u)*.85) calc(var(--u)*2.1);
  border-radius:calc(var(--u)*2);background:linear-gradient(#f8e2aa,#dba54d);color:#271806}
.vp-video-format{display:flex;align-items:center;gap:calc(var(--u)*1.2);
  padding-left:calc(var(--u)*2.3);border-left:1px solid var(--gold)}
.vp-video-format svg{width:calc(var(--u)*4.7);height:calc(var(--u)*4.7);color:var(--gold)}
.vp-reading{display:contents}
.vp-question{flex:none;box-sizing:border-box;width:100%;height:calc(var(--u)*18);display:flex;align-items:center;gap:calc(var(--u)*3.2);padding:calc(var(--u)*1.6) calc(var(--u)*2.6);
  border:calc(var(--u)*1.6) solid transparent;border-image:url(/static/img/frame.svg) 16 / calc(var(--u)*1.6) stretch;
  background:rgba(16,11,8,.76);background-clip:padding-box;box-shadow:0 0 calc(var(--u)*4) rgba(240,190,90,.18)}
.vp-q-mark{flex:none;color:var(--gold-2);font-size:calc(var(--u)*3.1);font-weight:700}
.vp-question p{flex:1;min-width:0;margin:0;padding-left:calc(var(--u)*3.2);border-left:1px solid var(--gold-dim);font-size:calc(var(--u)*4.7);font-weight:700;font-style:italic;
  line-height:1.16;color:#f7ecd2;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;overflow-wrap:anywhere}
.vp-question.long p{font-size:calc(var(--u)*4)}
.vp-meta{flex:none;box-sizing:border-box;width:100%;display:flex;align-items:center;
  padding:calc(var(--u)*1.3) calc(var(--u)*1.5);border:1.5px solid var(--gold-dim);border-radius:calc(var(--u)*1.6);
  background:linear-gradient(180deg,rgba(22,16,10,.82),rgba(12,9,6,.82));box-shadow:inset 0 0 0 calc(var(--u)*.5) rgba(10,8,6,.6),0 0 0 1px rgba(240,190,90,.12)}
.vp-cell{flex:1 1 0;display:flex;align-items:center;justify-content:center;gap:calc(var(--u)*1.8);min-width:0;padding:0 calc(var(--u)*1)}
.vp-cell:first-child{flex-grow:1.25}
.vp-cell:not([hidden])~.vp-cell:not([hidden]){border-left:1px solid var(--gold-dim)}
.vp-poster .vp-cell svg{width:calc(var(--u)*5);height:calc(var(--u)*5);color:var(--gold);stroke-width:1.6}
.vp-cell>span{display:flex;flex-direction:column;min-width:0;line-height:1.15;white-space:nowrap}
.vp-cell small{font-size:calc(var(--u)*2.9);color:#e8dbbd}
.vp-cell b{font-size:calc(var(--u)*3.7);font-weight:700;color:var(--gold-2)}
.vp-cell b.vp-date{font-weight:500;color:#f3e7cc}
.vp-cell small.vp-time{color:#f3e7cc}
/* The answer box holds its own "Answer" label: a gold brush stroke at the top left. */
.vp-answer{flex:none;box-sizing:border-box;width:100%;display:flex;flex-direction:column;align-items:flex-start;gap:calc(var(--u)*1.2);min-height:0;
  padding:calc(var(--u)*2.2) calc(var(--u)*3.2) calc(var(--u)*2);border:calc(var(--u)*1.6) solid transparent;
  border-image:url(/static/img/frame.svg) 16 / calc(var(--u)*1.6) stretch;background:rgba(16,11,8,.8);background-clip:padding-box}
.vp-ribbon{flex:none;padding:calc(var(--u)*.5) calc(var(--u)*6) calc(var(--u)*.5) calc(var(--u)*3);font-size:calc(var(--u)*4.6);font-weight:700;font-style:italic;
  line-height:1.15;color:#2a1806;white-space:nowrap;border-radius:40% 60% 55% 45% / 50%;
  background:linear-gradient(90deg,rgba(196,146,60,.15),#c4923c 10%,#f4d995 45%,#d8ad5c 78%,rgba(196,146,60,0));
  filter:drop-shadow(0 0 calc(var(--u)*1.2) rgba(240,190,90,.3))}
.vp-poster .visual-caption{box-sizing:border-box;width:100%;height:calc(var(--u)*29);max-height:none;min-height:0;margin:0;padding:0;
  border:0;border-radius:0;background:transparent;font-size:calc(var(--u)*4.1);line-height:1.42;text-align:left;overflow-y:auto;scrollbar-width:none}
.vp-poster .visual-stage{flex:1 1 0;min-height:0;width:100%;display:flex;justify-content:center}
.vp-poster .visual-stage .chart-card{width:100%;height:100%;padding:0}
.vp-poster .visual-stage .chart-meta{display:none}
.vp-poster .visual-stage .chart-grid{box-shadow:0 0 0 2px #d9b064,0 0 36px rgba(240,190,90,.38)}
.vp-poster .visual-caption::-webkit-scrollbar{display:none}
.vp-footer{flex:none;display:flex;align-items:center;gap:calc(var(--u)*2.4);font-size:calc(var(--u)*4.4);letter-spacing:.06em;color:var(--gold-2)}
.vp-footer i{position:relative}
.vp-footer i::after{content:'';position:absolute;right:calc(var(--u)*-1.2);top:50%;width:calc(var(--u)*1.2);height:calc(var(--u)*1.2);border:1.5px solid var(--gold);transform:translateY(-50%) rotate(45deg)}
/* Landscape: the site name is centered below the title, above the two columns. */
@container (min-aspect-ratio:1/1){
  .vp-poster{--u:min(.5625cqw,1cqh);width:calc(var(--u)*177.7);display:grid;
    grid-template-columns:minmax(0,1fr) calc(var(--u)*90);grid-template-rows:auto auto minmax(0,1fr);
    column-gap:calc(var(--u)*5);row-gap:calc(var(--u)*1.8);
    padding:calc(var(--u)*3.5) calc(var(--u)*5);align-items:center;justify-items:center}
  .vp-title{grid-column:1/-1;grid-row:1}
  .vp-footer{grid-column:1/-1;grid-row:2}
  .vp-reading{display:flex;flex-direction:column;gap:calc(var(--u)*1.8);grid-column:1;grid-row:3;width:100%;height:100%;min-height:0}
  .vp-meta{order:-1}
  .vp-question{height:calc(var(--u)*13.5)}
  .vp-answer{flex:1;padding-top:calc(var(--u)*1.6);gap:calc(var(--u)*.8)}
  .vp-poster .visual-stage{grid-column:2;grid-row:3;height:100%;z-index:1}
  .visual-stage .chart-grid{top:var(--landscape-chart-top,0px);transform:translateX(-50%) scale(var(--chart-scale,0));transform-origin:top center}
  .vp-question p{font-size:calc(var(--u)*3.6)}
  .vp-question.long p{font-size:calc(var(--u)*3.1)}
  .vp-q-mark{font-size:calc(var(--u)*2.5)}
  .vp-meta{padding:calc(var(--u)*1) calc(var(--u)*1)}
  .vp-cell{gap:calc(var(--u)*1.3)}
  .vp-poster .vp-cell svg{width:calc(var(--u)*3.8);height:calc(var(--u)*3.8)}
  .vp-cell small{font-size:calc(var(--u)*2.2)}
  .vp-cell b{font-size:calc(var(--u)*2.9)}
  .vp-ribbon{font-size:calc(var(--u)*3.6)}
  .vp-poster .visual-caption{flex:1;height:auto;font-size:calc(var(--u)*3.2)}
  .vp-footer{font-size:calc(var(--u)*3.4)}
}
/* The poster carries the title; the player's header keeps only the counter and buttons. */
.visual-head h2{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
/* The video is the poster alone, edge to edge. */
.video-render .visual-dialog{padding:0}
.video-render .visual-frame{border-radius:0}


/* The portrait player and MP4 share the compact poster and vertical callout layout. */
svg.visual-anchor-connector{display:none}
@container (aspect-ratio < 1/1){
  .vp-poster{--u:min(1cqw,.57cqh);gap:calc(var(--u)*1);padding-block:calc(var(--u)*1.4) calc(var(--u)*1)}
  .vp-footer,.vp-question,.vp-answer{margin-block-end:calc(var(--u)*1.6)}
  .vp-question{height:calc(var(--u)*13.5);gap:calc(var(--u)*2)}
  .vp-question p{padding-left:calc(var(--u)*2)}
  .vp-meta{padding-block:calc(var(--u)*.75)}
  .vp-answer{order:1;gap:calc(var(--u)*.6);padding-block:calc(var(--u)*.65)}
  .vp-ribbon{font-size:calc(var(--u)*3.5)}
  .vp-poster .visual-caption{
    height:calc(var(--u)*12);font-size:calc(var(--u)*3.55);line-height:1.3}
  .vp-footer{font-size:calc(var(--u)*3.4)}
  .vp-poster .visual-stage{--portrait-visual:1;width:98cqw}
  .visual-stage .chart-grid{top:calc(50% + var(--chart-shift, 0px))}
  .visual-anchor-box[data-portrait-side] .visual-anchor-badges{
    inset:auto;left:50%;width:100%;flex-direction:column;align-items:center;gap:0}
  .visual-anchor-box[data-portrait-side=top] .visual-anchor-badges{
    bottom:100%;transform:translate(-50%,calc(-1 * var(--badge-distance)))}
  .visual-anchor-box[data-portrait-side=bottom] .visual-anchor-badges{
    top:100%;transform:translate(-50%,var(--badge-distance))}
  .visual-anchor-badge{box-sizing:border-box;max-width:calc(100% - 16px);height:32px;margin:1px 0;font-size:20px}
  svg.visual-anchor-connector{display:block;position:absolute;inset:0;width:100%;height:100%;overflow:visible;
    fill:none;stroke:var(--red-2);stroke-width:3px;filter:drop-shadow(0 0 1px var(--gold))}
}

/* Checkout return/cancel pages (billing-result.html) */
.result-main { width: min(640px, calc(100% - 32px)); text-align: center; }
.result-icon { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 20px; border-radius: 50%; border: 1.5px solid var(--gold); color: var(--gold-2); font: 700 30px/1 Arial, sans-serif; box-shadow: inset 0 0 0 3px var(--ink), inset 0 0 0 4px rgba(212,175,106,.45); }
.result-main[data-outcome="success"] .result-icon { background: var(--gold); color: var(--ink); }
.result-main[data-outcome="failed"] .result-icon { border-color: #c9584c; color: #f0a196; box-shadow: inset 0 0 0 3px var(--ink), inset 0 0 0 4px rgba(201,88,76,.45); }
.result-spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(212,175,106,.25); border-top-color: var(--gold-2); animation: result-spin .9s linear infinite; }
@keyframes result-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .result-spinner { animation-duration: 3s; } }
.result-main h1 { font-size: clamp(28px, 5vw, 40px); }
.result-main h1:focus { outline: none; }
.result-main .info-subtitle { margin: 14px auto 24px; max-width: 46ch; font-size: 15px; }
.result-details { margin: 0 0 24px; padding: 4px 18px; border: 1px solid var(--gold-dim); border-radius: 10px; text-align: left; font: 15px/1.5 Arial, sans-serif; }
.result-details div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid rgba(143,118,70,.35); }
.result-details div:last-child { border-bottom: 0; }
.result-details dt { color: var(--muted); }
.result-details dd { margin: 0; color: var(--text); font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.result-button { display: inline-flex; align-items: center; justify-content: center; min-width: 180px; min-height: 44px; padding: 10px 20px; border: 1px solid var(--gold-dim); border-radius: 8px; background: transparent; color: var(--gold-2); font: 600 16px/1.2 var(--serif); text-decoration: none; cursor: pointer; }
.result-button:hover:not(:disabled) { border-color: var(--gold); }
.result-button.primary { border-color: var(--gold); background: var(--gold); color: var(--ink); }
.result-button.primary:hover:not(:disabled) { background: var(--gold-2); }
.result-button:disabled { opacity: .5; cursor: default; }
.result-feedback { margin: 0 0 16px; color: #f0a196; font: 14px/1.5 Arial, sans-serif; }
.result-ref { margin: 24px 0 0; color: var(--muted); font: 12px/1.5 Arial, sans-serif; overflow-wrap: anywhere; }
@media (max-width: 520px) {
  .result-actions { flex-direction: column; }
  .result-button { width: 100%; }
  .result-details div { flex-direction: column; gap: 2px; }
  .result-details dd { text-align: left; }
}

/* Plans & Billing: the current plan's card (badge, status, billing details, Manage / Cancel). */
.billing-plan-current{position:relative;overflow:visible;border:2px solid var(--gold);box-shadow:0 0 0 1px rgba(240,217,160,.25),0 0 28px rgba(212,175,106,.22)}
.billing-current-badge{position:absolute;top:0;left:50%;transform:translate(-50%,-55%);display:inline-flex;align-items:center;gap:6px;
  padding:4px 14px;border-radius:999px;background:linear-gradient(180deg,#f6dc9c,var(--gold));color:#1a1408;
  font:700 14px/1.2 system-ui,sans-serif;white-space:nowrap;box-shadow:0 2px 8px rgba(0,0,0,.45)}
.billing-current-badge .billing-icon{width:17px;height:17px}
.billing-plan-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:0 0 18px}
#billing-dialog .billing-plan-head .billing-plan-name{margin:0}
.billing-status{flex:none;padding:3px 12px;border-radius:999px;font:700 13px/1.4 system-ui,sans-serif;color:#fff}
.billing-status-trial{background:#8a6a2a;color:#fff3d6}
.billing-status-cancelled{background:#7d3a32;color:#ffe2dc}
.billing-icon{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.billing-current-details{margin:0 0 7px;padding:6px 12px;font-size:14px;border:1px solid var(--gold-dim);border-radius:10px;background:rgba(0,0,0,.18)}
.billing-current-details div{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px 0}
.billing-current-details dt{display:inline-flex;align-items:center;gap:8px;color:var(--text);white-space:nowrap}
.billing-current-details dd{margin:0;color:var(--text);font-weight:600;text-align:right;white-space:nowrap}
.billing-plan-button-current{
  border-color:var(--gold)!important;background:rgba(212,175,106,.16)!important;color:var(--gold-2)!important;opacity:1!important}
.billing-sub-links{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:6px 8px;margin-top:10px}
.billing-sub-link{display:inline-flex;align-items:center;gap:5px;padding:4px 0;border:0;background:none;color:var(--text);
  font:14px/1.3 var(--serif);white-space:nowrap;text-decoration:underline dotted;text-decoration-color:var(--gold-dim);text-underline-offset:4px;cursor:pointer}
.billing-sub-link:hover{color:var(--gold-2);text-decoration-style:solid}
.billing-sub-sep{color:var(--gold-dim)}
.billing-cancel-confirm{margin-top:12px;padding-top:12px;border-top:1px solid rgba(143,118,70,.35)}
.billing-cancel-confirm p{margin:0 0 10px;color:var(--text);font-size:14px;line-height:1.45}
.billing-cancel-actions{display:flex;align-items:center;flex-wrap:wrap;gap:10px 16px}
.billing-cancel-yes{padding:7px 14px;border:1px solid #c9584c;border-radius:7px;background:transparent;color:#f0a196;font:600 15px/1.2 var(--serif);cursor:pointer}
.billing-cancel-yes:hover:not(:disabled){background:rgba(201,88,76,.14)}
@media (max-width: 650px) {
  .billing-plan-head { grid-column: 1; grid-row: 1; margin: 0; justify-content: flex-start; flex-wrap: wrap; }
  .billing-plan-current { margin-top: 14px; }
  .billing-current-badge { font-size: 12px; padding: 3px 12px; }
  .billing-status { font-size: 11px; padding: 2px 9px; }
  .billing-current-details { font-size: 14px; }
}
/* Manage | Cancel side by side when the card is wide enough, stacked (no separator) otherwise. */
.billing-plan-current .billing-plan-actions { container-type: inline-size; }
@container (max-width: 300px) {
  .billing-sub-links { flex-direction: column; align-items: flex-start; gap: 4px; }
  .billing-sub-sep { display: none; }
}
/* Manage subscription popup. */
.subscription-dialog{width:min(440px,calc(100vw - 32px))}
.subscription-details{margin:6px 0 16px;padding:4px 16px;border:1px solid var(--gold-dim);border-radius:10px;background:rgba(0,0,0,.18)}
.subscription-details div{display:flex;justify-content:space-between;gap:16px;padding:10px 0;border-bottom:1px solid rgba(143,118,70,.3)}
.subscription-details div:last-child{border-bottom:0}
.subscription-details dt{color:var(--muted)}
.subscription-details dd{margin:0;color:var(--text);font-weight:700;text-align:right}
.subscription-dialog h2{padding-inline:44px}
.billing-resume-yes{padding:7px 14px;border:1px solid var(--gold);border-radius:7px;background:var(--gold);color:var(--ink);font:600 15px/1.2 var(--serif);cursor:pointer}
.billing-resume-yes:hover:not(:disabled){background:var(--gold-2)}

/* Admin Users page (/admin/users, static/admin-users.js). The table scrolls sideways inside its box, never the page. */
.admin-users-page .users-main{width:min(1500px,calc(100% - 32px))}
.admin-users-page .users-main h1{font-size:clamp(28px,4vw,40px)}
.users-rule{color:var(--muted);font-size:14px;margin:8px 0 14px}
.users-counts{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:12px}
.users-count{height:30px;padding:0 12px;font-size:13px}
.users-count.selected{background:var(--gold);color:#1a1208}
.users-tools{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:8px}
.users-tools input{flex:1 1 220px;min-width:0}
.users-table-wrap{overflow-x:auto;max-width:100%;border:1px solid var(--line);border-radius:10px}
.users-table{width:100%;border-collapse:collapse;font-size:14px;font-family:Arial,sans-serif}
.users-table th,.users-table td{padding:8px 10px;text-align:left;vertical-align:top;border-bottom:1px solid var(--line);white-space:nowrap}
.users-table thead th{position:sticky;top:0;background:var(--panel-2);color:var(--gold-2);font-weight:600;z-index:1}
.users-table tbody tr:hover{background:rgba(212,175,106,.06)}
.users-table td.num{text-align:right;font-variant-numeric:tabular-nums}
.users-table td[data-col=name]{white-space:normal;min-width:200px;max-width:320px}
.users-sort{all:unset;cursor:pointer;color:inherit}
.users-sort:focus-visible{outline:2px solid var(--gold);outline-offset:2px}
.users-name{font-weight:600;color:var(--text)}
.users-email,.users-date{color:var(--muted);font-size:12px;overflow-wrap:anywhere}
.users-rel{color:var(--text)}
.users-status{display:inline-block;font-size:12px;padding:2px 8px;border-radius:999px;border:1px solid var(--gold-dim);color:var(--gold-2)}
.users-status-active{color:#7fc47f;border-color:#7fc47f}
.users-status-reminded,.users-status-waitlist_due{color:#e0b85a;border-color:#e0b85a}
.users-status-waitlisted,.users-status-rejected{color:#d98a7a;border-color:#d98a7a}
.users-table .chip{height:30px;font-size:13px;white-space:nowrap}
.users-topup-balance{margin-inline-end:8px;font-variant-numeric:tabular-nums}
#users-topup-recipient{overflow-wrap:anywhere}
#users-topup-amount,#users-topup-expiry{display:block;width:min(100%,260px);min-height:44px;padding:8px 12px;font:inherit}

.profile-menu-row[href]{text-decoration:none}
.checkout-page{color:#f4efe7;background-color:#0b1019}
.checkout-header{display:flex;justify-content:space-between;align-items:baseline;gap:8px;
  width:min(620px,100%);margin-inline:auto;padding:max(12px,env(safe-area-inset-top)) 20px 8px}
.checkout-brand,.checkout-header h1{font-size:clamp(23px,6vw,36px);font-weight:700;line-height:1.08;color:#ffe2a4;text-shadow:0 2px 12px #09101b}
.checkout-brand{text-decoration:none}
.checkout-header h1{margin:0;color:#f4e4c8;font-size:clamp(18px,5vw,27px)}
.checkout-main{width:min(620px,calc(100% - 16px));margin:0 auto 8px;padding:clamp(8px,2.4vw,20px);
  background:linear-gradient(155deg,rgba(15,19,26,.97),rgba(9,17,26,.94));background-clip:padding-box}
.checkout-card,.checkout-note,.checkout-coupon{border:1px solid #777a78;border-radius:14px;
  background:linear-gradient(135deg,rgba(72,73,72,.30),rgba(37,46,54,.26))}
.checkout-card{padding:clamp(10px,2.5vw,18px)}
.checkout-plan{display:flex;align-items:center;gap:clamp(8px,2.5vw,16px);padding-bottom:8px;border-bottom:1px solid #535957}
.checkout-plan-icon{display:grid;place-items:center;width:clamp(34px,10vw,48px);aspect-ratio:1;flex:none;border:1px solid #d2ae65;border-radius:12px;color:#f4cc7a;background:#181d24}
.checkout-plan-icon svg{width:67%;height:67%;stroke-width:1.3}
.checkout-plan-name{min-width:0;flex:1}
.checkout-plan h2{margin:0;font-size:clamp(19px,5.4vw,33px);line-height:1.1;overflow-wrap:anywhere}
.checkout-plan p{margin:4px 0 0;color:#e7e0d5;font-size:clamp(13px,3.3vw,17px)}
.checkout-cycle-badge{align-self:flex-start;flex:none;padding:4px 8px;border:1px solid #d8ad60;border-radius:999px;
  color:#ffdb90;background:#29251f;font-size:clamp(11px,2.8vw,14px);font-weight:700}
#checkout-payment-heading{margin:8px 0 2px;font-size:16px;color:#f4e4c8}
.checkout-totals{margin:0;font-size:clamp(14px,3.6vw,17px)}
.checkout-totals>div{display:flex;justify-content:space-between;gap:8px;align-items:baseline;padding:5px 0;border-bottom:1px solid #535957}
.checkout-totals dt{min-width:0;overflow-wrap:anywhere}
.checkout-totals dd{margin:0;text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
.checkout-totals .checkout-due{margin-top:6px;padding:6px 8px;border:1px solid #d2ae65;border-radius:8px;color:#ffda90;
  font-size:clamp(17px,4.4vw,23px);font-weight:700;background:#2a261f}
.has-coupon .checkout-due{border-color:#8de9a3;background:linear-gradient(120deg,#244537,#142e28)}
.checkout-saving-row{color:#a0f4ad}
.checkout-options{display:grid;grid-template-columns:minmax(0,1fr);gap:8px;margin-top:8px}
.checkout-discount{display:flex;gap:8px;align-items:center;margin-top:3px}
.checkout-discount input{flex:1;width:0;min-width:0;min-height:44px;padding:6px 10px;border:1px solid #8a8984;border-radius:8px;background:#11151e;color:#fff}
.checkout-discount input::placeholder{color:#bab6ae}
.checkout-discount .chip{min-height:44px;color:#ffe2ab}
.checkout-coupon{display:flex;align-items:center;gap:8px;padding:4px 5px 4px 8px;color:#b0f2bc;font-size:clamp(12px,3.4vw,16px)}
.checkout-coupon-code{display:inline-flex;align-items:center;gap:5px;min-width:0;max-width:52%;padding:6px 8px;border:1px solid #619b71;border-radius:9px;background:#234735;color:#e5fce5}
.checkout-coupon-code strong{overflow-wrap:anywhere}
#checkout-remove{display:grid;place-items:center;width:44px;height:44px;margin-inline-start:auto;flex:none;border:0;border-radius:6px;background:transparent;color:#f4efe7}
#checkout-remove:hover{background:rgba(255,255,255,.1)}
.checkout-note{display:flex;align-items:flex-start;gap:8px;padding:8px;color:#f3eee5;font-size:clamp(13px,3.5vw,17px);line-height:1.25}
.checkout-note svg{width:24px;height:24px;color:#f4c66e}
.checkout-note strong{display:block;color:#ffda90;font-size:1.12em}
.checkout-note p{margin:3px 0 0}
.checkout-feedback{margin:12px 0;font-size:14px}
.checkout-feedback:empty{display:none}
.checkout-actions{display:grid;gap:6px;margin-top:8px}
.checkout-pay,.checkout-cancel{display:flex;width:100%;min-height:44px;align-items:center;justify-content:center;padding:8px;text-align:center}
.checkout-pay{border:1px solid #ffe0a0;border-radius:14px;color:#15100b;
  background:linear-gradient(150deg,#e0af58,#ffe7ad 42%,#efbb5f);font:700 clamp(16px,4.5vw,22px)/1.2 system-ui,sans-serif}
.checkout-pay:hover:not(:disabled){background:linear-gradient(150deg,#edbd6b,#fff0c5 42%,#f6cb79)}
.checkout-cancel{border:1px solid #f1d59b;border-radius:9px;color:#f8ede0;text-decoration:none}
.checkout-cancel:hover{background:rgba(255,226,171,.09)}
.checkout-legal{margin:6px 0 0;text-align:center;color:#e4dfd4;font:12px/1.35 system-ui,sans-serif}
.checkout-legal a{color:#ffda90;text-underline-offset:2px}
@media (min-width:760px){
  .checkout-header{width:min(900px,100%);padding-top:max(24px,env(safe-area-inset-top))}
  .checkout-main{width:min(900px,calc(100% - 32px))}
  #checkout-summary{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);align-items:start;gap:16px}
  .checkout-options{margin-top:0;gap:12px}
  .checkout-actions{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;margin-top:12px}
  .checkout-actions:has(.checkout-pay[hidden]){grid-template-columns:1fr}
}
@media (max-width:759px) and (max-height:680px){
  .checkout-header{padding-top:max(6px,env(safe-area-inset-top));padding-bottom:4px}
  .checkout-main{margin-bottom:0}
  .checkout-card{padding:8px}
  .checkout-plan{padding-bottom:5px}
  .checkout-actions{grid-template-columns:minmax(0,1.55fr) minmax(0,1fr)}
  .checkout-actions:has(.checkout-pay[hidden]){grid-template-columns:1fr}
  .checkout-pay,.checkout-cancel{padding-inline:4px;font-size:14px}
}
@media (min-width:360px) and (max-width:759px) and (min-height:760px),
       (min-width:760px) and (min-height:700px){
  .checkout-header{display:grid;justify-items:center;justify-content:center;gap:8px;
    padding-top:max(16px,env(safe-area-inset-top));padding-bottom:10px}
  .checkout-brand{font-size:clamp(30px,8vw,44px)}
  .checkout-header h1{font-size:clamp(28px,7.6vw,40px)}
  .checkout-main{padding:12px}
  .checkout-card{padding:12px}
  .checkout-plan h2{font-size:clamp(22px,6vw,32px)}
  .checkout-plan p,.checkout-options label,.checkout-discount input{font-size:15px}
  #checkout-payment-heading{font-size:17px;margin-top:9px}
  .checkout-totals{font-size:16px}
  .checkout-totals .checkout-due{font-size:20px}
  .checkout-options{gap:10px}
  .checkout-note{padding:10px;font-size:14px;line-height:1.3}
  .checkout-actions{gap:8px;margin-top:10px}
  .checkout-pay{min-height:49px}
  .checkout-legal{margin-top:8px}
}
@media (min-width:760px) and (min-height:700px){
  .checkout-main{padding:22px}
  #checkout-summary{gap:20px}
  .checkout-card,.checkout-note{padding:16px}
  .checkout-options{gap:14px}
  .checkout-note{font-size:16px}
  .checkout-actions{gap:12px;margin-top:14px}
}
.activity-nav,.activity-filters{display:flex;flex-wrap:wrap;gap:12px 16px;align-items:end;margin-bottom:16px}
.activity-nav{gap:8px}
.activity-nav .chip{min-height:44px;text-decoration:none}
.activity-nav .chip[aria-current="page"]{background:var(--gold);color:#1a1208;font-weight:700}
.activity-filters[hidden],#activity-table-wrap[hidden]{display:none}
.activity-filters label{display:grid;gap:4px}
.activity-filters input[type=number]{width:115px}
.activity-filters input,.activity-filters select{min-height:40px;padding:6px 10px;font:inherit}
.activity-table dd{margin:0;overflow-wrap:anywhere}
.activity-table dl{display:grid;grid-template-columns:max-content minmax(140px,1fr);gap:4px 12px;margin:0;white-space:normal}
.activity-table dt{color:var(--muted)}
#activity-more{margin-top:16px}


#activity-title{margin-bottom:16px}

#bonus-new-panel,#users-topup-panel{max-width:620px;margin:16px 0;padding:16px;border:1px solid var(--line);border-radius:10px}
#admin-bonus-panel .feedback span{margin-inline-end:8px}
#admin-bonus-panel .feedback .chip + .chip{margin-inline-start:8px}

#affiliate-month{color-scheme:dark;color:var(--text);background:rgba(10,11,14,.9);border:1px solid var(--gold-dim);border-radius:8px;padding:8px 10px;font:inherit}
#affiliate-referrals,.affiliate-review-list,.affiliate-payments ul{list-style:none;margin:0;padding:0}
.affiliate-referral,.affiliate-payments li{display:grid;gap:4px;padding:10px 0;border-top:1px solid var(--gold-dim);overflow-wrap:anywhere}
.affiliate-payments summary{cursor:pointer;padding:6px 0}
.affiliate-payments ul{padding-inline-start:12px}

.affiliate-form textarea{display:block;width:100%;resize:vertical;padding:10px 14px;color:var(--text);background:rgba(10,11,14,.9);border:1.5px solid var(--gold-dim);border-radius:10px}
#affiliate-bank-editor summary,.affiliate-review-list summary{cursor:pointer}
.affiliate-review-list .early-bird-summary{grid-template-columns:minmax(0,1fr) minmax(0,1.2fr)}
