/* ========== 02-home.css ========== */
/* 首頁背景、首頁圖標網格、滑動頁、小組件 */

#screen-home {
  background-image: url('../images/home wallpaper.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #e4e4e9;
}

/* ===== 傳統首頁圖標（備用） ===== */
.home-grid {
  display: flex;
  justify-content: center;
  gap: 28px;
  padding: 80px 30px;
  flex-wrap: wrap;
}

.home-icon-custom-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;   /* 或 cover，取决于你想怎么填充 */
  border-radius: inherit;
  display: block;
}
.app-icon-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
}

.app-icon-wrap:active .app-icon {
  transform: scale(.9);
}

.app-icon {
  width: 68px;
  height: 68px;
  background: #fff;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
  transition: transform .15s;
  position: relative;   /* ← 加上这一行 */
}

.app-icon svg {
  width: 32px;
  height: 32px;
  stroke: #3a3a3c;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-label {
  font-size: 12px;
  color: #1d1d1f;
  font-weight: 500;
}

.home-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  background: rgba(60, 60, 64, .85);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid rgba(240, 240, 245, .9);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}

.home-badge:empty {
  display: none;
}

/* ===== 首頁重構：滑動頁面 ===== */
.home-pages {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.home-page {
  min-width: 100%;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 26px 16px 20px;
  transition: transform .35s cubic-bezier(.32, .72, 0, 1);
}

.home-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  padding: 6px 0 4px;
  flex-shrink: 0;
}

.home-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(29, 29, 31, .15);
  transition: all .35s cubic-bezier(.32, .72, 0, 1);
}

.home-dot.active {
  background: rgba(29, 29, 31, .55);
  width: 18px;
  border-radius: 3px;
}

/* ===== Dock（支持 3 個圖標） ===== */
.home-dock {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 0 20px calc(env(safe-area-inset-bottom, 4px) + 18px);
  flex-shrink: 0;
  position: relative;
  margin-top: -10px;
}

.home-dock::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 30px;
  right: 30px;
  bottom: calc(env(safe-area-inset-bottom, 4px) + 10px);
  background: rgba(220, 220, 225, 0.45);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
  z-index: 0;
}

.home-dock .app-icon-wrap {
  gap: 4px;
  position: relative;
  z-index: 1;
}

.home-dock .app-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255,255,255,.85), rgba(255,255,255,.55));
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 2px 12px rgba(0,0,0,.06), 0 0.5px 0 rgba(255,255,255,.9) inset;
}

.home-dock .app-label {
  display: none;
}

/* ===== Blog Widget (Safari-style) ===== */
.blog-widget {
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 2px 16px rgba(0,0,0,.08);
  overflow: hidden;
  margin-bottom: 20px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
}

.bw-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f2f2f4;
  padding: 8px 14px;
  border-bottom: 0.5px solid rgba(0,0,0,.06);
}

.bw-top-left {
  font-size: 13px;
  font-weight: 500;
  color: #6e6e73;
  cursor: pointer;
  min-width: 28px;
}

.bw-top-left:active { opacity: .6; }

.bw-top-center {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #3a3a3c;
  font-weight: 500;
  cursor: pointer;
  flex: 1;
  justify-content: center;
}

.bw-top-center:active { opacity: .6; }

.bw-lock {
  width: 10px;
  height: 12px;
  stroke: #3a3a3c;
  fill: none;
  stroke-width: 1.4;
  flex-shrink: 0;
}

.bw-top-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  cursor: pointer;
  min-width: 28px;
}

.bw-top-right svg {
  width: 17px;
  height: 17px;
  stroke: #6e6e73;
  fill: none;
  stroke-width: 1.5;
}

.bw-top-right:active { opacity: .6; }

.bw-profile {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 10px;
}

