/* PHDc Hub — ⑤ v16 官網首頁（參考 AsPEN 柔和學術配色） */
:root {
  --hub-bg-top: #e9f2ef;
  --hub-bg-mid: #f3f7f5;
  --hub-bg-bottom: #edf3f1;
  --hub-page-gradient: linear-gradient(165deg, var(--hub-bg-top) 0%, var(--hub-bg-mid) 45%, var(--hub-bg-bottom) 100%);
  --hub-surface: #f8fbfa;
  --hub-surface-raised: #fcfefd;
  --hub-surface-card: #ffffff;
  --hub-border: #d5e3de;
  --hub-border-subtle: #e4ece9;
  --hub-text: #1c2b28;
  --hub-text-muted: #5c6b66;
  --hub-text-soft: #7a8783;
  --hub-accent: #0d6e6e;
  --hub-accent-deep: #0a5c5c;
  --hub-accent-soft: #e4f2ef;
  --hub-header-bg: rgba(248, 251, 250, 0.72);
  --hub-header-bg-scrolled: rgba(248, 251, 250, 0.9);
  --hub-page-pad-x: clamp(20px, 4vw, 48px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Inter", -apple-system, "SF Pro Text", "Microsoft JhengHei", sans-serif;
  background: var(--hub-page-gradient);
  background-attachment: fixed;
  color: var(--hub-text);
  transition: background 0.45s ease;
}

/* 桶金餘額為負：柔和底色 + 強化呼吸燈 */
body.hub-tunkin-warn {
  position: relative;
  --hub-bg-top: #f4cdb8;
  --hub-bg-mid: #fde5d8;
  --hub-bg-bottom: #e8b5a0;
  --hub-surface: #fff5f0;
  --hub-surface-raised: #fffaf7;
  --hub-surface-card: #fffbf8;
  --hub-border: #e8a88e;
  --hub-border-subtle: #f0c4b0;
  --hub-header-bg: rgba(255, 236, 228, 0.84);
  --hub-header-bg-scrolled: rgba(255, 228, 216, 0.94);
}

body.hub-tunkin-warn::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 110% 75% at 50% 0%, rgba(249, 115, 22, 0.62) 0%, transparent 68%),
    radial-gradient(ellipse 95% 65% at 50% 100%, rgba(220, 38, 38, 0.42) 0%, transparent 62%),
    radial-gradient(ellipse 85% 55% at 50% 50%, rgba(251, 146, 60, 0.32) 0%, transparent 72%);
  animation: hub-tunkin-breathe 3s ease-in-out infinite;
}

body.hub-tunkin-warn::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  box-shadow:
    inset 0 0 100px 48px rgba(234, 88, 12, 0.28),
    inset 0 0 220px 80px rgba(239, 68, 68, 0.12);
  animation: hub-tunkin-edge-breathe 3s ease-in-out infinite;
}

@keyframes hub-tunkin-breathe {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}

@keyframes hub-tunkin-edge-breathe {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  body.hub-tunkin-warn::before {
    animation: none;
    opacity: 0.92;
  }
  body.hub-tunkin-warn::after {
    animation: none;
    opacity: 0.88;
  }
}

body.hub-tunkin-warn .v16-aspen {
  position: relative;
  z-index: 1;
}

body.hub-tunkin-warn .v16-header {
  background: var(--hub-header-bg);
}

body.hub-tunkin-warn .hub-announcements {
  background: linear-gradient(90deg, rgba(254, 215, 170, 0.92) 0%, rgba(254, 226, 200, 0.92) 100%);
  border-color: #f97316;
}

body.hub-tunkin-warn .v16-header.is-scrolled {
  box-shadow: 0 4px 24px rgba(180, 60, 30, 0.12);
}

body.hub-tunkin-warn .v16-search {
  background: rgba(255, 247, 242, 0.92);
  border-color: #f0b89a;
}

body.hub-tunkin-warn .v16-tool-card::before {
  background: linear-gradient(135deg, rgba(254, 215, 170, 0.45) 0%, rgba(255, 237, 213, 0.22) 45%, rgba(255, 255, 255, 0) 72%);
}

