/* ============================================================
   元素周期表 · periodicTable.css
   只作用于 .pt-app 内部，避免影响站点其它模块
   ============================================================ */

.tool-content {
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    padding: 1.2em;
    border-radius: .6em;
    position: relative;
}

.pt-app {
    --pt-rail: 320px;
    --pt-line: #e7e9ef;
    --pt-ink: #252525;
    --pt-muted: #8b919c;
    --pt-soft: #f7f8fb;
    color: var(--pt-ink);
    width: 100%;
    max-width: 100%;
}

/* ---------- 工具条 ---------- */
.pt-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px 14px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.pt-tip {
    font-size: 12.5px;
    color: var(--pt-muted);
    line-height: 1.5;
}

.pt-tip b {
    color: var(--pt-ink);
    font-weight: 600;
}

.pt-search {
    position: relative;
}

.pt-search input {
    width: 250px;
    max-width: 100%;
    padding: 8px 14px 8px 32px;
    border: 1px solid var(--pt-line);
    border-radius: 999px;
    background: #fff;
    font-size: 13px;
    color: var(--pt-ink);
    font-family: inherit;
    outline: none;
    transition: none;
}

.pt-search input::placeholder {
    color: #9098a4;
    font-size: 13px;
    font-weight: 400;
}

.pt-search input:focus {
    border-color: #b7b1f7;
    box-shadow: 0 0 0 3px rgba(60, 44, 255, .08);
}

.pt-search svg {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    opacity: .42;
    pointer-events: none;
}

/* ---------- 图例 ---------- */
.pt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.pt-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 7px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--pt-line);
    font-size: 12px;
    color: #4a5160;
    font-family: inherit;
    cursor: pointer;
    user-select: none;
    transition: none;
}

.pt-chip .dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--c);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}

.pt-chip .en {
    opacity: .45;
    font-size: 10.5px;
}

.pt-chip:hover {
    border-color: #cbcfd9;
    transform: translateY(-1px);
}

.pt-chip.on {
    border-color: rgba(60, 44, 255, .45);
    background: #f2f1ff;
    color: #2b1fc4;
    font-weight: 600;
}

.pt-chip-reset {
    color: var(--pt-muted);
    border-style: dashed;
}

/* ---------- 主区：表格 + 右侧浮动详情栏 ---------- */
.pt-body {
    position: relative;
    display: block;
}

.pt-main {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    container-type: inline-size;
}

.ptable {
    display: grid;
    grid-template-columns: 18px repeat(18, minmax(0, 1fr));
    gap: 4px;
    min-width: 690px;
}

.pt-glabel {
    grid-row: 1;
    font-size: 9px;
    color: #a6adb8;
    text-align: center;
    align-self: end;
    padding-bottom: 1px;
    font-variant-numeric: tabular-nums;
}

.pt-plabel {
    grid-column: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: #a6adb8;
    font-variant-numeric: tabular-nums;
}

.pt-cell {
    position: relative;
    aspect-ratio: 1 / 1;
    border: 1px solid rgba(0, 0, 0, .06);
    border-radius: 7px;
    background: var(--c);
    color: #23293a;
    padding: 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-family: inherit;
    overflow: hidden;
    contain: layout paint style;
    /* 悬停不做任何补间：状态瞬间切换；提层避免首次悬停才创建合成层的卡顿 */
    transition: none;
    will-change: transform;
}

.pt-cell .num {
    position: absolute;
    top: 2px;
    left: 3px;
    font-size: 8px;
    line-height: 1;
    opacity: .6;
    font-variant-numeric: tabular-nums;
}

.pt-cell .sym {
    font-size: 15px;
    font-size: clamp(11px, 1.75cqw, 19px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: .01em;
}

.pt-cell .zh {
    font-size: 9px;
    font-size: clamp(7px, 1.05cqw, 10.5px);
    line-height: 1.1;
    margin-top: 2px;
    opacity: .85;
    white-space: nowrap;
}

.pt-cell .mass {
    font-size: 8px;
    font-size: clamp(6px, 1cqw, 9px);
    line-height: 1.1;
    margin-top: 1px;
    opacity: .5;
    font-variant-numeric: tabular-nums;
}

.pt-cell:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 22px -6px rgba(22, 32, 46, .32), 0 3px 8px rgba(22, 32, 46, .14);
    border-color: rgba(255, 255, 255, .9);
    z-index: 3;
}