.bw-avatar {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: #ececf0;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  border: 2px solid rgba(255,255,255,.9);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.bw-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bw-avatar svg {
  width: 30px;
  height: 30px;
  stroke: #b0b0b5;
  fill: none;
  stroke-width: 1.4;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.bw-avatar:active { opacity: .75; }

.bw-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bw-title {
  font-size: 16px;
  font-weight: 700;
  color: #1d1d1f;
  cursor: pointer;
  letter-spacing: -.3px;
  margin-bottom: 4px;
}

.bw-title:active { opacity: .6; }

.bw-desc {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bw-desc {
  flex-direction: column;
  gap: 0;
}

.bw-desc span {
  font-size: 12px;
  color: #a0a0a8;
  font-weight: 400;
  line-height: 1.55;
  cursor: pointer;
  display: inline;
}

.bw-desc span:active { opacity: .6; }

.bw-images {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 0 10px 10px;
}

.bw-img-wrap {
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  overflow: hidden;
  background: #f4f4f6;
  cursor: pointer;
  position: relative;
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: 0 0 0 0.5px rgba(0,0,0,.05);
  transition: transform .15s;
}

.bw-img-wrap:active { transform: scale(.97); }

.bw-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bw-img-ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bw-img-ph svg {
  width: 22px;
  height: 22px;
  stroke: #c7c7cc;
  fill: none;
  stroke-width: 1.3;
}

.bw-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 12px;
  background: #fff;
  border-top: 0.5px solid rgba(0,0,0,.05);
}

.bw-nav-arrow {
  font-size: 15px;
  color: #c7c7cc;
  font-weight: 300;
  min-width: 20px;
  text-align: center;
}

.bw-reload-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,.95);
  border: 0.5px solid rgba(0,0,0,.08);
  border-radius: 20px;
  padding: 8px 28px;
  font-size: 14px;
  color: #3a3a3c;
  font-weight: 400;
  box-shadow: 0 1px 6px rgba(0,0,0,.07);
  letter-spacing: .1px;
}

.bw-reload-btn svg {
  width: 13px;
  height: 13px;
  stroke: #8e8e93;
  fill: none;
  stroke-width: 1.5;
}

/* ===== Profile Widget ===== */
.profile-widget {
  border-radius: 24px;
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, .07), 0 1px 0 rgba(255, 255, 255, .8) inset;
  border: 1px solid rgba(255, 255, 255, .65);
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
}

.pw-banner {
  flex: 1;
  background: linear-gradient(135deg, #e8e8ed 0%, #dddde3 40%, #d4d4da 100%);
  position: relative;
  cursor: pointer;
  overflow: hidden;
  display: block;
}

.pw-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pw-banner-edit {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .08);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  opacity: .4;
  transition: opacity .2s;
}

.pw-banner-edit:active {
  opacity: .7;
}

.pw-banner-edit svg {
  width: 14px;
  height: 14px;
  stroke: #fff;
  fill: none;
  stroke-width: 1.8;
}

.pw-glass {
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(24px);
  padding: 0 20px 20px;
  position: relative;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.pw-avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 3.5px solid rgba(255, 255, 255, .9);
  background: linear-gradient(135deg, #ececf0, #e0e0e5);
  margin: -38px auto 0;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 3px 16px rgba(0, 0, 0, .08), 0 0 0 0.5px rgba(0, 0, 0, .04);
  z-index: 2;
  flex-shrink: 0;
}

.pw-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pw-avatar svg {
  width: 32px;
  height: 32px;
  stroke: #8e8e93;
  fill: none;
  stroke-width: 1.5;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.pw-name {
  font-size: 18px;
  font-weight: 700;
  color: #1d1d1f;
  margin-top: 10px;
  cursor: pointer;
  padding: 3px 10px;
  border-radius: 8px;
  display: inline-block;
  letter-spacing: -.2px;
}

.pw-name:active {
  background: rgba(0, 0, 0, .04);
}

.pw-bio {
  font-size: 12px;
  color: #a0a0a5;
  margin-top: 2px;
  font-weight: 400;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
}

.pw-bio:active {
  background: rgba(0, 0, 0, .04);
}

/* ===== 首頁圖標行 ===== */
.home-icon-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px 24px;
  padding: 0 30px;
  justify-items: center;
}

.home-icon-row .app-icon {
  width: 62px;
  height: 62px;
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .85), rgba(255, 255, 255, .55));
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, .7);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .06), 0 0.5px 0 rgba(255, 255, 255, .9) inset;
  transition: transform .15s, box-shadow .15s;
}

