﻿
  /* ============================================
     PET MEMORIAL PROTOTYPE — WIREFRAME STYLE
     ============================================ */
  :root {
    --bg: #F5F5F0;
    --card: #FFFFFF;
    --border: #CCCCCC;
    --text: #333333;
    --text-light: #888888;
    --accent: #8B7355;
    --accent-light: #C4A882;
    --danger: #C07070;
    --success: #7A9E7A;
    --font: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

  body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    margin: 0;
    padding: 0;
  }

  /* ---- Phone Frame (removed for production) ---- */

  /* ---- Status Bar (removed for production) ---- */

  /* ---- Screen / Page Wrapper System ---- */
  .screen {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden;
    animation: fadeIn 0.3s ease;
  }
  .screen.active { display: flex; }
  .page-wrap {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden;
    animation: fadeIn 0.3s ease;
  }
  /* ---- Home / Scan content helpers ---- */
  .home-content {
    background: linear-gradient(180deg, #F0EBE3 0%, #F5F5F0 60%);
    position: relative;
    min-height: 100vh;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 32px;
    text-align: center;
  }
  .scan-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
  }
  /* ---- Video duration badge ---- */
  .video-duration {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
  }
  .photo-grid-item.video { position: relative; }


  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* ===========================================
     SCREEN 3 — PET SPACE (GRID VIEW)
     =========================================== */
  .space-header {
    padding: 16px 20px 12px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .space-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .pet-avatar-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--accent-light);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
  }
  .pet-info-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
  }
  .pet-info-dates {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
  }
  .btn-icon,
  a.btn-icon {
    display: flex;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--card);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text);
  }
  .btn-icon:active,
  a.btn-icon:active { transform: scale(0.94); background: var(--bg); }

  /* Memorial quote strip */
  .quote-strip {
    background: var(--accent);
    color: white;
    padding: 14px 20px;
    font-size: 13px;
    font-style: italic;
    line-height: 1.5;
    position: relative;
  }
  .quote-strip::before { content: '"'; font-size: 28px; opacity: 0.3; margin-right: 4px; }

  /* Content stats bar */
  .stats-bar {
    display: flex;
    gap: 0;
    background: var(--card);
    border-bottom: 1px solid var(--border);
  }
  .stat-item,
  a.stat-item {
    flex: 1;
    padding: 12px 0;
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
  }
  .stat-item.active,
  a.stat-item.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
  }
  .stat-item span,
  a.stat-item span {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
  }

  /* Photo grid */
  .photo-grid {
    /* 不要 flex:1，让网格自然适应内容高度 */
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* 明确的行高：每行 = 一行照片高度，不多也不少 */
    grid-auto-rows: calc((100vw - 32px) / 3);
    gap: 6px;
    padding: 10px;
    padding-bottom: 80px;
    background: var(--bg);
    align-items: start;
    overflow-y: auto;
  }
  .photo-grid-item {
    /* 高度由 grid-auto-rows 精确控制，不被子内容撑开 */
    width: 100%;
    height: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
  }
  .photo-grid-item a {
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }
  .photo-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .photo-grid-item.video::after {
    content: '▶';
    position: absolute;
    bottom: 4px;
    right: 4px;
    font-size: 10px;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  }
  .photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-light);
    font-size: 11px;
  }
  .photo-placeholder-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  /* video indicator */
  .photo-grid-item.video { position: relative; }
  .photo-grid-item.video::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.08);
    z-index: 1;
    pointer-events: none;
  }

  /* Bottom nav bar */
  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  }
  .nav-item,
  a.nav-item,
  button.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 6px 20px;
    border-radius: 12px;
    transition: all 0.2s;
    color: var(--text-light);
    font-size: 11px;
    text-decoration: none;
    background: transparent;
    border: none;
    outline: none;
  }
  .nav-item.active,
  a.nav-item.active { color: var(--accent); }
  .nav-item:active,
  a.nav-item:active { transform: scale(0.92); background: var(--bg); }
  .nav-divider {
    width: 1px;
    height: 28px;
    background: var(--border);
  }

  /* FAB */
  .fab,
  a.fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 999;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(139,115,85,0.4);
    z-index: 20;
    transition: all 0.2s;
  }
  .fab:active { transform: scale(0.9); box-shadow: 0 2px 8px rgba(139,115,85,0.3); }

  /* ===========================================
     SCREEN 4 — UPLOAD FLOW
     =========================================== */
  .upload-header {
    padding: 16px 20px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .btn-back,
  a.btn-back {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--card);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    text-decoration: none;
  }
  .upload-header-title {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
    text-align: center;
    margin-right: 48px;
  }

  .upload-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: var(--bg);
  }

  /* Upload zone */
  .upload-zone {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    background: var(--card);
    transition: all 0.2s;
  }
  .upload-zone:hover, .upload-zone:active {
    border-color: var(--accent);
    background: #FAF7F2;
  }
  .upload-zone-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
  }
  .upload-zone-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
  }
  .upload-zone-sub {
    font-size: 12px;
    color: var(--text-light);
  }

  /* Preview area */
  .upload-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .preview-thumb {
    aspect-ratio: 1;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    overflow: hidden;
    position: relative;
    background: var(--card);
    cursor: pointer;
  }
  .preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  /* 视频播放按钮覆盖层 */
  .video-play-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
  }
  /* 视频时长标签 */
  .video-duration-label {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
    line-height: 1.5;
  }
  .preview-thumb .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Form fields */
  .form-group {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
  }
  .form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .form-label .tag {
    font-size: 10px;
    background: var(--accent-light);
    color: white;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 400;
  }
  .form-textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 90px;
    outline: none;
    transition: border 0.2s;
    background: var(--bg);
    color: var(--text);
  }
  .form-textarea:focus { border-color: var(--accent); }

  /* Form input (date/text) - 与 quote-chip 风格统一 */
  .form-input {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--card);
    color: var(--text);
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
  }
  .form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
  }

  /* Auto quotes suggestion */
  .auto-quotes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .quote-chip {
    padding: 8px 14px;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--card);
  }
  .quote-chip:hover, .quote-chip.selected {
    border-color: var(--accent);
    color: var(--accent);
    background: #FAF7F2;
  }
  .quote-chip.selected::after { content: ' ✓'; }

  /* Submit button */
  .btn-primary {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    border: none;
    background: var(--accent);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    margin-top: 4px;
  }
  .btn-primary:active { transform: scale(0.97); background: #7A6248; }

  /* 次要按钮样式 */
  .btn-secondary {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    border: 1.5px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
  }
  .btn-secondary:active { transform: scale(0.97); background: var(--bg); }

  /* Modal action button - 左右留间距并居中 */
  .modal-action-btn {
    display: block;
    width: 80%;
    margin: 0 auto;
    box-sizing: border-box;
  }

  /* ===========================================
     SCREEN 5 — DETAIL VIEW
     =========================================== */
  .detail-media {
    width: 100%;
    aspect-ratio: 1;
    background: #f5f0e8;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
  }
  .detail-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
  .detail-media a {
    display: flex;
    width: 100%;
    height: 100%;
    cursor: zoom-in;
    text-decoration: none;
  }
  .detail-media .video-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
  }
  .play-btn-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #333;
  }

  .detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg);
  }
  .detail-memorial-text {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
  }
  .detail-memorial-text .label {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
  }
  .detail-memorial-text .text {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text);
    font-style: italic;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
  }
  .detail-memorial-text .source {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 8px;
    text-align: right;
  }

  .detail-meta {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .detail-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
  }
  .detail-meta-row .key { color: var(--text-light); }
  .detail-meta-row .val { color: var(--text); font-weight: 500; }

  /* ===========================================
     SCREEN 6 — EDIT PET INFO
     =========================================== */
  .edit-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: var(--bg);
  }
  .edit-avatar-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  .edit-avatar-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px dashed var(--border);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
  }
  .edit-avatar-circle:hover { border-color: var(--accent); }
  #edit-avatar-emoji {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
  }
  #edit-avatar-emoji svg {
    width: 100%;
    height: 100%;
  }
  .edit-avatar-circle .camera-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
  }
  .edit-avatar-label {
    font-size: 12px;
    color: var(--text-light);
  }
  .avatar-emoji-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .avatar-emoji-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--bg);
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
  }
  .avatar-emoji-btn:hover { border-color: var(--accent); background: #FAF7F2; }
  .avatar-emoji-btn.selected { border-color: var(--accent); background: #FAF7F2; box-shadow: 0 0 0 2px var(--accent-light); }

  /* 上传中弹窗 */
  #upload-loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
  }
  .upload-loading-box {
    background: white;
    border-radius: 16px;
    padding: 32px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  }
  .upload-loading-spinner {
    width: 36px; height: 36px;
    border: 3px solid #E8E0D6;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: upload-spin 0.8s linear infinite;
  }
  @keyframes upload-spin {
    to { transform: rotate(360deg); }
  }
  .upload-loading-text {
    font-size: 14px;
    color: var(--text-light);
  }
  .btn-disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
  }
  .edit-field-group {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
  }
  .edit-field {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
  }
  .edit-field:last-child { border-bottom: none; }
  .edit-field-label {
    font-size: 14px;
    color: var(--text);
    min-width: 72px;
    font-weight: 500;
  }
  .edit-field-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    background: transparent;
    color: var(--text);
    text-align: right;
  }
  .edit-field-input::placeholder { color: var(--text-light); }
  .date-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
  }
  .date-input {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    background: var(--bg);
    color: var(--text);
    transition: border 0.2s;
  }
  .date-input:focus { border-color: var(--accent); }
  .date-sep { font-size: 12px; color: var(--text-light); }

  .detail-actions {
    display: flex;
    gap: 10px;
  }
  .detail-actions button,
  .detail-actions a.action-btn {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--card);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    color: var(--text);
    text-decoration: none;
    box-sizing: border-box;
  }
  .detail-actions button:active,
  .detail-actions a.action-btn:active { transform: scale(0.96); background: var(--bg); }
  .detail-actions button.danger,
  .detail-actions a.action-btn.danger { color: var(--danger); border-color: var(--danger); }

  /* ===========================================
     LANGUAGE MODAL
     =========================================== */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 1100;
    animation: fadeIn 0.2s;
  }
  .modal-overlay.active { display: flex; }

  /* ---- Privacy Consent Modal ---- */
  .consent-overlay {
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    padding: 16px;
  }
  .consent-sheet {
    background: var(--card);
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
  }
  .consent-header {
    padding: 16px 20px 0;
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
  }
  .consent-lang-toggle {
    display: flex;
    gap: 0;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
  }
  .consent-lang-btn {
    padding: 4px 14px;
    font-size: 12px;
    border: none;
    background: var(--card);
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
  }
  .consent-lang-btn.active {
    background: var(--accent);
    color: white;
    font-weight: 600;
  }
  .consent-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    text-align: center;
    padding: 12px 24px 8px;
    flex-shrink: 0;
  }
  .consent-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 16px;
  }
  .consent-body p {
    font-size: 13.5px;
    color: var(--text);
    line-height: 1.75;
    margin-bottom: 12px;
    text-align: justify;
  }
  .consent-body p:last-child {
    margin-bottom: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
  }
  .consent-policy-link {
    padding: 0 24px 16px;
    text-align: center;
    flex-shrink: 0;
  }
  .consent-policy-link a {
    font-size: 12.5px;
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
  }
  .consent-buttons {
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
    flex-shrink: 0;
  }
  .btn-decline {
    flex: 1;
    padding: 14px;
    border-radius: 14px;
    border: 1.5px solid var(--border);
    background: var(--card);
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
  }
  .btn-decline:active {
    background: var(--bg);
    transform: scale(0.97);
  }
  .btn-consent {
    flex: 1;
    padding: 14px;
    border-radius: 14px;
    border: none;
    background: var(--accent);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
  }
  .btn-consent:active {
    background: #7A6248;
    transform: scale(0.97);
  }

  .modal-sheet {
    background: var(--card);
    border-radius: 20px 20px 0 0;
    width: 100%;
    padding: 8px 0 32px;
    animation: slideUp 0.3s ease;
  }
  @keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  .modal-handle {
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 8px auto 16px;
  }
  .modal-title {
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 16px;
    padding: 0 20px;
  }
  .lang-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    cursor: pointer;
    transition: background 0.15s;
  }
  .lang-option:active { background: var(--bg); }
  .lang-option-left { display: flex; align-items: center; gap: 12px; }
  .lang-flag { font-size: 22px; }
  .lang-name { font-size: 15px; }
  .lang-native { font-size: 12px; color: var(--text-light); margin-top: 1px; }
  .lang-check { color: var(--accent); font-size: 18px; }

  /* 开关切换样式 */
  .toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 30px;
    margin-left: 12px;
    flex-shrink: 0;
  }
  .toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
  }
  .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 30px;
  }
  .toggle-slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  }
  .toggle-switch input:checked + .toggle-slider {
    background-color: #8B7355;
  }
  .toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
  }


  /* ===========================================
     TOAST / FEEDBACK
     =========================================== */
  .toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    white-space: nowrap;
    z-index: 2001;
    animation: toast-in 0.3s ease;
    pointer-events: none;
  }
  @keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
  }

  /* ===========================================
     SCREEN-SPECIFIC BOTTOM NAV OVERRIDE
     =========================================== */
  .bottom-nav.floating {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
  }

  /* ===========================================
     EMPTY STATE
     =========================================== */
  .empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-light);
    padding: 40px;
    text-align: center;
  }
  .empty-state-icon {
    font-size: 48px;
    opacity: 0.3;
  }
  .empty-state h3 { font-size: 15px; color: var(--text); }
  .empty-state p { font-size: 13px; line-height: 1.5; }

  /* 空状态上传按钮（照片/视频/回忆页面通用） */
  .empty-content {
    text-align: center;
    padding: 40px 20px 100px;
    color: #999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  /* 在 grid 布局中，空状态占据全部列并保持居中 */
  .photo-grid > .empty-content {
    grid-column: 1 / -1;
  }
  .empty-upload-btn {
    display: inline-block;
    margin-top: 16px;
    padding: 12px 28px;
    background: #8B7355;
    color: #fff;
    border-radius: 24px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(139,115,85,0.3);
    transition: all 0.2s;
  }
  .empty-upload-btn:hover {
    background: #7a6348;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(139,115,85,0.4);
  }
  .empty-upload-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(139,115,85,0.3);
  }

  /* ===========================================
     MEMORY LANE (timeline view)
     =========================================== */
  .memory-timeline {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    padding-bottom: 96px;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
  .timeline-year {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--accent-light);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .timeline-year::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
  }
  .timeline-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
  }
  .timeline-item-media {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #DDD;
    overflow: hidden;
    position: relative;
  }
  .timeline-item-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .timeline-item-body {
    padding: 12px 14px;
  }
  .timeline-item-date {
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 6px;
  }
  .timeline-item-text {
    font-size: 13px;
    color: var(--text);
    line-height: 1.6;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
  }
  .timeline-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
  }
  .timeline-item-actions button {
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
  }
  .timeline-item-actions button:active { transform: scale(0.95); }

  /* ===========================================
     MISC UTILITIES
     =========================================== */
  .screen-content-scroll {
    flex: 1;
    overflow-y: auto;
  }
  .screen-with-header {
    display: flex;
    flex-direction: column;
    flex: 1;
  }

  @keyframes pulse-border-btn {
    0%, 100% { border-color: var(--accent-light); box-shadow: 0 0 0 0 rgba(139,115,85,0.2); }
    50% { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(139,115,85,0.1); }
  }

