/* ==========================================================================
   加权平均分计算器 · 页面专属样式
   设计意图：主体是一张实体成绩单——顶部装订、行间虚线、单元格直接可写；
   右侧结果卡像盖章后的成绩条，分数字号最大，权重分布用一条横条表示。
   仅本页引用。
   ========================================================================== */

.ws-desk {
    display: grid;
    grid-template-columns: minmax(0, 1.58fr) minmax(0, .92fr);
    gap: 20px;
    align-items: start;
    margin-top: 26px;
}

/* ---------- 成绩单 ---------- */
.ws-sheet {
    position: relative;
    background: var(--d3-card);
    border: 1px solid var(--d3-line);
    border-radius: var(--d3-radius);
    padding: 0 0 4px;
    overflow: hidden;
}

.ws-sheet::before {
    content: "";
    display: block;
    height: 4px;
    background: linear-gradient(90deg,
        var(--d3-accent) 0%,
        rgba(var(--d3-accent-rgb), .45) 46%,
        transparent 100%);
}

/* 装订孔：沿左侧一排小圆点 */
.ws-sheet::after {
    content: "";
    position: absolute;
    left: 9px;
    top: 26px;
    bottom: 18px;
    width: 4px;
    background-image: radial-gradient(circle, var(--d3-line-2) 1.6px, transparent 1.7px);
    background-size: 4px 16px;
    background-repeat: repeat-y;
    opacity: .8;
    pointer-events: none;
}

.ws-sheet-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 15px 18px 13px 24px;
    border-bottom: 1px solid var(--d3-line);
}

.ws-title {
    display: flex;
    align-items: baseline;
    gap: 9px;
}

.ws-title h2 {
    font-size: var(--d3-fs-h3);
    letter-spacing: -.01em;
}

.ws-title span {
    font-family: var(--d3-mono);
    font-size: 11.5px;
    color: var(--d3-ink-3);
    letter-spacing: .03em;
}

.ws-modes {
    margin-left: auto;
    display: inline-flex;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--d3-line-2);
    border-radius: 8px;
    background: var(--d3-paper-2);
}

.ws-mode {
    appearance: none;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--d3-ink-3);
    background: transparent;
    padding: 7px 11px;
    border-radius: 6px;
    white-space: nowrap;
    transition: background .15s ease, color .15s ease;
}

.ws-mode:hover { color: var(--d3-ink); }

.ws-mode.is-on {
    background: var(--d3-card);
    color: var(--d3-accent);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .07);
}

/* ---------- 工具条 ---------- */
.ws-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 18px 12px 24px;
    border-bottom: 1px dashed var(--d3-line);
}

.ws-btn {
    appearance: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 650;
    line-height: 1;
    padding: 9px 13px;
    border-radius: 7px;
    border: 1px solid var(--d3-accent);
    background: var(--d3-accent);
    color: var(--d3-accent-ink);
    transition: filter .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
}

.ws-btn:hover { filter: brightness(1.06); }

.ws-btn-ghost {
    background: transparent;
    border-color: var(--d3-line-2);
    color: var(--d3-ink-2);
}

.ws-btn-ghost:hover {
    border-color: var(--d3-accent);
    color: var(--d3-accent);
    background: rgba(var(--d3-accent-rgb), .06);
}

.ws-btn-sm { padding: 7px 11px; font-size: 12px; }

.ws-unit-tip {
    margin-left: auto;
    font-size: 11.5px;
    color: var(--d3-ink-3);
}

/* ---------- 粘贴区 ---------- */
.ws-paste {
    padding: 14px 18px 16px 24px;
    border-bottom: 1px dashed var(--d3-line);
    background: rgba(var(--d3-accent-rgb), .035);
}

.ws-paste textarea {
    width: 100%;
    margin-top: 6px;
    font-family: var(--d3-mono);
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--d3-ink);
    background: var(--d3-card);
    border: 1px solid var(--d3-line-2);
    border-radius: var(--d3-radius-sm);
    padding: 10px 12px;
    resize: vertical;
    outline: none;
}

