* {
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* 舊 Edge */
}

*::-webkit-scrollbar {
  /* Chrome / Safari / iOS */
  display: none;
  width: 0;
  height: 0;
}

:root {
  --scale: 1;

  /* ===== ★ 共用版面（所有頁面 + header 一齊用，只喺呢度改） ===== */
  --app-max: 1100px;      /* 內容最闊幾多 */
  --app-gutter: 1.5rem;   /* 左右留白 */
  --app-gap: 20px;        /* header 離頂 = header 同內容之間 */

  --color-primary: #4f46e5;
  --color-primary-hover: #4338ca;
  --color-primary-soft: rgba(79, 70, 229, 0.12);
  --color-danger: #e11d48;

  --color-bg: #f5f6fa;
  --color-surface: #ffffff;
  --color-text: #111827;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-input-bg: #f9fafb;

  --radius-sm: calc(10px * var(--scale));
  --radius-md: calc(14px * var(--scale));
  --radius-lg: calc(24px * var(--scale));

  --shadow-card: 0 10px 40px rgba(17, 24, 39, 0.08);
  --shadow-pop: 0 8px 24px rgba(17, 24, 39, 0.12);
  --transition: 0.2s ease;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC",
    "Noto Sans TC", "Microsoft JhengHei", sans-serif;

  color-scheme: light;
}

/* 平板 / 手機：留白同距離一齊收細 */
@media (max-width: 860px) {
  :root {
    --app-gutter: 1rem;
    --app-gap: 16px;
  }
}

:root[data-theme="dark"] {
  --color-primary: #6366f1;
  --color-primary-hover: #818cf8;
  --color-primary-soft: rgba(99, 102, 241, 0.2);
  --color-bg: #0b0f19;
  --color-surface: #111827;
  --color-text: #f3f4f6;
  --color-text-muted: #9ca3af;
  --color-border: #1f2937;
  --color-input-bg: #0f1523;
  --shadow-card: 0 10px 40px rgba(0, 0, 0, 0.5);
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.5);

  color-scheme: dark;
}

/* ========== 基本重設 ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  transition: background-color var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

/* ========== ★ 頁面主體：所有頁面共用（限寬 + 置中 + 同 header 一樣距離） ==========
   header（header.css .app-header）都係用 --app-max / --app-gutter / --app-gap，
   所以左右邊一定對齊，header 離頂 = 內容離 header */
.app-main {
  width: 100%;
  max-width: var(--app-max);
  margin-inline: auto;
  padding: var(--app-gap) var(--app-gutter) calc(4rem + env(safe-area-inset-bottom));
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(32px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  max-width: calc(100% - 48px);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 100;
}

:root[data-theme="dark"] .toast {
  background: rgba(243, 244, 246, 0.95);
  color: #111827;
}

.toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation-duration: 0.01ms !important;
  }
}