/* ===== 站內公告橫幅（可關閉）===== */
.cy-announce-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(255, 77, 131, 0.96), rgba(255, 138, 91, 0.96));
  color: #fff;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Noto Sans TC",
    "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.3);
}
.cy-announce-text { flex: 1; line-height: 1.5; min-width: 0; }
.cy-announce-cta {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
  padding: 5px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.cy-announce-cta:hover { background: rgba(255, 255, 255, 0.36); }
.cy-announce-close {
  flex-shrink: 0;
  appearance: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.85;
}
.cy-announce-close:hover { opacity: 1; }
@media (max-width: 600px) {
  .cy-announce-banner { font-size: 12.5px; padding: 8px 12px; gap: 8px; }
  .cy-announce-cta { padding: 4px 10px; }
  .cy-announce-close { font-size: 20px; }
}

/* 共用主題：色票 + 動畫背景。所有頁面都會載入。 */
:root {
  --c-rose: #ff4d83;
  --c-coral: #ff8a5b;
  --c-amber: #fbbf24;
  --c-violet: #8b5cf6;
  --c-cyan: #22d3ee;
  --c-mint: #5eead4;
  --g-primary: linear-gradient(135deg, #ff4d83 0%, #ff8a5b 55%, #fbbf24 100%);
  --g-violet: linear-gradient(135deg, #8b5cf6, #22d3ee);
}

/* 動畫背景。頁面只要放 <div class="bg-wall" aria-hidden="true"></div> 即可生效。 */
.bg-wall {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(1200px 800px at 50% -10%, rgba(139, 92, 246, 0.15), transparent 65%),
    linear-gradient(180deg, #14102b 0%, #0a0a1f 60%, #08091a 100%);
}
.bg-wall::before,
.bg-wall::after {
  content: "";
  position: absolute;
  inset: -10%;
  z-index: -1;
  will-change: transform;
}
.bg-wall::before {
  background:
    radial-gradient(520px 380px at 18% 22%, rgba(255, 77, 131, 0.32), transparent 60%),
    radial-gradient(620px 460px at 82% 72%, rgba(34, 211, 238, 0.28), transparent 62%);
  animation: cyBgDrift1 22s ease-in-out infinite alternate;
  filter: blur(8px);
}
.bg-wall::after {
  background:
    radial-gradient(700px 520px at 75% 18%, rgba(139, 92, 246, 0.32), transparent 60%),
    radial-gradient(560px 420px at 22% 82%, rgba(251, 191, 36, 0.22), transparent 60%);
  animation: cyBgDrift2 28s ease-in-out infinite alternate;
  filter: blur(10px);
}
@keyframes cyBgDrift1 {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(3%, -2%, 0) scale(1.08); }
  100% { transform: translate3d(-2%, 3%, 0) scale(1.04); }
}
@keyframes cyBgDrift2 {
  0%   { transform: translate3d(0, 0, 0) scale(1.05); }
  50%  { transform: translate3d(-3%, 2%, 0) scale(1); }
  100% { transform: translate3d(2%, -3%, 0) scale(1.1); }
}
@media (prefers-reduced-motion: reduce) {
  .bg-wall::before,
  .bg-wall::after { animation: none; }
}

/* 飄浮裝飾層：散落在頁面空白處的小圖示。頁面只要放 <div class="deco-layer">...</div> 即可。 */
.deco-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.deco {
  position: absolute;
  fill: none;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.7;
  will-change: transform, opacity;
}
@media (max-width: 720px) {
  .deco-layer .deco:nth-child(n+5) { display: none; }
  .deco-layer .deco { transform: scale(0.8); }
}
.deco-heart    { top: 8%;  left: 6%;   width: 56px;  height: 56px;  stroke: rgba(255, 77, 131, 0.55);  animation: cyDecoFloatA 11s infinite alternate ease-in-out; }
.deco-spark-1  { top: 18%; right: 10%; width: 38px;  height: 38px;  stroke: rgba(251, 191, 36, 0.65);  animation: cyDecoFloatB 8s  infinite alternate ease-in-out; }
.deco-envelope { top: 42%; right: 6%;  width: 64px;  height: 64px;  stroke: rgba(34, 211, 238, 0.45);  animation: cyDecoFloatA 13s infinite alternate ease-in-out; animation-delay: -3s; }
.deco-calendar { top: 50%; left: 4%;   width: 52px;  height: 52px;  stroke: rgba(139, 92, 246, 0.55);  animation: cyDecoFloatB 12s infinite alternate ease-in-out; animation-delay: -2s; }
.deco-bubble   { bottom: 16%; left: 12%; width: 60px; height: 60px; stroke: rgba(94, 234, 212, 0.5);   animation: cyDecoFloatA 14s infinite alternate ease-in-out; animation-delay: -5s; }
.deco-spark-2  { bottom: 22%; right: 14%; width: 32px; height: 32px; stroke: rgba(255, 138, 91, 0.6);  animation: cyDecoFloatB 9s  infinite alternate ease-in-out; animation-delay: -4s; }
.deco-paper    { bottom: 8%;  right: 8%;  width: 54px; height: 54px; stroke: rgba(139, 92, 246, 0.4);  animation: cyDecoFloatA 15s infinite alternate ease-in-out; animation-delay: -6s; }
.deco-dot-1    { top: 30%; left: 38%; width: 8px; height: 8px; background: rgba(251, 191, 36, 0.45); border-radius: 50%; animation: cyDecoTwinkle 4s infinite alternate ease-in-out; animation-delay: -1s; }
.deco-dot-2    { top: 62%; right: 32%; width: 6px; height: 6px; background: rgba(34, 211, 238, 0.5);  border-radius: 50%; animation: cyDecoTwinkle 5s infinite alternate ease-in-out; animation-delay: -2.5s; }
.deco-dot-3    { bottom: 30%; left: 42%; width: 10px; height: 10px; background: rgba(255, 77, 131, 0.4); border-radius: 50%; animation: cyDecoTwinkle 6s infinite alternate ease-in-out; animation-delay: -3.5s; }

@keyframes cyDecoFloatA {
  0%   { opacity: 0.6; transform: translate3d(0, 0, 0) rotate(-4deg); }
  100% { opacity: 1;   transform: translate3d(8px, -14px, 0) rotate(6deg); }
}
@keyframes cyDecoFloatB {
  0%   { opacity: 0.55; transform: translate3d(0, 0, 0) rotate(5deg) scale(1); }
  100% { opacity: 1;    transform: translate3d(-6px, 12px, 0) rotate(-7deg) scale(1.08); }
}
@keyframes cyDecoTwinkle {
  0%   { opacity: 0.25; transform: scale(1); }
  100% { opacity: 1;    transform: scale(1.6); }
}
@media (prefers-reduced-motion: reduce) {
  .deco { animation: none !important; opacity: 0.5 !important; }
}

/* 共用左側導覽選單樣式。Class 前綴 cy- 避免與頁面內既有樣式衝突。 */

.cy-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 220px;
  padding: 22px 14px;
  background:
    radial-gradient(420px 280px at 50% -10%, rgba(139, 92, 246, 0.18), transparent 70%),
    linear-gradient(180deg, rgba(24, 18, 50, 0.82) 0%, rgba(14, 12, 32, 0.88) 100%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid rgba(139, 92, 246, 0.18);
  overflow-y: auto;
  z-index: 40;
  color: rgba(255, 255, 255, 0.94);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Noto Sans TC", "PingFang TC",
    "Microsoft JhengHei", sans-serif;
}
.cy-sidebar-brand {
  display: block;
  padding: 8px 12px 22px;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0.04em;
  background: var(--g-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 14px rgba(255, 138, 91, 0.3));
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.18s ease, transform 0.18s ease;
}
.cy-sidebar-brand:hover {
  filter: drop-shadow(0 4px 18px rgba(255, 77, 131, 0.55)) brightness(1.08);
  transform: translateY(-1px);
}
.cy-sidebar-brand:active {
  transform: translateY(0);
}
.cy-sidebar-title {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
  padding: 0 12px 8px;
  text-transform: uppercase;
  font-weight: 700;
}
.cy-sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.62);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 2px;
  transition: background 0.15s ease, color 0.15s ease;
}
.cy-sidebar-link:hover {
  background: rgba(139, 92, 246, 0.1);
  color: rgba(255, 255, 255, 0.96);
}
.cy-sidebar-link.is-active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.32), rgba(34, 211, 238, 0.22));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.55), 0 4px 16px rgba(139, 92, 246, 0.25);
}