/* ===========================================
   PRIVACY POLICY PAGE
   =========================================== */
.policy-page {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.header-lang-btn {
  width: 44px;
  height: 36px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

.header-delete-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #e74c3c;
  flex-shrink: 0;
  margin-left: 8px;
}

.header-delete-btn:hover {
  background: #fef0ef;
  border-color: #e74c3c;
}

/* 删除确认弹窗 */
.delete-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.modal-content {
  background: var(--card);
  border-radius: 16px;
  padding: 32px 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.modal-icon {
  margin-bottom: 16px;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.modal-message {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 24px;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-btn-cancel,
.modal-btn-confirm {
  flex: 1;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.modal-btn-cancel {
  background: var(--bg);
  color: var(--text-light);
  border: 1.5px solid var(--border);
}

.modal-btn-cancel:hover {
  background: var(--border);
}

.modal-btn-confirm {
  background: #e74c3c;
  color: white;
}

.modal-btn-confirm:hover {
  background: #c0392b;
}

.modal-btn-confirm:disabled {
  background: #bbb;
  cursor: not-allowed;
}

.policy-lang-bar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 8px 20px;
  font-size: 12px;
  color: var(--text-light);
  text-align: center;
  flex-shrink: 0;
}

.policy-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.policy-body {
  padding: 0 0 40px;
}

.policy-section {
  padding: 20px 20px 0;
}

.policy-section h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.policy-section p {
  font-size: 13.5px;
  color: #555;
  line-height: 1.8;
  margin-bottom: 10px;
  text-align: justify;
}

.policy-section ul {
  list-style: none;
  margin-bottom: 10px;
}

.policy-section ul li {
  font-size: 13.5px;
  color: #555;
  line-height: 1.8;
  padding-left: 16px;
  position: relative;
  margin-bottom: 4px;
}

.policy-section ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-light);
}

.policy-section ul li strong {
  color: var(--text);
  font-weight: 600;
}

.policy-footer-text {
  font-size: 12px !important;
  color: var(--text-light) !important;
  text-align: right !important;
  margin-top: 4px !important;
}

/* ===========================================
   SET PASSWORD PAGE
   =========================================== */
.setpass-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 32px;
}

.setpass-lang-bar {
  display: flex;
  gap: 8px;
  padding: 12px 20px 0;
  justify-content: flex-end;
}

.setpass-lang-btn {
  padding: 4px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--card);
  font-size: 12px;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}
