/* ============================================================
   基础样式：设计变量、重置、通用控件（图标 / 按钮 / 分段页签 / 详情面板 / 弹窗 / 滚动条）
   页面样式：css/skill.css（技能加点）、css/spray.css（喷漆制作）、css/entry.css（词条）
   三个页面均只依赖本文件与各自页面样式，无外部样式依赖
   ============================================================ */

:root {
    --bg: #eef1f6;
    --panel: #ffffff;
    --line: #e5e9f0;
    --line-2: #d6dde7;
    --ink: #1d2531;
    --muted: #7a8699;
    --faint: #9aa5b1;
    --accent: #1e9fff;
    --accent-2: #1a8feb;
    --ok: #16b777;
    --warn: #ffa726;
    --danger: #f4511e;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(29, 37, 49, .05), 0 12px 28px -20px rgba(29, 37, 49, .5);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 13px/1.5 "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* 表单控件固定浅色渲染，避免系统深色模式把滑杆 / 输入框变暗 */
button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
    color-scheme: light;
}

[hidden] {
    display: none !important;
}

/* ---------- 图标：内联 SVG，描边取 currentColor ---------- */

.ico {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- 按钮 ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--line-2);
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s, opacity .15s;
}

.btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.btn.primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.btn.primary:hover:not(:disabled) {
    border-color: var(--accent-2);
    background: var(--accent-2);
    color: #fff;
}

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

/* 顶栏按钮：图标 + 短标签，窄屏只留图标 */
.tbtn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    transition: background .15s, color .15s;
}

.tbtn:hover:not(:disabled) {
    background: #f1f5fa;
    color: var(--accent);
}

.tbtn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.tbtn .ico {
    width: 15px;
    height: 15px;
}

/* ---------- 分段页签 ---------- */

.pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    border-radius: 11px;
    background: #e6ebf3;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 12.5px;
    transition: background .15s, color .15s, box-shadow .15s;
}

.pill:hover {
    color: var(--ink);
}

.pill.on {
    background: #fff;
    color: var(--accent);
    font-weight: 600;
    box-shadow: var(--shadow);
}

/* ---------- 数值标签 ---------- */

.stat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 8px;
    background: #f2f5fa;
    color: var(--muted);
    font-size: 12px;
}

.stat b {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.stat.-accent {
    background: #eaf5ff;
    color: var(--accent);
}

.stat.-accent b {
    color: var(--accent);
}

.chip {
    max-width: 160px;
    padding: 3px 8px;
    border-radius: 7px;
    background: #f2f5fa;
    color: var(--muted);
    font-family: ui-monospace, Consolas, monospace;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chip.-warn {
    background: #fff3e0;
    color: #b26a00;
    font-family: inherit;
}

.spacer {
    flex: 1;
}

/* ---------- 右侧详情面板（技能 / 词条共用） ---------- */

.detail-empty {
    flex: 1;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 8px;
    border: 1.5px dashed var(--line-2);
    border-radius: 12px;
    color: var(--faint);
    font-size: 12px;
}

.detail-empty .ico {
    width: 26px;
    height: 26px;
}

.detail-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.detail-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}

.detail-name {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 14.5px;
    font-weight: 600;
}

.detail-lv {
    color: var(--muted);
    font-size: 11.5px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.detail-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
}

.detail-desc {
    display: flex;
    flex-direction: column;
    gap: 3px;
    color: #48546a;
    font-size: 12.5px;
    line-height: 1.7;
}

.detail-actions {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--line);
}

.detail-actions .btn {
    flex: 1;
}

/* ---------- 滚动条 ---------- */

.scroll {
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: #c6cfdc transparent;
}

.scroll::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

.scroll::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 9px;
    background: #c6cfdc;
    background-clip: content-box;
}

.scroll::-webkit-scrollbar-thumb:hover {
    background: #aeb9c8;
    background-clip: content-box;
}

.scroll::-webkit-scrollbar-track {
    background: transparent;
}

/* ---------- 弹窗内容 ---------- */

.dlg {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
}

.dlg-row {
    display: flex;
    gap: 8px;
}

.dlg-input {
    flex: 1;
    min-width: 0;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line-2);
    border-radius: 9px;
    background: #f7f9fc;
    font-family: ui-monospace, Consolas, monospace;
    font-size: 12px;
    outline: none;
}

.dlg-input:focus {
    border-color: var(--accent);
    background: #fff;
}

.dlg-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    color: var(--muted);
}

.dlg-body {
    padding: 16px;
    line-height: 1.7;
}

.spin {
    width: 16px;
    height: 16px;
    border: 2px solid var(--line-2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------- 弹窗（js/common/dialog.js） ---------- */

.md-mask {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(29, 37, 49, .34);
    animation: md-in .15s ease;
}

/* 不压暗背景：iframe 工具窗口用 */
.md-mask.-plain {
    background: transparent;
}

.md-mask.-full {
    padding: 0;
}

.md-card {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
    border-radius: 12px;
    background: var(--panel);
    box-shadow: 0 20px 50px -20px rgba(29, 37, 49, .6);
    animation: md-pop .16s ease;
}

.md-mask.-full .md-card {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.md-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px 11px 14px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    font-weight: 600;
}

.md-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.md-close {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--faint);
    cursor: pointer;
    transition: background .15s, color .15s;
}

.md-close:hover {
    background: #f1f5fa;
    color: var(--ink);
}

.md-close .ico {
    width: 14px;
    height: 14px;
}

.md-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* iframe 子页：由 iframe 撑满卡片 */
.md-body.-frame {
    overflow: hidden;
}

.md-body.-frame iframe {
    flex: 1 1 auto;
    width: 100%;
    border: 0;
    display: block;
    background: var(--bg);
}

.md-confirm {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
}

.md-confirm p {
    margin: 0;
    color: #48546a;
    font-size: 12.5px;
    line-height: 1.7;
}

.md-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ---------- 轻提示 ---------- */

.toasts {
    position: fixed;
    top: 64px;
    left: 50%;
    z-index: 120;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transform: translateX(-50%);
    pointer-events: none;
}

.toast {
    max-width: 70vw;
    padding: 7px 14px;
    border-radius: 10px;
    background: rgba(29, 37, 49, .9);
    color: #fff;
    font-size: 12.5px;
    text-align: center;
    overflow-wrap: break-word;
    box-shadow: 0 10px 26px -14px rgba(0, 0, 0, .8);
    animation: md-in .16s ease;
    transition: opacity .2s, transform .2s;
}

.toast.-out {
    opacity: 0;
    transform: translateY(-6px);
}

@keyframes md-in {
    from {
        opacity: 0;
    }
}

@keyframes md-pop {
    from {
        opacity: 0;
        transform: translateY(6px) scale(.98);
    }
}