/* 未登入訪客「鎖定」項目（例如配對）：視覺模糊 + 鎖頭圖示 + cursor 變禁止 */
.cy-sidebar-link[data-locked="1"] {
  filter: blur(0.8px);
  opacity: 0.55;
  cursor: not-allowed;
  position: relative;
}
.cy-sidebar-link[data-locked="1"]::after {
  content: "🔒";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  filter: blur(0px);
  font-size: 12px;
  opacity: 0.85;
}
.cy-sidebar-link[data-locked="1"]:hover {
  background: rgba(255, 77, 131, 0.08);
  filter: blur(0.5px);
  opacity: 0.7;
}

/* 紅點：有未讀通知時，相關選單項顯示閃爍紅點 */
.cy-sidebar-link {
  position: relative;
}
.cy-sidebar-dot {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #fbbf24;
  box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.7);
  display: none;
}
.cy-sidebar-link[data-has-unread="1"] .cy-sidebar-dot {
  display: block;
  animation: cySidebarDotPulse 1.4s ease-out infinite;
}
@keyframes cySidebarDotPulse {
  0%   { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.7); transform: translateY(-50%) scale(1); }
  70%  { box-shadow: 0 0 0 8px rgba(251, 191, 36, 0); transform: translateY(-50%) scale(1.25); }
  100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); transform: translateY(-50%) scale(1); }
}
.cy-sidebar-link .cy-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 底部：使用者資訊 + 登出 */
.cy-sidebar-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.cy-sidebar-user {
  padding: 6px 12px 10px;
}
.cy-sidebar-user-name {
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
}
.cy-sidebar-user-email {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 2px;
  overflow-wrap: anywhere;
}
button.cy-sidebar-link {
  width: 100%;
  appearance: none;
  background: transparent;
  border: none;
  font: inherit;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.cy-sidebar-link.cy-logout {
  color: rgba(255, 180, 190, 0.85);
}
.cy-sidebar-link.cy-logout:hover {
  background: rgba(255, 77, 131, 0.14);
  color: #ffadbe;
}
.cy-sidebar-link.cy-login-link {
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 77, 131, 0.38), rgba(251, 191, 36, 0.28));
  box-shadow: inset 0 0 0 1px rgba(255, 138, 91, 0.55), 0 4px 16px rgba(255, 77, 131, 0.2);
}

