/* Tử Vi Huyền Cơ V31 — one-page profile, oracle and AI */
body[data-home-runtime="31"] main{width:min(1180px,calc(100% - 28px));margin:0 auto;padding:34px 0 72px}
.v31-steps{position:sticky;top:76px;z-index:30;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:0 auto 22px;padding:9px;border:1px solid var(--line);border-radius:16px;background:rgba(9,7,15,.88);backdrop-filter:blur(16px);box-shadow:0 12px 36px rgba(0,0,0,.22)}
.v31-step-link{display:flex;align-items:center;justify-content:center;gap:9px;min-height:48px;padding:8px 12px;border:1px solid transparent;border-radius:11px;color:var(--muted);font-size:13px;font-weight:800}
.v31-step-link b{width:28px;height:28px;display:grid;place-items:center;border-radius:50%;background:rgba(223,189,115,.1);color:var(--gold2)}
.v31-step-link:hover,.v31-step-link.active{border-color:rgba(223,189,115,.34);background:rgba(223,189,115,.1);color:var(--text)}
.v31-section{scroll-margin-top:150px;margin:0 0 26px;padding:clamp(20px,4vw,38px);border:1px solid rgba(223,189,115,.18);border-radius:22px;background:linear-gradient(145deg,rgba(255,255,255,.038),rgba(255,255,255,.012)),rgba(10,8,13,.82);box-shadow:0 24px 64px rgba(0,0,0,.24)}
.v31-section-head{display:grid;grid-template-columns:auto minmax(0,1fr);gap:14px;align-items:start;margin-bottom:24px}
.v31-section-number{width:44px;height:44px;display:grid;place-items:center;border:1px solid rgba(223,189,115,.42);border-radius:14px;color:var(--gold2);font:700 19px Georgia,serif;background:rgba(223,189,115,.08)}
.v31-section-head small{display:block;margin-bottom:4px;color:var(--gold);font-size:10px;font-weight:900;letter-spacing:.14em}.v31-section-head h1,.v31-section-head h2{margin:0;color:var(--text);font:500 clamp(28px,4vw,44px)/1.08 Georgia,serif}.v31-section-head p{grid-column:2;margin:8px 0 0;color:var(--muted);font-size:14px;line-height:1.65;max-width:760px}
#homeProfileForm{position:absolute;transform:translateY(-150px)}
.v31-profile-form{display:grid;gap:13px}.v31-profile-group{border:1px solid var(--line);border-radius:15px;background:rgba(255,255,255,.018);overflow:hidden}.v31-profile-group>summary{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:54px;padding:12px 16px;cursor:pointer;list-style:none;font-weight:850;color:var(--text)}.v31-profile-group>summary::-webkit-details-marker{display:none}.v31-profile-group>summary small{color:var(--muted);font-size:11px}.v31-profile-group[open]>summary{border-bottom:1px solid var(--line);color:var(--gold2)}
.v31-profile-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px;padding:16px}.v31-profile-grid.three{grid-template-columns:repeat(3,minmax(0,1fr))}.v31-profile-grid label,.v31-relation-fields label{display:grid;gap:6px;min-width:0;color:var(--muted);font-size:12px;font-weight:800}.v31-profile-grid label>span,.v31-relation-fields label>span{color:var(--muted)}
.v31-profile-grid input,.v31-profile-grid select,.v31-relation-fields input,.v31-relation-fields select{width:100%;min-width:0;min-height:46px;padding:11px 12px;border:1px solid rgba(223,189,115,.22);border-radius:10px;background:rgba(0,0,0,.22);color:var(--text);outline:none}.v31-profile-grid input:focus,.v31-profile-grid select:focus,.v31-relation-fields input:focus,.v31-relation-fields select:focus{border-color:var(--gold);box-shadow:0 0 0 3px rgba(223,189,115,.1)}
.v31-consent{display:flex!important;grid-column:1/-1;grid-template-columns:auto 1fr!important;align-items:flex-start;gap:10px!important;padding:12px;border:1px dashed rgba(223,189,115,.25);border-radius:11px;font-weight:600!important;line-height:1.5}.v31-consent input{width:20px!important;min-height:20px!important;margin-top:1px;accent-color:#c69b45}
.v31-privacy{grid-column:1/-1;margin:0;color:var(--muted);font-size:12px;line-height:1.55}.v31-privacy strong{color:var(--gold2)}
.v31-relation-toolbar{display:flex;flex-wrap:wrap;gap:8px;padding:14px 16px 0}.v31-relation-toolbar button,.relation-remove{min-height:38px;padding:7px 11px;border:1px solid rgba(223,189,115,.28);border-radius:999px;background:rgba(223,189,115,.07);color:var(--gold2);font-size:12px;font-weight:800;cursor:pointer}.v31-relation-list{display:grid;gap:10px;padding:14px 16px 16px}.v31-relation-empty{padding:18px;border:1px dashed var(--line);border-radius:12px;color:var(--muted);text-align:center;font-size:13px}.v31-relation-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:start;padding:13px;border:1px solid var(--line);border-radius:13px;background:rgba(0,0,0,.12)}.v31-relation-fields{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.v31-relation-fields label:last-child{grid-column:span 2}.relation-remove{border-radius:9px;color:#ffb6ad;border-color:rgba(255,112,96,.24);background:rgba(255,112,96,.06)}
.v31-savebar{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;padding:15px 16px;border:1px solid rgba(223,189,115,.28);border-radius:14px;background:linear-gradient(135deg,rgba(223,189,115,.12),rgba(146,112,255,.06))}.v31-savebar button{min-height:48px;padding:0 20px;border:0;border-radius:11px;background:linear-gradient(135deg,#e8ca83,#b98b3c);color:#251708;font-weight:900;cursor:pointer}.home-profile-status{margin:0;color:var(--muted);font-size:13px}.home-profile-status[data-state="saved"]{color:#9be2ba}.home-profile-status[data-state="error"]{color:#ffaaa0}.home-profile-status[data-state="pending"]{color:#e9cf91}.v31-saved-summary{display:flex;flex-wrap:wrap;gap:7px}.v31-saved-summary span{padding:6px 9px;border:1px solid var(--line);border-radius:999px;color:var(--muted);font-size:11px}
.v31-oracle-layout{display:grid;grid-template-columns:minmax(260px,.72fr) minmax(0,1.28fr);gap:18px;align-items:start}.v31-oracle-card,.v31-oracle-result{border:1px solid var(--line);border-radius:18px;background:rgba(255,255,255,.02)}.v31-oracle-card{display:grid;justify-items:center;gap:13px;padding:22px;text-align:center}.v31-wheel{width:min(270px,68vw);aspect-ratio:1;display:grid;place-items:center;border-radius:50%;background:radial-gradient(circle,rgba(223,189,115,.15),transparent 66%)}.v31-wheel img{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 18px 35px rgba(0,0,0,.45));animation:v31-wheel-float 7s ease-in-out infinite}.v31-gate{display:grid;gap:2px}.v31-gate span{font-size:10px;letter-spacing:.12em;color:var(--gold)}.v31-gate b{color:var(--text)}.v31-gate small{color:var(--muted);font-variant-numeric:tabular-nums}.v31-oracle-profile{padding:10px 12px;border:1px dashed var(--line);border-radius:10px;color:var(--muted);font-size:12px}.v31-oracle-form button{min-height:48px;padding:0 22px;border:0;border-radius:11px;background:linear-gradient(135deg,#e8ca83,#b98b3c);color:#251708;font-weight:900;cursor:pointer}.v31-oracle-form button:disabled{opacity:.45}.v31-oracle-form .error{min-height:20px;margin:5px 0 0;color:#ffaaa0;font-size:12px}
.v31-oracle-result{min-height:360px;padding:22px}.v31-oracle-placeholder{min-height:310px;display:grid;place-items:center;text-align:center;color:var(--muted);padding:28px}.v31-oracle-result .result{display:grid;gap:16px}.v31-oracle-result .result[hidden]{display:none}.v31-oracle-result .eyebrow{color:var(--gold);font-size:10px;letter-spacing:.14em}.v31-oracle-result .result-grid{display:grid;grid-template-columns:.55fr 1.45fr;gap:12px}.number-card,.hex-card{padding:17px;border:1px solid var(--line);border-radius:14px;background:rgba(0,0,0,.14)}.number-card{display:grid;align-content:center;text-align:center}.number-card strong{display:block;color:var(--gold2);font:500 clamp(48px,8vw,74px)/1 Georgia,serif}.number-card small{color:var(--muted)}.hex-card h2{margin:5px 0;color:var(--text);font:500 30px Georgia,serif}.hex-card p{color:var(--muted);line-height:1.55}.hex-lines{display:grid;gap:5px;width:100px;margin-top:10px}.hex-lines i{height:7px;display:block;background:var(--gold2);border-radius:2px}.hex-lines i.yin{background:linear-gradient(90deg,var(--gold2) 0 42%,transparent 42% 58%,var(--gold2) 58%)}.scores{display:grid;gap:9px}.score span{display:flex;justify-content:space-between;font-size:12px}.score em{color:var(--gold2);font-style:normal}.score .bar{height:7px;margin-top:5px;border-radius:999px;background:rgba(255,255,255,.07);overflow:hidden}.score .bar i{display:block;height:100%;background:linear-gradient(90deg,#a57a30,#efd18c)}.v31-oracle-result blockquote{margin:0;padding:14px;border-left:2px solid var(--gold);color:var(--muted);line-height:1.6}.v31-oracle-result .actions{display:flex;flex-wrap:wrap;gap:8px}.v31-oracle-result .actions button{min-height:42px;padding:8px 12px;border:1px solid rgba(223,189,115,.3);border-radius:10px;background:rgba(223,189,115,.08);color:var(--gold2);font-weight:800;cursor:pointer}.v31-oracle-saved{margin:0;color:#9be2ba;font-size:12px}
.v31-ai-toolbar{display:flex;align-items:end;justify-content:space-between;gap:12px;margin-bottom:12px}.v31-ai-toolbar label{display:grid;gap:5px;color:var(--muted);font-size:12px;font-weight:800}.v31-ai-toolbar select{min-height:42px;padding:8px 34px 8px 11px;border:1px solid var(--line);border-radius:10px;background:#111;color:var(--text)}.v31-ai-profile-badge{padding:8px 11px;border:1px solid rgba(223,189,115,.25);border-radius:999px;color:var(--gold2);font-size:11px}.v31-chat.chat-shell{min-height:500px}.v31-chat .chat-messages{min-height:320px;max-height:520px}.v31-chat .msg.bot.has-mindmap{max-width:100%}
@keyframes v31-wheel-float{0%,100%{transform:translateY(0) rotate(-1deg)}50%{transform:translateY(-8px) rotate(1deg)}}
body.light .v31-steps{background:rgba(255,250,240,.9)}body.light .v31-section,body.light .v31-oracle-card,body.light .v31-oracle-result{background:linear-gradient(145deg,rgba(255,255,252,.98),rgba(247,237,218,.96));border-color:rgba(112,72,20,.25)}body.light .v31-profile-grid input,body.light .v31-profile-grid select,body.light .v31-relation-fields input,body.light .v31-relation-fields select,body.light .v31-ai-toolbar select{background:#fffdf8;color:#302418;border-color:rgba(107,73,25,.24)}body.light .v31-profile-group,body.light .v31-relation-row,body.light .number-card,body.light .hex-card{background:rgba(255,255,255,.58)}
@media(max-width:850px){.v31-steps{top:64px}.v31-section{scroll-margin-top:132px}.v31-oracle-layout{grid-template-columns:1fr}.v31-profile-grid.three{grid-template-columns:repeat(2,minmax(0,1fr))}.v31-relation-fields{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){body[data-home-runtime="31"] main{width:min(100% - 20px,1180px);padding-top:18px}.v31-steps{gap:4px;padding:6px;border-radius:13px}.v31-step-link{display:grid;justify-items:center;gap:3px;min-height:54px;padding:5px;font-size:10px;text-align:center}.v31-step-link b{width:25px;height:25px}.v31-section{padding:17px;border-radius:17px}.v31-section-head{grid-template-columns:38px minmax(0,1fr);gap:10px}.v31-section-number{width:38px;height:38px}.v31-section-head p{grid-column:1/-1}.v31-profile-grid,.v31-profile-grid.three,.v31-relation-fields{grid-template-columns:minmax(0,1fr);padding:13px}.v31-relation-fields label:last-child{grid-column:auto}.v31-relation-row{grid-template-columns:1fr}.relation-remove{justify-self:start}.v31-savebar{align-items:stretch}.v31-savebar button{width:100%}.v31-oracle-result .result-grid{grid-template-columns:1fr}.v31-ai-toolbar{align-items:stretch;flex-direction:column}.v31-ai-profile-badge{border-radius:10px}.v31-chat.chat-shell{min-height:500px}.v31-chat .chat-messages{min-height:340px;max-height:500px}.v31-chat .chat-compose{grid-template-columns:minmax(0,1fr) auto}.v31-chat .chat-compose button{height:50px}}
@media(max-width:420px){.v31-chat .chat-compose{grid-template-columns:1fr}.v31-chat .chat-compose button{width:100%}}
@media(prefers-reduced-motion:reduce){.v31-wheel img{animation:none}}
/* V31.3 — homepage layout repair. Keep every override scoped to the one-page runtime. */
body[data-home-runtime="31"]{--v31-header-h:72px;--v31-sticky-gap:8px}
body[data-home-runtime="31"] main#main-content{
  display:block!important;
  width:min(1160px,calc(100% - 32px))!important;
  max-width:1160px!important;
  margin:0 auto!important;
  padding:18px 0 56px!important;
}
body[data-home-runtime="31"] main#main-content::before,
body[data-home-runtime="31"] main#main-content::after{display:none!important}
body[data-home-runtime="31"] .v31-steps{
  top:calc(var(--v31-header-h) + var(--v31-sticky-gap));z-index:1050;gap:6px;
  margin:0 0 16px;padding:7px;border-radius:14px;background:rgba(7,7,9,.96);
  box-shadow:0 10px 28px rgba(0,0,0,.32)
}
body[data-home-runtime="31"] .v31-step-link{min-height:44px;padding:7px 10px}
body[data-home-runtime="31"] .v31-step-link b{width:26px;height:26px}
body[data-home-runtime="31"] .v31-section{
  scroll-margin-top:calc(var(--v31-header-h) + 78px);margin:0 0 18px;
  padding:clamp(20px,2.6vw,30px);border-radius:18px
}
body[data-home-runtime="31"] .v31-section-head{gap:12px;margin-bottom:18px}
body[data-home-runtime="31"] .v31-section-number{width:40px;height:40px;border-radius:12px;font-size:17px}
body[data-home-runtime="31"] .v31-section-head h1,
body[data-home-runtime="31"] .v31-section-head h2{font-size:clamp(28px,3.2vw,38px)!important;line-height:1.1!important;letter-spacing:-.025em}
body[data-home-runtime="31"] .v31-section-head p{margin-top:6px;font-size:13px;line-height:1.55}
body[data-home-runtime="31"] .v31-profile-form{gap:11px}
body[data-home-runtime="31"] .v31-profile-group>summary{min-height:50px;padding:10px 14px}
body[data-home-runtime="31"] .v31-profile-grid{gap:11px;padding:14px}
body[data-home-runtime="31"] .v31-profile-grid.three{grid-template-columns:repeat(3,minmax(0,1fr))}
body[data-home-runtime="31"] .v31-profile-grid input,
body[data-home-runtime="31"] .v31-profile-grid select,
body[data-home-runtime="31"] .v31-relation-fields input,
body[data-home-runtime="31"] .v31-relation-fields select{min-height:44px!important;padding:9px 11px!important}
body[data-home-runtime="31"] .v31-profile-grid .v28-date-wrap{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1.35fr);gap:6px;margin-top:0}
body[data-home-runtime="31"] .v31-profile-grid .v28-date-part{min-width:0}
body[data-home-runtime="31"] .v31-profile-grid .v28-date-part input{padding-inline:5px!important}
body[data-home-runtime="31"] .v31-relation-toolbar{gap:7px;padding:12px 14px 0}
body[data-home-runtime="31"] .v31-relation-list{padding:12px 14px 14px}
body[data-home-runtime="31"] .v31-relation-toolbar button,
body[data-home-runtime="31"] .relation-remove{width:auto!important;min-height:38px!important}
body[data-home-runtime="31"] .v31-savebar{padding:13px 14px}
body[data-home-runtime="31"] .v31-savebar button{width:auto!important;min-height:46px!important}
body[data-home-runtime="31"] .v31-oracle-layout{grid-template-columns:minmax(300px,.88fr) minmax(0,1.12fr);gap:16px;align-items:stretch}
body[data-home-runtime="31"] .v31-oracle-card,
body[data-home-runtime="31"] .v31-oracle-result{min-width:0;min-height:430px}
body[data-home-runtime="31"] .v31-oracle-card{align-content:start;gap:10px;padding:18px}
body[data-home-runtime="31"] .v31-wheel{width:min(230px,58vw)}
body[data-home-runtime="31"] .v31-oracle-result{padding:18px}
body[data-home-runtime="31"] .v31-oracle-placeholder{min-height:390px;padding:20px}
body[data-home-runtime="31"] .v31-oracle-result .result{gap:13px}
body[data-home-runtime="31"] .v31-oracle-result .result-grid{grid-template-columns:minmax(120px,.55fr) minmax(0,1.45fr)}
body[data-home-runtime="31"] .number-card,
body[data-home-runtime="31"] .hex-card{padding:14px}
body[data-home-runtime="31"] .hex-card h2{font-size:26px!important}
body[data-home-runtime="31"] .v31-oracle-form button,
body[data-home-runtime="31"] .v31-oracle-result .actions button{width:auto!important}
body[data-home-runtime="31"] .v31-ai-toolbar{margin-bottom:10px}
body[data-home-runtime="31"] .v31-chat.chat-shell{min-height:420px!important}
body[data-home-runtime="31"] .v31-chat .chat-head{padding:13px 15px}
body[data-home-runtime="31"] .v31-chat .chat-messages{min-height:230px!important;max-height:420px!important;padding:16px}
body[data-home-runtime="31"] .v31-chat .chat-compose{padding:11px}
body[data-home-runtime="31"] .v31-chat .chat-compose button{width:auto!important;min-width:76px}
@media(max-width:1050px){
  body[data-home-runtime="31"] .v31-steps{position:relative;top:auto;z-index:1;box-shadow:none}
  body[data-home-runtime="31"] main#main-content{width:min(100% - 28px,1160px)!important}
  body[data-home-runtime="31"] .v31-section{padding:22px}
  body[data-home-runtime="31"] .v31-section-head h1,
  body[data-home-runtime="31"] .v31-section-head h2{font-size:clamp(27px,3.4vw,34px)!important}
  body[data-home-runtime="31"] .v31-profile-grid.three{grid-template-columns:repeat(2,minmax(0,1fr))}
  body[data-home-runtime="31"] .v31-profile-grid.three>label[style*="grid-column:span 2"]{grid-column:1/-1!important}
  body[data-home-runtime="31"] .v31-oracle-layout{grid-template-columns:minmax(280px,.82fr) minmax(0,1.18fr)}
  body[data-home-runtime="31"] .v31-wheel{width:min(210px,52vw)}
}
@media(max-width:760px){
  body[data-home-runtime="31"]{--v31-header-h:64px;--v31-sticky-gap:0px}
  body[data-home-runtime="31"] main#main-content{width:100%!important;padding:12px 10px 40px!important}
  body[data-home-runtime="31"] .v31-steps{position:relative;top:auto;z-index:1;margin-bottom:12px;padding:5px;border-radius:12px;box-shadow:none}
  body[data-home-runtime="31"] .v31-step-link{display:grid;justify-items:center;gap:2px;min-height:50px;padding:4px;font-size:10px}
  body[data-home-runtime="31"] .v31-step-link b{width:24px;height:24px}
  body[data-home-runtime="31"] .v31-section{scroll-margin-top:72px;margin-bottom:14px;padding:17px 14px;border-radius:15px}
  body[data-home-runtime="31"] .v31-section-head{grid-template-columns:36px minmax(0,1fr);gap:9px;margin-bottom:15px}
  body[data-home-runtime="31"] .v31-section-number{width:36px;height:36px;font-size:16px}
  body[data-home-runtime="31"] .v31-section-head h1,
  body[data-home-runtime="31"] .v31-section-head h2{font-size:clamp(25px,7.3vw,31px)!important}
  body[data-home-runtime="31"] .v31-section-head p{grid-column:1/-1;margin-top:2px;font-size:13px}
  body[data-home-runtime="31"] .v31-profile-group>summary{align-items:flex-start;min-height:48px;padding:10px 12px}
  body[data-home-runtime="31"] .v31-profile-group>summary small{max-width:48%;text-align:right}
  body[data-home-runtime="31"] .v31-profile-grid,
  body[data-home-runtime="31"] .v31-profile-grid.three,
  body[data-home-runtime="31"] .v31-relation-fields{grid-template-columns:minmax(0,1fr);padding:12px}
  body[data-home-runtime="31"] .v31-profile-grid.three>label[style*="grid-column:span 2"]{grid-column:auto!important}
  body[data-home-runtime="31"] .v31-relation-toolbar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));padding:12px 12px 0}
  body[data-home-runtime="31"] .v31-relation-toolbar button{width:100%!important;padding-inline:8px}
  body[data-home-runtime="31"] .v31-relation-list{padding:10px 12px 12px}
  body[data-home-runtime="31"] .v31-relation-row{grid-template-columns:1fr}
  body[data-home-runtime="31"] .relation-remove{justify-self:start}
  body[data-home-runtime="31"] .v31-savebar{align-items:stretch;padding:12px}
  body[data-home-runtime="31"] .v31-savebar button{width:100%!important}
  body[data-home-runtime="31"] .v31-oracle-layout{grid-template-columns:1fr;gap:12px}
  body[data-home-runtime="31"] .v31-oracle-card,
  body[data-home-runtime="31"] .v31-oracle-result{min-height:0}
  body[data-home-runtime="31"] .v31-oracle-card{padding:15px}
  body[data-home-runtime="31"] .v31-wheel{width:min(200px,60vw)}
  body[data-home-runtime="31"] .v31-oracle-result{padding:15px}
  body[data-home-runtime="31"] .v31-oracle-placeholder{min-height:180px;padding:18px}
  body[data-home-runtime="31"] .v31-oracle-result .result-grid{grid-template-columns:1fr}
  body[data-home-runtime="31"] .v31-oracle-form,
  body[data-home-runtime="31"] .v31-oracle-form button{width:100%!important}
  body[data-home-runtime="31"] .v31-oracle-result .actions{display:grid!important;grid-template-columns:1fr!important}
  body[data-home-runtime="31"] .v31-oracle-result .actions button{width:100%!important}
  body[data-home-runtime="31"] .v31-ai-toolbar{align-items:stretch;flex-direction:column}
  body[data-home-runtime="31"] .v31-ai-profile-badge{border-radius:10px}
  body[data-home-runtime="31"] .v31-chat.chat-shell{min-height:380px!important}
  body[data-home-runtime="31"] .v31-chat .chat-messages{min-height:210px!important;max-height:380px!important;padding:13px}
  body[data-home-runtime="31"] .v31-chat .msg{max-width:92%;font-size:13px}
  body[data-home-runtime="31"] .v31-chat .chat-compose{grid-template-columns:minmax(0,1fr) auto!important}
  body[data-home-runtime="31"] .v31-chat .chat-compose button{width:auto!important;min-width:70px!important}
}
@media(max-width:430px){
  body[data-home-runtime="31"] .v31-relation-toolbar{grid-template-columns:1fr}
  body[data-home-runtime="31"] .v31-profile-grid .v28-date-wrap{grid-template-columns:1fr 1fr 1.25fr}
  body[data-home-runtime="31"] .v31-chat .chat-compose{grid-template-columns:1fr!important}
  body[data-home-runtime="31"] .v31-chat .chat-compose button{width:100%!important}
}

/* V31 flow stage ---------------------------------------------------------
   Progressive enhancement: home-v31.js enables this only after it has set
   data-home-stage plus matching is-active / is-off-left / is-off-right classes.
   Long content scrolls inside the active panel; the page stays one viewport. */
body.v31-flow-home[data-home-runtime="31"]{
  --v31-stage-gap:10px;
  height:100vh;
  height:100dvh;
  min-height:0;
  overflow:hidden;
}
body.v31-flow-home[data-home-runtime="31"] main#main-content{
  position:relative;
  isolation:isolate;
  display:grid!important;
  grid-template-columns:minmax(0,1fr);
  grid-template-rows:minmax(0,1fr);
  gap:0;
  box-sizing:border-box;
  height:calc(100vh - var(--v31-header-h));
  height:calc(100dvh - var(--v31-header-h));
  min-height:0;
  overflow:hidden;
  padding:10px 0 12px!important;
}
body.v31-flow-home[data-home-runtime="31"] main#main-content::before,
body.v31-flow-home[data-home-runtime="31"] main#main-content::after{display:none!important}
body.v31-flow-home[data-home-runtime="31"]>.topbar{flex:0 0 var(--v31-header-h)}
body.v31-flow-home[data-home-runtime="31"]>footer{display:none!important}

/* Only the active tool remains visible; stage controls provide the way back. */
body.v31-flow-home[data-home-runtime="31"] .v31-steps{display:none!important}
body.v31-flow-home[data-home-runtime="31"] .v31-section-head{position:relative}
body.v31-flow-home[data-home-runtime="31"] .v31-stage-actions{
  position:absolute;
  inset-block-start:0;
  inset-inline-end:0;
  z-index:3;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:6px;
}
body.v31-flow-home[data-home-runtime="31"] #oracle .v31-section-head>div:nth-child(2){padding-right:116px}
body.v31-flow-home[data-home-runtime="31"] #ai .v31-section-head>div:nth-child(2){padding-right:214px}
body.v31-flow-home[data-home-runtime="31"] .v31-stage-control{
  appearance:none;
  width:auto!important;
  min-width:0!important;
  min-height:34px!important;
  padding:6px 10px!important;
  border:1px solid rgba(223,189,115,.3);
  border-radius:999px;
  background:rgba(223,189,115,.08);
  color:var(--gold2);
  box-shadow:none;
  font-size:12px!important;
  font-weight:800;
  line-height:1.2;
  white-space:nowrap;
  cursor:pointer;
}
body.v31-flow-home[data-home-runtime="31"] .v31-stage-control:hover{
  border-color:rgba(223,189,115,.58);
  background:rgba(223,189,115,.15);
}
body.v31-flow-home[data-home-runtime="31"] .v31-stage-control:focus-visible{
  outline:2px solid var(--gold2);
  outline-offset:2px;
}
body.light.v31-flow-home[data-home-runtime="31"] .v31-stage-control{
  background:rgba(255,255,255,.68);
  border-color:rgba(112,72,20,.28);
  color:#70460e;
}

/* All panels share one grid cell. JS supplies inert and aria-hidden too. */
body.v31-flow-home[data-home-runtime="31"] #main-content>.v31-section{
  grid-area:1/1;
  align-self:stretch;
  box-sizing:border-box;
  width:100%;
  height:100%;
  min-width:0;
  min-height:0;
  max-height:100%;
  margin:0!important;
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  user-select:none;
  transform:translate3d(0,14px,0) scale(.985);
  transform-origin:50% 50%;
  transition:
    transform .48s cubic-bezier(.22,.72,.2,1),
    opacity .28s ease,
    visibility 0s linear .48s;
  will-change:transform,opacity;
}
body.v31-flow-home[data-home-runtime="31"] #main-content>.v31-section.is-before,
body.v31-flow-home[data-home-runtime="31"] #main-content>.v31-section.is-off-left{
  transform:translate3d(-106%,0,0);
}
body.v31-flow-home[data-home-runtime="31"] #main-content>.v31-section.is-after,
body.v31-flow-home[data-home-runtime="31"] #main-content>.v31-section.is-off-right{
  transform:translate3d(106%,0,0);
}
/* Product direction is fixed: profile leaves left, oracle leaves right. */
body.v31-flow-home[data-home-runtime="31"] #main-content>#profile:not(.is-active){
  transform:translate3d(-106%,0,0);
}
body.v31-flow-home[data-home-runtime="31"] #main-content>#oracle:not(.is-active){
  transform:translate3d(106%,0,0);
}
body.v31-flow-home[data-home-runtime="31"] #main-content>#ai:not(.is-active){
  transform:translate3d(106%,0,0);
}
body.v31-flow-home[data-home-runtime="31"] #main-content>.v31-section.is-active,
body.v31-flow-home[data-home-runtime="31"][data-home-stage="profile"] #profile,
body.v31-flow-home[data-home-runtime="31"][data-home-stage="oracle"] #oracle,
body.v31-flow-home[data-home-runtime="31"][data-home-stage="ai"] #ai{
  z-index:2;
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  user-select:auto;
  transform:translate3d(0,0,0) scale(1);
  transition-delay:0s;
}
body.v31-flow-home[data-home-runtime="31"] #main-content>.v31-section[aria-hidden="true"],
body.v31-flow-home[data-home-runtime="31"] #main-content>.v31-section[inert]{pointer-events:none}