.setpass-lang-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 600;
}

.setpass-skip-hint {
  margin: 12px 20px 0;
  padding: 10px 14px;
  background: rgba(139,115,85,0.08);
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--text-light);
  line-height: 1.6;
}

.setpass-form {
  padding: 16px 20px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setpass-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setpass-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.setpass-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--card);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
  box-sizing: border-box;
}
.setpass-input:focus {
  border-color: var(--accent);
}
.setpass-input::placeholder {
  color: #bbb;
}

.select-wrap {
  position: relative;
}
.setpass-select {
  width: 100%;
  padding: 12px 36px 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--card);
  font-size: 14px;
  color: var(--text);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.setpass-select:focus {
  border-color: var(--accent);
}
.select-wrap::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #999;
  pointer-events: none;
}

.setpass-custom-wrap {
  margin-top: 6px;
}

.setpass-pw-wrap {
  position: relative;
}
.setpass-pw {
  padding-right: 44px;
}
.pw-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.setpass-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 2px;
}

.setpass-display-text {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg);
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

/* Buttons */
.setpass-actions {
  padding: 20px 20px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setpass-btn-save {
  width: 100%;
  padding: 15px;
  border-radius: 14px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.setpass-btn-save:active {
  background: #7A6248;
  transform: scale(0.98);
}

.btn-skip {
  width: 100%;
  padding: 13px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text-light);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-skip:active {
  background: var(--bg);
  transform: scale(0.98);
}

.btn-exit {
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: color 0.2s;
  font-family: inherit;
  margin-top: 4px;
}
.btn-exit:active {
  color: var(--danger);
}

.btn-back-placeholder {
  width: 40px;
  height: 36px;
  flex-shrink: 0;
}

/* =============================================
   图片/视频列表 - 加载占位符
   ============================================= */

/* 加载中占位符容器（包裹图片或视频） */
.media-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #f0ebe4;
  display: block;
}

/* 回忆列表：.timeline-item-media 横版比例占位（仅回忆页生效） */
.timeline-item-media {
  aspect-ratio: 16 / 9;
  display: block;
}

/* 回忆列表内的 .media-wrap 继承 timeline-item-media 的 16:9 高度 */
.timeline-item-media .media-wrap {
  height: 100%;
}

/* 加载动画 — 绕中心顺时针旋转 */
.media-wrap .spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 2.5px solid rgba(139, 115, 85, 0.3);
  border-top-color: #8B7355;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  z-index: 2;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===========================================
   PREVIEW POPUP - 列表页弹窗预览
   =========================================== */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 20px;
  box-sizing: border-box;
}
.popup-overlay.active {
  opacity: 1;
}

