/* 无言 · 纸感精修（2026-11-12）
   视觉基准：桌面「无聊/_设计草稿_20261029/草稿A_纸感精修.html」
   与「无聊」落地版「改造后_列表页.png」保持一致：宣纸米色渐变、墨蓝文字、
   陶土橙强调、圆角方形头像、发丝分隔线、左对齐大标题 + 小副标题、
   内陷搜索框、浅橙通知条、橙色圆角加号按钮。
   只改视觉，所有 id / class / 结构名一个未删，业务逻辑零改动。 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --paper-top: #F8F4EC;
    --paper-bottom: #EDE5D6;
    --card: #FFFFFF;
    --card-2: #F4EEE2;
    --ink: #1F2E45;
    --text: #263140;
    --text-2: #5C6675;
    --dim: #978F80;
    --text-primary: #263140;     /* 兼容原有变量名 */
    --text-secondary: #978F80;   /* 兼容原有变量名 */
    --accent: #B5654A;
    --line: rgba(31, 46, 69, .08);
    --grad-accent: linear-gradient(135deg, #B5654A 0%, #C9845A 100%);
    --shadow-soft: 0 4px 20px rgba(31, 46, 69, .08);
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--paper-top);
    color: var(--text-primary);
    overscroll-behavior: none;
}

.page {
    display: none;
    min-height: 100vh;
    flex-direction: column;
    background: linear-gradient(180deg, var(--paper-top) 0%, var(--paper-bottom) 100%);
}
.page.active { display: flex; }

/* ===== 头部：左对齐大标题 + 小副标题 + 右上轻量按钮 ===== */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 20px 14px;
    padding-top: max(8px, env(safe-area-inset-top));
    min-height: 56px;
    position: relative;
}
.hdr-left { min-width: 0; }
header h1 {
    font-size: 29px;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.15;
    text-align: left;
    color: var(--ink);
}
header .sub {
    font-size: 11.5px;
    color: var(--dim);
    letter-spacing: .1em;
    margin-top: 3px;
}
/* 子页面有返回按钮（绝对定位），标题左侧留出它的位置 */
header .back-btn + h1 { margin-left: 46px; }
.header-btn {
    flex-shrink: 0;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .7);
    color: var(--text-2);
    font-size: 12.5px;
    font-family: inherit;
    padding: 8px 12px;
    border-radius: 19px;
    cursor: pointer;
}
.header-btn:active { background: rgba(31, 46, 69, .08); }
.back-btn {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-2);
    font-size: 15px;
    padding: 6px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
}

/* ===== 搜索：无边框、内陷米色 ===== */
.search-wrap {
    padding: 0 20px 10px;
    flex-shrink: 0;
}
.search-input {
    width: 100%;
    height: 38px;
    border: none;
    border-radius: 11px;
    background-color: rgba(31, 46, 69, .045);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23978F80' stroke-width='2.2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 13px center;
    background-size: 14px 14px;
    color: var(--text-primary);
    /* iOS 上小于 16px 会触发输入自动放大，必须保持 16px */
    font-size: 16px;
    font-family: inherit;
    padding: 0 13px 0 36px;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}
.search-input::placeholder { color: var(--dim); }
.no-match-hint {
    display: none;
    text-align: center;
    color: var(--dim);
    font-size: 13.5px;
    margin-top: 32px;
    padding: 0 40px;
}

/* ===== 顶部通知条：浅橙底、不起眼 ===== */
.notif {
    display: block;
    width: calc(100% - 40px);
    margin: 0 20px 12px;
    padding: 9px 12px;
    border: none;
    border-radius: 10px;
    background: rgba(181, 101, 74, .09);
    color: #8d4c37;
    font-size: 11.5px;
    font-family: inherit;
    letter-spacing: .02em;
    text-align: left;
    cursor: pointer;
}
.notif::before { content: "🔔"; margin-right: 6px; }
.notif:active { opacity: .8; }

