/* 九号调试 · WEB — 浅色主题 */

:root {
    --bg: #f5f6f8;
    --bg-grad: radial-gradient(1200px 600px at 15% -10%, #ffffff 0%, #f5f6f8 55%, #eef0f4 100%);
    --surface: #ffffff;
    --surface-soft: #f8f9fb;
    --ink: #1b2027;
    --ink-2: #4a525e;
    --ink-3: #7c8593;
    --line: #e3e6ea;
    --line-strong: #cfd4db;
    --accent: #e8323c;
    --accent-soft: #fdecee;
    --ok: #15803d;
    --ok-soft: #e8f6ee;
    --warn: #b45309;
    --warn-soft: #fdf4e3;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(23, 28, 38, .05), 0 8px 24px -12px rgba(23, 28, 38, .12);
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    background-image: var(--bg-grad);
    background-attachment: fixed;
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
    font-size: 14px;
    line-height: 1.55;
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

/* 触屏双击缩放会打断连续按键，统一交给浏览器单击处理 */
.btn,
.chip,
.action,
summary,
.file-label,
.swatch {
    touch-action: manipulation;
}

h1, h2, h3 {
    margin: 0;
    font-weight: 650;
    letter-spacing: -.01em;
}

.mono {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
}

.muted {
    color: var(--ink-3);
}

.small {
    font-size: 12px;
}

.grow {
    flex: 1;
}

/* ----------------------------- 顶栏 ----------------------------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px clamp(16px, 4vw, 40px);
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(160deg, #23292f, #101418);
    color: #fff;
    font-weight: 800;
    font-size: 19px;
    display: grid;
    place-items: center;
    box-shadow: 0 6px 14px -6px rgba(16, 20, 24, .6);
}

.brand-text h1 {
    font-size: 17px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-text p {
    margin: 1px 0 0;
    font-size: 11.5px;
    color: var(--ink-3);
    letter-spacing: .01em;
}

.badge {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .14em;
    padding: 3px 6px 2px;
    border-radius: 5px;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid #f6cdd1;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--ink-2);
    white-space: nowrap;
}

.pill i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #b6bdc7;
    box-shadow: 0 0 0 3px rgba(182, 189, 199, .18);
}

.pill.on i {
    background: var(--ok);
    box-shadow: 0 0 0 3px rgba(21, 128, 61, .16);
}

.pill.auth {
    border-color: #bfe3cd;
    background: var(--ok-soft);
    color: #14612f;
}

.pill.auth i {
    background: var(--ok);
}

.pill.busy i {
    background: var(--warn);
    animation: pulse 1.1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .3; }
}

/* --------------------------- 环境提示 --------------------------- */

.envbar {
    margin: 14px clamp(16px, 4vw, 40px) 0;
    padding: 11px 16px;
    border-radius: 11px;
    background: var(--warn-soft);
    border: 1px solid #f0dfbe;
    color: #7c4a06;
    font-size: 12.5px;
}

.envbar.error {
    background: var(--accent-soft);
    border-color: #f6cdd1;
    color: #a11420;
}

/* ----------------------------- 布局 ----------------------------- */

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 372px;
    gap: 18px;
    padding: 18px clamp(16px, 4vw, 40px) 32px;
    max-width: 1280px;
    margin: 0 auto;
    align-items: start;
}

.col-main, .col-side {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

/* ----------------------------- 卡片 ----------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}

.card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.card-head h2 {
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 9px;
}

.step {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: #1f252c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: grid;
    place-items: center;
    font-family: var(--mono);
}

.card-head h3 {
    font-size: 13.5px;
}

.card h3 {
    font-size: 13px;
    margin: 20px 0 10px;
    color: var(--ink-2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card h3:first-of-type {
    margin-top: 4px;
}

.tag {
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 500;
    color: var(--ink-3);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    padding: 2px 6px;
    border-radius: 5px;
}

.tag.tag-rec {
    color: #fff;
    background: var(--accent, #d93b3b);
    border-color: transparent;
    font-weight: 600;
}

/* ----------------------------- 控件 ----------------------------- */

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

.row.wrap {
    flex-wrap: wrap;
}

.row.tight {
    gap: 6px;
}

.btn {
    appearance: none;
    border: 1px solid var(--line-strong);
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    font-weight: 550;
    padding: 9px 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .12s, border-color .12s, transform .06s, box-shadow .12s;
    white-space: nowrap;
}

.btn:hover:not(:disabled) {
    background: var(--surface-soft);
    border-color: #b9c0ca;
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

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

.btn.primary {
    background: linear-gradient(180deg, #2b323b, #1b2027);
    border-color: #1b2027;
    color: #fff;
    box-shadow: 0 6px 14px -8px rgba(20, 25, 32, .8);
}

.btn.primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #353d48, #232a33);
}

.btn.danger {
    background: linear-gradient(180deg, #ef4451, #d9202c);
    border-color: #c81c27;
    color: #fff;
    box-shadow: 0 6px 14px -8px rgba(200, 28, 39, .8);
}

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

.btn.ghost:hover:not(:disabled) {
    background: var(--surface-soft);
    border-color: var(--line);
}

.btn.small {
    padding: 6px 11px;
    font-size: 12.5px;
    border-radius: 9px;
}

.btn.tiny {
    padding: 4px 8px;
    font-size: 11.5px;
    border-radius: 7px;
}

.btn.block {
    width: 100%;
    margin-top: 12px;
}

.input {
    flex: 1;
    min-width: 0;
    font: inherit;
    font-size: 13px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 9px 12px;
    outline: none;
    transition: border-color .12s, box-shadow .12s;
}

.input:focus {
    border-color: #8d96a3;
    box-shadow: 0 0 0 3px rgba(141, 150, 163, .14);
}

.field-row {
    margin-top: 14px;
}

.field-row.tight {
    margin-top: 12px;
}

.field-row label {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--ink-2);
    margin-bottom: 6px;
    font-weight: 550;
}

.field-row label em {
    font-style: normal;
    font-weight: 400;
    color: var(--ink-3);
    font-size: 11.5px;
}

.input-with-tag {
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-tag {
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 9px;
    border-radius: 8px;
    background: #eef2ff;
    border: 1px solid #d8e0f7;
    color: #34437a;
    white-space: nowrap;
}

.status-line {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--ink-2);
    min-height: 38px;
}

.status-line.ok {
    background: var(--ok-soft);
    border-color: #cbe8d8;
    color: #14612f;
}

.status-line.err {
    background: var(--accent-soft);
    border-color: #f6cdd1;
    color: #a11420;
}

/* --------------------------- 身份信息 --------------------------- */

.identity {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 11px;
    overflow: hidden;
    margin-bottom: 14px;
}

.kv {
    background: #fff;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.kv span {
    font-size: 11px;
    color: var(--ink-3);
    letter-spacing: .02em;
}

.kv strong {
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kv strong.small {
    font-size: 11px;
    color: var(--ink-2);
}

/* ---------------------------- 密钥面板 ---------------------------- */

.keybox {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
    overflow: hidden;
}

.keybox summary {
    cursor: pointer;
    padding: 10px 12px;
    font-size: 12.5px;
    font-weight: 550;
    color: var(--ink-2);
    list-style: none;
}

.keybox summary::-webkit-details-marker {
    display: none;
}

.keybox summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 7px;
    color: var(--ink-3);
    transition: transform .15s;
}

.keybox[open] summary::before {
    transform: rotate(90deg);
}

.keybox-body {
    padding: 4px 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fff;
    border-top: 1px solid var(--line);
}

.keybox-body p {
    margin: 0;
}

/* --------------------- 固件方案 chips / 动作 --------------------- */

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    appearance: none;
    font: inherit;
    font-size: 12.5px;
    font-weight: 550;
    padding: 7px 13px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: #fff;
    color: var(--ink-2);
    cursor: pointer;
    transition: all .12s;
}

.chip:hover:not(:disabled) {
    border-color: #9aa3b0;
    color: var(--ink);
}

.chip.active {
    background: #1b2027;
    border-color: #1b2027;
    color: #fff;
    box-shadow: 0 6px 14px -9px rgba(20, 25, 32, .9);
}

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

.profile-line {
    margin-top: 10px;
    font-size: 12px;
    color: var(--ink-3);
}

/* 固件版本信息（构建期解密得到） */
.fwmeta {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--ink-3);
}

.fwmeta-row {
    display: block;
    padding: 6px 9px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.025);
    border: 1px solid rgba(0, 0, 0, 0.05);
    font-variant-numeric: tabular-nums;
}