body.hub-tunkin-warn .v16-tool-card:hover,
body.hub-tunkin-warn .v16-tool-card:focus-visible {
  border-color: #fdba74;
  box-shadow: 0 12px 28px rgba(234, 88, 12, 0.14), 0 2px 8px rgba(234, 88, 12, 0.08);
}

body.hub-tunkin-warn .v16-tool-card.is-featured {
  border-color: #f0a890;
  background: linear-gradient(180deg, #fff5f0 0%, var(--hub-surface-card) 100%);
}

body.hub-tunkin-warn .v16-tool-flag {
  background: #fff1e8;
}

/* ── 頂欄摘要（AsPEN 風格：扁平 pill） ── */
.hub-status-bar {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.hub-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--hub-border-subtle);
  background: rgba(252, 254, 253, 0.88);
  color: var(--hub-text);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.hub-stat:hover {
  background: var(--hub-accent-soft);
  border-color: #b8ddd6;
}
.hub-stat > i {
  font-size: 11px;
  color: var(--hub-accent);
  opacity: 0.8;
}
.hub-stat--notify > i { color: #6366f1; }
.hub-stat--comp > i { color: #d97706; }
.hub-stat--tunkin > i { color: #ca8a04; }
.hub-stat--tunkin .hub-stat-value { color: #a16207; }
.hub-stat--tunkin.hub-stat--warn {
  border-color: #ea580c;
  background: #ffedd5;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.28), 0 0 14px rgba(234, 88, 12, 0.35);
  animation: hub-tunkin-pill-breathe 3s ease-in-out infinite;
}
.hub-stat--tunkin.hub-stat--warn:hover {
  background: #fed7aa;
  border-color: #c2410c;
}

@keyframes hub-tunkin-pill-breathe {
  0%, 100% { box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.22), 0 0 10px rgba(234, 88, 12, 0.25); }
  50% { box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.4), 0 0 20px rgba(234, 88, 12, 0.5); }
}

@media (prefers-reduced-motion: reduce) {
  .hub-stat--tunkin.hub-stat--warn {
    animation: none;
  }
}
.hub-stat--tunkin.hub-stat--warn > i.fa-coins { color: #ea580c; }
.hub-stat--tunkin.hub-stat--warn .hub-stat-value { color: #c2410c; }
.hub-stat-warn-icon {
  font-size: 9px;
  color: #ea580c;
  line-height: 1;
}
.hub-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--hub-text-muted);
  line-height: 1;
}
.hub-stat-value {
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--hub-accent-deep);
}
.hub-stat-value--empty {
  font-size: 12px;
  color: var(--hub-text-soft);
}
.hub-stat-unit {
  margin-left: 1px;
  font-size: 10px;
  font-weight: 700;
  color: var(--hub-text-muted);
}
.hub-stat--notify .hub-stat-value { color: #4338ca; }
.hub-stat--comp .hub-stat-value { color: #b45309; }

/* 舊 pill 樣式保留給其他頁面相容 */
.hub-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--hub-border-subtle);
  background: var(--hub-surface-raised);
  color: #374151;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.hub-pill:hover { background: var(--hub-accent-soft); }
.hub-pill i { font-size: 12px; opacity: 0.85; }
.hub-pill-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #1f2937;
  font-size: 10px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hub-pill--tasks .hub-pill-count { background: #ccfbf1; color: #0f766e; }
.hub-pill--notify .hub-pill-count.has-unread { background: #fee2e2; color: #b91c1c; }

.tool-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}
.tool-badge.live { background: #d1fae5; color: #065f46; }
.tool-badge.soon { background: #f4f4f5; color: #71717a; }
.tool-badge.ext { background: #dbeafe; color: #1e40af; }

.profile-avatar-img {
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.profile-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #0d6e6e, #14b8a6);
  color: #fff;
  font-weight: 700;
}

.profile-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.profile-modal[hidden] { display: none; }
.profile-modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--hub-surface-card);
  border-radius: 14px;
  padding: 24px;
  border: 1px solid var(--hub-border-subtle);
  box-shadow: 0 24px 64px rgba(13, 110, 110, 0.14);
  box-sizing: border-box;
  overflow-x: hidden;
}
.profile-modal-card h2 { margin: 0 0 16px; font-size: 18px; }

.profile-modal-fields {
  margin: 0 0 18px;
  padding: 0;
}

.profile-modal-field {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hub-border-subtle);
}

.profile-modal-field:last-child {
  border-bottom: none;
}

.profile-modal-field dt {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--hub-text-soft);
}

.profile-modal-field dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--hub-text);
  word-break: break-word;
}

.profile-modal-avatar-section {
  margin-bottom: 16px;
  padding-top: 4px;
}

.profile-modal-section-title {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--hub-text-muted);
  text-transform: uppercase;
}