/* ===== 联系人列表：无卡片、发丝分隔线 ===== */
.contact-list {
    flex: 1;
    overflow: hidden;
    padding-top: 2px;
}
.contact-item-wrapper {
    position: relative;
    overflow: hidden;
    margin: 0;
    border-radius: 0;
}
.contact-item-wrapper + .contact-item-wrapper::before {
    content: "";
    position: absolute;
    left: 76px;
    right: 0;
    top: 0;
    height: .5px;
    background: var(--line);
    z-index: 2;
    pointer-events: none;
}
.contact-item {
    display: flex;
    align-items: center;
    gap: 13px;
    background: transparent;
    border-radius: 0;
    padding: 13px 20px;
    cursor: pointer;
    position: relative;
    z-index: 1;
    box-shadow: none;
    transition: transform .25s ease;
    /* 长按用于「置顶」，必须屏蔽系统长按菜单/文本选择 */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
.contact-item-wrapper.swiped .contact-item { transform: translateX(-86px); }
.contact-item:active { background: rgba(31, 46, 69, .03); }

/* 圆角方形姓氏头像；app.js 用内联 background 指定六色之一，
   background-image 加 !important 才能在纯色上叠出渐变质感 */
.contact-avatar {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: .02em;
    background-image: linear-gradient(140deg, rgba(255, 255, 255, .18), rgba(0, 0, 0, .12)) !important;
}
.contact-text {
    flex: 1;
    min-width: 0;
}
.contact-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    letter-spacing: .01em;
}
.contact-pin-badge {
    flex-shrink: 0;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1;
    padding: 3px 7px;
    border-radius: 8px;
    color: #8d4c37;
    background: rgba(181, 101, 74, .12);
}
/* 未接来电角标：橙渐变，与草稿A 的未读角标同一套 */
.contact-missed-badge {
    flex-shrink: 0;
    box-sizing: border-box;
    min-width: 19px;
    height: 19px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    border-radius: 10px;
    color: #FFFFFF;
    background: var(--grad-accent);
}
.contact-code {
    font-size: 13.5px;
    color: var(--dim);
    margin-top: 4px;
    letter-spacing: .01em;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.contact-call-hint {
    width: 18px;
    height: 18px;
    margin-left: 0;
    flex-shrink: 0;
    opacity: .35;
}
/* 删除键：默认完全藏起来，只有这一行真的左滑开（.swiped）才显示。
   ⚠ 不能靠行背景去遮挡 —— 纸感版的行是透明底（要露出页面渐变），
   否则红色会从每一行右侧透出来（2026-11-12 用户截图发现）。 */
.contact-delete-btn {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 86px;
    border: none;
    background: #D64545;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    z-index: 0;
    border-radius: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity .12s ease;
}
.contact-item-wrapper.swiped .contact-delete-btn {
    opacity: 1;
    visibility: visible;
}

.empty-hint {
    display: none;
    text-align: center;
    color: var(--dim);
    font-size: 14px;
    margin-top: 30vh;
    padding: 0 40px;
    line-height: 1.9;
}

/* ===== 轻量提示条（toast）===== */
.wuyan-hint {
    position: fixed;
    left: 50%;
    bottom: 96px;
    transform: translateX(-50%) translateY(8px);
    background: rgba(31, 46, 69, .92);
    color: #fff;
    font-size: 13px;
    padding: 10px 18px;
    border-radius: 14px;
    opacity: 0;
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
    z-index: 9998;
    white-space: nowrap;
}
.wuyan-hint.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== 浮动按钮：陶土橙圆角方形 ===== */
.fab {
    position: fixed;
    right: 22px;
    bottom: max(34px, calc(env(safe-area-inset-bottom) + 20px));
    width: 54px;
    height: 54px;
    border-radius: 18px;
    border: none;
    background: var(--grad-accent);
    color: #fff;
    font-size: 26px;
    font-weight: 300;
    line-height: 0;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(181, 101, 74, .34), 0 2px 6px rgba(181, 101, 74, .2);
    z-index: 10;
}
.fab:active { transform: scale(.95); }

/* ===== 我的二维码页 ===== */
.qr-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 24px 40px;
}
#qr-canvas {
    margin-top: 18px;
    width: 260px;
    height: 260px;
    max-width: 72vw;
    max-height: 72vw;
    background: #fff;
    border-radius: 18px;
    padding: 18px;
    box-shadow: var(--shadow-soft);
}
.id-line {
    margin-top: 26px;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
}
.id-label { font-size: 13px; color: var(--dim); }
.id-value {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .5px;
    color: var(--text);
}
.hint {
    margin-top: 24px;
    text-align: center;
    font-size: 13px;
    color: var(--dim);
    line-height: 1.9;
}
.btn-accent {
    margin-top: 26px;
    padding: 14px 44px;
    border: none;
    border-radius: 16px;
    background: var(--grad-accent);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(181, 101, 74, .28);
}
.btn-accent:active { transform: scale(.96); }
.link-btn {
    margin-top: 14px;
    background: none;
    border: none;
    padding: 6px 10px;
    color: var(--dim);
    font-size: 12.5px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: underline;
}

