/* ==========================================================
   responsive.css —— 跨平台(电脑 / 安卓 / 苹果)响应式适配覆盖层
   仅作覆盖与增强，不破坏原有动画与布局逻辑，可安全回退。
   ========================================================== */

/* ---------- 通用：统一字体与基础 ---------- */
html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  /* 苹果 / 安卓 / Windows 通用中文字体栈，保证各端显示一致美观 */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif !important;
}

img {
  max-width: 100%;
}

/* ==========================================================
   手机端（宽度 ≤ 768px，覆盖主流安卓 / 苹果竖屏）
   ========================================================== */
@media (max-width: 768px) {
  html,
  body {
    overflow-x: hidden;
  }

  /* ---------- index.html 登录页 ---------- */
  .htmleaf-container .container {
    margin-top: 0;
    padding: 0 20px;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .htmleaf-container .container h1 {
    font-size: clamp(26px, 8vw, 38px);
    letter-spacing: 1px;
  }
  .htmleaf-container form {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .htmleaf-container form input,
  .htmleaf-container form button {
    width: min(300px, 86vw);
    height: 48px;
    font-size: 17px;
  }
  .htmleaf-container form input:focus {
    width: min(320px, 90vw);
  }

  /* ---------- BirthdayCake.html 蛋糕页 ---------- */
  #cake {
    transform: scale(0.52);
    transform-origin: 50% 20%;
    margin-top: -2em;
  }
  .velas {
    top: 132px;
    height: 24px;
    width: 4px;
    margin-left: 48.5%;
  }
  .fuego {
    top: -16px;
    margin-left: -1.8px;
    width: 5.5px;
    height: 14px;
  }
  .name {
    font-size: clamp(26px, 7vw, 34px);
    letter-spacing: 2px;
  }
  .happy {
    width: min(230px, 60vw);
    height: auto;
    margin-left: 0;
    left: 0;
    transform: translateX(0);
  }
  .happy img {
    width: 100%;
    height: auto;
  }
  .button-style1,
  .button-style2 {
    left: 0;
    width: 100%;
    margin-left: 0;
    text-align: center;
  }
  .button-style1 .lk1,
  .button-style2 .lk1 {
    font-size: 16px !important;
    line-height: 1.7;
    margin-left: 12px !important;
    margin-right: 12px !important;
  }
  .button-style2 .link2 {
    margin: 0 auto;
  }
  table {
    table-layout: fixed;
  }
  table td {
    width: 50%;
    padding: 4px;
  }
  .link1,
  .link2 {
    width: min(148px, 40vw);
    height: 50px;
    font-size: 17px;
    border-radius: 26px;
  }
  .bt1 {
    top: 18%;
    font-size: 17px !important;
  }
  a.lk1 {
    float: none !important;
    display: inline-block;
  }

  /* ---------- img.html 照片散落页 ---------- */
  .begin {
    font-size: clamp(18px, 5.4vw, 24px);
    line-height: 1.8;
    padding: 0 6%;
    top: 44%;
  }
  .container img {
    width: auto;
    height: auto;
    max-width: 46vw;
  }

  /* ---------- Memories.html 回忆时间轴页 ---------- */
  .bgcolor {
    min-height: 100vh;
  }
  /* 时间轴竖线与节点整体左移，给内容让出空间 */
  .timeline {
    left: 7%;
    width: 6px;
  }
  .active .timeline {
    width: 6px;
  }
  .timepoint11 {
    left: 7%;
    width: 16px;
    height: 16px;
    margin-left: -5px;
  }
  .active .timepoint11 {
    top: 12%;
  }
  /* 左右两个卡片在手机上改为上下堆叠 */
  .ly-box11,
  .ly-box12 {
    position: relative;
    width: 86%;
    height: auto;
    left: auto;
    top: auto;
    margin: 18% auto 0;
    transform: none !important;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  }
  .active .ly-box11,
  .active .ly-box12 {
    opacity: 0.95;
    transform: none !important;
  }
  /* 卡片内图片区：固定比例、铺满、不变形 */
  .ly-imgbox11 {
    position: relative;
    width: 100%;
    height: auto;
    bottom: auto;
    border-radius: 12px 12px 0 0;
  }
  .ly-img11 {
    position: relative;
    width: 100%;
    height: auto;
    bottom: auto;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    display: block;
  }
  /* 日期标题 */
  .ly-txt13 {
    position: relative;
    left: 0;
    top: 0;
    text-align: center;
    font-size: clamp(20px, 6vw, 28px);
    margin: 14px 0 4px;
  }
  /* 正文文字：居中、适中字号、舒适行距 */
  .ly-txt14 {
    position: relative;
    top: 0;
    margin: 0 auto 20px;
    width: 86%;
    height: auto !important;
    text-indent: 0;
    text-align: center;
    font-size: clamp(15px, 4.4vw, 19px);
    line-height: 1.9;
    letter-spacing: 0.5px;
    overflow: visible;
  }
  .active .ly-txt14 {
    height: auto !important;
    transition-delay: 0s;
  }
  /* 连接箭头三角形在手机上隐藏，避免错位 */
  .ly-triangle11,
  .ly-triangle12 {
    display: none;
  }
  /* 第一屏文字动画字号适配 */
  .ly-stxt01,
  .ly-stxt02,
  .ly-stxt03,
  .ly-stxt04,
  .ly-stxt05 {
    font-size: clamp(20px, 6vw, 28px);
  }
  .ly-txt01 {
    width: 74%;
    left: 13%;
    top: 20%;
  }
  /* 结尾压轴屏 */
  .ly-final {
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 8%;
    box-sizing: border-box;
  }
  .ly-final-title {
    font-size: clamp(14px, 4vw, 18px);
    line-height: 2;
    margin: 4px 0;
  }
  .ly-final-sub {
    font-size: clamp(16px, 4.6vw, 22px);
    margin: 18px 0 30px;
  }
  .ly-final-btn {
    padding: 13px 34px;
    font-size: 17px;
  }

  /* ---------- index1.html 粒子命令页 ---------- */
  .overlay {
    width: 92vw;
    max-width: 420px;
    height: auto;
    margin: 0;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -52%) rotateY(0);
  }
  .overlay--visible {
    transform: translate(-50%, -52%) rotateY(0);
  }
  .ui {
    width: 82vw;
    max-width: 320px;
    left: 50%;
    margin-left: -41vw;
  }
  .commands-item-title {
    width: 30%;
  }
  .commands-item-info {
    width: 58%;
    font-size: 13px;
  }
}

/* ==========================================================
   小屏手机（宽度 ≤ 480px）进一步增强
   ========================================================== */
@media (max-width: 480px) {
  /* 蛋糕页 */
  #cake {
    transform: scale(0.46);
    margin-top: -1em;
  }
  .velas {
    top: 122px;
  }
  .name {
    top: 4%;
  }
  /* 登录页 */
  .htmleaf-container .container h1 {
    font-size: 8vw;
  }
  /* 回忆页进一步压缩上下留白 */
  .ly-box11,
  .ly-box12 {
    margin-top: 14%;
  }
}