.ws-paste textarea:focus {
    border-color: var(--d3-accent);
    box-shadow: 0 0 0 3px rgba(var(--d3-accent-rgb), .13);
}

.ws-paste-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    margin-top: 10px;
}

.ws-paste-actions .d3-hint { margin: 0; }

/* ---------- 表格 ---------- */
.ws-table-wrap {
    border: 0;
    border-radius: 0;
}

.ws-table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    font-size: 13.5px;
}

.ws-table th,
.ws-table td {
    padding: 8px 10px;
    text-align: right;
    border-bottom: 1px solid var(--d3-line);
    white-space: nowrap;
    vertical-align: middle;
}

.ws-table th {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--d3-ink-3);
    letter-spacing: .03em;
    background: transparent;
    padding-top: 11px;
    padding-bottom: 9px;
}

.ws-table th:first-child,
.ws-table td:first-child {
    text-align: left;
    padding-left: 24px;
}

.ws-table tbody tr:hover td { background: rgba(var(--d3-accent-rgb), .04); }

.ws-table tfoot td {
    font-weight: 700;
    background: var(--d3-card-2);
    border-top: 1px solid var(--d3-line-2);
    border-bottom: 0;
}

.ws-table td.num {
    font-family: var(--d3-mono);
    font-variant-numeric: tabular-nums;
}

.ws-col-name { width: 40%; }
.ws-col-weight { width: 15%; }
.ws-col-score { width: 15%; }
.ws-col-share { width: 22%; }
.ws-col-del { width: 8%; }

/* 单元格内的输入：无边框，聚焦才出现底纹 */
.ws-in {
    width: 100%;
    appearance: none;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--d3-ink);
    padding: 6px 7px;
    border-radius: 5px;
    outline: none;
    transition: background .14s ease, box-shadow .14s ease;
}

.ws-in:hover { background: var(--d3-paper-2); }

.ws-in:focus {
    background: var(--d3-card);
    box-shadow: inset 0 0 0 1px var(--d3-accent), 0 0 0 3px rgba(var(--d3-accent-rgb), .12);
}

.ws-in.is-bad {
    background: rgba(176, 42, 36, .07);
    box-shadow: inset 0 0 0 1px rgba(176, 42, 36, .55);
}

.ws-in.num {
    text-align: right;
    font-family: var(--d3-mono);
    font-variant-numeric: tabular-nums;
}

.ws-name { width: 100%; }

/* 占比条 */
.ws-share {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.ws-share-bar {
    flex: 1 1 auto;
    max-width: 96px;
    height: 6px;
    border-radius: 999px;
    background: var(--d3-paper-2);
    overflow: hidden;
}

.ws-share-bar i {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(var(--d3-accent-rgb), .55), var(--d3-accent));
    transition: width .22s ease;
}

.ws-share-txt {
    flex: none;
    width: 42px;
    text-align: right;
    font-family: var(--d3-mono);
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    color: var(--d3-ink-3);
}

/* 删除行 */
.ws-del {
    appearance: none;
    border: 0;
    background: transparent;
    cursor: pointer;
    color: var(--d3-ink-3);
    font-size: 15px;
    line-height: 1;
    padding: 6px 8px;
    border-radius: 5px;
    transition: color .14s ease, background .14s ease;
}

.ws-del:hover {
    color: var(--d3-bad);
    background: rgba(176, 42, 36, .09);
}

.ws-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

/* ---------- 结果卡 ---------- */
.ws-side {
    position: sticky;
    top: 76px;
    display: grid;
    gap: 12px;
}

.ws-score-card {
    position: relative;
    background: var(--d3-card);
    border: 1px solid var(--d3-line);
    border-radius: var(--d3-radius);
    padding: 18px;
    overflow: hidden;
}