/* ===== 扫码页 ===== */
.scan-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #16233A;   /* 摄像头画面本身是暗的，这里保持深色 */
    overflow: hidden;
}
.scan-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.scan-result {
    display: none;
    padding: 20px;
    text-align: center;
    color: var(--accent);
}
.scan-manual {
    flex-shrink: 0;
    padding: 14px 20px calc(16px + env(safe-area-inset-bottom));
}
.scan-manual-title {
    font-size: 12.5px;
    color: var(--dim);
    line-height: 1.6;
    margin-bottom: 8px;
}
.pair-input {
    width: 100%;
    border: none;
    border-radius: 11px;
    background: rgba(31, 46, 69, .045);
    color: var(--text-primary);
    /* iOS 上小于 16px 会触发输入自动放大 */
    font-size: 16px;
    font-family: inherit;
    line-height: 1.5;
    padding: 11px 13px;
    outline: none;
    resize: none;
    -webkit-appearance: none;
    appearance: none;
}
.pair-input::placeholder { color: var(--dim); }
#btn-add-by-code { margin-top: 10px; }

/* ===== 通话页 / 来电页：与列表页同一张纸 ===== */
.call-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--paper-top) 0%, var(--paper-bottom) 100%);
    color: var(--text);
    padding: 40px;
}
.call-avatar {
    width: 108px;
    height: 108px;
    border-radius: 28px;
    border: none;
    background: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 30px;
    box-shadow: 0 10px 26px rgba(31, 46, 69, .18);
}
.call-name {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -.01em;
    margin-bottom: 12px;
    color: var(--ink);
}
.call-code {
    font-size: 14px;
    color: var(--dim);
    margin-bottom: 8px;
}
.call-status {
    font-size: 14px;
    color: var(--text-2);
    margin-bottom: 80px;
}
.call-actions { display: flex; gap: 36px; }
.call-btn {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    border: 1px solid var(--line);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .8);
    color: var(--text-2);
    box-shadow: 0 4px 14px rgba(31, 46, 69, .08);
    /* 长按「免提」= 换播法档位，必须屏蔽 iOS 长按选中文字/系统菜单 */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}
.call-btn.hangup { background: #D64545; color: #fff; font-weight: 700; border-color: transparent; }
.call-btn.accept { background: #2F9E63; color: #fff; font-weight: 700; width: 76px; height: 76px; border-color: transparent; }
.call-btn.on { background: #2F9E63; color: #fff; font-weight: 700; border-color: transparent; }
.call-btn:active { transform: scale(.92); }

/* ===== 设置页 ===== */
.settings-container { padding: 24px 20px; }
.settings-container label {
    display: block;
    font-size: 13px;
    color: var(--dim);
    margin-bottom: 8px;
}
.settings-container input {
    width: 100%;
    padding: 11px 13px;
    border: none;
    border-radius: 11px;
    font-size: 16px;
    font-family: inherit;
    margin-bottom: 16px;
    background: rgba(31, 46, 69, .045);
    color: var(--text-primary);
    outline: none;
}
.btn-primary {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 14px;
    background: var(--grad-accent);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(181, 101, 74, .24);
}
.btn-primary:active { opacity: .85; }
