/* 基本排版 */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(12px, 2vw, 24px);
}

.hero {
    margin-bottom: 12px;
}

.page-title {
    font-size: clamp(22px, 3vw, 32px);
    margin: 0 0 6px;
    line-height: 1.25;
}

.page-subtitle {
    margin: 0;
    color: var(--muted, #9CA3AF);
}

/* 橫向並排（桌機） */
.row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

@media (max-width: 980px) {
    .row-2 {
        grid-template-columns: 1fr;
    }
}

/* 卡片 */
.card {
    background: var(--card-bg, #0b1220);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 16px;
    padding: 14px;
    margin: 8px 0;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

/* 表單與控制 */
:root {
    --control-h: 40px;
    --ring: 0 0 0 3px rgba(59, 130, 246, .35);
}

.field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.label {
    font-weight: 600;
}

.input-with-hint {
    display: grid;
    gap: 4px;
}

.input,
select {
    width: 100%;
    max-width: 100%;
    height: var(--control-h);
    padding: 0 12px;
    border-radius: 10px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .03);
    color: #E5E7EB;
}

/* 下拉辨識度與聚焦 */
select {
    background: linear-gradient(180deg, #111827, #0b1220);
    border-color: rgba(255, 255, 255, .18);
}

select:focus,
.input:focus {
    outline: none;
    border-color: rgba(59, 130, 246, .65);
    box-shadow: var(--ring);
}

option {
    color: #E5E7EB;
    background: #1F2937;
}

.hint {
    font-size: 12px;
    color: var(--muted, #9CA3AF);
}

.hint.error {
    color: #F87171;
    font-weight: 700;
}

/* 隱藏 number 的上下箭頭 */
.no-spin {
    -moz-appearance: textfield;
}

.no-spin::-webkit-outer-spin-button,
.no-spin::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* 網格工具 */
.grid {
    display: grid;
    gap: 12px;
}

.grid-1 {
    grid-template-columns: 1fr;
}

/* 讓裝備分類與裝備兩欄各 50% 並左右對齊 */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* 50% / 50% */
    gap: 10px;
}


/* 裝備分類 / 裝備 */
.grid-3 {
    grid-template-columns: repeat(3, 1fr);
    align-items: end;
}

@media (max-width: 960px) {
    .grid-3 {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* 按鈕 */
.btn {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, .14);
    background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02));
    color: #fff;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform .06s ease, box-shadow .2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.btn-primary {
    border-color: rgba(59, 130, 246, .35);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, .35) inset;
}

.btn-ghost {
    background: transparent;
    border-color: rgba(255, 255, 255, .18);
}

/* 展示區 */
.display-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 14px;
    align-items: start;
}

@media (max-width: 520px) {
    .display-grid {
        grid-template-columns: 1fr;
    }
}

.equip-figure {
    margin: 0;
    display: grid;
    place-items: center;
    padding: 12px;
    border: 1px dashed rgba(255, 255, 255, .12);
    border-radius: 12px;
    background: rgba(255, 255, 255, .02);
    min-height: 300px;
}

.equip-figure img {
    width: 240px;
    height: 240px;
    object-fit: contain;
    aspect-ratio: 1/1;
    image-rendering: -webkit-optimize-contrast;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .25));
}

.equip-name {
    margin-top: 8px;
    font-weight: 700;
    text-align: center;
}

.equip-meta {
    display: grid;
    gap: 8px;
}

.kv {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.k {
    color: #9CA3AF;
}

.v {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.meta-table-wrap {
    overflow: auto;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 10px;
}

.meta-table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.meta-table th,
.meta-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    white-space: nowrap;
}

.meta-table tr:last-child td {
    border-bottom: none;
}

/* 加成黃字 */
.plus {
    color: #FACC15;
    font-weight: 800;
    margin-left: 6px;
}

/* 操作區與統計 */
.actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    flex-wrap: wrap;
}

.actions-left,
.actions-right {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.stat-box {
    display: inline-flex;
    align-items: center;
    height: var(--control-h);
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 10px;
    background: rgba(255, 255, 255, .03);
    font-weight: 700;
}

.live-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
    font-variant-numeric: tabular-nums;
}

/* 成功分佈 */
.hist-legend {
    font-size: 12px;
    color: #9CA3AF;
    margin-bottom: 6px;
}

.hist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 8px;
}

.hist-cell {
    padding: 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(255, 255, 255, .08);
    text-align: center;
}

.hist-k {
    font-size: 12px;
    color: #9CA3AF;
}

.hist-v {
    font-weight: 800;
    margin-top: 4px;
}

/* 備註 */
.note {
    color: #9CA3AF;
    font-size: 13px;
}

/* 括號的輔助樣式：顏色偏淡，與主數值區隔 */
.paren {
    color: var(--muted, #9CA3AF);
    margin-left: 6px;
    white-space: nowrap;
}

/* 手機版不顯示裝備圖片（≤640px） */
@media (max-width: 640px) {
    #equipImage {
        display: none !important;
    }

    /* 避免留下大空白：縮小圖片容器樣式，但保留裝備名稱 */
    .equip-figure {
        min-height: 0;
        padding: 0;
        border: 0;
        background: transparent;
        place-items: start;
    }

    .equip-name {
        margin: 0 0 6px;
        text-align: left;
    }
}

.hist-pct {
    font-size: 12px;
    color: var(--muted, #9CA3AF);
    margin-top: 2px;
    white-space: nowrap;
}

/* 廣告區 */
.ad {
    position: relative;
    top: 10px;
    width: min(970px, calc(100vw - 32px));
    max-width: 100%;
    height: 90px;
    /* background: #333;
    border: 1px dashed #aaa;
    color: #fff; */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 8px;
    z-index: 1;
    margin: 0 auto;
}

/* 底部位置 */
.ad-bottom-test {
    left: auto;
}

.ad-right-push {
    position: fixed;
    top: 180px;
    width: 10px;
    height: 10px;
    right: calc(50% - 650px);
}

/* 小螢幕隱藏，避免擠壓內容 */
@media (max-width: 1400px) {
    .ad {
        display: none;
    }
}