.home-icon-row .app-icon:active {
  transform: scale(.92);
  box-shadow: 0 1px 6px rgba(0, 0, 0, .08);
}

.home-icon-row .app-icon svg {
  width: 27px;
  height: 27px;
  stroke: #4a4a4e;
  stroke-width: 1.4;
}

.home-icon-row .app-label {
  font-size: 10px;
  color: #48484a;
  font-weight: 500;
  letter-spacing: .2px;
}

/* ===== Greeting Widget (couple card style) ===== */
.greeting-widget {
  border-radius: 24px;
  overflow: hidden;
  margin-bottom: 18px;
  margin-top: 10px;
  position: relative;
  min-height: 210px;
  box-shadow: 0 4px 28px rgba(0,0,0,.13), 0 1px 4px rgba(0,0,0,.07);
  border: 1px solid rgba(220,220,225,.9);
    background: #ffffff;
}

.gw-bg-blur { display: none; }

/* ===== Greeting Widget 圆点装饰（重构版） ===== */
.gw-dots-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 34px;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

/* 三排圆点：第1排(4px) + 第2排(16px, 错位) + 第3排(28px) */
.gw-dots-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(180,180,188,.58) 2px, transparent 2px);
  background-size: 16px 20px;   /* ← 10 改成 20 */
  background-position: 3px -2px;
}

/* 删掉原来的 ::after（大圆点 + 旧样式） */
.gw-dots-header::after {
  content: '';
  display: block;
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(180,180,188,.4) 2px, transparent 2px);
  background-size: 16px 20px;      /* 垂直间距改大，只保留一排 */
  background-position: 11px 8px;   /* 垂直位置从 9px 改为 14px */
}

/* Content wrapper */
.gw-content-wrapper {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  padding: 48px 16px 20px;
  gap: 10px;
}

/* Bubbles row */
.gw-bubbles-row {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-end;
  padding: 0 8px;
  gap: 36px;
}

/* Speech bubble */
.gw-bubble {
  background: rgba(230,230,235,.6);
  border: 1px solid rgba(210,210,218,.8);
  border-radius: 16px;
  padding: 6px 14px 8px;
  font-size: 12px;
  color: #4a4a50;
  font-weight: 400;
  letter-spacing: .4px;
  position: relative;
  min-width: 70px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  cursor: pointer;
}

/* triangle pointing toward the corresponding avatar center */
.gw-bubble::before {
  content: '';
  position: absolute;
  bottom: -7px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid rgba(230,230,235,.9);
}

/* left bubble: tail points right toward left avatar */
.gw-bubble-left::before {
  right: 22px;
  left: auto;
}

/* right bubble: tail points left toward right avatar */
.gw-bubble-right::before {
  left: 22px;
  right: auto;
}

.gw-bubble:active { opacity: .75; }

/* Avatars + info row */
.gw-avatars-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
}

/* Name + tag info block */
.gw-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.gw-info-left {
  align-items: flex-end;
  padding-right: 14px;
}

.gw-info-right {
  align-items: flex-start;
  padding-left: 14px;
}

/* Avatar circle */
.gw-avatar {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid rgba(255,255,255,.95);
  box-shadow: 0 4px 16px rgba(0,0,0,.14), inset 0 1px 3px rgba(255,255,255,.6);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease;
  flex-shrink: 0;
  margin: 0 -6px;
}

.gw-avatar:active {
  transform: scale(0.94);
}