.profile-modal-avatar-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.profile-modal-text-btn {
  padding: 0;
  border: none;
  background: none;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.profile-modal-text-btn:hover {
  text-decoration: underline;
}

.profile-modal-text-btn[hidden] {
  display: none;
}

.profile-modal-color-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.profile-modal-color-row input[type="color"] {
  width: 44px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--hub-border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.profile-modal-color-hint {
  font-size: 11px;
  color: var(--hub-text-soft);
  line-height: 1.4;
}

.profile-modal-alert {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid #fecaca;
  background: #fff5f5;
  color: #b91c1c;
}

.profile-modal-alert.is-success {
  border-color: #b8ddd6;
  background: #edf7f4;
  color: #134e4a;
}

.profile-modal-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #86868b;
  margin-bottom: 6px;
}
.profile-modal-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  font-family: inherit;
}
.profile-modal-avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.profile-modal-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}
.profile-modal-upload {
  padding: 8px 14px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  background: #f5f5f7;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.profile-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.profile-modal-cancel,
.profile-modal-save {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  border: none;
}
.profile-modal-cancel { background: #f5f5f7; color: #1c1c1e; }
.profile-modal-save { background: #0d6e6e; color: #fff; }

/* ── 公告輪播（箭頭 + 拖曳） ── */
.hub-announcements {
  margin-bottom: 18px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(228, 242, 239, 0.95) 0%, rgba(237, 247, 244, 0.95) 100%);
  border: 1px solid #b8ddd6;
}

.hub-announcements-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hub-announcement-nav {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #0d6e6e;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  opacity: 0.75;
  transition: opacity 0.15s, color 0.15s;
}

.hub-announcement-nav:hover {
  background: transparent;
  opacity: 1;
  color: #0a5c5c;
}

.hub-announcement-nav[hidden] {
  display: none;
}

.hub-announcements-viewport {
  flex: 1;
  min-width: 0;
  min-height: 2.5em;
  overflow: hidden;
  cursor: grab;
  touch-action: pan-y;
}

.hub-announcements-viewport.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.hub-announcements-track {
  display: flex;
  will-change: transform;
}

.hub-announcement-slide {
  flex: 0 0 100%;
  min-width: 100%;
  font-size: 14px;
  line-height: 1.5;
  color: #134e4a;
  box-sizing: border-box;
  padding: 2px 2px;
}

.hub-announcement-slide strong { font-weight: 700; margin-right: 8px; }

.hub-announcement-slide a {
  color: #0d6e6e;
  font-weight: 600;
  text-decoration: none;
  margin-left: 8px;
}

.hub-announcement-slide a:hover {
  text-decoration: underline;
}

/* ── v16 版型 ── */
.v16-aspen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: transparent;
  color: var(--hub-text);
}

.v16-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 14px 0;
  border-bottom: 1px solid var(--hub-border-subtle);
  background: var(--hub-header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.v16-header.is-scrolled {
  background: var(--hub-header-bg-scrolled);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 24px rgba(13, 46, 42, 0.06);
  border-bottom-color: var(--hub-border);
}
.v16-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--hub-page-pad-x);
}

.v16-header-lead {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
}

