/* Chemistry Draw page (phoenicx.org/chemdraw/) – hosts the Ketcher editor */
.chem{padding-top:18px}
.chem-wrap{max-width:1720px}
.chem-head{margin:6px 0 14px}
.chem-head .crumbs{margin-bottom:8px}
.chem-title{display:flex;align-items:flex-end;justify-content:space-between;gap:18px;flex-wrap:wrap}
.chem-title h1{font:800 clamp(26px,3vw,36px)/1.1 var(--head);letter-spacing:-.5px;margin:0}
.chem-title .lead{margin:6px 0 0;font-size:15.5px;color:var(--muted);max-width:none}
.chem-chips .chip i{color:var(--flame);margin-right:2px}

.chem-bar{display:flex;align-items:center;flex-wrap:wrap;gap:10px 18px;padding:12px 14px!important;margin-bottom:12px}
.chem-actions{display:flex;flex-wrap:wrap;gap:8px}
.chem-actions .btn[disabled]{opacity:.5;cursor:wait}
.chem-actions kbd{font:600 11px var(--mono);padding:2px 6px;border-radius:6px;background:rgba(0,0,0,.18);margin-left:4px;letter-spacing:0}
.chem-opts{display:flex;flex-wrap:wrap;gap:8px 16px;align-items:center}
.seg{display:inline-flex;align-items:center;gap:4px;font-size:13px;color:var(--muted)}
.seg-l{margin-right:4px;font-weight:600}
.seg label{position:relative;cursor:pointer}
.seg input[type=radio]{position:absolute;opacity:0;pointer-events:none}
.seg label > span{display:inline-block;padding:6px 11px;border:1px solid var(--line2);border-radius:9px;color:var(--text);font-weight:500}
.seg input:checked + span{border-color:var(--ember);background:rgba(255,106,31,.12);color:var(--flame)}
.seg input:focus-visible + span{outline:2px solid var(--flame);outline-offset:2px}
.seg select{background:var(--bg2);color:var(--text);border:1px solid var(--line2);border-radius:9px;padding:6px 8px;font:500 13px var(--body)}
.chem-msg{flex:1 1 100%;font-size:13.5px;min-height:0;display:none;align-items:center;gap:10px;flex-wrap:wrap;padding:9px 12px;border-radius:10px;border:1px solid var(--line2);background:var(--bg2)}
.chem-msg.show{display:flex}
.chem-msg.ok{border-color:rgba(34,197,94,.45);color:#86efac}
.chem-msg.warn{border-color:rgba(255,174,66,.5);color:var(--flame)}
.chem-msg .btn{padding:6px 12px;font-size:13px}

.chem-frame{position:relative;height:calc(100vh - 120px);min-height:620px;scroll-margin-top:88px;border-radius:16px;overflow:hidden;border:1px solid var(--line2);background:#fff;box-shadow:0 18px 50px -24px rgba(0,0,0,.55)}
.chem-frame iframe{display:block;width:100%;height:100%;border:0;background:#fff}
.chem-loading{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;gap:12px;background:#fff;color:#334155;font:500 15px var(--body);transition:opacity .3s}
.chem-loading.done{opacity:0;pointer-events:none}
.chem-loading .spin{width:22px;height:22px;border-radius:50%;border:3px solid #e2e8f0;border-top-color:#ff6a1f;animation:cdspin .8s linear infinite}
@keyframes cdspin{to{transform:rotate(360deg)}}

.chem-tips{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:14px 0}
.chem-tips .tip{display:flex;gap:12px;padding:14px 16px!important}
.chem-tips .tip > i{flex:none;width:34px;height:34px;border-radius:9px;display:flex;align-items:center;justify-content:center;background:rgba(255,106,31,.1);color:var(--flame)}
.chem-tips .tip > div > b{display:block;font-size:14.5px;margin-bottom:3px}
.chem-tips p{margin:0;font-size:13.5px;color:var(--muted);line-height:1.5}

.chem-credit{padding:18px 20px!important;margin:0 0 30px}
.chem-credit h2{font:700 17px var(--head);margin:0 0 8px}
.chem-credit h2 i{color:var(--flame);margin-right:4px}
.chem-credit p{margin:6px 0;font-size:14px;color:var(--muted);line-height:1.55}
.chem-credit .chem-powered{font-size:15px;color:var(--text);font-weight:600}
.chem-credit a{color:var(--flame)}
.chem-note{font-size:12.5px!important}

html[data-theme="light"] .chem-msg.ok{color:#15803d}
html[data-theme="light"] .chem-msg.warn{color:#b45309}
html[data-theme="light"] .chem-actions kbd{background:rgba(255,255,255,.28)}

@media (max-width:1100px){.chem-tips{grid-template-columns:1fr}}
@media (max-width:720px){
  .chem{padding-top:12px}
  .chem-frame{height:78vh;min-height:520px;border-radius:12px}
  .chem-actions{width:100%}
  .chem-actions .btn{flex:1 1 auto;justify-content:center}
  .chem-actions kbd{display:none}
  .chem-chips{display:none}
}