/* Chat owns the remaining height instead of forcing its old 420-500px floor. */
body.v31-flow-home[data-home-runtime="31"] #main-content>#ai.is-active,
body.v31-flow-home[data-home-runtime="31"][data-home-stage="ai"] #ai{
  display:grid;
  grid-template-rows:auto auto minmax(0,1fr);
  overflow:hidden;
}
body.v31-flow-home[data-home-runtime="31"] #ai .v31-chat.chat-shell{
  width:100%;
  height:100%;
  min-height:0!important;
  max-height:100%;
}
body.v31-flow-home[data-home-runtime="31"] #ai .v31-chat .chat-messages{
  min-height:0!important;
  max-height:none!important;
}

@media(max-width:760px){
  body.v31-flow-home[data-home-runtime="31"]{--v31-stage-gap:7px}
  body.v31-flow-home[data-home-runtime="31"] main#main-content{
    width:100%!important;
    padding:7px 8px max(8px,env(safe-area-inset-bottom))!important;
  }
  body.v31-flow-home[data-home-runtime="31"] .v31-steps{
    margin:0!important;
    padding:3px;
    border-radius:10px;
  }
  body.v31-flow-home[data-home-runtime="31"] .v31-step-link{
    display:flex;
    gap:5px;
    min-height:36px;
    padding:3px 5px;
    font-size:10px;
    white-space:nowrap;
  }
  body.v31-flow-home[data-home-runtime="31"] .v31-step-link b{
    width:22px;
    height:22px;
    flex-basis:22px;
  }
  body.v31-flow-home[data-home-runtime="31"] #main-content>.v31-section{
    padding:14px 12px;
    border-radius:14px;
    scrollbar-gutter:auto;
  }
  body.v31-flow-home[data-home-runtime="31"] .v31-section-head{margin-bottom:12px}
}