.gw-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gw-avatar svg {
  width: 56px;
  height: 56px;
  stroke: #b0b0b8;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Name */
.gw-name {
  font-size: 20px;
  font-weight: 700;
  color: #2c2c2e;
  letter-spacing: -.3px;
  cursor: pointer;
  line-height: 1.1;
}

.gw-name:active { opacity: .6; }

/* Tag line */
.gw-tag {
  font-size: 11px;
  font-weight: 400;
  color: #8e8e93;
  letter-spacing: .1px;
  cursor: pointer;
  line-height: 1.3;
}

.gw-tag:active { opacity: .6; }

/* ===== Music Widget (Collect / album style) ===== */
.music-widget {
  border-radius: 22px;
  background: #ffffff;                    /* ← 背景改為白色 */
  padding: 16px 16px 0;
  box-shadow: 0 2px 18px rgba(0, 0, 0, .06);
  display: flex;
  flex-direction: column;
  gap: 0;
  aspect-ratio: 1;
  width: 100%;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

/* Header row: title + arrow button */
.mw-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  padding-bottom: 14px;
  position: relative;
}

/* 文字與返回按鈕之間的白線 */
.mw-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 40px;                            /* 停在返回按鈕左側前一點 */
  bottom: 4px;
  height: 1.5px;
  background: #ffffff;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .10);
}

.mw-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mw-song {
  font-size: 13px;                        /* ← 由 15px 縮小 */
  font-weight: 700;
  color: #2f2f31;
  cursor: pointer;
  letter-spacing: -.3px;
  line-height: 1.2;
}

.mw-song:active { opacity: .6; }

.mw-artist {
  font-size: 8px;                         /* ← 由 9px 縮小 */
  color: #8e8e93;
  font-weight: 400;
  cursor: pointer;
  letter-spacing: -.1px;
}

.mw-artist:active { opacity: .6; }

/* 返回按鈕（縮小 + 淺灰陰影） */
.mw-next-btn {
  width: 32px;                            /* ← 由 38px 縮小 */
  height: 32px;                           /* ← 由 38px 縮小 */
  border-radius: 10px;                    /* ← 由 12px 微調 */
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, .04);   /* ← 淺灰細邊框 */
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08), 0 0 0 .5px rgba(0, 0, 0, .03);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  z-index: 2;                             /* 蓋在白線上方 */
}

.mw-next-btn svg {
  width: 15px;                            /* ← 由 18px 縮小 */
  height: 15px;                           /* ← 由 18px 縮小 */
  stroke: #8e8e93;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mw-next-btn:active { opacity: .7; }

/* Disc + cover area */
.mw-disc-area {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-end;
}

/* 唱片背景（外圈白 + 淺灰陰影） */
.mw-disc-bg {
  position: absolute;
  left: 32%;
  bottom: 10%;
  width: 74%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .08), 0 0 0 .5px rgba(0, 0, 0, .03);
  z-index: 1;
}

.mw-disc-bg::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #e4e4e8;
}

.mw-disc-bg::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 25%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #a6a6ac;
}

/* 專輯封面（白色外框 + 淺灰陰影） */
.mw-cover {
  position: relative;
  z-index: 2;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 14px;
  background: #d8d8dc;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 0 0 4px #ffffff, 0 2px 12px rgba(0, 0, 0, .10);
  margin-bottom: 14px;
  flex-shrink: 0;
}

.mw-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mw-cover-ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #d0d0d4;
}

.mw-cover-ph svg {
  width: 28px;
  height: 28px;
  stroke: #b0b0b5;
  fill: none;
  stroke-width: 1.3;
}

.mw-cover:active { opacity: .85; }

/* ===== Calendar Widget (Captcha) — padding-bottom 正方形版本 ===== */
.calendar-widget {
  /* 核心：用 padding-bottom 撐出正方形，完全不依賴 aspect-ratio */
  position: relative;
  width: 100%;
  height: 0 !important;
  padding-bottom: 100% !important; /* 高度 = 寬度 → 正方形 */

  /* 外觀 */
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 2px 18px rgba(0,0,0,.07), 0 1px 0 rgba(255,255,255,.9) inset;
  border: 1px solid rgba(255,255,255,.7);
  overflow: hidden;
  box-sizing: border-box;

  /* 防止被 flex 壓縮或拉伸 */
  flex: 0 0 auto !important;
  align-self: flex-start;
}

/* 內部所有「直接子元素」絕對定位填滿 */
.calendar-widget > .cw-robot-bar,
.calendar-widget > .cw-body,
.calendar-widget > div[style*="display:none"] {
  position: absolute;
  left: 0;
  right: 0;
}

/* 頂欄貼齊頂部 */
.calendar-widget > .cw-robot-bar {
  top: 0;
  height: auto;
}

