/* 互動週期表樣式（由單檔 HTML 抽出；body.state-mode / body.cmp-mode 由 JS 切換） */

  :root {
    --pt-bg: #f3efe6;
    --ink: #1c2430;
    --muted: #5c6675;
    --line: rgba(28, 36, 48, .14);
    --alkali: #c4a06a;
    --alkaline: #3f7eb5;
    --transition: #7fbf62;
    --other: #a3a8ae;
    --metalloid: #8fa35a;
    --nonmetal: #f0d84a;
    --halogen: #5ec4e0;
    --noble: #f0a04a;
    --lanth: #d45a9e;
    --actin: #8d62c4;
    --panel: #fffdf8;
  }
  * { box-sizing: border-box; }
  .pt-app {
    font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "MingLiU-ExtB", "MingLiU", "Heiti TC", sans-serif;
    background:
      radial-gradient(1200px 500px at 10% -10%, #fff8e8 0%, transparent 55%),
      var(--pt-bg);
    color: var(--ink);
    
  }
  .wrap { max-width: 1440px; margin: 0 auto; padding: 22px 18px 48px; }
  header.top {
    display: flex; gap: 18px; align-items: flex-end; justify-content: space-between;
    flex-wrap: wrap; margin-bottom: 14px;
  }
  h1 {
    font-size: 34px; letter-spacing: .08em; margin: 0 0 4px;
    font-weight: 800;
  }
  .sub { color: var(--muted); font-size: 14px; margin: 0; }
  .tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
  input[type="search"] {
    border: 1px solid var(--line); background: #fff; border-radius: 999px;
    padding: 8px 14px; font-size: 14px; width: 220px; font-family: inherit;
  }
  button.tool, .legend button {
    border: 1px solid var(--line); background: #fff; border-radius: 999px;
    padding: 7px 12px; font-family: inherit; font-size: 13px; cursor: pointer; color: var(--ink);
  }
  button.tool.on, .legend button.on { background: #1c2430; color: #fff; border-color: #1c2430; }
  .legend {
    display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; align-items: center;
  }
  .legend button { display: inline-flex; align-items: center; gap: 6px; }
  .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,.15); }
  .board {
    background: rgba(255,255,255,.55);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 12px 16px;
    box-shadow: 0 10px 30px rgba(60, 40, 10, .05);
  }
  .ptable {
    display: grid;
    grid-template-columns: 58px repeat(18, minmax(0, 1fr));
    gap: 4px;
    align-items: stretch;
  }
  .gh, .ph, .gaplabel {
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: #102033; font-weight: 800; text-align: center; line-height: 1.05;
  }
  .gh {
    flex-direction: column; gap: 2px; min-height: 52px;
    background: #d9e6f5; border: 1px solid #7f9bb8; border-radius: 6px;
  }
  .gh .new { font-size: 16px; font-weight: 900; color: #102033; line-height: 1; }
  .gh .old { font-size: 13px; font-weight: 800; color: #1d4e89; line-height: 1; }
  .ph {
    font-size: 18px; font-weight: 900; color: #102033;
    background: #f3e6c4; border: 1px solid #c4a86a; border-radius: 6px;
  }
  .corner {
    position: relative;
    border: 2px solid #1c2430;
    border-radius: 6px;
    background: #fffdf8;
    min-height: 52px;
    overflow: hidden;
  }
  .corner svg { position: absolute; inset: 0; width: 100%; height: 100%; }
  .corner .zu, .corner .zhou {
    position: absolute; font-size: 13px; font-weight: 900; color: #102033; line-height: 1; background: rgba(255,253,248,.86);
  }
  .corner .zu { top: 4px; right: 4px; padding: 0 1px; }
  .corner .zhou { bottom: 4px; left: 3px; letter-spacing: .02em; padding: 0 1px; }
  .cell, .pholder {
    position: relative;
    border: 1px solid rgba(0,0,0,.16);
    border-radius: 6px;
    min-height: 78px;
    padding: 22px 3px 4px;
    cursor: pointer;
    background: #ddd;
    color: #1a1a1a;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
    transition: transform .12s ease, box-shadow .12s ease, opacity .15s ease;
    font-family: inherit;
    width: 100%;
  }
  .cell:hover, .pholder:hover { transform: translateY(-2px) scale(1.04); z-index: 3; box-shadow: 0 8px 16px rgba(0,0,0,.16); }
  .cell.sel { outline: 3px solid #1c2430; outline-offset: 1px; z-index: 2; }
  .cell.dim, .pholder.dim { opacity: .14; filter: grayscale(.4); }
  .cell.blank, .pholder.blank {
    background: #fff !important; color: transparent !important;
    border-color: #e6e1d6; box-shadow: none; opacity: 1; filter: none;
  }
  .cell.blank .zh, .cell.blank .mid, .cell.blank .mass, .pholder.blank span, .pholder.blank small { visibility: hidden; }
  .cell.blank { pointer-events: none; }
  .zh {
    position: absolute; top: 2px; right: 3px;
    font-size: 18px; font-weight: 700; letter-spacing: .02em; line-height: 1;
  }
  .mid { display: flex; align-items: flex-end; justify-content: center; line-height: 1; }
  .anum {
    font-size: 11px; font-weight: 800; margin-right: 1px; position: relative; bottom: 1px;
  }
  .sym { font-size: 22px; font-weight: 800; letter-spacing: -0.04em; line-height: .85; }
  .mass {
    margin-top: 5px; font-size: 10px; font-weight: 650; letter-spacing: .01em;
    font-variant-numeric: tabular-nums; opacity: .82;
  }
  .pholder { background: #f7f4ee; color: #9a3b3b; font-weight: 800; min-height: 74px; justify-content: center; padding-top: 8px; }
  .pholder span { font-size: 18px; }
  .pholder small { display: block; font-size: 10px; font-weight: 700; color: #6d5353; margin-top: 2px; }
  .series-label {
    grid-column: 1 / 3;
    display: flex; align-items: center; justify-content: flex-end;
    font-size: 12px; font-weight: 800; padding-right: 6px; color: #6b3a55;
  }
  .series-label.act { color: #5a3d78; }
  .spacer { grid-column: 1 / -1; height: 10px; }
  .note {
    margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.6;
  }
  .watermark {
    margin-top: 8px;
    text-align: right;
    font-family: "Palatino Linotype", Palatino, "Times New Roman", serif;
    font-size: 15px;
    font-style: italic;
    letter-spacing: .08em;
    color: rgba(28, 36, 48, .45);
    user-select: none;
  }
  .statekey { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: var(--muted); }
  .statekey b { font-style: normal; }
  .alkali { background: var(--alkali); }
  .alkaline { background: var(--alkaline); color: #fff; }
  .alkaline .mass, .alkaline .anum { color: #f4f7fb; }
  .transition { background: var(--transition); }
  .other { background: var(--other); }
  .metalloid { background: var(--metalloid); }
  .nonmetal { background: var(--nonmetal); }
  .halogen { background: var(--halogen); }
  .noble { background: var(--noble); }
  .lanth { background: var(--lanth); color: #fff; }
  .lanth .mass, .lanth .anum { color: #fff5fa; }
  .actin { background: var(--actin); color: #fff; }
  .actin .mass, .actin .anum { color: #f7f2ff; }
  body.state-mode .cell { background: #f7f5f0 !important; color: #1a1a1a !important; }
  body.state-mode .cell .mass, body.state-mode .cell .anum { color: #333 !important; }
  body.state-mode .sym.g, body.state-mode .cell:has(.sym.g) .zh,
  .cell.sel .sym.g, .cell.sel:has(.sym.g) .zh,
  .hero.st-g .big, .hero.st-g .hz, .st-g { color: #1e8a42 !important; }
  body.state-mode .sym.l, body.state-mode .cell:has(.sym.l) .zh,
  .cell.sel .sym.l, .cell.sel:has(.sym.l) .zh,
  .hero.st-l .big, .hero.st-l .hz, .st-l { color: #1d5fbf !important; }
  body.state-mode .sym.s, body.state-mode .cell:has(.sym.s) .zh,
  .cell.sel .sym.s, .cell.sel:has(.sym.s) .zh,
  .hero.st-s .big, .hero.st-s .hz, .st-s { color: #1a1a1a !important; }
  body.state-mode .sym.syn, body.state-mode .cell:has(.sym.syn) .zh,
  .cell.sel .sym.syn, .cell.sel:has(.sym.syn) .zh,
  .hero.st-syn .big, .hero.st-syn .hz, .st-syn { color: #c0392b !important; }
  #panel {
    position: fixed; top: 0; right: 0; height: 100vh; width: min(380px, 100vw);
    background: var(--panel); border-left: 1px solid var(--line);
    box-shadow: -12px 0 40px rgba(0,0,0,.08);
    transform: translateX(104%); transition: transform .22s ease;
    z-index: 20; padding: 22px 22px 32px; overflow: auto;
  }
  #panel.open { transform: none; }
  #panel .close {
    position: absolute; top: 12px; right: 12px; border: 0; background: #efeae0;
    width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 18px;
  }
  .hero {
    border-radius: 14px; padding: 16px 16px 12px; margin-bottom: 14px; color: #1a1a1a;
    min-height: 120px;
  }
  .hero .big { font-size: 64px; font-weight: 800; line-height: .9; letter-spacing: -0.04em; }
  .hero .hz { font-size: 28px; font-weight: 800; margin-top: 4px; }
  .hero .zy { font-size: 18px; letter-spacing: .12em; }
  .hero .en { font-size: 18px; opacity: .88; margin-top: 4px; font-weight: 650; letter-spacing: .02em; }
  .hero .hz, .hero .en { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .speak {
    border: 0; background: rgba(255,255,255,.72); color: #1c2430;
    width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
    font-size: 14px; line-height: 1; padding: 0;
  }
  .speak:hover { background: #fff; }
  .hero .big { cursor: pointer; }
  .pt-icon {
    width: 5px; height: 5px; border-radius: 1px; border: 0; background: currentColor;
    box-shadow: 6px 0 0 currentColor, 0 6px 0 currentColor, 6px 6px 0 currentColor;
    display: inline-block;
  }
  .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .fact {
    background: #f6f3ec; border-radius: 10px; padding: 8px 10px;
  }
  .fact span { display: block; font-size: 11px; color: var(--muted); }
  .fact b { font-size: 15px; font-weight: 750; }
  .fact.wide { grid-column: 1 / -1; }
  .hint { margin-top: 14px; font-size: 12px; color: var(--muted); line-height: 1.55; }
  .photo { margin: 0 0 12px; border-radius: 12px; overflow: hidden; background: #f6f3ec; min-height: 0; }
  .photo img { width: 100%; max-height: 160px; object-fit: cover; display: block; }
  .photo small { display: block; padding: 4px 8px 6px; color: var(--muted); font-size: 11px; }
  .alloys { margin-top: 10px; }
  .alloys h3 { font-size: 13px; margin: 0 0 6px; }
  .allo { background: #f6f3ec; border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; }
  .allo b { display: block; font-size: 14px; }
  .allo { padding: 8px 10px; }
  .allo b { font-size: 14px; }

  .allo span { display: block; font-size: 12px; color: #3d4a5c; margin-top: 2px; }

  @media (max-width: 900px) {
    h1 { font-size: 26px; }
    .cell, .pholder { min-height: 62px; padding-top: 14px; }
    .sym { font-size: 16px; }
    .zh { font-size: 13px; }
    .anum, .mass { font-size: 9px; }
  }
  @media print {
    #panel, .tools, .legend { display: none !important; }
    body { background: #fff; }
    .cell { break-inside: avoid; }
  }
  /* ===== 化合物互動區 ===== */
  #cmpZone {
    grid-column: 4 / 14; grid-row: 2 / 5;
    border: 2px dashed rgba(28,36,48,.35); border-radius: 12px;
    background: rgba(255,253,248,.85);
    display: none; flex-direction: column; gap: 5px;
    padding: 6px 8px; min-height: 0; overflow: hidden; z-index: 1;
    transition: background .15s, border-color .15s;
  }
  body.cmp-mode #cmpZone { display: flex; }
  #cmpZone.over { background: #fff4cf; border-color: #c4881a; }
  .cz-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; min-height: 26px; }
  .cz-title { font-weight: 800; color: #6b3a55; }
  .cz-chips { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; align-items: center; }
  .cz-empty { color: var(--muted); font-size: 12px; }
  .chip {
    display: inline-flex; align-items: center; gap: 3px; border-radius: 999px;
    padding: 1px 4px 1px 8px; font-weight: 800; font-size: 13px; cursor: pointer;
    border: 1px solid rgba(0,0,0,.2); color: #1a1a1a;
  }
  .chip.alkaline, .chip.lanth, .chip.actin { color: #fff; }
  .chip small { font-weight: 600; font-size: 11px; }
  .chip i { font-style: normal; width: 16px; height: 16px; line-height: 15px; text-align: center; border-radius: 50%; background: rgba(255,255,255,.65); color: #333; font-size: 12px; }
  .cz-head input {
    border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; font-size: 12px; width: 130px; font-family: inherit; background: #fff;
  }
  .cz-head button, .cz-filters button {
    border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 2px 9px;
    font-size: 12px; font-family: inherit; cursor: pointer; color: var(--ink);
  }
  .cz-filters { display: flex; gap: 4px; flex-wrap: wrap; }
  .cz-filters button.on { background: #1c2430; color: #fff; border-color: #1c2430; }
  .cz-count { font-size: 11px; color: var(--muted); }
  .cz-list { flex: 1; min-height: 0; overflow: auto; display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start; padding-right: 2px; }
  .cp {
    border: 1px solid rgba(0,0,0,.16); border-radius: 8px; background: #fff; cursor: pointer;
    padding: 2px 7px; font-family: inherit; text-align: left; line-height: 1.15; color: var(--ink);
  }
  .cp:hover { box-shadow: 0 3px 8px rgba(0,0,0,.15); transform: translateY(-1px); }
  .cp b { display: block; font-size: 14px; font-weight: 800; }
  .cp span { font-size: 11px; color: #3d4a5c; }
  .cp.exact { background: #fff0b8; border-color: #c4881a; }
  .cp.t-i { border-left: 4px solid #3f7eb5; } .cp.t-m { border-left: 4px solid #7fbf62; }
  .cp.t-a { border-left: 4px solid #d4513f; } .cp.t-b { border-left: 4px solid #8d62c4; }
  .cp.t-o { border-left: 4px solid #555; } .cp.t-e { border-left: 4px solid #f0a04a; }
  .cp.t-c, .cp.t-p { border-left: 4px solid #d45a9e; } .cp.t-h { border-left: 4px solid #5ec4e0; }
  .cell.inzone { outline: 3px solid #c4881a; outline-offset: 1px; z-index: 2; }
  .cmp-formula { font-size: 40px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; }
  .cmp-formula sup { font-size: .5em; }
  .tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,.75); margin-top: 6px; }
  .pct { display: flex; align-items: center; gap: 6px; font-size: 12px; margin: 3px 0; }
  .pct .bar { height: 8px; border-radius: 4px; background: #c4881a; }
  .cmp-el { display:inline-block; cursor:pointer; margin:2px 3px 0 0; }

  #cmpZone { contain: size; }
  .cz-head .chg { font-weight: 800; }
  .cz-head .chg.pos { color: #c0392b; border-color: #c0392b; }
  .cz-head .chg.neg { color: #1d5fbf; border-color: #1d5fbf; }
  .cz-head .chg:hover { background: #f6f3ec; }
  .cz-head input { margin-left: auto; }
  .cz-eq { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; min-height: 34px; max-height: 84px; overflow: auto;
    padding: 3px 4px; border-radius: 8px; background: rgba(28,36,48,.04); }
  .cz-eq .plus { font-weight: 800; color: #6b7280; font-size: 15px; }
  .cz-ph { width: 100%; text-align: center; color: #8b8f98; font-size: 17px; letter-spacing: .12em; }
  .chip.cpos { background: #fde3df; color: #c0392b; border-color: #c0392b; }
  .chip.cneg { background: #dce9fb; color: #1d5fbf; border-color: #1d5fbf; }
  .chip { font-size: 15px; }
  .cz-now { font-size: 14px; min-height: 0; }
  .cz-now b { font-size: 18px; }
  .cp.sim { background: #f1efe9; opacity: .85; }
  .cz-eq { min-height: 32px; max-height: 64px; flex: 0 0 auto; }
  .model3d { flex:0 0 250px; width:250px; border-left:1px solid var(--line); padding-left:6px; }
  .model3d .cz-msg { font-size:11px; line-height:1.3; }
  .model3d .tool { font-size:11px; padding:2px 8px; }
  .cz-res { flex: 1; min-height: 0; overflow: auto; display: flex; gap: 8px; align-items: flex-start; }
  .cz-msg { font-size: 12px; color: var(--muted); line-height: 1.5; padding: 2px 4px; }
  .cz-chiplist { display: flex; flex-wrap: wrap; gap: 4px; }
  .rc { border: 1px solid rgba(0,0,0,.18); border-radius: 10px; background: #fff; padding: 3px 8px 6px; display: flex; flex-direction: column; gap: 2px; flex: 0 0 auto; }
  .rc-h { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
  .rc-h b { font-size: 18px; }
  .rc-h em { font-style: normal; font-size: 11px; color: var(--muted); }
  .rc-h button { margin-left: auto; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 1px 9px; font-size: 12px; cursor: pointer; font-family: inherit; }
  .rc-b { display: flex; gap: 8px; }
  .sb { position: relative; width: 190px; height: 100px; overflow: hidden; border-radius: 8px; background: #fbfaf6; border: 1px solid #ece7da; }
  .sb .sl { position: absolute; top: 2px; left: 6px; font-size: 11px; font-weight: 700; color: #6b3a55; z-index: 1; }
  .sb svg { position: absolute; left: 0; top: 15px; width: 100%; height: calc(100% - 15px); display: block; }
  .sb.wide { width: auto; min-width: 230px; padding: 22px 14px 6px; display: flex; align-items: center; }
  .simple { font-size: 30px; font-weight: 800; }
  .simple small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
/* One noninteractive tooltip; never captures the drag target or pointer. */
#atomPreview {
  position:fixed; z-index:60; pointer-events:none; user-select:none;
  width:292px; max-width:calc(100vw - 16px); max-height:calc(100vh - 16px);
  overflow:hidden; padding:12px 14px 10px; border:1px solid #d8c8a5;
  border-radius:16px; background:rgba(255,253,247,.98); color:var(--ink);
  box-shadow:0 12px 36px rgba(52,40,20,.2); font-size:12px; line-height:1.45;
}
#atomPreview[hidden] { display:none; }
#atomPreview .ap-heading { display:flex; align-items:baseline; gap:7px; }
#atomPreview .ap-symbol { font-size:25px; font-weight:800; }
#atomPreview .ap-name { font-size:16px; font-weight:750; }
#atomPreview .ap-number { margin-left:auto; color:var(--muted); }
#atomPreview .ap-shells { font-size:13px; font-weight:700; margin-top:2px; }
#atomPreview canvas { display:block; width:100%; height:auto; max-height:230px; object-fit:contain; }
#atomPreview .ap-config { font-size:11px; color:#655842; overflow-wrap:anywhere; }
#atomPreview .ap-note { margin:6px 0 0; font-size:11px; color:var(--muted); }
#atomPreview .ap-source { margin-top:3px; font-size:10px; color:#7b725f; }
@media (max-height:500px) {
  #atomPreview { width:260px; padding:7px 10px; }
  #atomPreview canvas { max-height:130px; }
  #atomPreview .ap-note { margin-top:2px; }
}
@media (max-height:360px) {
  #atomPreview canvas { height:70px; max-height:70px; }
  #atomPreview .ap-config, #atomPreview .ap-source { display:none; }
}
@media print { #atomPreview { display:none !important; } }


main.wide{max-width:1440px}
.pt-app{border-radius:12px}
/* 手機：表格維持可讀寬度，改為橫向捲動 */
@media (max-width: 900px){
  .board{overflow-x:auto;-webkit-overflow-scrolling:touch}
  .ptable{min-width:880px}
}