.fwmeta-row b {
    display: inline-block;
    min-width: 46px;
    margin-right: 6px;
    color: var(--ink-2);
    font-weight: 600;
}

.fwmeta-row em {
    display: block;
    margin-top: 3px;
    font-style: normal;
    color: var(--ink-3);
    font-size: 11.5px;
}

.fwmeta-row.warn {
    background: var(--warn-soft);
    border-color: #f0dfbe;
    color: #7c4a06;
}

.actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.actions.single {
    grid-template-columns: minmax(190px, 260px);
}

.action {
    appearance: none;
    font: inherit;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 14px;
    border-radius: 11px;
    border: 1px solid var(--line-strong);
    background: #fff;
    cursor: pointer;
    transition: box-shadow .14s, border-color .14s, transform .06s;
}

.action:hover:not(:disabled) {
    border-color: #a9b1bd;
    box-shadow: 0 8px 18px -12px rgba(23, 28, 38, .3);
}

.action:active:not(:disabled) {
    transform: translateY(1px);
}

.action:disabled {
    opacity: .45;
    cursor: not-allowed;
    background: var(--surface-soft);
}

.action-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.action-sub {
    font-size: 11.5px;
    color: var(--ink-3);
    font-family: var(--mono);
}

.action.danger-hint:hover:not(:disabled) {
    border-color: #e8b4b9;
    background: #fffbfb;
}

