/* 记忆站 H5 公共样式 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
    --primary: #4f6ef7;
    --primary-dark: #3d5ae0;
    --bg: #f4f6fb;
    --text: #2b2f3a;
    --text-dim: #8a90a0;
    --card: #ffffff;
    --line: #e8ebf3;
    --danger-bg: #fdecec;
    --danger-text: #c0392b;
}

html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
}

/* ---------- 登录页 ---------- */
.page-login {
    min-height: 100vh;
    background: linear-gradient(160deg, #4f6ef7 0%, #6a8bff 45%, #8fb0ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
}
.login-wrap {
    width: 100%;
    max-width: 380px;
    text-align: center;
}
.login-logo {
    width: 76px; height: 76px;
    margin: 0 auto 14px;
    border-radius: 24px;
    background: rgba(255,255,255,.92);
    color: var(--primary);
    font-size: 38px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 24px rgba(0,0,0,.14);
}
.login-title { color: #fff; font-size: 24px; letter-spacing: 2px; }
.login-sub { color: rgba(255,255,255,.82); font-size: 14px; margin: 6px 0 26px; }

.login-form {
    background: var(--card);
    border-radius: 18px;
    padding: 26px 22px 30px;
    box-shadow: 0 12px 32px rgba(20,40,120,.18);
    text-align: left;
}
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 7px; }
.field input {
    width: 100%;
    height: 46px;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 0 14px;
    font-size: 16px;
    color: var(--text);
    background: #fafbff;
    outline: none;
    transition: border-color .18s;
}
.field input:focus { border-color: var(--primary); background: #fff; }

.btn-primary {
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 6px;
    margin-top: 4px;
    cursor: pointer;
    transition: background .18s;
}
.btn-primary:active { background: var(--primary-dark); }

.alert {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    margin-bottom: 16px;
    text-align: left;
}

.login-foot { color: rgba(255,255,255,.75); font-size: 12px; margin-top: 22px; }

/* ---------- 首页（欢迎页） ---------- */
.page-home { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    height: 52px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-title { font-size: 18px; font-weight: 600; letter-spacing: 2px; }
.topbar-link { color: rgba(255,255,255,.9); font-size: 14px; text-decoration: none; padding: 6px 2px; }

.main { flex: 1; padding: 18px 16px 30px; }

.hero {
    background: linear-gradient(150deg, #4f6ef7, #7d9bff);
    border-radius: 18px;
    color: #fff;
    padding: 26px 20px;
    text-align: center;
    box-shadow: 0 8px 22px rgba(79,110,247,.28);
    margin-bottom: 16px;
}
.hero-avatar {
    width: 64px; height: 64px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    font-size: 28px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid rgba(255,255,255,.5);
}
.hero h2 { font-size: 21px; margin-bottom: 4px; }
.hero p { font-size: 13px; color: rgba(255,255,255,.85); }

.card {
    background: var(--card);
    border-radius: 16px;
    padding: 18px 18px 20px;
    margin-bottom: 14px;
    box-shadow: 0 2px 10px rgba(30,50,100,.06);
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; padding-left: 9px; border-left: 3px solid var(--primary); line-height: 1.2; }
.info-list { list-style: none; }
.info-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.info-list li:last-child { border-bottom: none; }
.info-list span { color: var(--text-dim); }
.info-list b { font-weight: 500; }

.card-dim { opacity: .92; }
.dim-text { font-size: 14px; color: var(--text-dim); }

.foot { text-align: center; color: var(--text-dim); font-size: 12px; padding: 14px 0 22px; }

/* ---------- 应用内页通用 ---------- */
.page-app { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: 62px; }
.topbar-back { color: rgba(255,255,255,.9); font-size: 14px; text-decoration: none; }
.topbar-side { width: 30px; }

.notice {
    background: #e9f7ef;
    color: #1e7e46;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    margin-bottom: 14px;
}

.empty {
    text-align: center;
    color: var(--text-dim);
    font-size: 14px;
    padding: 46px 20px;
}

/* ---------- 首页快捷入口 ---------- */
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.quick-item {
    background: var(--card);
    border-radius: 14px;
    padding: 14px 10px;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(30,50,100,.06);
}
.quick-item b { display: block; font-size: 14px; color: var(--text); margin-bottom: 3px; }
.quick-item span { font-size: 11px; color: var(--text-dim); }

/* ---------- 记忆卡片 ---------- */
.mem-card {
    background: var(--card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 2px 10px rgba(30,50,100,.06);
}
.mem-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.mem-title { font-size: 16px; font-weight: 600; line-height: 1.35; }
.pin-tag {
    font-style: normal;
    font-size: 11px;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 6px;
    padding: 1px 6px;
    margin-left: 6px;
    vertical-align: 2px;
}
.mem-author { flex-shrink: 0; font-size: 12px; color: var(--text-dim); }
.pub-yes { color: #1e7e46; }
.pub-no { color: #b08a2e; }
.mem-desc { font-size: 14px; color: #454b59; margin-bottom: 10px; word-break: break-word; }
.mem-meta { display: flex; flex-direction: column; gap: 4px; }
.meta-item { font-size: 12.5px; color: var(--text-dim); }
.mem-imgs { display: grid; gap: 6px; margin-top: 12px; }
.mem-imgs-1 { grid-template-columns: 1fr; }
.mem-imgs-2, .mem-imgs-3 { grid-template-columns: repeat(3, 1fr); }
.mem-imgs img {
    width: 100%;
    height: 92px;
    object-fit: cover;
    border-radius: 10px;
    display: block;
    background: var(--bg);
}
.mem-ops { display: flex; gap: 10px; margin-top: 12px; }
.op-form { display: inline; }
.op-btn {
    display: inline-block;
    font-size: 13px;
    color: var(--primary);
    background: #eef2ff;
    border: none;
    border-radius: 8px;
    padding: 6px 16px;
    text-decoration: none;
    cursor: pointer;
}
.op-danger { color: var(--danger-text); background: var(--danger-bg); }

/* ---------- 添加记忆按钮 ---------- */
.btn-add {
    display: block;
    text-align: center;
    background: var(--primary);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 2px;
    border-radius: 14px;
    padding: 13px 0;
    text-decoration: none;
    margin-bottom: 16px;
    box-shadow: 0 6px 16px rgba(79,110,247,.3);
}
.btn-add:active { background: var(--primary-dark); }

/* ---------- 表单 ---------- */
.mem-form, .card form { text-align: left; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 7px; }
.field label em { font-style: normal; font-size: 12px; color: #b6bcc9; }
.field input[type="text"],
.field input[type="tel"],
.field input[type="password"],
.field input[type="datetime-local"],
.field textarea {
    width: 100%;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 11px 14px;
    font-size: 15px;
    color: var(--text);
    background: #fafbff;
    outline: none;
    font-family: inherit;
    transition: border-color .18s;
}
.field input:focus, .field textarea:focus { border-color: var(--primary); background: #fff; }
.field textarea { resize: vertical; }
.field input[type="file"] { font-size: 13px; color: var(--text-dim); }
.field input:disabled { background: #f0f2f7; color: var(--text-dim); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
    color: var(--text);
    margin: 4px 0 16px;
}
.check-row input { width: 18px; height: 18px; accent-color: var(--primary); flex-shrink: 0; margin-top: 1px; }
.check-row .hint { display: block; font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ---------- 图片上传框（竖版 1:2） ---------- */
.up-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.up-box {
    position: relative;
    aspect-ratio: 1 / 2;
    border: 1.5px dashed #c3cbde;
    border-radius: 12px;
    background: #fafbff;
    overflow: hidden;
    cursor: pointer;
    transition: border-color .18s;
}
.up-box:active { border-color: var(--primary); }
.up-box.has { border-style: solid; border-color: var(--line); }
.up-prev { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.up-prev.is-sample { opacity: .55; filter: saturate(.6); }
.up-tag {
    position: absolute;
    left: 50%; bottom: 10px;
    transform: translateX(-50%);
    background: rgba(79,110,247,.92);
    color: #fff;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
    pointer-events: none;
}
.up-del {
    position: absolute;
    top: 4px; right: 4px;
    width: 22px; height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}

.btn-secondary {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.btn-secondary:active { background: var(--primary-dark); }

.btn-logout {
    display: block;
    text-align: center;
    background: #fff;
    color: var(--danger-text);
    border: 1.5px solid #f5c6c0;
    border-radius: 12px;
    padding: 12px 0;
    font-size: 15px;
    text-decoration: none;
    margin-top: 4px;
}

/* ---------- 底部固定导航 ---------- */
.tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: 58px;
    display: flex;
    background: rgba(255,255,255,.98);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px rgba(30,50,100,.06);
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom);
}
.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--text-dim);
    font-size: 11px;
}
.tab-icon { width: 22px; height: 22px; }
.tab.active { color: var(--primary); font-weight: 600; }