@media(max-width:430px){
  body.v31-flow-home[data-home-runtime="31"] .v31-step-link{
    display:grid;
    justify-items:center;
    gap:1px;
    min-height:38px;
    line-height:1.1;
  }
}

/* Short laptop/landscape viewports give the controls more vertical room. */
@media(max-height:720px){
  body.v31-flow-home[data-home-runtime="31"] main#main-content{padding-block:7px!important}
  body.v31-flow-home[data-home-runtime="31"] #main-content>.v31-section{padding-block:14px}
  body.v31-flow-home[data-home-runtime="31"] .v31-section-head{margin-bottom:10px}
  body.v31-flow-home[data-home-runtime="31"] .v31-section-head p{display:none}
  body.v31-flow-home[data-home-runtime="31"] .v31-section-head h1,
  body.v31-flow-home[data-home-runtime="31"] .v31-section-head h2{font-size:clamp(24px,3vw,31px)!important}
  body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-toolbar{margin-bottom:7px}
}

@media(prefers-reduced-motion:reduce){
  body.v31-flow-home[data-home-runtime="31"] #main-content>.v31-section{
    transition:none;
    will-change:auto;
  }
}

@media(max-width:760px){
  body.v31-flow-home[data-home-runtime="31"] .v31-stage-actions{
    position:static;
    grid-column:1/-1;
    justify-self:end;
    flex-wrap:wrap;
    margin-top:1px;
  }
  body.v31-flow-home[data-home-runtime="31"] #oracle .v31-section-head>div:nth-child(2),
  body.v31-flow-home[data-home-runtime="31"] #ai .v31-section-head>div:nth-child(2){padding-right:0}
  body.v31-flow-home[data-home-runtime="31"] .v31-stage-control{
    width:auto!important;
    min-height:32px!important;
    padding:5px 9px!important;
    font-size:11px!important;
  }
}


