/* 連結頁的樣式：公開頁（index.html）和私人頁（functions/me）共用 */
/* ── 顏色：淺色是頭像那種粉彩，深色跟個人網站同一個底 ── */
:root {
  --bg: #f5f0fb;
  --glow-a: #ffd3e4;
  --glow-b: #cfd8ff;
  --glow-c: #e3d4ff;
  --card: rgba(255, 255, 255, .74);
  --card-hover: rgba(255, 255, 255, .96);
  --line: rgba(70, 60, 130, .12);
  --fg: #221f38;
  --dim: #6a6688;
  --accent: #5560d6;
  --accent-soft: rgba(85, 96, 214, .12);
  --pink: #e4649a;
  --shadow: 0 1px 2px rgba(60, 50, 120, .06), 0 8px 24px -12px rgba(60, 50, 120, .28);
  --shadow-hover: 0 2px 4px rgba(60, 50, 120, .08), 0 18px 36px -14px rgba(60, 50, 120, .42);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131218;
    --glow-a: #4a2440;
    --glow-b: #232c5c;
    --glow-c: #2f2350;
    --card: rgba(255, 255, 255, .055);
    --card-hover: rgba(255, 255, 255, .1);
    --line: rgba(255, 255, 255, .1);
    --fg: #eceaf6;
    --dim: #9d99b6;
    --accent: #aab3ff;
    --accent-soft: rgba(170, 179, 255, .14);
    --pink: #ff9cc4;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .7);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .35), 0 20px 40px -16px rgba(0, 0, 0, .85);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131218;
  --glow-a: #4a2440;
  --glow-b: #232c5c;
  --glow-c: #2f2350;
  --card: rgba(255, 255, 255, .055);
  --card-hover: rgba(255, 255, 255, .1);
  --line: rgba(255, 255, 255, .1);
  --fg: #eceaf6;
  --dim: #9d99b6;
  --accent: #aab3ff;
  --accent-soft: rgba(170, 179, 255, .14);
  --pink: #ff9cc4;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .7);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, .35), 0 20px 40px -16px rgba(0, 0, 0, .85);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  /* 底色畫在 html 上，body 不能再畫一層，不然會把後面的光暈蓋掉 */
  background: transparent;
  color: var(--fg);
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* 背景：三團很淡的光暈，固定在畫面上不跟著捲 */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.backdrop i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .9; }
.backdrop i:nth-child(1) { width: 46vmax; height: 46vmax; left: -14vmax; top: -16vmax; background: var(--glow-a); }
.backdrop i:nth-child(2) { width: 50vmax; height: 50vmax; right: -18vmax; top: 8vmax; background: var(--glow-b); }
.backdrop i:nth-child(3) { width: 44vmax; height: 44vmax; left: 10vmax; bottom: -22vmax; background: var(--glow-c); }

.wrap {
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 68px) max(16px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 40px) max(16px, env(safe-area-inset-left));
}

/* 右上角的兩顆小按鈕 */
.tools { position: fixed; top: calc(env(safe-area-inset-top) + 14px); right: max(14px, env(safe-area-inset-right)); display: flex; gap: 8px; z-index: 5; }
.tool {
  width: 42px; height: 42px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--card); color: var(--fg);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  cursor: pointer; transition: transform .15s, background .2s;
}
.tool:hover { background: var(--card-hover); }
.tool:active { transform: scale(.92); }
.tool svg { width: 19px; height: 19px; }
.tool .moon, :root[data-theme="dark"] .tool .sun { display: none; }
:root[data-theme="dark"] .tool .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tool .sun { display: none; }
  :root:not([data-theme="light"]) .tool .moon { display: block; }
}

/* ── 上半：頭像、名字、一句話 ── */
.me { text-align: center; }
.avatar {
  width: 108px; height: 108px; margin: 0 auto 16px; padding: 4px; border-radius: 50%;
  background: conic-gradient(from 210deg, var(--pink), var(--accent), #8fd3c8, var(--pink));
  box-shadow: var(--shadow);
}
.avatar img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 3px solid var(--bg); }
h1 { margin: 0; font: 700 30px/1.15 "Shantell Sans", "PingFang TC", system-ui, sans-serif; letter-spacing: -.01em; }
.role { margin: 6px 0 0; font-size: 15px; color: var(--dim); }
.aside {
  display: inline-block; margin: 14px 0 0; padding: 7px 14px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 13.5px;
}

/* ── 連結 ── */
.links { display: grid; gap: 12px; margin-top: 30px; }
.link, .feature, .tile {
  position: relative; display: flex; align-items: center;
  border: 1px solid var(--line); background: var(--card);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  transition: transform .18s cubic-bezier(.2, .8, .2, 1), box-shadow .18s, background .18s, border-color .18s;
}
.link:hover, .feature:hover, .tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); background: var(--card-hover); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.link:active, .feature:active, .tile:active { transform: scale(.985); }

