﻿/*
 * Base, layout, header, stars
 */


    * { margin: 0; padding: 0; box-sizing: border-box; }
    :root {
      --scrollbar-track: rgba(255, 255, 255, 0.08);
      --scrollbar-track-edge: rgba(234, 242, 238, 0.18);
      --scrollbar-thumb-start: rgba(255, 255, 255, 0.14);
      --scrollbar-thumb-mid: rgba(229, 238, 234, 0.2);
      --scrollbar-thumb-end: rgba(207, 223, 217, 0.28);
      --scrollbar-thumb-hover-start: rgba(255, 255, 255, 0.74);
      --scrollbar-thumb-hover-mid: rgba(224, 236, 231, 0.84);
      --scrollbar-thumb-hover-end: rgba(189, 210, 202, 0.92);
      --scrollbar-thumb-active-start: rgba(247, 251, 249, 0.92);
      --scrollbar-thumb-active-mid: rgba(214, 229, 223, 0.94);
      --scrollbar-thumb-active-end: rgba(175, 198, 189, 0.98);
      --scrollbar-frame: rgba(255, 255, 255, 0.22);
      --scrollbar-shadow: rgba(106, 136, 126, 0.05);
      --scrollbar-shadow-hover: rgba(106, 136, 126, 0.12);
      --scrollbar-color-fallback: rgba(182, 201, 194, 0.32);
    }
    html {
      scrollbar-width: thin;
      scrollbar-color: var(--scrollbar-color-fallback) var(--scrollbar-track);
    }
    * {
      scrollbar-width: thin;
      scrollbar-color: var(--scrollbar-color-fallback) var(--scrollbar-track);
    }
    *::-webkit-scrollbar {
      width: 12px;
      height: 12px;
    }
    *::-webkit-scrollbar-track {
      background: linear-gradient(180deg, var(--scrollbar-track) 0%, var(--scrollbar-track-edge) 100%);
      border-radius: 999px;
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
    }
    *::-webkit-scrollbar-thumb {
      background: linear-gradient(180deg, var(--scrollbar-thumb-start) 0%, var(--scrollbar-thumb-mid) 52%, var(--scrollbar-thumb-end) 100%);
      border: 2px solid var(--scrollbar-frame);
      border-radius: 999px;
      box-shadow: 0 4px 10px var(--scrollbar-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.16);
      min-height: 56px;
      transition: background 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    }
    html:hover::-webkit-scrollbar-thumb,
    body:hover::-webkit-scrollbar-thumb,
    .modal-card:hover::-webkit-scrollbar-thumb,
    .worship-records:hover::-webkit-scrollbar-thumb {
      background: linear-gradient(180deg, var(--scrollbar-thumb-hover-start) 0%, var(--scrollbar-thumb-hover-mid) 52%, var(--scrollbar-thumb-hover-end) 100%);
      box-shadow: 0 6px 14px var(--scrollbar-shadow-hover), inset 0 1px 0 rgba(255, 255, 255, 0.32);
      border-color: rgba(255, 255, 255, 0.5);
    }
    *::-webkit-scrollbar-thumb:hover {
      background: linear-gradient(180deg, var(--scrollbar-thumb-hover-start) 0%, var(--scrollbar-thumb-hover-mid) 52%, var(--scrollbar-thumb-hover-end) 100%);
      box-shadow: 0 6px 14px var(--scrollbar-shadow-hover), inset 0 1px 0 rgba(255, 255, 255, 0.32);
      border-color: rgba(255, 255, 255, 0.5);
    }
    *::-webkit-scrollbar-thumb:active {
      background: linear-gradient(180deg, var(--scrollbar-thumb-active-start) 0%, var(--scrollbar-thumb-active-mid) 52%, var(--scrollbar-thumb-active-end) 100%);
    }
    *::-webkit-scrollbar-corner {
      background: transparent;
    }
    body {
      min-height: 100vh;
      background: linear-gradient(145deg, #fbe9f0 0%, #e0f2e5 100%);
      font-family: 'Nunito', 'Quicksand', sans-serif;
      color: #3a3a3a;
      padding: 1.5rem 1rem;
      position: relative;
      overflow-x: hidden;
    }
    body::before {
      content: '';
      position: fixed;
      top: 0; left: 0; width: 100%; height: 100%;
      background: radial-gradient(circle at 20% 30%, rgba(255,240,245,0.5) 0%, transparent 25%),
                  radial-gradient(circle at 90% 70%, rgba(210,240,230,0.6) 0%, transparent 30%),
                  radial-gradient(circle at 40% 80%, rgba(245,235,200,0.4) 0%, transparent 35%);
      pointer-events: none; z-index: 0;
    }
    .container {
      max-width: 1400px;
      min-height: calc(100vh - 3rem);
      margin: 0 auto;
      position: relative;
      z-index: 2;
      padding: 0 2rem;
      display: flex;
      flex-direction: column;
    }

    /* 头部 */
    .memorial-header {
      display: flex; justify-content: space-between; align-items: center;
      background: linear-gradient(135deg, rgba(255,250,240,0.6), rgba(245,240,230,0.4)); backdrop-filter: blur(8px);
      border-radius: 40px; padding: 1.5rem 2rem;
      border: 1px solid rgba(255,255,255,0.8); margin-bottom: 2rem;
      flex-wrap: wrap;
      box-shadow: 0 8px 32px rgba(140,120,110,0.1);
      position: relative;
      overflow: hidden;
    }
    .memorial-header::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: radial-gradient(circle at 20% 30%, rgba(255,240,245,0.3) 0%, transparent 25%),
                  radial-gradient(circle at 80% 70%, rgba(210,240,230,0.4) 0%, transparent 30%),
                  radial-gradient(circle at 40% 80%, rgba(245,235,200,0.3) 0%, transparent 35%);
      z-index: -1;
    }
    /* 动态星星效果 */
    .star {
      position: absolute;
      border-radius: 50%;
      z-index: 1;
    }
    
    @keyframes starAscend {
      0% {
        opacity: 0;
        transform: translateY(0) translateX(0) scale(0.3);
      }
      30% {
        opacity: 1;
        transform: translateY(-30px) translateX(calc(var(--move-x) * 0.3)) scale(1);
      }
      70% {
        opacity: 1;
      }
      100% {
        opacity: 0;
        transform: translateY(-250px) translateX(var(--move-x)) scale(0.5);
      }
    }
    .logo { flex: 1; text-align: left; cursor: pointer; }
    .logo-container {
      display: flex;
      align-items: center;
      gap: 20px;
    }
    .eternal-tombstone-logo {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 160px;
      height: 160px;
    }
    .tombstone-icon {
      font-size: 5rem;
      text-shadow: 4px 4px 25px rgba(255, 182, 193, 1);
      position: relative;
      z-index: 3;
    }
    .eternal-elements {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 2;
    }
    .glow-effect {
      position: absolute;
      top: 50%;
      left: 50%;
      width: 140px;
      height: 140px;
      background: radial-gradient(circle, rgba(255, 182, 193, 0.4) 0%, rgba(255, 105, 180, 0.2) 50%, transparent 70%);
      border-radius: 50%;
      transform: translate(-50%, -50%);
      animation: pulse 3s ease-in-out infinite;
      z-index: 1;
    }

    @keyframes pulse {
      0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.4;
      }
      50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.7;
      }
    }
    .logo-text {
      display: flex;
      flex-direction: column;
      justify-content: center;
    }
    .logo h1 {
      font-family: 'Noto Sans SC', '微软雅黑', 'Microsoft YaHei', sans-serif; font-weight: 900; font-size: 2.8rem;
      color: #ff69b4; text-shadow: 2px 2px 15px rgba(255, 182, 193, 0.8);
      margin-bottom: 0.2rem;
      letter-spacing: 2px;
      font-style: normal;
    }
    .logo .sub {
      font-size: 1.4rem; color: #ff85c2; font-weight: 500;
      margin-left: 0;
      font-family: 'Noto Serif SC', '楷体', 'KaiTi', serif;
      text-shadow: 1px 1px 5px rgba(255, 182, 193, 0.6);
      letter-spacing: 2px;
    }

    .language-switch {
      display: flex;
      gap: 0.4rem;
      align-items: center;
      flex-shrink: 0;
    }
    .lang-btn {
      background: rgba(200,180,165,0.3);
      border: 1px solid rgba(255,240,230,0.8);
      border-radius: 20px;
      padding: 0.3rem 0.8rem;
      font-size: 0.9rem;
      color: #4e5b4c;
      cursor: pointer;
      transition: 0.2s;
      backdrop-filter: blur(2px);
      min-width: 40px;
      text-align: center;
    }
    .lang-btn:hover {
      background: rgba(180,160,145,0.4);
      transform: translateY(-2px);
    }
    .lang-btn.active {
      background: linear-gradient(135deg, #ff69b4, #ff1493);
      border-color: #ff69b4;
      color: white;
      box-shadow: 0 4px 12px rgba(255, 105, 180, 0.3);
    }
    .lang-btn.active:hover {
      background: linear-gradient(135deg, #ff85c2, #ff69b4);
      transform: translateY(-2px);
      box-shadow: 0 6px 16px rgba(255, 105, 180, 0.4);
      border-color: #ff69b4;
    }
    .user-area {
      display: flex;
      gap: 0.8rem;
      align-items: center;
      flex-wrap: nowrap;
      justify-content: flex-end;
      padding-right: 1rem;
    }
    .account-menu {
      position: relative;
      display: inline-flex;
      align-items: center;
      min-width: 0;
      flex-shrink: 0;
    }
    .account-menu[hidden] {
      display: none !important;
    }
    .data-source-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 38px;
      padding: 0.45rem 0.95rem;
      border-radius: 999px;
      border: 1px solid rgba(255,240,230,0.9);
      background: rgba(255,250,245,0.88);
      color: #5f6e5a;
      font-size: 0.92rem;
      font-weight: 600;
      box-shadow: 0 4px 12px rgba(140,120,110,0.08);
    }
    .data-source-badge.is-local {
      color: #6a5f57;
    }
    .data-source-badge.is-supabase {
      color: #2e7d60;
      background: rgba(236, 252, 244, 0.95);
      border-color: rgba(148, 227, 191, 0.95);
    }
    .data-source-badge.is-syncing {
      color: #946200;
      background: rgba(255, 249, 219, 0.95);
      border-color: rgba(255, 222, 128, 0.95);
    }
    .data-source-badge.is-error {
      color: #a04444;
      background: rgba(255, 239, 239, 0.95);
      border-color: rgba(246, 178, 178, 0.95);
    }
    .user-area button {
      background: linear-gradient(135deg, rgba(200,180,165,0.4), rgba(180,160,145,0.3));
      border: 1px solid rgba(255,240,230,0.9);
      border-radius: 40px;
      padding: 0.6rem 1.4rem;
      font-size: 1rem;
      color: #4e5b4c;
      cursor: pointer;
      transition: all 0.3s ease;
      backdrop-filter: blur(8px);
      display: flex;
      align-items: center;
      gap: 8px;
      box-shadow: 0 4px 12px rgba(140,120,110,0.1);
      font-weight: 500;
    }
    .user-area button:hover {
      background: linear-gradient(135deg, rgba(180,160,145,0.5), rgba(160,140,125,0.4));
      transform: translateY(-3px);
      box-shadow: 0 6px 16px rgba(140,120,110,0.15);
      border-color: rgba(255,240,230,1);
    }
    .user-area button:active {
      transform: translateY(-1px);
      box-shadow: 0 2px 8px rgba(140,120,110,0.1);
    }
    .account-toggle {
      min-width: 0;
      max-width: min(210px, 30vw);
      padding: 0.42rem 0.62rem;
      gap: 0.58rem;
      justify-content: flex-start;
      border-radius: 999px;
    }
    .account-toggle__avatar {
      width: 32px;
      height: 32px;
      flex: 0 0 32px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      position: relative;
      border-radius: 999px;
      overflow: hidden;
      background: linear-gradient(135deg, rgba(255, 244, 248, 0.98), rgba(245, 250, 247, 0.98));
      color: #b37a8d;
      box-shadow: inset 0 0 0 1px rgba(236, 208, 214, 0.92);
    }
    .account-toggle__avatar img {
      width: 100%;
      height: 100%;
      display: block;
      object-fit: cover;
    }
    .account-toggle__avatar-fallback {
      font-size: 0.9rem;
      font-weight: 800;
      line-height: 1;
      color: #8f6670;
      text-transform: uppercase;
    }
    .account-toggle__copy {
      min-width: 0;
      display: block;
      text-align: left;
    }
    #userInfo {
      color: #4f5d4d;
      font-weight: 700;
      font-size: 0.94rem;
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      display: block;
      line-height: 1.15;
    }
    .account-toggle__status {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }
    @media (max-width: 960px) {
      .user-area {
        flex-wrap: wrap;
        justify-content: flex-start;
        padding-right: 0;
      }
      .account-toggle {
        max-width: 100%;
      }
    }
    @media (max-width: 640px) {
      .memorial-header {
        gap: 1rem;
      }
      .user-area {
        width: 100%;
      }
      .account-menu {
        margin-left: auto;
      }
      .account-toggle {
        max-width: min(100%, 190px);
      }
    }

    /* 视图切换 */
    .view { display: none; }
    .view.active {
      display: block;
      flex: 1 0 auto;
    }
    .detail-view-shell {
      display: flex;
      flex-direction: column;
      gap: 1.2rem;
    }
    .detail-view-toolbar {
      position: fixed;
      left: 50%;
      bottom: clamp(18px, 4vw, 30px);
      transform: translateX(-50%);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 125;
      padding: 0;
      margin: 0;
      pointer-events: none;
    }
    .detail-view-back {
      display: inline-flex;
      align-items: center;
      gap: 0.65rem;
      border: 1px solid rgba(255,255,255,0.82);
      border-radius: 999px;
      background: linear-gradient(135deg, rgba(255,250,246,0.78), rgba(240,246,243,0.58));
      color: #56645b;
      padding: 0.78rem 1.2rem;
      font-size: 0.96rem;
      font-weight: 600;
      cursor: pointer;
      backdrop-filter: blur(10px);
      box-shadow: 0 8px 18px rgba(120, 100, 90, 0.06);
      transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
      pointer-events: auto;
      white-space: nowrap;
    }
    .detail-view-back:hover {
      transform: translateY(-1px);
      background: linear-gradient(135deg, rgba(255,252,249,0.88), rgba(236,244,240,0.72));
      box-shadow: 0 10px 22px rgba(120, 100, 90, 0.09);
    }
    .detail-view-back:active {
      transform: translateY(0);
    }
    .detail-view-back i {
      color: #7d9a8c;
    }
    #detailContent {
      min-height: 60vh;
      padding-bottom: 5.8rem;
    }
    .detail-view-top {
      position: fixed;
      right: clamp(14px, 3vw, 28px);
      bottom: clamp(18px, 4vw, 30px);
      width: 44px;
      height: 44px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: 1px solid rgba(224, 230, 226, 0.96);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.9);
      color: #5f7167;
      box-shadow: 0 12px 24px rgba(93, 103, 97, 0.12);
      backdrop-filter: blur(12px);
      cursor: pointer;
      opacity: 0;
      transform: translateY(10px);
      pointer-events: none;
      transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease, color 0.2s ease;
      z-index: 120;
    }
    .detail-view-top.is-visible {
      opacity: 1;
      transform: translateY(0);
      pointer-events: auto;
    }
    .detail-view-top:hover {
      background: rgba(248, 251, 249, 0.96);
      color: #4f675b;
    }
    .detail-view-top i {
      font-size: 0.95rem;
    }
    
