/* Shared visual language for the shell and every embedded tool. */
:root{color-scheme:light;--bg:#f6f7f4;--paper:#ffffff;--ink:#243529;--muted:#596758;--line:#d3dacd;--accent:#244f30;--soft:#edf3ea;--error:#a52a2a;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif}
body{background:var(--bg);color:var(--ink);font-family:inherit;font-size:18px;line-height:1.65}
button,input,textarea,select{font-family:inherit}
a{color:var(--accent);text-underline-offset:4px}
button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,summary:focus-visible{outline:3px solid #688a53;outline-offset:3px}
button{border-radius:10px}button:disabled{cursor:not-allowed;opacity:.55}
button.primary,.primary,#shared-submit,#shared-logout,#copy-adapted,[data-page="templates"] #copy,[data-page="materials"] button{background:var(--accent);border:1px solid var(--accent);color:white;border-radius:10px;min-height:48px;padding:12px 22px;font-weight:650}
button.primary:hover:enabled,.primary:hover:enabled,#shared-submit:hover:enabled,#shared-logout:hover:enabled,[data-page="templates"] #copy:hover,[data-page="materials"] button:hover:enabled{background:#193d23;border-color:#193d23}
.primary:active{background:#16341f}
.secondary,.copy{background:var(--paper);color:var(--accent);border:1px solid var(--line);border-radius:10px;min-height:48px}
.secondary:hover,.copy:hover:enabled{background:var(--soft);color:var(--accent);border-color:#9cad96}
.text-button,.number,.eyebrow,.steps span,li::marker{color:var(--accent)}
input:not([type="radio"]):not([type="checkbox"]),textarea,select{background:var(--paper);color:var(--ink);border-color:var(--line);border-radius:10px;font-size:17px}
input[type="radio"],input[type="checkbox"],progress{accent-color:var(--accent)}
.hint,.quiet,.intro>p:last-child,.lead,.account-note{color:var(--muted)}
.notice{background:var(--soft);border-color:#cedbc8;color:var(--accent)}
.error,#login-error,#shared-status{color:var(--error)}
.tag,.step{background:var(--soft);color:var(--accent)}
body:not([data-page="shell"])>main{max-width:1140px;padding:40px 32px 56px;margin:0 auto}
body:not([data-page="shell"]) .intro{padding:0;margin:0 0 32px}
body:not([data-page="shell"]) h1{font-size:40px;line-height:1.3;letter-spacing:-.025em;margin:12px 0 16px}
body:not([data-page="shell"]) .eyebrow{font-size:14px;line-height:1.5;font-weight:650;letter-spacing:.07em}
body:not([data-page="shell"]) .lead{font-size:18px}
body:not([data-page="shell"]) article,body:not([data-page="shell"]) .result,body:not([data-page="shell"]) .workspace{border-color:var(--line)}
[data-page="video"] .workspace,[data-page="download"] .workspace,[data-page="templates"] article,[data-page="materials"] article{border:1px solid var(--line);background:var(--paper);border-radius:16px;padding:28px}
[data-page="keywords"]>header,[data-page="video"]>.topbar{display:none}
[data-page="keywords"] .toolkit{display:none}
[data-page="keywords"] label{font-size:18px}
[data-page="keywords"] .number{font-size:14px}
[data-page="keywords"] .hint,[data-page="keywords"] .privacy,[data-page="keywords"] .result-foot p{font-size:14px}
[data-page="keywords"] textarea{min-height:120px;font-size:17px}
[data-page="keywords"] #output{font-size:17px}
[data-page="keywords"] .result{border-radius:16px}
[data-page="keywords"] .result h2{font-size:20px}
[data-page="keywords"] .result-foot{background:var(--soft)}
[data-page="keywords"] #status{font-size:15px;color:var(--accent)}
[data-page="shell"] header{background:var(--paper);border-color:var(--line)}
[data-page="shell"] nav button[aria-selected="true"]{background:var(--soft);color:var(--accent);border-color:var(--accent);border-radius:10px 10px 0 0}
[data-page="shell"] #account-button{border-radius:10px}
@media(max-width:740px){body:not([data-page="shell"])>main{padding:28px 18px 40px}body:not([data-page="shell"]) h1{font-size:30px}[data-page="video"] .workspace,[data-page="download"] .workspace,[data-page="templates"] article,[data-page="materials"] article{padding:20px 16px}body{font-size:17px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}

[data-page="keywords"] #status.error{color:var(--error)}

/* The shell owns the viewport; only the selected tool scrolls. */
html:has(body[data-page="shell"]){height:100%}
body[data-page="shell"]{height:100vh;height:100dvh;display:flex;flex-direction:column;overflow:hidden}
[data-page="shell"]>header{flex:none}
[data-page="shell"]>main{flex:1;min-height:0}
[data-page="shell"]>main>section{height:100%}
[data-page="shell"] iframe{height:100%;min-height:0}
body{overflow-wrap:break-word}
.workspace>*{min-width:0}
@media(max-width:740px){
  body{-webkit-text-size-adjust:100%;font-size:17px}
  body:not([data-page="shell"])>main{padding:24px 16px max(32px,env(safe-area-inset-bottom))}
  body:not([data-page="shell"]) h1{font-size:28px;line-height:1.35}
  body:not([data-page="shell"]) .intro{margin-bottom:24px}
  body:not([data-page="shell"]) .lead{font-size:17px}
  button,a.secondary,summary{touch-action:manipulation;min-height:48px}
  input:not([type="radio"]):not([type="checkbox"]),textarea,select{font-size:17px;max-width:100%;min-width:0}
  textarea{padding:14px!important}
  pre,article p,article a,.history-row strong{overflow-wrap:anywhere}
  .history-row{flex-wrap:wrap}.history-row>div{min-width:0;flex:1 1 180px}
  .section-heading{flex-wrap:wrap;align-items:flex-start}
  .result-tools{display:grid;grid-template-columns:1fr 1fr;width:100%;gap:10px}
  .result-tools button{width:100%;padding:10px}
  [data-page="shell"]>header{padding:10px max(12px,env(safe-area-inset-right)) 8px max(12px,env(safe-area-inset-left))}
  [data-page="shell"] .brand{font-size:20px;line-height:48px}
  [data-page="shell"] .brand span,[data-page="shell"] header>p{display:none}
  [data-page="shell"] #account-button{font-size:15px;min-height:44px;padding:8px 12px}
  [data-page="shell"] #global-account-status{display:none}
  [data-page="shell"] nav{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:6px;overflow:visible;margin-top:8px}
  [data-page="shell"] nav button{grid-column:span 2;font-size:15px;white-space:normal;padding:10px 4px;line-height:1.35;min-height:46px;border:1px solid var(--line);border-radius:9px;background:var(--paper)}
  [data-page="shell"] nav button:nth-child(-n+2){grid-column:span 3}
  [data-page="shell"] nav button[aria-selected="true"]{border-radius:9px;background:var(--accent);color:#fff;border-color:var(--accent)}
  [data-page="shell"] dialog{width:calc(100% - 24px);max-height:calc(100dvh - 24px);padding:20px 18px;overscroll-behavior:contain}
  [data-page="shell"] dialog h2{font-size:22px;clear:both;padding-top:8px}
  [data-page="shell"] #shared-tabs{display:flex;gap:8px}
  [data-page="shell"] #shared-tabs button{flex:1;padding:10px 6px}
  [data-page="shell"] #shared-submit{width:100%;min-height:52px}
  [data-page="shell"] #shared-form input{font-size:17px;min-height:48px}
  [data-page="shell"] .account-note{font-size:14px}
  [data-page="keywords"] .workspace{grid-template-columns:minmax(0,1fr);gap:28px}
  [data-page="keywords"] .actions{flex-direction:column;align-items:stretch;gap:6px}
  [data-page="keywords"] .actions button{width:100%;min-height:50px}
  [data-page="keywords"] .mode label{display:flex;align-items:center;gap:8px;min-height:48px}
  [data-page="keywords"] .mode input{width:20px;height:20px;flex:none}
  [data-page="keywords"] .hint{margin-left:0}
  [data-page="keywords"] .empty{min-height:220px;padding:24px 20px}
  [data-page="keywords"] .result-head,[data-page="keywords"] .result-foot{padding:16px}
  [data-page="keywords"] .record-actions{display:flex;flex-wrap:wrap;gap:8px}
  [data-page="video"] .submit-row{flex-direction:column-reverse;align-items:stretch}
  [data-page="video"] .submit-row .primary{width:100%}
  [data-page="video"] #video-file{padding:10px;font-size:16px}
  [data-page="video"] #video-file::file-selector-button{padding:10px;margin-right:6px}
  [data-page="download"] #download-form{margin-top:20px}
  [data-page="download"] #link{min-height:120px}
  [data-page="download"] #submit{width:100%;min-height:52px;margin-top:16px}
  [data-page="download"] #result:not([hidden]){display:flex;flex-direction:column;gap:12px}
  [data-page="download"] #save{display:flex;align-items:center;justify-content:center;text-decoration:none}
  [data-page="download"] details{font-size:15px;color:var(--muted);margin:16px 0}
  [data-page="download"] summary{display:flex;align-items:center;color:var(--accent);cursor:pointer;text-decoration:underline}
  [data-page="templates"] .card-heading{display:block}
  [data-page="templates"] #copy{width:100%;min-height:52px}
  [data-page="templates"] h2{font-size:23px}
  [data-page="templates"] textarea{height:55dvh;min-height:260px}
  [data-page="materials"] #refresh,[data-page="materials"] #more{width:100%}
  [data-page="materials"] main>a{display:block;padding:12px 0;text-align:center;min-height:48px}
  [data-page="materials"] article a,[data-page="materials"] article button{display:block;min-height:48px;margin:10px 0;padding:10px 12px}
  [data-page="materials"] video{max-height:50dvh}
}