/* Body 撐滿剩餘空間：從頂欄底部到容器底部 */
.calendar-widget > .cw-body {
  top: 50px;   /* ← 這個值 = 頂欄實際高度，若跑版可微調 48~54 */
  bottom: 0;
  border-radius: 0 0 22px 22px;
  display: flex;
  flex-direction: column;
}

/* 隱藏用的 div 不要佔空間 */
.calendar-widget > div[style*="display:none"] {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Top bar */
.cw-robot-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px 11px;
  background: #ffffff;
  border-bottom: 0.5px solid rgba(0,0,0,.06);
  flex-shrink: 0;         /* ← 新增：頂欄不被壓縮 */
}

/* Checkmark circle */
.cw-robot-checkbox {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8e8ed, #dddde3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  position: relative;
  overflow: hidden;
}

.cw-robot-checkbox::after {
  content: '';
  width: 9px;
  height: 5px;
  border-left: 2px solid #8e8e93;
  border-bottom: 2px solid #8e8e93;
  transform: rotate(-45deg) translate(1px, -1px);
  display: block;
}

.cw-robot-label {
  font-size: 13px;
  font-weight: 600;
  color: #2c2c2e;
  letter-spacing: -.2px;
  flex: 1;
}

/* reCAPTCHA logo area */
.cw-robot-bar-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.cw-robot-bar-logo svg {
  width: 18px;
  height: 18px;
  stroke: #b0b0b8;
  fill: none;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cw-robot-bar-logo-text {
  font-size: 7px;
  color: #c0c0c5;
  font-weight: 500;
  letter-spacing: .2px;
  line-height: 1;
}

/* Triangle hidden in new design */
.cw-triangle { display: none; }

/* Body */
.cw-body {
  background: #f7f7f9;
  border-radius: 0 0 22px 22px;
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
  min-height: 0;          /* ← 新增：關鍵，允許被壓縮 */
  overflow: hidden;       /* ← 新增：不讓內容溢出撐大 */
}

/* Input row */
.cw-input-row {
  display: grid;
  grid-template-columns: 1fr auto;  /* 輸入框吃剩餘空間，按鈕吃自己的寬度 */
  gap: 7px;
  align-items: center;
  min-width: 0;
  flex-shrink: 0;
}

.cw-type-input {
  flex: 1;
  min-width: 0;
  height: 32px;
  min-height: 0;
  border: 1px solid rgba(0,0,0,.09);
  border-radius: 10px;
  background: #ffffff;
  padding: 0 10px;
  font-size: 11px;
  color: #b0b0b8;
  font-weight: 400;
  outline: none;
  font-family: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,.05) inset;
}

.cw-type-input:focus {
  border-color: rgba(0,0,0,.18);
  color: #3a3a3c;
}

.cw-verify-btn {
  height: 32px;
  min-height: 0;
  padding: 0 12px;
  background: #2c2c2e;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
  letter-spacing: .1px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

.cw-verify-btn:active {
  background: #1a1a1c;
  transform: scale(.97);
}

/* Image area */
.cw-image-row {
  display: flex;
  align-items: stretch;
  gap: 7px;
  flex: 1;
  min-height: 0;          /* ← 新增：關鍵，允許被壓縮 */
  overflow: hidden;       /* ← 新增：不讓內容溢出 */
}

.cw-captcha-img-wrap {
  flex: 1;
  min-height: 0;
  border: 1px solid rgba(0,0,0,.07);
  border-radius: 14px;
  background: #ffffff;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}

.cw-captcha-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
}

.cw-captcha-img-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.cw-captcha-img-ph svg {
  width: 24px;
  height: 24px;
  stroke: #d0d0d5;
  fill: none;
  stroke-width: 1.3;
}

.cw-captcha-img-wrap:active { opacity: .8; }

/* Right icon buttons */
.cw-icon-btns {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  width: 28px;
  min-height: 0;          /* ← 核心修復：不再撐高父層 */
  overflow: hidden;       /* ← 新增：保險 */
}

.cw-icon-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,.07);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  transition: background .15s, transform .15s;
  flex-shrink: 0;
}