.notice {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.5;
}

.notice p {
    margin: 0 0 8px;
}

.notice p:last-child {
    margin-bottom: 0;
}

.notice strong {
    color: inherit;
}

.notice.warn {
    background: var(--warn-soft);
    border: 1px solid #f0dfbe;
    color: #7c4a06;
}

/* --------------------------- 自定义文件 --------------------------- */

.file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
    margin-bottom: 8px;
}

.file-label {
    cursor: pointer;
    background: #fff;
    flex: none;
}

.file-label input {
    display: none;
}

.file-meta {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    color: var(--ink-3);
    font-family: var(--mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta.loaded {
    color: var(--ink-2);
}

/* ----------------------------- 调色 ----------------------------- */

.preview {
    height: 52px;
    border-radius: 11px;
    border: 1px solid var(--line-strong);
    display: grid;
    place-items: center;
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .04em;
    margin: 12px 0;
    transition: background-color .1s, color .1s;
}

.wheel {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    max-height: 320px;
    margin: 0 auto;
    display: block;
    cursor: crosshair;
    touch-action: none;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}

.range {
    width: 100%;
    appearance: none;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #dfe3e8, #1b2027);
    outline: none;
}

.range::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #aab2bd;
    box-shadow: 0 2px 6px rgba(23, 28, 38, .25);
    cursor: pointer;
}

.range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #aab2bd;
    cursor: pointer;
}

.presets {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.swatch {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, .12);
    cursor: pointer;
    padding: 0;
    transition: transform .1s, box-shadow .1s;
}

.swatch:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 10px -4px rgba(0, 0, 0, .35);
}

.swatch.active {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1b2027;
}

/* ----------------------------- 进度 ----------------------------- */

.progress-block {
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 11px 12px;
    margin-bottom: 12px;
    background: var(--surface-soft);
}

.progress-head {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 7px;
    color: var(--ink-2);
}

.progress {
    height: 8px;
    border-radius: 999px;
    background: #e6e9ee;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #2b323b, #101418);
    transition: width .18s ease-out;
}