.pt-cell:active {
    transform: translateY(-1px);
}

.pt-cell.active {
    transform: translateY(-3px);
    box-shadow: 0 0 0 2px rgba(60, 44, 255, .55), 0 9px 20px -6px rgba(22, 32, 46, .3);
    z-index: 4;
}

.pt-cell.dim {
    background: #eceef2;
    color: #b0b7c2;
    pointer-events: none;
    box-shadow: none;
    border-color: transparent;
}

@container (max-width: 900px) {
    .pt-cell .mass {
        display: none;
    }
}

@container (max-width: 700px) {
    .pt-cell .zh {
        display: none;
    }
}

.pt-marker {
    aspect-ratio: 1 / 1;
    border: 1.5px dashed #d3d9e3;
    border-radius: 7px;
    background: var(--pt-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: #97a0ad;
    line-height: 1.25;
    text-align: center;
}

.pt-marker b {
    font-size: 9px;
    color: #8a94a3;
    font-weight: 600;
}

.pt-rowlabel {
    grid-column: 2 / 4;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 5px;
    font-size: 9px;
    color: #97a0ad;
    letter-spacing: .05em;
}

/* ---------- 类别色 ---------- */
.pt-c-am { --c: #f4a8a8; }
.pt-c-ae { --c: #f8c894; }
.pt-c-tm { --c: #f2e189; }
.pt-c-pt { --c: #c3e08c; }
.pt-c-ml { --c: #95dcb8; }
.pt-c-nm { --c: #8ecdeb; }
.pt-c-hl { --c: #a3b1ee; }
.pt-c-ng { --c: #bda6ea; }
.pt-c-ln { --c: #f2a7cd; }
.pt-c-ac { --c: #d79fe9; }
.pt-c-unk { --c: #d9dee5; }

/* ---------- 右侧详情栏：整个抽屉做成独立合成层，只用 transform 滑入 ---------- */
.pt-rail {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--pt-rail);
    z-index: 40;
    pointer-events: none;
    /* 收起时整体移出屏幕右侧（连投影一起），滑出/滑入都在 GPU 合成层上完成 */
    transform: translate3d(calc(100% + 34px), 0, 0);
    will-change: transform;
    backface-visibility: hidden;
    transition: transform .4s cubic-bezier(.22, .61, .36, 1);
}

.pt-rail.open {
    transform: translate3d(0, 0, 0);
    pointer-events: auto;
}

.pt-panel {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #dfe3ec;
    border-left: 1px solid #d7dde8;
    border-radius: 10px 0 0 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    /* 向左的投影：抽屉浮在页面之上，静态绘制在层内，不参与逐帧重绘 */
    box-shadow: -12px 0 28px -16px rgba(22, 32, 46, .2),
        -2px 0 10px -6px rgba(22, 32, 46, .1),
        inset 26px 0 30px -28px rgba(22, 32, 46, .12);
    contain: layout;
}

.pt-head {
    position: relative;
    flex: none;
    padding: 14px 14px 12px;
    background: var(--c);
    background: linear-gradient(160deg, var(--c) 0%, color-mix(in srgb, var(--c) 58%, #fff) 100%);
    border-radius: 10px 0 0 0;
}

.pt-head .row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pt-sym {
    width: 52px;
    height: 52px;
    flex: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, .72);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 23px;
    font-weight: 800;
    box-shadow: 0 3px 10px rgba(22, 32, 46, .12);
}

.pt-zh {
    font-size: 21px;
    font-weight: 700;
    line-height: 1.15;
}

.pt-en {
    font-size: 11.5px;
    color: #485566;
    margin-top: 2px;
}

.pt-close {
    position: absolute;
    top: 9px;
    right: 9px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .6);
    color: #3a4a5e;
    font-size: 13px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: none;
}

.pt-close:hover {
    background: #fff;
    color: #16283c;
    box-shadow: 0 1px 4px rgba(22, 32, 46, .14);
}

.pt-close:active {
    background: #eef1f6;
}

.pt-close:focus-visible {
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(60, 44, 255, .14);
}

.pt-nav {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.pt-nav button {
    flex: 1;
    min-width: 0;
    padding: 8px 6px;
    border-radius: 8px;
    border: 1px solid #e1e6ef;
    background: #fff;
    color: #33445a;
    font-size: 12px;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
    transition: none;
}

.pt-nav button:hover {
    transform: translateY(-2px);
    background: #fff;
    border-color: #c9d2e1;
    color: #16283c;
    box-shadow: 0 6px 14px -6px rgba(22, 32, 46, .3);
}

.pt-nav button:active {
    transform: translateY(0);
    background: #eceff7;
    border-color: #c2ccdd;
    box-shadow: 0 1px 3px rgba(22, 32, 46, .12);
}

.pt-nav button:focus-visible {
    outline: none;
    border-color: rgba(60, 44, 255, .55);
    box-shadow: 0 0 0 3px rgba(60, 44, 255, .13);
}

.pt-nav button.on {
    background: #f5f7fb;
    border-color: rgba(60, 44, 255, .42);
    color: #2b1fc4;
    font-weight: 600;
}

.pt-bohr {
    flex: none;
    padding: 16px 8px 6px;
    display: flex;
    justify-content: center;
    contain: layout paint;
}

.pt-bohr svg {
    width: 200px;
    height: auto;
}

.pt-body-pad {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2px 12px 12px;
}

.pt-title {
    font-size: 10px;
    letter-spacing: .16em;
    color: #98a0ad;
    text-transform: uppercase;
    margin: 18px 0 8px;
}

.pt-list {
    display: grid;
    gap: 1px;
    background: var(--pt-line);
    border: 1px solid var(--pt-line);
    border-radius: 9px;
    overflow: hidden;
}

.pt-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 10px;
    background: #fff;
    font-size: 12.5px;
    line-height: 1.5;
}

.pt-item span {
    color: #78818f;
    flex: none;
}

.pt-item b {
    font-weight: 600;
    text-align: right;
    min-width: 0;
    font-variant-numeric: tabular-nums;
}

.pt-item b sup {
    font-size: .72em;
}

.pt-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pt-tag i {
    width: 9px;
    height: 9px;
    border-radius: 3px;
    background: var(--c);
}

.pt-tag em {
    font-style: normal;
}

.pt-note {
    margin: 10px 0 0;
    padding-top: 10px;
    margin-top: auto;
    font-size: 11px;
    color: #a3aab6;
    line-height: 1.6;
    border-top: 1px solid #f1f3f7;
}

/* 同族 / 同系快捷跳转 */
.pt-peers {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pt-peer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid #e3e7ef;
    border-radius: 9px;
    background: #fbfcfe;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.2;
    color: #38455a;
    cursor: pointer;
    transition: none;
}

.pt-peer:hover {
    background: #fff;
    border-color: #c9d2e1;
    box-shadow: 0 6px 14px -6px rgba(22, 32, 46, .26);
    transform: translateY(-2px);
}

.pt-peer:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(22, 32, 46, .12);
}

.pt-peer i {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 3px;
    background: var(--c);
}

.pt-peer b {
    font-weight: 600;
}

.pt-peer em {
    font-style: normal;
    color: #98a0ad;
    font-variant-numeric: tabular-nums;
}

.pt-foot {
    margin: 10px 0 0;
    font-size: 11.5px;
    color: #9299a5;
    line-height: 1.7;
}

.pt-foot b {
    color: #6b7480;
    font-weight: 600;
}

/* ---------- 窄屏：详情栏宽度收一点，避免压掉太多格子 ---------- */
@media (max-width: 1100px) {
    .pt-rail {
        width: min(290px, 100%);
    }
}

@media (max-width: 768px) {
    .pt-search input {
        width: 100%;
        font-size: 16px;
    }

    .pt-search {
        flex: 1 1 100%;
    }

    .pt-toolbar {
        gap: 8px;
    }

    /* 手机端：详情变成铺满屏幕高度的浮层卡片，内容在内部滚动 */
    .pt-rail {
        top: 8px;
        right: 8px;
        bottom: 8px;
        left: 8px;
        width: auto;
        z-index: 200;
        border-radius: 14px;
    }

    .pt-panel {
        border-radius: 14px;
        border-color: #cfd6e2;
        box-shadow: 0 10px 40px -18px rgba(22, 32, 46, .5);
    }

    .ptable {
        min-width: 660px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pt-app *,
    .pt-app *::before,
    .pt-app *::after {
        transition: none !important;
        animation: none !important;
    }
}