/* V31.4.1 — keep the dynamically-added lookup controls on the header row. */
body.v31-flow-home[data-home-runtime="31"] .v31-field-hint{
  display:block;
  margin-top:5px;
  color:var(--muted);
  font-size:10px;
  font-weight:500;
  line-height:1.35;
  letter-spacing:0;
}
@media(min-width:1101px) and (max-width:1480px){
  body.v31-flow-home[data-home-runtime="31"]>.topbar{
    display:grid!important;
    grid-template-columns:auto minmax(24px,1fr) auto auto auto auto!important;
    grid-template-rows:1fr!important;
    align-items:center!important;
    height:var(--v31-header-h)!important;
    min-height:var(--v31-header-h)!important;
    max-height:var(--v31-header-h)!important;
    padding:6px clamp(12px,2vw,24px)!important;
    gap:8px!important;
    overflow:hidden!important;
  }
  body.v31-flow-home[data-home-runtime="31"]>.topbar>.brand{grid-column:1!important;grid-row:1!important}
  body.v31-flow-home[data-home-runtime="31"]>.topbar>.nav{grid-column:2!important;grid-row:1!important;display:none!important}
  body.v31-flow-home[data-home-runtime="31"]>.topbar>#aiSearchOpen,
  body.v31-flow-home[data-home-runtime="31"]>.topbar>#aiSearchOpenUnified{
    grid-column:3!important;
    grid-row:1!important;
    order:initial!important;
    justify-self:end!important;
    width:auto!important;
    min-width:96px!important;
    margin:0!important;
  }
  body.v31-flow-home[data-home-runtime="31"]>.topbar>#langBtn,
  body.v31-flow-home[data-home-runtime="31"]>.topbar>#langBtnUnified{
    grid-column:4!important;
    grid-row:1!important;
    order:initial!important;
    justify-self:end!important;
    width:auto!important;
    min-width:68px!important;
    margin:0!important;
  }
  body.v31-flow-home[data-home-runtime="31"]>.topbar>#themeBtn{
    grid-column:5!important;
    grid-row:1!important;
    order:initial!important;
    margin:0!important;
  }
  body.v31-flow-home[data-home-runtime="31"]>.topbar>#menuBtn{
    grid-column:6!important;
    grid-row:1!important;
    order:initial!important;
    margin:0!important;
  }
}