.popup-container {
  background: var(--card);
  border-radius: 20px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.3s ease;
  -webkit-overflow-scrolling: touch;
}
.popup-overlay.active .popup-container {
  transform: translateY(0);
}

.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--card);
  border-radius: 20px 20px 0 0;
}
.popup-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.popup-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.popup-close:active {
  background: var(--border);
  transform: scale(0.95);
}

.popup-body {
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.popup-media {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: 50vh;
}
.popup-media img,
.popup-media video {
  width: 100%;
  height: auto;
  max-height: 50vh;
  object-fit: contain;
  display: block;
}
.popup-media-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0ebe4;
}
.popup-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(139, 115, 85, 0.3);
  border-top-color: #8B7355;
  border-radius: 50%;
  animation: popup-spin 0.8s linear infinite;
}
@keyframes popup-spin {
  to { transform: rotate(360deg); }
}
.popup-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  transition: transform 0.2s;
  z-index: 2;
}
.popup-play-overlay:active {
  transform: translate(-50%, -50%) scale(0.9);
}

.popup-memorial-text {
  background: #faf8f6;
  border-radius: 8px;
  padding: 14px 16px;
  margin: 12px 0;
}
.popup-memorial-title {
  font-size: 12px;
  color: #8B7355;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.popup-memorial-content {
  font-size: 14px;
  line-height: 1.8;
  color: #333;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
}