.link { gap: 14px; min-height: 68px; padding: 10px 16px 10px 12px; border-radius: 20px; }
.ico {
  flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px;
  background: var(--accent-soft); color: var(--accent);
}
.ico svg { width: 22px; height: 22px; }
.txt { flex: 1; min-width: 0; }
.txt b { display: block; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txt span:not(.status) { display: block; margin-top: 1px; font-size: 13px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.go { flex: none; width: 18px; height: 18px; color: var(--dim); transition: transform .18s, color .18s; }
.link:hover .go, .feature:hover .go, .tile:hover .go { transform: translate(2px, -2px); color: var(--accent); }

/* 最上面那張大的：主打的作品 */
.feature { flex-direction: column; align-items: stretch; overflow: hidden; border-radius: 24px; }
.feature .shot { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: #1b1c1a; }
.feature .body { display: flex; align-items: center; gap: 14px; padding: 14px 16px 15px; }
.status { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; font-size: 12px; font-weight: 600; color: #1f9d57; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #2fbf6c; box-shadow: 0 0 0 3px rgba(47, 191, 108, .22); }
:root[data-theme="dark"] .status { color: #7be3a4; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .status { color: #7be3a4; } }

/* 下半：自己用的工具，兩欄的小方塊 */
.group { margin: 34px 4px 12px; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--dim); }
.group svg { width: 15px; height: 15px; }
.group::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { gap: 11px; min-height: 62px; padding: 9px 12px 9px 10px; border-radius: 18px; }
.tile .ico { width: 40px; height: 40px; border-radius: 12px; }
.tile .ico svg { width: 20px; height: 20px; }
.tile .txt b { font-size: 14.5px; }
.tile .txt span:not(.status) { font-size: 12px; }
.tile .go { width: 15px; height: 15px; }
/* 手機上一欄一個，網址才不會被截掉 */
@media (max-width: 519px) { .tiles { grid-template-columns: 1fr; } }

/* 私人那一頁連結多，版面放寬、電腦上排三欄（平板兩欄、手機一欄） */
.wrap.wide { max-width: 940px; }
@media (min-width: 800px) { .wide .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

footer { margin-top: 38px; text-align: center; font-size: 12.5px; color: var(--dim); }
footer a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
footer a:hover { color: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translate(-50%, 16px);
  padding: 10px 18px; border-radius: 999px; background: var(--fg); color: var(--bg); font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 進場：由上到下一個一個浮上來 */
@media (prefers-reduced-motion: no-preference) {
  .rise { opacity: 0; transform: translateY(14px); animation: rise .55s cubic-bezier(.2, .8, .2, 1) forwards; animation-delay: calc(var(--i, 0) * 55ms); }
  @keyframes rise { to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  .link, .feature, .tile, .tool, .go { transition: none; }
}

/* ── 右上角按鈕是連結的時候（去私人那一頁的鎖頭）── */
a.tool { text-decoration: none; }

/* ── 私人那一頁：上面小一點的頭像和標題 ── */
.me.small .avatar { width: 72px; height: 72px; margin-bottom: 12px; padding: 3px; }
.me.small h1 { font-size: 24px; }
.group:first-of-type { margin-top: 28px; }

/* ── 輸入通關密語的那一張卡片 ── */
.gate {
  margin: 34px auto 0; max-width: 380px; padding: 26px 22px 22px; border-radius: 24px; text-align: center;
  border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.gate .ico { margin: 0 auto 14px; width: 54px; height: 54px; border-radius: 17px; }
.gate .ico svg { width: 25px; height: 25px; }
.gate h2 { margin: 0; font-size: 18px; }
.gate p { margin: 6px 0 0; font-size: 13.5px; color: var(--dim); }
.gate form { margin-top: 18px; display: grid; gap: 10px; }
.gate input[type="password"] {
  width: 100%; height: 50px; padding: 0 16px; border-radius: 15px; border: 1px solid var(--line);
  background: var(--card-hover); color: var(--fg); font: inherit; font-size: 16px; text-align: center; outline: none;
}
.gate input[type="password"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.gate button {
  height: 50px; border: 0; border-radius: 15px; background: var(--accent); color: var(--bg);
  font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; transition: transform .15s, filter .15s;
}
.gate button:hover { filter: brightness(1.08); }
.gate button:active { transform: scale(.98); }
.gate .err { margin-top: 12px; padding: 9px 12px; border-radius: 12px; background: rgba(228, 100, 154, .14); color: var(--pink); font-size: 13.5px; }
.back { display: inline-block; margin-top: 18px; font-size: 13px; color: var(--dim); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.back:hover { color: var(--accent); }
