:root {
  --bg: #fff8ec;
  --card-bg: #fffdf7;

  --main: #00bfa6;
  --main-dark: #008f80;
  --main-light: #b8eee4;

  --accent: #ff6b4a;
  --accent-light: #ffe0d7;

  --yellow: #ffd76a;
  --text: #263b38;
  --muted: #7a8a86;

  --cream-border: #f2dfbd;
  --shadow: rgba(0, 143, 128, 0.14);

  /* 社群柔化色：保留平台辨識，但不要用官方高飽和原色 */
  --ig-bg-1: #fff1f2;
  --ig-bg-2: #fce7f3;
  --ig-bg-3: #f5e8ff;
  --ig-text: #7a315f;
  --ig-fill: linear-gradient(135deg, #f9a8d4, #c4b5fd);

  --fb-bg-1: #f0f7ff;
  --fb-bg-2: #dbeafe;
  --fb-text: #244c8f;
  --fb-fill: linear-gradient(135deg, #bfdbfe, #93c5fd);

  --line-bg-1: #f0fff4;
  --line-bg-2: #dcfce7;
  --line-text: #226b3a;
  --line-fill: linear-gradient(135deg, #bbf7d0, #86efac);

  --threads-bg-1: #f7f2ff;
  --threads-bg-2: #ede9fe;
  --threads-text: #56358f;
  --threads-fill: linear-gradient(135deg, #ddd6fe, #a78bfa);
}

/* 全域設定 */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;

  font-family: Arial, "Noto Sans TC", sans-serif;
  color: var(--text);

  background:
    radial-gradient(circle at 18% 12%, rgba(230, 255, 248, 0.95) 0, transparent 32%),
    radial-gradient(circle at 82% 88%, rgba(255, 231, 220, 0.9) 0, transparent 34%),
    radial-gradient(circle at 70% 20%, rgba(255, 215, 106, 0.22) 0, transparent 24%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.55) 25%, transparent 25%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.32) 25%, transparent 25%),
    var(--bg);

  background-size:
    auto,
    auto,
    auto,
    18px 18px,
    22px 22px,
    auto;
}

/* 整頁容器 */
.ecard-page {
  position: relative;

  min-height: 100vh;
  padding: 24px 18px;

  display: flex;
  justify-content: center;
  align-items: center;

  overflow: hidden;
}

/* 頁面紙張顆粒感 */
.ecard-page::before {
  content: "";
  position: absolute;
  inset: 0;

  background-image:
    radial-gradient(circle, rgba(38, 59, 56, 0.055) 1px, transparent 1px),
    radial-gradient(circle, rgba(255, 107, 74, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18), transparent 40%, rgba(0, 191, 166, 0.05));

  background-size:
    8px 8px,
    13px 13px,
    100% 100%;

  opacity: 0.45;
  pointer-events: none;
}

/* CSS-only 開關 */
.enter-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* 電子名片主體 */
.ecard {
  position: relative;
  z-index: 1;

  width: 100%;
  max-width: 430px;
  min-height: 720px;

  padding: 30px 22px 24px;

  display: flex;
  flex-direction: column;

  border: 2px solid var(--main-light);
  border-radius: 36px;

  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.96), rgba(255, 249, 235, 0.94)),
    var(--card-bg);

  box-shadow:
    0 24px 60px var(--shadow),
    inset 0 0 0 1px rgba(255, 255, 255, 0.65);

  text-align: center;
  overflow: hidden;
}

/* eCard 內部紙張紋理 */
.ecard::before {
  content: "";
  position: absolute;
  inset: 0;

  background-image:
    radial-gradient(circle, rgba(0, 143, 128, 0.06) 1px, transparent 1px),
    radial-gradient(circle, rgba(255, 107, 74, 0.055) 1px, transparent 1px),
    linear-gradient(115deg, rgba(255, 255, 255, 0.28), transparent 48%, rgba(242, 223, 189, 0.22));

  background-size:
    10px 10px,
    15px 15px,
    100% 100%;

  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}

/* 內容層級 */
.brand,
.enter-button,
.portal-list,
.footer,
.star,
.circle,
.paper-dots {
  position: relative;
  z-index: 2;
}

/* 品牌區 */
.brand {
  margin-bottom: 20px;
  perspective: 1000px;
}

