:root {
  --bg-color: #ebedf0;
  --text-main: #09090b;
  --card-bg: #ffffff;
  --card-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  --card-shadow-hover: 0 4px 14px rgba(0, 0, 0, 0.08);
  --border-subtle: #f1f5f9;
  --text-muted: #64748b;
  --primary-accent: #e11d48;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* 頂部列 */
.top-bar {
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card-bg);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: transform 0.15s, background-color 0.15s;
}

.icon-btn:hover {
  background-color: #f8fafc;
}

.icon-btn:active {
  transform: scale(0.95);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  color: var(--text-main);
}

/* 主容器 */
.main-container {
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  padding: 0 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 頭像與標題 */
.profile-section {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.avatar-circle {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--card-bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  margin-bottom: 0.75rem;
}

.avatar-logo {
  width: 64px;
  height: 64px;
}

.profile-username {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.75rem;
  user-select: text;
}

/* 連結列表 */
.links-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.link-card {
  width: 100%;
  background-color: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.link-card:hover {
  box-shadow: var(--card-shadow-hover);
}

.link-card:active {
  transform: scale(0.99);
}

.link-card-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: inherit;
}

.link-spacer {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.link-title {
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  flex: 1;
  word-break: break-word;
  padding: 0 0.5rem;
}

.link-dots-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #94a3b8;
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}

.link-dots-btn:hover {
  color: var(--text-main);
  background-color: #f1f5f9;
}

.link-dots-btn svg {
  width: 16px;
  height: 16px;
}

/* 骨架屏載入動畫 */
.skeleton {
  height: 58px;
  background: linear-gradient(90deg, #ffffff 25%, #f1f5f9 50%, #ffffff 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 頁尾 */
.footer {
  width: 100%;
  padding: 2rem 0;
  display: flex;
  justify-content: center;
}

.linktree-watermark {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  opacity: 0.6;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.75rem;
  transition: opacity 0.15s;
}

.linktree-watermark:hover {
  opacity: 1;
}

.linktree-icon {
  width: 16px;
  height: 16px;
}

/* 彈窗樣式 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background-color: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
  }
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--card-bg);
  border-top-left-radius: 1rem;
  border-top-right-radius: 1rem;
  width: 100%;
  max-width: 380px;
  padding: 1.25rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  transform: translateY(100%);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}

@media (min-width: 640px) {
  .modal-content {
    border-radius: 1rem;
    transform: scale(0.95);
  }
}

.modal-backdrop.show .modal-content {
  transform: translateY(0);
}

@media (min-width: 640px) {
  .modal-backdrop.show .modal-content {
    transform: scale(1);
  }
}

.modal-drag-bar {
  width: 40px;
  height: 4px;
  background-color: #e2e8f0;
  border-radius: 2px;
  margin: 0 auto 1rem;
}

@media (min-width: 640px) {
  .modal-drag-bar {
    display: none;
  }
}

.share-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: #f1f5f9;
  margin: 0 auto 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-icon-wrap svg {
  width: 28px;
  height: 28px;
  color: var(--text-main);
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
}

.modal-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  margin-bottom: 1.25rem;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btn {
  width: 100%;
  padding: 0.75rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.99);
}

.btn-primary {
  background-color: var(--text-main);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #27272a;
}

.btn-secondary {
  background-color: #f1f5f9;
  color: #334155;
}

.btn-secondary:hover {
  background-color: #e2e8f0;
}

.text-left {
  text-align: left;
}

.item-title {
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.item-action-btn {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  cursor: pointer;
  transition: background-color 0.15s;
}

.item-action-btn:hover {
  background-color: #f1f5f9;
}

.item-action-btn svg {
  width: 16px;
  height: 16px;
  color: #64748b;
}

.item-action-btn.cancel {
  color: #94a3b8;
}

/* 提示氣泡 */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  padding: 0.625rem 1rem;
  background-color: var(--text-main);
  color: #ffffff;
  border-radius: 9999px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.avatar-circle {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--card-bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  overflow: hidden; /* 確保圓形裁切 */
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* 保持比例填滿，不變形 */
  display: block;
}
.toast.show {
  opacity: 1;
}

.toast svg {
  width: 16px;
  height: 16px;
  color: #34d399;
}

.hidden {
  display: none !important;
}

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}