/* Instagram 連結（側欄底部、登入前後皆顯示） */
.cy-sidebar-social {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.82);
  background: linear-gradient(135deg, rgba(225, 48, 108, 0.18), rgba(131, 58, 180, 0.18), rgba(64, 93, 230, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.12s ease, box-shadow 0.15s ease, color 0.15s ease;
}
.cy-sidebar-social .cy-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.cy-sidebar-social:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(225, 48, 108, 0.28);
  background: linear-gradient(135deg, rgba(225, 48, 108, 0.32), rgba(131, 58, 180, 0.32), rgba(64, 93, 230, 0.32));
}

.cy-sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 50;
  appearance: none;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.cy-sidebar-toggle svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
}

/* 預設：桌面版身體左側騰出 220px 給 sidebar */
body.cy-has-sidebar {
  padding-left: 220px;
}
body.cy-has-sidebar .cy-sidebar-toggle { display: none; }

@media (max-width: 900px) {
  .cy-sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    /* 用動態視窗高度（dvh），避免被手機瀏覽器上下工具列裁掉底部的「登出 / IG」。
       100vh 在 iOS 是「工具列收起時」的最大高度 → 工具列出現時會超出可視範圍，故用 dvh 修正 */
    height: 100vh;
    height: 100dvh;
    /* backdrop-filter 在捲動時會逐格重算模糊 → 在手機上嚴重卡頓。
       抽屜本來就該是不透明的，改用實心底色，捲動立刻變順 */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: linear-gradient(180deg, #181230 0%, #0e0c20 100%);
    -webkit-overflow-scrolling: touch;          /* iOS 慣性捲動 */
    overscroll-behavior: contain;               /* 捲到底不要連動到背景頁面 */
    /* 底部多留安全區，讓登出 / IG 不被 home 指示條或工具列蓋住 */
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }
  .cy-sidebar[data-open="1"] {
    transform: translateX(0);
  }
  body.cy-has-sidebar {
    padding-left: 0;
  }
  body.cy-has-sidebar .cy-sidebar-toggle {
    display: inline-flex;
  }
  /* 抽屜開啟時隱藏漢堡鈕，避免蓋住左上角 LOGO（不支援 :has 的舊瀏覽器維持顯示，仍可點外面關閉）*/
  body.cy-has-sidebar:has(.cy-sidebar[data-open="1"]) .cy-sidebar-toggle {
    display: none;
  }
}

/* ===== 全域登入提示 Modal（訪客操作受限時顯示） ===== */
.cy-login-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 9, 26, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  font-family: ui-sans-serif, system-ui, "Segoe UI", "Noto Sans TC",
    "PingFang TC", "Microsoft JhengHei", sans-serif;
}
.cy-login-modal[data-open="1"] {
  opacity: 1;
  pointer-events: auto;
}
.cy-login-modal-card {
  width: min(420px, calc(100% - 32px));
  background: rgba(20, 16, 43, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  padding: 32px 28px 24px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.65);
  color: rgba(255, 255, 255, 0.92);
  text-align: center;
  transform: translateY(8px) scale(0.98);
  transition: transform 0.18s ease;
}
.cy-login-modal[data-open="1"] .cy-login-modal-card {
  transform: translateY(0) scale(1);
}
.cy-login-modal-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(255, 77, 131, 0.25), rgba(255, 138, 91, 0.25));
  border: 1px solid rgba(255, 138, 91, 0.4);
  font-size: 30px;
}
.cy-login-modal-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
}
.cy-login-modal-msg {
  margin: 0 0 24px;
  font-size: 15px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.72);
}
.cy-login-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.cy-login-modal-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 650;
  font-size: 15px;
  font-family: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}
.cy-login-modal-btn.primary {
  background: linear-gradient(135deg, #ff4d83, #ff8a5b);
  color: #fff;
  box-shadow: 0 8px 24px rgba(255, 77, 131, 0.35);
}
.cy-login-modal-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(255, 77, 131, 0.45);
}
.cy-login-modal-btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.cy-login-modal-btn.ghost:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* ===== iOS 防自動縮放 =====
   iPhone Safari 在 focus 字級 < 16px 的輸入框時會強制放大整頁、且縮不回去。
   全站輸入欄統一最小 16px（手機尺寸才套用，桌機維持各頁原本字級）。*/
@media (max-width: 600px) {
  input,
  textarea,
  select {
    font-size: 16px !important;
  }
}