.hub-lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--hub-border-subtle);
  background: rgba(252, 254, 253, 0.72);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.hub-lang-switch--header {
  padding: 1px 4px;
  gap: 2px;
}

.hub-lang-switch--header .hub-lang-btn {
  padding: 3px 5px;
  font-size: 10px;
}

.hub-lang-switch--login {
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.hub-login-lang-wrap {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  max-width: 420px;
  margin: 0 auto 10px;
}

.hub-lang-btn {
  border: 0;
  background: transparent;
  color: var(--hub-text-muted);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.hub-lang-btn:hover {
  color: var(--hub-text);
}

.hub-lang-btn.is-active {
  color: var(--hub-primary);
  background: rgba(13, 110, 110, 0.1);
}

.hub-lang-sep {
  color: var(--hub-text-muted);
  opacity: 0.55;
  user-select: none;
}

.profile-modal-locale-section {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--hub-border-subtle);
}

.hub-lang-switch--profile {
  margin-top: 8px;
  padding: 4px 8px;
  font-size: 13px;
}

.hub-lang-switch--profile .hub-lang-btn {
  font-size: 13px;
  padding: 6px 12px;
}

.v16-launch {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 24px var(--hub-page-pad-x) 32px;
}
.v16-launch-head {
  margin-bottom: 14px;
}
.v16-profile {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 2px 10px 2px 2px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--hub-text);
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.v16-profile:hover {
  background: rgba(252, 254, 253, 0.7);
  border-color: var(--hub-border-subtle);
}
.v16-profile .profile-avatar-fallback,
.v16-profile .profile-avatar-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 12px;
}
.v16-profile-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 760px) {
  .v16-header {
    padding: 10px 0;
  }

  /* 單行：左側姓名＋精簡語系，右側儀表板（恢復原版型） */
  .v16-header-inner {
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
  }

  .v16-header-lead {
    gap: 4px;
    flex: 0 1 auto;
    max-width: 34%;
  }

  .v16-profile {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    padding-right: 2px;
  }

  .v16-profile-name {
    max-width: 4.5em;
    flex: 0 1 auto;
    min-width: 0;
  }

  .hub-lang-switch--header {
    flex-shrink: 0;
    padding: 1px 3px;
  }

  .hub-lang-switch--header .hub-lang-btn {
    padding: 2px 4px;
    font-size: 9px;
  }

  .hub-status-bar {
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(3, auto);
    grid-template-rows: auto auto;
    gap: 5px 6px;
    justify-content: end;
    align-content: center;
    overflow: visible;
    flex-wrap: unset;
    padding-bottom: 0;
  }

  .hub-stat {
    padding: 4px 8px;
    gap: 4px;
    max-width: 100%;
  }

  .hub-stat > i {
    font-size: 10px;
  }

  .hub-stat-label {
    font-size: 10px;
  }

  .hub-stat-value {
    font-size: 11px;
  }

  .hub-stat-unit {
    font-size: 9px;
  }

  .v16-launch-head { flex-direction: column; }
  .v16-launch-actions { justify-content: flex-start; }
}