.ws-score-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 108px;
    background: radial-gradient(300px 108px at 20% 0%, rgba(var(--d3-accent-rgb), .16), transparent 74%);
    pointer-events: none;
}

.ws-score-label {
    position: relative;
    font-family: var(--d3-mono);
    font-size: 11px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--d3-ink-3);
}

.ws-score {
    position: relative;
    margin-top: 8px;
    font-family: var(--d3-mono);
    font-variant-numeric: tabular-nums;
    font-size: clamp(38px, 6vw, 52px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.045em;
    color: var(--d3-ink);
}

.ws-score small {
    font-family: var(--d3-sans);
    font-size: 14px;
    font-weight: 600;
    color: var(--d3-ink-3);
    letter-spacing: 0;
    margin-left: 4px;
}

.ws-score-meta {
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--d3-ink-3);
}

.ws-grade-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.ws-grade {
    font-size: 12.5px;
    font-weight: 650;
    padding: 4px 10px;
    border-radius: 999px;
    color: var(--d3-accent);
    background: rgba(var(--d3-accent-rgb), .12);
}

.ws-gpa {
    font-family: var(--d3-mono);
    font-size: 12px;
    color: var(--d3-ink-2);
    margin-left: auto;
}

.ws-bar {
    display: flex;
    gap: 2px;
    margin-top: 14px;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--d3-paper-2);
}

.ws-bar i {
    display: block;
    height: 100%;
    min-width: 2px;
}

.ws-kv { margin-top: 14px; }

.ws-kv dd { font-variant-numeric: tabular-nums; }

/* 去最高最低步进器 */
.ws-trim {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--d3-line);
}

.ws-trim > label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--d3-ink-2);
    margin-bottom: 7px;
}

.ws-trim-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--d3-ink-3);
}

.ws-trim-row span { margin-left: 4px; }
.ws-trim-row b { color: var(--d3-accent); font-family: var(--d3-mono); }

.ws-step {
    appearance: none;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border: 1px solid var(--d3-line-2);
    border-radius: 6px;
    background: var(--d3-paper);
    color: var(--d3-ink-2);
    font-size: 15px;
    line-height: 1;
    display: grid;
    place-items: center;
    transition: border-color .14s ease, color .14s ease;
}

.ws-step:hover { border-color: var(--d3-accent); color: var(--d3-accent); }

#wsTrimN {
    width: 46px;
    height: 28px;
    text-align: center;
    font-family: var(--d3-mono);
    font-size: 13px;
    color: var(--d3-ink);
    background: var(--d3-paper);
    border: 1px solid var(--d3-line-2);
    border-radius: 6px;
    outline: none;
}

#wsTrimN:focus { border-color: var(--d3-accent); }

.ws-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px dashed var(--d3-line);
}

.ws-alerts { display: grid; gap: 8px; margin-top: 12px; }
.ws-alerts:empty { display: none; }

.ws-note {
    font-size: 12px;
    line-height: 1.72;
    color: var(--d3-ink-3);
    padding: 0 2px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
    .ws-desk { grid-template-columns: minmax(0, 1fr); }
    .ws-side { position: static; }
    .ws-score-card::before { height: 84px; }
}

@media (max-width: 700px) {
    .ws-sheet-head { padding-left: 18px; }
    .ws-sheet::after { display: none; }
    .ws-modes { margin-left: 0; width: 100%; }
    .ws-mode { flex: 1 1 0; padding: 8px 6px; }
    .ws-toolbar { padding-left: 18px; }
    .ws-unit-tip { margin-left: 0; }
    .ws-table th:first-child,
    .ws-table td:first-child { padding-left: 18px; }
    .ws-paste { padding-left: 18px; }
}

@media print {
    .d3-top, .d3-foot, .ws-toolbar, .ws-actions, .d3-related, .ws-paste { display: none !important; }
    .ws-desk { grid-template-columns: 1fr; }
    body { background: #fff; }
}