.popup-meta {
  background: var(--bg);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.popup-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.popup-meta-row .key {
  color: var(--text-light);
}
.popup-meta-row .val {
  color: var(--text);
  font-weight: 500;
}

.popup-actions {
  display: flex;
  gap: 12px;
}
.popup-btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.popup-btn:active {
  background: var(--bg);
  transform: scale(0.98);
}
.popup-btn.danger {
  color: var(--danger);
  border-color: var(--danger);
}

/* =============================================
   上传 Loading 动画
   ============================================= */
.upload-loading-wrap {
  text-align: center;
  color: #fff;
  padding: 30px 40px;
  background: rgba(0,0,0,0.75);
  border-radius: 16px;
  min-width: 160px;
}
.upload-loading-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  position: relative;
}
.upload-loading-icon::before,
.upload-loading-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
}
.upload-loading-icon::before {
  border-top-color: rgba(255,255,255,0.3);
  animation: upload-spin 1.2s linear infinite;
}
.upload-loading-icon::after {
  border-top-color: #fff;
  animation: upload-spin 0.8s linear infinite;
  inset: 6px;
}
@keyframes upload-spin {
  to { transform: rotate(360deg); }
}
.upload-loading-dots {
  display: inline-block;
  animation: upload-dots 1.5s infinite;
}
@keyframes upload-dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}
.upload-loading-text {
  font-size: 15px;
  margin-top: 12px;
  color: rgba(255,255,255,0.9);
}
.upload-loading-progress {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  margin-top: 16px;
  overflow: hidden;
}
.upload-loading-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #8B7355, #A69076);
  border-radius: 3px;
  transition: width 0.2s ease;
  width: 0%;
}
.upload-loading-percent {
  font-size: 12px;
  color: rgba(255,255,255,0.8);
  margin-top: 8px;
  text-align: center;
}

/* =============================================
   隐私政策链接（列表页底部）
   ============================================= */
.privacy-footer-link {
  padding: 12px 20px 80px;  /* 底部留出空间，避免被固定导航遮挡 */
  text-align: center;
}
.privacy-link {
  font-size: 12px;
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.2s;
}
.privacy-link:active {
  color: var(--accent);
}

/* =============================================
   访客模式标识
   ============================================= */
.guest-mode-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #FFF3E0;
  border: 1px solid #FFB74D;
  border-radius: 12px;
  font-size: 12px;
  color: #E65100;
  cursor: pointer;
  transition: all 0.2s;
}
.guest-mode-badge:active {
  transform: scale(0.95);
  background: #FFE0B2;
}