.progress-bar.done {
    background: linear-gradient(90deg, #1a8f4c, #14612f);
}

.progress-bar.error {
    background: linear-gradient(90deg, #ef4451, #c81c27);
}

.progress-foot {
    margin-top: 7px;
    font-size: 11.5px;
    color: var(--ink-3);
    font-family: var(--mono);
}

/* ------------------------------ 日志 ------------------------------ */

.log {
    height: 300px;
    overflow-y: auto;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 10px 12px;
    font-family: var(--mono);
    font-size: 11.5px;
    line-height: 1.72;
    color: var(--ink-2);
    white-space: pre-wrap;
    word-break: break-word;
}

.log .line {
    display: flex;
    gap: 8px;
}

.log .t {
    color: #a2aab5;
    flex: none;
}

.log .m {
    flex: 1;
    min-width: 0;
}

.log .stage .m {
    color: #14181e;
}

.log .ok .m {
    color: var(--ok);
}

.log .err .m {
    color: #b8141f;
}

.log .hex .m {
    color: #5b6472;
}

/* ----------------------------- 页脚 ----------------------------- */

.footer {
    padding: 0 clamp(16px, 4vw, 40px) 40px;
    max-width: 1280px;
    margin: 0 auto;
    font-size: 11.5px;
    color: var(--ink-3);
}

.footer a {
    color: var(--ink-2);
}

/* ----------------------------- 弹窗 ----------------------------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(18, 22, 28, .42);
    backdrop-filter: blur(3px);
    display: grid;
    place-items: center;
    padding: 20px;
    overflow-y: auto;
}

.modal-backdrop[hidden] {
    display: none;
}

.modal {
    width: min(520px, 100%);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px -20px rgba(10, 14, 20, .45);
    padding: 22px 22px 18px;
    animation: modalIn .18s ease-out;
}

.modal.wide {
    width: min(620px, 100%);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(8px) scale(.99); }
    to { opacity: 1; transform: none; }
}

.modal .eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .16em;
    color: var(--accent);
    text-transform: uppercase;
}

.modal .eyebrow i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
}

.modal h2 {
    font-size: 21px;
    margin: 10px 0 4px;
    letter-spacing: -.02em;
}

.modal .sub {
    font-size: 12.5px;
    color: var(--ink-3);
    margin-bottom: 16px;
}

.modal .body {
    font-size: 13px;
    color: var(--ink-2);
    line-height: 1.68;
    max-height: 46vh;
    overflow-y: auto;
    padding-right: 4px;
}

.modal .body p {
    margin: 0 0 10px;
}

.modal .body ul {
    margin: 0 0 10px;
    padding-left: 18px;
}

.modal .body li {
    margin-bottom: 4px;
}

.modal .callout {
    background: var(--accent-soft);
    border: 1px solid #f6cdd1;
    border-radius: 11px;
    padding: 12px 14px;
    margin: 14px 0 0;
    color: #8c121b;
    font-size: 12.5px;
}

.modal .callout strong {
    display: block;
    font-size: 11px;
    letter-spacing: .08em;
    margin-bottom: 5px;
    color: #c11722;
}

.modal .foot {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal .gate {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 14px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
    font-size: 12.5px;
    color: var(--ink-2);
    cursor: pointer;
    line-height: 1.5;
}

.modal .gate input {
    margin: 2px 0 0;
    width: 15px;
    height: 15px;
    accent-color: #1b2027;
    flex: none;
    cursor: pointer;
}

.modal .foot .btn {
    flex: 1;
    height: 44px;
    justify-content: center;
}

.modal .foot .btn.primary,
.modal .foot .btn.danger {
    flex: 1.6;
}

/* --------------------------- iOS 引导卡 --------------------------- */

.guide {
    margin: 14px clamp(16px, 4vw, 40px) 0;
    border-color: #dbe4f4;
    background: linear-gradient(180deg, #fbfcff, #f4f8ff);
}

.guide-head {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.guide-badge {
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(160deg, #23292f, #101418);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    display: grid;
    place-items: center;
}

.guide-copy h2 {
    font-size: 15px;
    margin-bottom: 5px;
}

.guide-copy p {
    margin: 0;
    font-size: 12.5px;
    color: var(--ink-2);
    line-height: 1.62;
}

.guide-list {
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.guide-list li {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 13px 14px;
}

.guide-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.guide-title strong {
    font-size: 13.5px;
}

.guide-list p {
    margin: 5px 0 11px;
    font-size: 12.5px;
    color: var(--ink-2);
    line-height: 1.6;
}

.guide-list p.guide-warn {
    margin: 0 0 11px;
    padding: 7px 10px;
    border-radius: 8px;
    background: #fff5e6;
    border: 1px solid #f2d3a6;
    color: #8a5a12;
    font-size: 12px;
    line-height: 1.55;
}

.guide-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.guide-actions .btn {
    flex: 1 1 170px;
    justify-content: center;
    height: 42px;
}

.guide-foot {
    margin: 12px 0 0;
}

/* --------------------------- 响应式 --------------------------- */

/* iOS Safari 只要聚焦字号 < 16px 的输入框就会放大整页，iPad 也一样。
   用 JS 挂的 .is-ios 类而不是 @supports，行为更确定。 */
.is-ios .input,
.is-ios select.input {
    font-size: 16px;
}

.is-ios .input {
    height: 46px;
}

/* 触屏设备统一按 44px 最小触控目标，桌面鼠标不受影响 */
@media (pointer: coarse) {
    .btn {
        min-height: 44px;
    }

    .btn.small {
        min-height: 40px;
    }

    .chip {
        min-height: 38px;
    }

    .swatch {
        width: 38px;
        height: 38px;
    }

    .kv strong {
        font-size: 13.5px;
    }
}

@media (max-width: 1080px) {
    .layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .col-side {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 620px) {
    .identity {
        grid-template-columns: minmax(0, 1fr);
    }

    .actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .actions.single {
        grid-template-columns: minmax(0, 1fr);
    }

    .topbar {
        padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
        gap: 10px;
    }

    .brand-text p {
        display: none;
    }

    .brand-text h1 {
        font-size: 15.5px;
    }

    .brand-mark {
        width: 32px;
        height: 32px;
        border-radius: 9px;
        font-size: 16px;
    }

    .layout {
        padding: 12px 14px calc(24px + env(safe-area-inset-bottom));
        gap: 14px;
    }

    .col-main, .col-side {
        gap: 14px;
    }

    .card {
        padding: 15px;
        border-radius: 13px;
    }

    .card-head {
        margin-bottom: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .card-head h2 {
        font-size: 14.5px;
    }

    .log {
        height: 34dvh;
        min-height: 190px;
        font-size: 11px;
    }

    /* iOS 输入框字号低于 16px 会在聚焦时自动放大整页 */
    .input,
    .field-row label,
    .modal .gate {
        font-size: 16px;
    }

    .field-row label {
        font-size: 12.5px;
    }

    .input {
        height: 46px;
    }

    .btn {
        min-height: 44px;
        padding: 11px 14px;
        font-size: 14.5px;
    }

    .btn.small {
        min-height: 40px;
        font-size: 13.5px;
    }

    .btn.ghost.tiny {
        min-height: 32px;
    }

    /* 触屏上按钮组不要挤成两列，等宽全铺更好按 */
    .row > .btn:not(.tiny) {
        flex: 1 1 100%;
    }

    .row.tight > .btn,
    .keybox-body .row > .btn {
        flex: 0 0 auto;
    }

    .chip {
        padding: 9px 14px;
        font-size: 13px;
    }

    .chips {
        gap: 7px;
    }

    .action {
        padding: 13px 14px;
        min-height: 58px;
    }

    .wheel {
        max-height: none;
        max-width: 300px;
    }

    .swatch {
        width: 38px;
        height: 38px;
    }

    .file-row {
        flex-wrap: wrap;
    }

    .file-row .file-meta {
        flex: 1 1 100%;
        order: 3;
    }

    .file-row .btn {
        flex: 1 1 0;
        min-height: 40px;
    }

    .footer {
        padding: 0 14px calc(28px + env(safe-area-inset-bottom));
        font-size: 11px;
    }

    .envbar {
        margin: 12px 14px 0;
        font-size: 12px;
    }

    .guide {
        margin: 12px 14px 0;
        padding: 16px 14px;
    }

    .guide-head {
        gap: 11px;
    }

    .guide-badge {
        width: 38px;
        height: 38px;
        border-radius: 10px;
        font-size: 11px;
    }

    .guide-copy h2 {
        font-size: 14px;
    }

    /* 弹窗改成底部抽屉，拇指区即可完成确认 */
    .modal-backdrop {
        padding: 0;
        place-items: end center;
    }

    .modal,
    .modal.wide {
        width: 100%;
        max-height: 92dvh;
        border-radius: 18px 18px 0 0;
        padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
        display: flex;
        flex-direction: column;
        animation: sheetIn .22s ease-out;
    }

    .modal .body {
        max-height: none;
        flex: 1 1 auto;
        min-height: 0;
        font-size: 13.5px;
    }

    .modal .foot {
        flex: none;
    }

    .modal .foot .btn {
        height: 48px;
        font-size: 15px;
    }

    .modal .gate {
        padding: 13px;
        font-size: 13.5px;
    }

    @keyframes sheetIn {
        from { transform: translateY(18px); opacity: .6; }
        to { transform: none; opacity: 1; }
    }
}

/* 横屏手机 / 小平板：色轮和日志并排，省得上下拉太长 */
@media (max-width: 1080px) and (orientation: landscape) {
    .col-side {
        display: grid;
        grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
        align-items: start;
    }
}