.brand-logo {
  width: 160px;
  height: 160px;
  max-width: 80%;

  display: block;
  margin: 0 auto 16px;

  border-radius: 50%;
  object-fit: cover;

  border: 0px solid var(--main);
  padding: 2px;
  background: #ffffff;

  box-shadow:
    0 0 0 4px rgba(90, 240, 215, 0.8),
    0 12px 28px rgba(0, 0, 0, 0.18);

  cursor: pointer;
  user-select: none;
  -webkit-user-drag: none;

  transform-origin: center center;
  transform-style: preserve-3d;
  backface-visibility: visible;
  will-change: transform;

  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    filter 0.25s ease;
}

/* 滑鼠滑上去：懸浮 */
.brand-logo:hover {
  transform: translateY(-8px) scale(1.04);

  box-shadow:
    0 0 0 5px rgba(184, 238, 228, 0.95),
    0 18px 38px rgba(0, 143, 128, 0.26);

  filter: brightness(1.04);
}

/* 點一下：往左水平翻轉 */
.brand-logo.flip-left {
  animation: logoFlipLeft 0.9s cubic-bezier(0.22, 0.9, 0.24, 1);
}

/* 再點一下：往右水平翻轉 */
.brand-logo.flip-right {
  animation: logoFlipRight 0.9s cubic-bezier(0.22, 0.9, 0.24, 1);
}

@keyframes logoFlipLeft {
  0% {
    transform: translateY(-8px) rotateY(0deg) scale(1.04);
  }

  50% {
    transform: translateY(-10px) rotateY(-180deg) scale(1.06);
  }

  100% {
    transform: translateY(-8px) rotateY(-360deg) scale(1.04);
  }
}

@keyframes logoFlipRight {
  0% {
    transform: translateY(-8px) rotateY(0deg) scale(1.04);
  }

  50% {
    transform: translateY(-10px) rotateY(180deg) scale(1.06);
  }

  100% {
    transform: translateY(-8px) rotateY(360deg) scale(1.04);
  }
}