.cw-icon-btn:active {
  background: #f0f0f2;
  transform: scale(.93);
}

.cw-icon-btn svg {
  width: 14px;
  height: 14px;
  stroke: #8e8e93;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cw-month, .cw-date, .cw-weekday, .cw-divider, .cw-event, .cw-countdown { display: none; }

/* ===== 第二頁佈局 ===== */
.p2-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.p2-left,
.p2-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* 删掉 align-items: flex-start */
  align-items: stretch;  /* 改回 stretch，让子元素撑满宽度 */
}

.p2-mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
  justify-items: center;
  width: 100%;  /* ← 新增 */
}

.p2-mini-grid .app-icon-wrap {
  gap: 6px;
}

.p2-mini-grid .app-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .85), rgba(255, 255, 255, .55));
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, .7);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .06), 0 0.5px 0 rgba(255, 255, 255, .9) inset;
  transition: transform .15s;
}

.p2-mini-grid .app-icon:active {
  transform: scale(.92);
}

.p2-mini-grid .app-icon svg {
  width: 24px;
  height: 24px;
  stroke: #4a4a4e;
  stroke-width: 1.5;
}

.p2-mini-grid .app-label {
  font-size: 9px;
  color: #48484a;
  font-weight: 500;
  letter-spacing: .2px;
}

/* ===== Page 1 Bottom: weather left + icons right ===== */
.home-p1-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 30px;
}

/* ===== Weather Widget (new style — matches image) ===== */
.weather-widget {
  aspect-ratio: 1;
  border-radius: 22px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.9);
  box-shadow: 0 4px 24px rgba(0,0,0,.07), 0 1px 0 rgba(255,255,255,.9) inset;
  padding: 14px 13px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: transform .15s;
}

.weather-widget:active { transform: scale(.97); }

/* top section: date left + text right */
.nww-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-shrink: 0;
}

.nww-date-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex-shrink: 0;
  min-width: 44px;
  padding-left: 8px;   /* ← 新增：向右挪進 */
}

.nww-weekday {
  font-size: 9px;      /* ← 由 11px 縮小 */
  color: rgba(120,120,128,.7);
  font-weight: 500;
  letter-spacing: .4px;
  line-height: 1;
  margin-bottom: 2px;
}

.nww-day {
  font-size: 34px;     /* ← 由 44px 縮小 */
  font-weight: 200;
  color: #2c2c2e;
  line-height: 1;
  letter-spacing: -2px;   /* ← 由 -3px 微調，配合縮小 */
}


.nww-record-block {
  flex: 1;
  min-width: 0;
  padding-top: 1px;
}

.nww-record1,
.nww-record2 {
  font-size: 11px;
  color: rgba(100,100,108,.75);
  font-weight: 400;
  line-height: 1.55;
  cursor: pointer;
  display: block;
}

.nww-record1:active,
.nww-record2:active { opacity: .6; }

.nww-oval {
  flex: 1;
  min-height: 0;
  margin: 0 -4px -2px;   /* ← 新增：用負邊距向外撐大橢圓 */
  border-radius: 999px;
  border: 1.5px solid rgba(255,255,255,.85);
  background: rgba(248,248,250,.5);
  display: flex;
  flex-direction: row;
  overflow: hidden;
  box-shadow: 0 1px 8px rgba(0,0,0,.06) inset;
}


/* left circle image — takes ~63% width, circular crop via border-radius trick */
.nww-oval-img {
  width: 63%;
  height: 100%;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  border-radius: 50%;
  margin: -1px 0 -1px -1px;
}

.nww-oval-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.nww-img-ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(220,220,225,.3);
  border-radius: 50%;
}

.nww-img-ph svg {
  width: 20px;
  height: 20px;
  stroke: #c7c7cc;
  fill: none;
  stroke-width: 1.3;
}

.nww-oval-img:active { opacity: .8; }

.nww-oval-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px 8px 0;   /* ← 右邊 padding 加大、左邊改 0，把內容往左推 */
}