@media (max-width: 400px) {
  .v16-profile {
    max-width: 36%;
    padding-right: 4px;
  }

  .hub-status-bar {
    gap: 4px 4px;
  }

  .hub-stat {
    padding: 3px 6px;
    gap: 3px;
  }

  .hub-stat-label {
    font-size: 9px;
  }

  .hub-stat-value {
    font-size: 10px;
  }
}
.v16-launch-eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #0d6e6e;
}
.v16-launch-greet h1,
.hub-datetime {
  margin: 0 0 6px;
  font-size: clamp(20px, 3vw, 28px);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.v16-launch-sub { margin: 0; color: var(--hub-text-muted); font-size: 13px; }
.v16-launch-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.v16-launch-actions .v16-btn i { margin-right: 8px; }

.v16-launch-bar {
  margin: 18px 0 22px;
}
.v16-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--hub-border-subtle);
  border-radius: 12px;
  background: var(--hub-surface-raised);
}
.v16-search i { color: #9ca3af; font-size: 14px; }
.v16-search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-size: 14px;
  font-family: inherit;
}
.v16-search-clear {
  border: none;
  background: #f3f4f6;
  color: #374151;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
}
.v16-search-clear:hover { background: #e5e7eb; }

.v16-mini-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--hub-border-subtle);
  border-radius: 12px;
  background: var(--hub-surface);
  min-width: 180px;
}
.v16-mini-stats div strong {
  display: block;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
  color: #0d6e6e;
}
.v16-mini-stats div span { display: block; margin-top: 2px; font-size: 11px; color: #6b7280; }

.v16-btn {
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  border: none;
  transition: filter 0.15s;
}
.v16-btn-primary { background: #0d6e6e; color: #fff; }
.v16-btn-primary:hover { filter: brightness(1.08); }
.v16-btn-ghost { background: transparent; color: #0d6e6e; border: 1px solid #0d6e6e; }

.v16-section--tight { padding: 0; }
.v16-section-title { margin: 0 0 6px; font-size: 24px; }
.v16-section-sub { margin: 0 0 24px; color: var(--hub-text-muted); font-size: 14px; }

.v16-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
/* ── 應用卡片：薄荷薄霧 + 柔和浮起（無流光）── */
.v16-tool-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  padding: 20px;
  border: 1px solid var(--hub-border-subtle);
  border-radius: 12px;
  background: var(--hub-surface-card);
  cursor: pointer;
  font-family: inherit;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition:
    transform 0.28s ease,
    box-shadow 0.28s ease,
    border-color 0.28s ease,
    background-color 0.28s ease;
}

.v16-tool-card-top {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.v16-tool-body {
  min-width: 0;
}

.v16-tool-card-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}
.v16-tool-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(204, 251, 241, 0.5) 0%, rgba(240, 253, 250, 0.25) 45%, rgba(255, 255, 255, 0) 72%);
  opacity: 0;
  transition: opacity 0.28s ease;
  pointer-events: none;
  z-index: 0;
}
.v16-tool-card:hover::before,
.v16-tool-card:focus-visible::before { opacity: 1; }
.v16-tool-card:hover,
.v16-tool-card:focus-visible {
  transform: translateY(-4px);
  border-color: #a7f3d0;
  background: var(--hub-surface-raised);
  box-shadow: 0 12px 28px rgba(13, 110, 110, 0.12), 0 2px 8px rgba(13, 110, 110, 0.06);
}
.v16-tool-card.is-featured {
  border-color: #a8d9d2;
  background: linear-gradient(180deg, #f7fcfb 0%, var(--hub-surface-card) 100%);
}
.v16-tool-card > * { position: relative; z-index: 1; }
.v16-tool-flag {
  display: inline-flex;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f0fdfa;
  align-items: center;
  justify-content: center;
  color: #0d6e6e;
  font-size: 18px;
  margin-bottom: 12px;
  transition: transform 0.28s ease, background 0.28s ease;
}
.v16-tool-card:hover .v16-tool-flag,
.v16-tool-card:focus-visible .v16-tool-flag {
  transform: scale(1.03);
  background: #ecfdf5;
}
.v16-tool-card h3 { margin: 0 0 8px; font-size: 16px; line-height: 1.35; }
.v16-tool-card p { margin: 0; font-size: 13px; color: var(--hub-text-muted); line-height: 1.5; }
.v16-tool-link {
  font-size: 13px;
  font-weight: 600;
  color: #0d6e6e;
  white-space: nowrap;
  flex-shrink: 0;
}

.v16-footer {
  display: flex;
  justify-content: space-between;
  padding: 20px clamp(20px, 4vw, 48px);
  border-top: 1px solid var(--hub-border-subtle);
  font-size: 12px;
  color: var(--hub-text-soft);
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

/* ── 載入畫面 ── */
.hub-loading {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--hub-page-gradient);
}
.hub-loading[hidden] { display: none; }
.hub-loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 36px;
  border-radius: 16px;
  background: var(--hub-surface-card);
  border: 1px solid var(--hub-border-subtle);
  box-shadow: 0 12px 40px rgba(13, 110, 110, 0.1);
  color: var(--hub-accent);
  font-weight: 600;
}
.hub-loading-card i { font-size: 24px; }
.hub-loading-card--error { color: #b91c1c; gap: 16px; }
.hub-loading-card--error button { margin-top: 4px; }

/* ── 空狀態 ── */
.v16-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  border: 1px dashed var(--hub-border);
  border-radius: 12px;
  color: var(--hub-text-muted);
  background: var(--hub-surface);
}
.v16-empty-state i { font-size: 28px; color: #9ca3af; margin-bottom: 12px; }
.v16-empty-state p { margin: 0 0 6px; font-size: 16px; font-weight: 600; color: #374151; }
.v16-empty-state span { font-size: 13px; }

/* ── 登入頁（taste-skill 風格：精緻層次、保留 PHDc 配色） ── */
.hub-login-body {
  overflow-x: hidden;
}

.hub-login-page {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(20px, env(safe-area-inset-top, 0px) + 16px)
    max(20px, env(safe-area-inset-right, 0px) + 16px)
    max(20px, env(safe-area-inset-bottom, 0px) + 16px)
    max(20px, env(safe-area-inset-left, 0px) + 16px);
  background: var(--hub-page-gradient);
}

.hub-login-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.hub-login-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.55;
  animation: hub-login-float 18s ease-in-out infinite alternate;
}

.hub-login-bg-orb--a {
  width: min(420px, 70vw);
  height: min(420px, 70vw);
  top: -12%;
  right: -8%;
  background: radial-gradient(circle, rgba(13, 110, 110, 0.28) 0%, transparent 70%);
}

.hub-login-bg-orb--b {
  width: min(360px, 60vw);
  height: min(360px, 60vw);
  bottom: -10%;
  left: -12%;
  background: radial-gradient(circle, rgba(6, 78, 59, 0.18) 0%, transparent 72%);
  animation-delay: -6s;
}

.hub-login-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(13, 110, 110, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 110, 110, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 42%, #000 20%, transparent 100%);
}

@keyframes hub-login-float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(0, -12px, 0) scale(1.04); }
}