.brand-subtitle {
  max-width: 100%;
  margin: 0 0 10px;

  color: var(--main-dark);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.2px;
  line-height: 1.6;

  white-space: normal;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.main-title {
  margin: auto 0 12px;

  color: var(--accent);
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: 1.2px;
}

.brand-description {
  margin: 0;

  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

/* TAP TO ENTER */
.enter-button {
  width: 210px;
  min-height: 65px;

  margin: auto auto 50px;

  display: flex;
  justify-content: center;
  align-items: center;

  border: 2px solid var(--accent);
  border-radius: 999px;

  background: var(--accent);
  color: #ffffff;

  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1.5px;

  cursor: pointer;

  box-shadow: 0 12px 24px rgba(255, 107, 74, 0.22);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.enter-button:hover {
  transform: translateY(-2px);
  background: #ff5c38;
  box-shadow: 0 16px 30px rgba(255, 107, 74, 0.28);
}

/* 入口清單：預設不顯示 */
.portal-list {
  display: none;

  margin-top: 24px;
  flex-direction: column;
  gap: 12px;
}

/* 點擊 enter 後 */
.enter-toggle:checked~.ecard .enter-button {
  display: none;
}

.enter-toggle:checked~.ecard .portal-list {
  display: flex;
}

.enter-toggle:checked~.ecard .main-title {
  display: none;
}

/* 入口按鈕 */
.portal {
  position: relative;
  overflow: hidden;

  width: 100%;
  min-height: 72px;

  padding: 14px 18px;

  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;

  border: 2px solid var(--main);
  border-radius: 24px;

  background: rgba(255, 255, 255, 0.86);
  color: var(--text);

  text-decoration: none;
  text-align: left;

  box-shadow: 0 8px 20px rgba(0, 191, 166, 0.08);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

/* 左到右填滿動畫 */
.portal::before {
  content: "";
  position: absolute;
  inset: 0;

  width: 0%;
  height: 100%;

  background: var(--portal-fill);
  background-size: 100% 100%;
  border-radius: inherit;

  transition: width 0.42s ease;

  z-index: 0;
}

/* 讓文字與 icon 壓在填滿色塊上面 */
.portal-info,
.portal-title,
.portal-text,
.portal-icon {
  position: relative;
  z-index: 1;
}

.portal-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.portal-title,
.portal-text,
.portal-icon {
  transition:
    color 0.25s ease,
    background 0.25s ease,
    transform 0.25s ease;
}

.portal-title {
  margin-bottom: 4px;

  color: var(--main-dark);
  font-size: 16px;
  font-weight: 800;
}

.portal-text {
  color: var(--muted);
  font-size: 13px;
}

.portal-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;

  display: flex;
  justify-content: center;
  align-items: center;

  border-radius: 50%;
  background: rgba(255, 255, 255, 0.56);
  backdrop-filter: blur(2px);

  font-size: 20px;
}

.portal:hover .portal-icon,
.portal:active .portal-icon {
  transform: scale(1.08);
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

/* hover / active 狀態 */
.portal:hover::before,
.portal:active::before {
  width: 100%;
}

.portal:hover,
.portal:active {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(0, 191, 166, 0.16);
}

/* IG：柔粉紫 */
.portal-ig {
  --portal-fill: var(--ig-fill);

  border-color: rgba(122, 49, 95, 0.24);
  background: linear-gradient(135deg, var(--ig-bg-1), var(--ig-bg-2), var(--ig-bg-3));
}

.portal-ig .portal-title {
  color: var(--ig-text);
}

/* FB：柔淡藍 */
.portal-fb {
  --portal-fill: var(--fb-fill);

  border-color: rgba(36, 76, 143, 0.22);
  background: linear-gradient(135deg, var(--fb-bg-1), var(--fb-bg-2));
}

.portal-fb .portal-title {
  color: var(--fb-text);
}

/* LINE：柔薄荷綠 */
.portal-line {
  --portal-fill: var(--line-fill);

  border-color: rgba(34, 107, 58, 0.22);
  background: linear-gradient(135deg, var(--line-bg-1), var(--line-bg-2));
}

.portal-line .portal-title {
  color: var(--line-text);
}

/* Threads：淡紫星球感 */
.portal-threads {
  --portal-fill: var(--threads-fill);

  border-color: rgba(29, 92, 50, 0.22);
  background: linear-gradient(135deg, var(--threads-bg-1), var(--threads-bg-2));
}

.portal-threads .portal-title {
  color: var(--threads-text);
}

/* 各平台 icon 顏色 */
.portal-ig .portal-icon {
  color: var(--ig-text);
}

.portal-threads .portal-icon {
  color: var(--threads-text);
}

.portal-fb .portal-icon {
  color: var(--fb-text);
}

.portal-line .portal-icon {
  color: var(--line-text);
}

/* hover / active 後文字與 icon 統一變白 */
.portal-ig:hover .portal-title,
.portal-ig:hover .portal-text,
.portal-ig:active .portal-title,
.portal-ig:active .portal-text,
.portal-fb:hover .portal-title,
.portal-fb:hover .portal-text,
.portal-fb:active .portal-title,
.portal-fb:active .portal-text,
.portal-line:hover .portal-title,
.portal-line:hover .portal-text,
.portal-line:active .portal-title,
.portal-line:active .portal-text,
.portal-threads:hover .portal-title,
.portal-threads:hover .portal-text,
.portal-threads:active .portal-title,
.portal-threads:active .portal-text {
  color: #ffffff;
}

/* Contact 展開卡片 */
.contact-box {
  border: 2px solid var(--yellow);
  border-radius: 24px;

  background: rgba(255, 250, 240, 0.9);

  text-align: left;
}

.contact-box summary {
  min-height: 60px;
  padding: 18px;

  color: #9a6a00;
  font-size: 16px;
  font-weight: 800;

  cursor: pointer;
  list-style: none;
}

.contact-box summary::-webkit-details-marker {
  display: none;
}

.contact-box summary::after {
  content: "＋";
  float: right;
}

.contact-box[open] summary::after {
  content: "－";
}

.contact-content {
  padding: 0 18px 18px;

  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.contact-content p {
  margin: 0 0 8px;
}

/* 底部 */
.footer {
  margin-top: 22px;

  color: #a5aaa4;
  font-size: 12px;
}

.footer p {
  margin: 0;
}

/* 背景小裝飾 */
/* 背景小裝飾 */
.star,
.circle {
  position: absolute;
  pointer-events: none;
}

.star {
  color: var(--accent);
  font-size: 22px;
  opacity: 0.7;

  animation: starFloat 4s ease-in-out infinite;
}

.circle {
  width: 14px;
  height: 14px;

  border-radius: 50%;
  background: var(--main-light);
  opacity: 0.8;

  animation: circleFloat 5s ease-in-out infinite;
}

/* Logo 周圍：左上橘色星星 */
.star-1 {
  top: 92px;
  left: 34px;
  font-size: 20px;
  color: var(--accent);
  animation-delay: 0s;
}

/* Logo 周圍：右上綠色小星 */
.star-2 {
  top: 78px;
  right: 78px;
  font-size: 16px;
  color: var(--main);
  opacity: 0.75;
  animation-delay: 0.7s;
}

/* Logo 周圍：右側橘色空心感 */
.star-3 {
  top: 180px;
  right: 38px;
  font-size: 22px;
  color: var(--accent);
  opacity: 0.55;
  animation-delay: 1.4s;
}

/* Logo 周圍：左側小橘星 */
.star-4 {
  top: 142px;
  left: 112px;
  font-size: 15px;
  color: var(--accent);
  opacity: 0.7;
  animation-delay: 2s;
}

/* Logo 周圍：右下小綠星 */
.star-5 {
  top: 205px;
  right: 116px;
  font-size: 15px;
  color: var(--main);
  opacity: 0.65;
  animation-delay: 2.6s;
}

/* Logo 周圍：左下橘星 */
.star-6 {
  top: 210px;
  left: 72px;
  font-size: 17px;
  color: var(--accent);
  opacity: 0.55;
  animation-delay: 3.2s;
}

/* Logo 周圍：左下綠圓 */
.circle-1 {
  top: 246px;
  left: 42px;
  width: 14px;
  height: 14px;
  background: var(--main-light);
  animation-delay: 0.4s;
}

/* Logo 周圍：右上橘圓 */
.circle-2 {
  top: 108px;
  right: 116px;
  width: 8px;
  height: 8px;
  background: var(--accent);
  opacity: 0.65;
  animation-delay: 1.2s;
}

/* Logo 周圍：左上綠圓 */
.circle-3 {
  top: 118px;
  left: 118px;
  width: 9px;
  height: 9px;
  background: var(--main);
  opacity: 0.55;
  animation-delay: 2.1s;
}

/* Logo 周圍：右下黃圓 */
.circle-4 {
  top: 238px;
  right: 88px;
  width: 10px;
  height: 10px;
  background: var(--yellow);
  opacity: 0.65;
  animation-delay: 2.8s;
}

@keyframes starFloat {
  0% {
    opacity: 0.35;
    transform: translateY(0) scale(0.95);
  }

  50% {
    opacity: 0.95;
    transform: translateY(-8px) scale(1.08);
  }

  100% {
    opacity: 0.35;
    transform: translateY(0) scale(0.95);
  }
}

@keyframes circleFloat {
  0% {
    opacity: 0.45;
    transform: translateY(0);
  }

  50% {
    opacity: 0.9;
    transform: translateY(-10px);
  }

  100% {
    opacity: 0.45;
    transform: translateY(0);
  }
}

/* 減少動態偏好 */
@media (prefers-reduced-motion: reduce) {

  .star,
  .circle {
    animation: none;
  }

  .portal,
  .portal::before,
  .portal-title,
  .portal-text,
  .portal-icon,
  .enter-button {
    transition: none;
  }
}

/* 小手機調整 */
@media (max-width: 380px) {
  .ecard-page {
    padding: 16px 12px;
  }

  .ecard {
    min-height: 610px;
    padding: 26px 18px 22px;
    border-radius: 30px;
  }

  .brand-logo {
    width: 160px;
    height: 160px;
  }

  .main-title {
    font-size: 24px;
  }

  .enter-button {
    width: 190px;
    min-height: 50px;

    font-size: 13px;
  }

  .portal {
    min-height: 68px;
    padding: 12px 16px;
  }

  .portal-icon {
    width: 38px;
    height: 38px;
    flex-basis: 38px;

    font-size: 18px;
  }
}