.nww-cond-icon svg {
  width: 22px;
  height: 22px;
  stroke: #8e8e93;
  fill: none;
  stroke-width: 1.3;
  stroke-linecap: round;
}

.nww-temp {
  font-size: 13px;
  font-weight: 500;
  color: #3a3a3c;
  letter-spacing: -.3px;
}

.ww-top, .ww-indicator, .ww-city, .ww-cond,
.ww-divider, .ww-hum-row, .ww-time { display: none; }

.ww-top {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.ww-indicator {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.ww-indicator svg {
  width: 18px;
  height: 18px;
  stroke: #8e8e93;
  fill: none;
  stroke-width: 1.4;
  stroke-linecap: round;
}

.ww-indicator.loading svg {
  animation: ww-spin 1s linear infinite;
}

@keyframes ww-spin {
  to { transform: rotate(360deg); }
}

.ww-city {
  font-size: 9px;
  color: #a0a0a5;
  font-weight: 500;
  letter-spacing: .3px;
  text-align: right;
  flex: 1;
  margin-left: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ww-temp {
  font-size: 28px;
  font-weight: 200;
  color: #1d1d1f;
  line-height: 1;
  letter-spacing: -1px;
  margin: 2px 0 0;
}

.ww-cond {
  font-size: 11px;
  color: #6e6e73;
  font-weight: 400;
  margin-top: 2px;
  letter-spacing: .1px;
}

.ww-divider {
  width: 100%;
  height: 0.5px;
  background: rgba(0,0,0,.07);
  margin: 6px 0;
}

.ww-hum-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ww-hum-row svg {
  width: 11px;
  height: 11px;
  stroke: #a0a0a5;
  fill: none;
  stroke-width: 1.4;
  flex-shrink: 0;
}

.ww-hum-row span {
  font-size: 11px;
  color: #6e6e73;
  font-weight: 400;
}

.ww-time {
  font-size: 9px;
  color: #c0c0c5;
  margin-top: 4px;
  letter-spacing: .2px;
}

/* ===== Page 1 icon grid: 2x3 on the right ===== */
.home-icon-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(2, auto);
  gap: 14px 12px;
  align-content: center;
  justify-items: center;
  padding-top: 0;
}

.home-icon-grid .app-icon-wrap {
  gap: 6px;
}

.home-icon-grid .app-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255,255,255,.85), rgba(255,255,255,.55));
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 2px 12px rgba(0,0,0,.06), 0 0.5px 0 rgba(255,255,255,.9) inset;
  transition: transform .15s;
}

.home-icon-grid .app-icon:active {
  transform: scale(.92);
}

.home-icon-grid .app-icon svg {
  width: 24px;
  height: 24px;
  stroke: #4a4a4e;
  stroke-width: 1.5;
}

.home-icon-grid .app-label {
  font-size: 9px;
  color: #48484a;
  font-weight: 500;
  letter-spacing: .2px;
}

/* ===== Modern Modals (Black & White) ===== */
.modern-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .25s ease;
}

.modern-modal-overlay.show { opacity: 1; }

.modern-modal {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  width: 100%;
  max-width: 340px;
  overflow: hidden;
  transform: scale(.9);
  transition: transform .25s ease;
}

.modern-modal-overlay.show .modern-modal {
  transform: scale(1);
}

.modern-modal-header {
  padding: 20px 20px 16px;
  text-align: center;
  border-bottom: 0.5px solid rgba(0,0,0,.08);
}

.modern-modal-title {
  font-size: 17px;
  font-weight: 600;
  color: #1d1d1f;
  letter-spacing: -.3px;
}

.modern-modal-subtitle {
  font-size: 13px;
  color: #6e6e73;
  margin-top: 4px;
  line-height: 1.4;
}

.modern-modal-body {
  padding: 20px;
}

.modern-modal-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid rgba(0,0,0,.12);
  border-radius: 12px;
  font-size: 15px;
  background: #fafafa;
  transition: all .2s;
  outline: none;
  font-family: inherit;
  color: #1d1d1f;
}

.modern-modal-input:focus {
  background: #fff;
  border-color: #3a3a3c;
  box-shadow: 0 0 0 3px rgba(0,0,0,.06);
}