/* V31.7 — natural chat first, mindmap second */
.v31-chat .agent-answer-prose{white-space:pre-wrap;line-height:1.68;margin:0 0 12px;padding:12px 14px;border-radius:12px;background:rgba(255,255,255,.025);border:1px solid rgba(223,189,115,.14);color:var(--text);font-size:14px}
.v31-chat .msg.bot.has-mindmap .huyen-mindmap{margin-top:6px}
@media(max-width:720px){.v31-chat .agent-answer-prose{font-size:13.5px;line-height:1.62;padding:11px 12px}}


/* V31.7.4 — rebalance Huyền Cơ AI mindmap columns */
@media (min-width: 980px){
  .v31-chat .msg.bot.has-mindmap .mindmap-branches,
  .v31-chat .msg.bot.has-mindmap .mindmap-grid,
  .v31-chat .msg.bot.has-mindmap .huyen-mindmap-grid,
  .v31-chat .msg.bot.has-mindmap [data-mindmap-branches]{
    display:grid !important;
    grid-template-columns:repeat(12,minmax(0,1fr)) !important;
    gap:12px !important;
    width:100% !important;
    align-items:start !important;
    justify-items:stretch !important;
    grid-auto-flow:row dense !important;
  }
  .v31-chat .msg.bot.has-mindmap .mindmap-branch,
  .v31-chat .msg.bot.has-mindmap .mindmap-card,
  .v31-chat .msg.bot.has-mindmap .mindmap-panel,
  .v31-chat .msg.bot.has-mindmap [data-mindmap-branch]{
    min-width:0 !important;
    width:100% !important;
    max-width:none !important;
    height:100% !important;
    align-self:stretch !important;
  }
  .v31-chat .msg.bot.has-mindmap .mindmap-branch:nth-child(1),
  .v31-chat .msg.bot.has-mindmap .mindmap-card:nth-child(1),
  .v31-chat .msg.bot.has-mindmap .mindmap-panel:nth-child(1),
  .v31-chat .msg.bot.has-mindmap [data-mindmap-branch]:nth-child(1){grid-column:span 5 !important;}
  .v31-chat .msg.bot.has-mindmap .mindmap-branch:nth-child(2),
  .v31-chat .msg.bot.has-mindmap .mindmap-card:nth-child(2),
  .v31-chat .msg.bot.has-mindmap .mindmap-panel:nth-child(2),
  .v31-chat .msg.bot.has-mindmap [data-mindmap-branch]:nth-child(2){grid-column:span 7 !important;}
  .v31-chat .msg.bot.has-mindmap .mindmap-branch:nth-child(n+3),
  .v31-chat .msg.bot.has-mindmap .mindmap-card:nth-child(n+3),
  .v31-chat .msg.bot.has-mindmap .mindmap-panel:nth-child(n+3),
  .v31-chat .msg.bot.has-mindmap [data-mindmap-branch]:nth-child(n+3){grid-column:span 4 !important;}
}
@media (min-width: 980px) and (max-width: 1199px){
  .v31-chat .msg.bot.has-mindmap .mindmap-branch:nth-child(1),
  .v31-chat .msg.bot.has-mindmap .mindmap-card:nth-child(1),
  .v31-chat .msg.bot.has-mindmap .mindmap-panel:nth-child(1),
  .v31-chat .msg.bot.has-mindmap [data-mindmap-branch]:nth-child(1),
  .v31-chat .msg.bot.has-mindmap .mindmap-branch:nth-child(2),
  .v31-chat .msg.bot.has-mindmap .mindmap-card:nth-child(2),
  .v31-chat .msg.bot.has-mindmap .mindmap-panel:nth-child(2),
  .v31-chat .msg.bot.has-mindmap [data-mindmap-branch]:nth-child(2){grid-column:span 6 !important;}
}
@media (max-width: 979px){
  .v31-chat .msg.bot.has-mindmap .mindmap-branches,
  .v31-chat .msg.bot.has-mindmap .mindmap-grid,
  .v31-chat .msg.bot.has-mindmap .huyen-mindmap-grid,
  .v31-chat .msg.bot.has-mindmap [data-mindmap-branches]{
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    gap:10px !important;
    width:100% !important;
  }
}