.hub-login-shell {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
  animation: hub-login-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes hub-login-enter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hub-login-card {
  width: 100%;
  padding: clamp(24px, 5vw, 36px);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 24px 48px -12px rgba(13, 110, 110, 0.14),
    0 8px 20px -8px rgba(28, 43, 40, 0.08);
}

.hub-login-brand {
  text-align: center;
  margin-bottom: clamp(20px, 4vw, 28px);
}

.hub-login-title {
  margin: 0;
  font-size: clamp(1.25rem, 4.5vw, 1.5rem);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: #064e3b;
}

.hub-login-subtitle {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--hub-text-muted);
  letter-spacing: 0.01em;
}

.hub-login-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hub-login-field {
  margin-bottom: 12px;
}

.hub-login-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--hub-text);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.hub-login-input-wrap {
  position: relative;
}

.hub-login-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--hub-text-soft);
  pointer-events: none;
  transition: color 0.2s ease;
}

.hub-login-input {
  width: 100%;
  padding: 13px 14px 13px 40px;
  border: 1px solid var(--hub-border);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--hub-text);
  background: rgba(248, 251, 250, 0.9);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.hub-login-input::placeholder {
  color: #9ca8a4;
}

.hub-login-input-wrap:focus-within .hub-login-input-icon {
  color: var(--hub-accent);
}

.hub-login-input:focus {
  outline: none;
  border-color: var(--hub-accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(13, 110, 110, 0.12);
}

.hub-login-error {
  font-size: 13px;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 10px 12px;
  border-radius: 10px;
  margin: 4px 0 12px;
  display: none;
}

.hub-login-error.is-visible { display: block; }

.hub-login-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
  padding: 14px 18px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #0f7a7a 0%, var(--hub-accent-deep) 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 10px 24px -8px rgba(13, 110, 110, 0.45);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease;
}

.hub-login-submit i {
  font-size: 13px;
  transition: transform 0.18s ease;
}