.modern-modal-textarea {
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

.modern-modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 20px 20px;
}

.modern-modal-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  letter-spacing: .2px;
}

.modern-modal-btn-primary {
  background: #1d1d1f;
  color: #fff;
}

.modern-modal-btn-primary:active {
  background: #000;
  transform: scale(.98);
}

.modern-modal-btn-secondary {
  background: #f2f2f7;
  color: #3a3a3c;
}

.modern-modal-btn-secondary:active {
  background: #e5e5ea;
  transform: scale(.98);
}

.modern-modal-btn-danger {
  background: transparent;
  color: #1d1d1f;
  border: 1px solid rgba(0,0,0,.15);
}

.modern-modal-btn-danger:active {
  background: rgba(0,0,0,.05);
}

.modern-modal-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: #fafafa;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 12px;
  cursor: pointer;
  transition: all .2s;
  margin-bottom: 10px;
}

.modern-modal-option:active {
  background: #f0f0f0;
  transform: scale(.98);
}

.modern-modal-option-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #2c2c2e;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modern-modal-option-icon svg {
  width: 20px;
  height: 20px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.modern-modal-option-text {
  flex: 1;
}

.modern-modal-option-title {
  font-size: 15px;
  font-weight: 500;
  color: #1d1d1f;
  margin-bottom: 2px;
}

.modern-modal-option-desc {
  font-size: 12px;
  color: #6e6e73;
  line-height: 1.3;
}

/* ===== 空白圖標 ===== */
.blank-icon {
  background: linear-gradient(145deg, rgba(255, 255, 255, .4), rgba(255, 255, 255, .2)) !important;
  border: 1.5px dashed rgba(0, 0, 0, .08) !important;
  box-shadow: none !important;
}

.blank-icon svg {
  stroke: #c7c7cc !important;
  stroke-width: 1.2 !important;
}

.blank-label {
  color: #c7c7cc !important;
}

.app-icon-wrap:has(.blank-icon):active .app-icon {
  transform: none;
}

/* ===== 窄螢幕（手機）下壓縮 Calendar Widget 內部，避免撐破 aspect-ratio 方塊 ===== */
@media (max-width: 520px) {
  /* 頂欄高度變小，body 的 top 也要跟著改 */
  .calendar-widget > .cw-body {
    top: 44px;   /* ← 因為手機端頂欄縮小了，這裡也縮小 */
  }

  /* 內部佈局 */
  .cw-body {
    padding: 8px 8px 10px;
    gap: 6px;
  }
  .cw-input-row {
    flex-shrink: 0;
  }
  .cw-image-row {
    flex: 1;
    min-height: 0;
  }
  .cw-captcha-img-wrap {
    height: 100%;
  }

  .cw-robot-bar {
    padding: 10px 12px 9px;
    gap: 8px;
  }
  .cw-robot-checkbox {
    width: 22px;
    height: 22px;
  }
  .cw-robot-checkbox::after {
    width: 8px;
    height: 4px;
    border-left-width: 1.8px;
    border-bottom-width: 1.8px;
  }
  .cw-robot-label {
    font-size: 12px;
  }
  .cw-robot-bar-logo svg {
    width: 15px;
    height: 15px;
  }
  .cw-robot-bar-logo-text {
    font-size: 6px;
  }
  .cw-body {
    padding: 8px 8px 10px;
    gap: 6px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }
  .cw-input-row {
    gap: 5px;
    flex-shrink: 0;
  }
  .cw-type-input {
    height: 28px;
    font-size: 10px;
    padding: 0 8px;
  }
  .cw-verify-btn {
    height: 28px;
    padding: 0 9px;
    font-size: 10px;
  }
  .cw-image-row {
    gap: 5px;
    flex: 1;
    min-height: 0;
  }
  .cw-captcha-img-wrap {
    height: 100%;
  }
  .cw-icon-btns {
    gap: 5px;
    width: 22px;
  }
  .cw-icon-btn {
    width: 22px;
    height: 22px;
    border-radius: 8px;
  }
  .cw-icon-btn svg {
    width: 12px;
    height: 12px;
  }
}