/* V31.8.1 — reclaim chat height: AI step has its own compact chrome */
body.v31-flow-home[data-home-runtime="31"] #ai.is-active > .v31-section-head,
body.v31-flow-home[data-home-runtime="31"][data-home-stage="ai"] #ai > .v31-section-head{
  display:none!important;
}
body.v31-flow-home[data-home-runtime="31"] #main-content>#ai.is-active,
body.v31-flow-home[data-home-runtime="31"][data-home-stage="ai"] #ai{
  grid-template-rows:auto minmax(0,1fr)!important;
  gap:6px!important;
  padding-top:10px!important;
}
body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-toolbar{
  display:grid!important;
  grid-template-columns:minmax(190px,260px) minmax(0,1fr);
  align-items:center!important;
  gap:8px!important;
  margin:0!important;
  min-height:42px;
}
body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-toolbar label{
  display:grid;
  grid-template-columns:auto minmax(100px,1fr);
  align-items:center;
  gap:7px;
  font-size:10px;
}
body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-toolbar label>small{display:none!important}
body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-toolbar select{min-height:36px!important;padding:6px 30px 6px 9px!important}
body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-profile-badge{
  justify-self:end;
  max-width:100%;
  min-height:34px;
  display:flex;
  align-items:center;
  padding:6px 10px!important;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
body.v31-flow-home[data-home-runtime="31"] #ai .v31-chat .chat-head{min-height:44px;padding:8px 12px!important}
body.v31-flow-home[data-home-runtime="31"] #ai .v31-chat .chat-head small{font-size:10px}
@media(max-width:680px){
  body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-toolbar{grid-template-columns:1fr!important;min-height:auto}
  body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-profile-badge{justify-self:stretch}
}


/* V31.8.2 — permanent return controls inside compact AI toolbar */
body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-toolbar{
  grid-template-columns:minmax(190px,260px) auto minmax(0,1fr)!important;
}
body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-return-actions{
  display:flex;
  align-items:center;
  gap:7px;
  min-width:max-content;
}
body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-return-actions .v31-stage-control{
  appearance:none;
  -webkit-appearance:none;
  min-height:34px;
  padding:6px 11px;
  border:1px solid rgba(212,171,76,.5);
  border-radius:999px;
  background:linear-gradient(180deg,rgba(62,48,24,.9),rgba(31,27,20,.96));
  color:#f5dfa1;
  font:800 11px/1.05 inherit;
  letter-spacing:.01em;
  cursor:pointer;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.06),0 3px 10px rgba(0,0,0,.12);
  transition:transform .16s ease,border-color .16s ease,background .16s ease,color .16s ease;
}
body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-return-actions .v31-stage-control:hover,
body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-return-actions .v31-stage-control:focus-visible{
  transform:translateY(-1px);
  border-color:#e4bd5f;
  background:linear-gradient(180deg,rgba(92,69,29,.98),rgba(48,38,22,.98));
  color:#fff2c6;
  outline:none;
}
body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-return-actions .v31-stage-control:active{transform:translateY(0)}
@media(max-width:820px){
  body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-toolbar{
    grid-template-columns:minmax(0,1fr) auto!important;
  }
  body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-profile-badge{
    grid-column:1/-1;
    justify-self:stretch;
  }
}
@media(max-width:560px){
  body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-toolbar{
    grid-template-columns:1fr!important;
  }
  body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-return-actions{
    width:100%;
    display:grid;
    grid-template-columns:1fr 1fr;
  }
  body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-return-actions .v31-stage-control{width:100%}
  body.v31-flow-home[data-home-runtime="31"] #ai .v31-ai-profile-badge{grid-column:auto}
}