.hub-login-submit:hover {
  filter: brightness(1.05);
  box-shadow: 0 14px 28px -8px rgba(13, 110, 110, 0.5);
  transform: translateY(-1px);
}

.hub-login-submit:hover i {
  transform: translateX(3px);
}

.hub-login-submit:active {
  transform: translateY(0);
}

.hub-login-submit:disabled {
  opacity: 0.72;
  cursor: wait;
  transform: none;
}

.hub-login-foot {
  margin: 0;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--hub-text-soft);
  letter-spacing: 0.04em;
}

@media (max-width: 480px) {
  .hub-login-page {
    align-items: flex-start;
    justify-content: flex-start;
    padding-top: max(10vh, calc(env(safe-area-inset-top, 0px) + 24px));
    padding-bottom: max(24px, env(safe-area-inset-bottom, 0px) + 16px);
  }

  .hub-login-shell {
    margin-top: 0;
  }

  .hub-login-card {
    border-radius: 18px;
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.85) inset,
      0 16px 32px -14px rgba(13, 110, 110, 0.12);
  }
}

@media (min-width: 481px) {
  .hub-login-page {
    align-items: center;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hub-login-shell,
  .hub-login-bg-orb {
    animation: none;
  }

  .hub-login-submit,
  .hub-login-submit i,
  .hub-login-input {
    transition: none;
  }
}

/* ── 個人資料彈窗擴充 ── */
.profile-modal-preview--center {
  margin: 0 auto 20px;
  width: 64px;
  height: 64px;
}
.profile-modal-actions--spread {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.profile-modal-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  white-space: nowrap;
}
.profile-modal-logout:hover { background: #fee2e2; }
.profile-modal-actions-end {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}
.profile-modal-ops-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--hub-border);
  background: var(--hub-accent-soft);
  color: var(--hub-accent-deep);
  white-space: normal;
  line-height: 1.3;
  text-align: center;
}
.profile-modal-ops-link:not([hidden]) {
  grid-column: 1 / -1;
}
.profile-modal-cancel,
.profile-modal-save {
  width: 100%;
  box-sizing: border-box;
}
.profile-modal-ops-link:hover {
  border-color: var(--hub-accent);
  color: var(--hub-accent);
}

@media (max-width: 760px) {
  .profile-modal {
    padding: 12px;
    align-items: flex-end;
  }

  .profile-modal-card {
    max-width: none;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 18px 16px 16px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .profile-modal-field {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px 0;
  }

  .profile-modal-color-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .profile-modal-color-hint {
    flex: 1 1 100%;
    min-width: 0;
  }

  .profile-modal-avatar-row {
    flex-wrap: wrap;
    gap: 12px;
  }

  .profile-modal-cancel,
  .profile-modal-save {
    padding: 10px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .v16-tool-card { transition: border-color 0.2s ease, box-shadow 0.2s ease; }
  .v16-tool-card:hover,
  .v16-tool-card:focus-visible { transform: none; }
}

@media (max-width: 1100px) {
  .hub-stat { padding: 4px 9px; }
  .hub-stat-value { font-size: 12px; }
}

@media (max-width: 760px) {
  .v16-tool-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .v16-tool-card {
    gap: 8px;
    padding: 12px 14px;
    border-radius: 10px;
  }

  .v16-tool-card:hover,
  .v16-tool-card:focus-visible {
    transform: none;
    box-shadow: 0 4px 14px rgba(13, 110, 110, 0.08);
  }

  .v16-tool-card-top {
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
  }

  .v16-tool-flag {
    width: 36px;
    height: 36px;
    margin-bottom: 0;
    border-radius: 9px;
    font-size: 16px;
    flex-shrink: 0;
  }

  .v16-tool-card h3 {
    font-size: 15px;
    margin-bottom: 4px;
  }

  .v16-tool-card p {
    font-size: 12px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .v16-tool-card-foot {
    padding-top: 8px;
    border-top: 1px solid var(--hub-border-subtle);
  }

  .v16-tool-link {
    font-size: 12px;
  }
}
