/* ==========================================================================
   玩途 WanTo 設計系統
   品牌調性：自然、溫暖親切
   主色取自 Logo（地圖圖釘 + 愛心 + 嫩芽）實際像素值 #F15E75
   ========================================================================== */

:root {
  /* 珊瑚玫瑰 —— 品牌主色階，H 351° */
  --brand-50:  #FEECEE;
  --brand-100: #FDD9DE;
  --brand-200: #FAB8C2;
  --brand-300: #F698A7;
  --brand-400: #F47C8E;
  --brand-500: #F15E75;   /* Logo 原色 */
  --brand-600: #DD3C55;
  --brand-700: #BE273F;
  --brand-800: #952335;

  /* 嫩芽綠 —— 取自 Logo 的芽苗，帶暖的鼠尾草綠 */
  --leaf-50:  #F1F7EE;
  --leaf-100: #E4EEDD;
  --leaf-300: #B3CEA1;
  --leaf-500: #77AB54;
  --leaf-600: #639245;
  --leaf-700: #507836;

  /* 大地暖色 —— 用在漸層與強調，讓畫面不會只有粉色 */
  --clay-400: #E8955F;
  --clay-500: #DD7A42;
  --sand-100: #FBF0E4;
  --sand-200: #F5E3D0;

  /* 暖中性色（紙感，刻意不用冷灰） */
  --bg:        #FBF9F6;
  --bg-soft:   #F5F1ED;
  --surface:   #FFFFFF;
  --surface-2: #FDFBFA;
  --border:    #EEE8E3;
  --border-strong: #DDD2CA;
  --text:      #2F2723;
  --text-2:    #72635A;
  --text-3:    #A09288;

  /* 陰影帶暖色調，不用藍黑 */
  --shadow-sm: 0 1px 2px rgba(78, 56, 44, .06), 0 1px 3px rgba(78, 56, 44, .05);
  --shadow-md: 0 4px 12px rgba(78, 56, 44, .08), 0 2px 4px rgba(78, 56, 44, .05);
  --shadow-lg: 0 18px 46px rgba(78, 56, 44, .13), 0 4px 12px rgba(78, 56, 44, .07);
  --ring:      0 0 0 3px rgba(241, 94, 117, .30);

  --ok:    #4E8F3A;
  --ok-bg: #EDF5E7;
  --warn:    #B06A16;
  --warn-bg: #FBF0DF;
  --danger:    #C93B4E;
  --danger-bg: #FBEAEC;
  --info:    #2F7A8C;
  --info-bg: #E6F2F4;

  /* 圓角比原本更圓潤一點，讀起來親切 */
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --header-h: 66px;
  --maxw: 1180px;
}

html[data-theme="dark"] {
  --bg:        #161310;
  --bg-soft:   #1F1A17;
  --surface:   #25201C;
  --surface-2: #2F2925;
  --border:    #403832;
  --border-strong: #584D46;
  --text:      #F8F5F2;
  --text-2:    #C5BCB4;
  --text-3:    #988B81;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .5);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .6);
  --ok-bg:     #1D2A16;
  --warn-bg:   #2E2312;
  --danger-bg: #331A1D;
  --info-bg:   #12262B;
  --sand-100:  #2A231D;
  --sand-200:  #342B23;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC",
               "Noto Sans TC", "Microsoft JhengHei", "Helvetica Neue", sans-serif;
  font-size: 16px;              /* 中文可讀性基準；也避免 iOS 表單聚焦時自動放大 */
  line-height: 1.75;
  letter-spacing: .01em;        /* 中文字距稍微拉開，行氣比較鬆 */
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
  transition: background .25s ease, color .25s ease;
}

/* 中文標題不需要負字距，那是拉丁字母的習慣 */
h1, h2, h3, h4 { letter-spacing: 0; }

a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
html[data-theme="dark"] a { color: var(--brand-300); }

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.4; font-weight: 700; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 1em; }
img { max-width: 100%; display: block; }

/* ICON.* 的內嵌 SVG 只有 viewBox、沒有 width/height 屬性。放進沒有對應
   「.X svg」尺寸規則的容器時，瀏覽器會讓它撐滿整個容器寬度 —— 報名紀錄頁
   的行事曆／地標圖示在手機上就是這樣變成整頁那麼大。這裡給一個隨字級縮放
   的保底尺寸；型別選擇器特異度最低 (0,0,1)，既有的 .btn svg / .alert svg /
   .chart 等規則都仍然覆蓋得過去。 */
svg { width: 1.05em; height: 1.05em; vertical-align: -.16em; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 760px; }

.muted   { color: var(--text-2); }
.dim     { color: var(--text-3); }
.small   { font-size: .9rem; }
.tiny    { font-size: .82rem; }
.bold    { font-weight: 600; }
.center  { text-align: center; }
.right   { text-align: right; }
.nowrap  { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hidden  { display: none !important; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; } .mt-5 { margin-top: 48px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.row { display: flex; gap: 12px; align-items: center; }
.row-wrap { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }

/* ---------------------------------------------------------------- Header */
.site-header {
  position: sticky; top: 0; z-index: 60;
  height: var(--header-h);
  display: flex; align-items: center;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; gap: 20px; }

.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.12rem;
        color: var(--text); letter-spacing: .01em; }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 34px; height: 34px; flex: none; object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(241, 94, 117, .3));
}
.logo-text { display: flex; flex-direction: column; line-height: 1.05; }
.logo-sub {
  font-size: .58rem; font-weight: 600; letter-spacing: .22em; color: var(--brand-600);
  text-transform: uppercase; margin-top: 2px;
}
html[data-theme="dark"] .logo-sub { color: var(--brand-400); }

.nav { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.nav a {
  padding: 7px 12px; border-radius: 9px; color: var(--text-2);
  font-size: .92rem; font-weight: 500; transition: .16s;
}
.nav a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.nav a.active { color: var(--brand-600); background: var(--brand-50); }
html[data-theme="dark"] .nav a.active { color: var(--brand-300); background: rgba(241,94,117,.16); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  cursor: pointer; transition: .16s; padding: 0;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.icon-btn svg { width: 17px; height: 17px; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-500), var(--clay-400)); color: #fff;
  font-weight: 700; font-size: .85rem; cursor: pointer; border: none;
}

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 80;
  opacity: 0; transform: translateY(-6px); pointer-events: none; transition: .16s;
}
.menu.open { opacity: 1; transform: none; pointer-events: auto; }
.menu-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu a, .menu button {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 9px 12px; border-radius: 10px; border: none; background: none;
  color: var(--text-2); font-size: .9rem; cursor: pointer; font-family: inherit;
}
.menu a:hover, .menu button:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.menu svg { width: 16px; height: 16px; flex: none; }


/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 20px; border-radius: 12px; border: 1px solid transparent;
  font-family: inherit; font-size: .96rem; font-weight: 600; line-height: 1.25;
  min-height: 44px;
  cursor: pointer; transition: .16s ease; white-space: nowrap; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600)); color: #fff;
  box-shadow: 0 4px 14px rgba(221, 60, 85, .30);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(221,60,85,.38); }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover:not(:disabled) { border-color: var(--brand-400); color: var(--brand-600); }
html[data-theme="dark"] .btn-outline:hover:not(:disabled) { color: var(--brand-300); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-soft); color: var(--text); }
.btn-soft { background: var(--brand-50); color: var(--brand-700); }
html[data-theme="dark"] .btn-soft { background: rgba(241,94,117,.18); color: var(--brand-300); }
.btn-soft:hover:not(:disabled) { background: var(--brand-100); }
html[data-theme="dark"] .btn-soft:hover:not(:disabled) { background: rgba(241,94,117,.28); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn-sm { padding: 7px 13px; font-size: .87rem; border-radius: 10px; min-height: 36px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: 15px 30px; font-size: 1.05rem; border-radius: 14px; min-height: 52px; }
.btn-block { width: 100%; }

/* ---------------------------------------------------------------- Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field > label { font-size: .88rem; font-weight: 600; color: var(--text); }
.field .hint { font-size: .8rem; color: var(--text-3); }
.req { color: var(--danger); margin-left: 3px; }

.input, .select, .textarea {
  width: 100%; padding: 12px 14px; font-family: inherit; font-size: 1rem;
  color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r); transition: .16s; appearance: none;
  min-height: 46px;                     /* 手指點得到 */
}
.textarea { min-height: 120px; }
.textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand-500); box-shadow: var(--ring);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23838aa3' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 15px;
  padding-right: 34px; cursor: pointer;
}
.input-group { display: flex; }
.input-group .input { border-radius: var(--r) 0 0 var(--r); }
.input-group .btn { border-radius: 0 var(--r) var(--r) 0; }

.check { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; padding: 10px 0;
         font-size: .95rem; color: var(--text-2); min-height: 44px; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand-600); cursor: pointer; flex: none; }

.opt-list { display: flex; flex-direction: column; gap: 6px; }
.opt {
  display: flex; align-items: center; gap: 11px; padding: 13px 15px;
  border: 1px solid var(--border-strong); border-radius: var(--r); cursor: pointer;
  transition: .14s; font-size: .96rem; background: var(--surface); min-height: 50px;
}
.opt:hover { border-color: var(--brand-400); background: var(--surface-2); }
.opt input { accent-color: var(--brand-600); width: 20px; height: 20px; cursor: pointer; flex: none; }
.opt.checked { border-color: var(--brand-500); background: var(--brand-50); color: var(--brand-700); font-weight: 500; }
html[data-theme="dark"] .opt.checked { background: rgba(241,94,117,.16); color: var(--brand-200); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .92rem; }
.switch input { display: none; }
.switch .track {
  width: 42px; height: 24px; border-radius: 99px; background: var(--border-strong);
  position: relative; transition: .2s; flex: none;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: .2s; box-shadow: var(--shadow-sm);
}
.switch input:checked + .track { background: var(--brand-600); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* ---------------------------------------------------------------- Card */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 24px; }
.card-head {
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 24px; }

.panel { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; }

/* ---------------------------------------------------------------- Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 99px; font-size: .8rem; font-weight: 600; line-height: 1.5;
  background: var(--bg-soft); color: var(--text-2); white-space: nowrap;
}
.badge-ok     { background: var(--ok-bg);     color: var(--ok); }
.badge-warn   { background: var(--warn-bg);   color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info   { background: var(--info-bg);   color: var(--info); }
.badge-brand  { background: var(--brand-50);  color: var(--brand-700); }
html[data-theme="dark"] .badge-brand { background: rgba(241,94,117,.18); color: var(--brand-300); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 9px 16px; border-radius: 99px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-2); font-size: .9rem; font-weight: 500;
  min-height: 40px; display: inline-flex; align-items: center;
  cursor: pointer; transition: .16s; white-space: nowrap; font-family: inherit;
}
.chip:hover { border-color: var(--brand-400); color: var(--brand-600); }
.chip.active {
  background: var(--text); border-color: var(--text); color: var(--bg);
}
html[data-theme="dark"] .chip.active { background: var(--brand-500); border-color: var(--brand-500); color: #fff; }

/* ---------------------------------------------------------------- Hero */
.hero {
  position: relative; overflow: hidden;
  padding: 68px 0 56px;
  background:
    radial-gradient(1100px 420px at 8% -10%, rgba(241, 94, 117, .20), transparent 60%),
    radial-gradient(900px 380px at 92% 0%, rgba(232, 149, 95, .20), transparent 60%),
    radial-gradient(700px 320px at 50% 110%, rgba(143, 190, 108, .16), transparent 60%);
  border-bottom: 1px solid var(--border);
}
.hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(currentColor 1px, transparent 1px);
  background-size: 26px 26px; color: var(--text-3); opacity: .1;
  mask-image: linear-gradient(180deg, #000, transparent 70%);
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 70%);
}
.hero .container { position: relative; }
.hero h1 { font-size: clamp(1.75rem, 6vw, 2.9rem); line-height: 1.35; margin-bottom: .4em; }
.hero .lead { font-size: 1.06rem; color: var(--text-2); max-width: 620px; margin: 0 auto 30px; }
.gradient-text {
  background: linear-gradient(112deg, var(--brand-600), var(--brand-500) 45%, var(--clay-500));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.searchbar {
  display: flex; align-items: center; gap: 8px; max-width: 640px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 99px; padding: 7px 7px 7px 18px; box-shadow: var(--shadow-lg);
}
.searchbar svg { width: 19px; height: 19px; color: var(--text-3); flex: none; }
.searchbar input {
  flex: 1; border: none; background: none; font-family: inherit; font-size: 1rem;
  color: var(--text); outline: none; min-width: 0;
}
.searchbar input::placeholder { color: var(--text-3); }
.searchbar .btn { border-radius: 99px; padding: 10px 22px; }

.hero-stats { display: flex; justify-content: center; gap: 40px; margin-top: 34px; flex-wrap: wrap; }
.hero-stats div { text-align: center; }
.hero-stats b { display: block; font-size: 1.5rem; letter-spacing: -.02em; }

/* ---------------------------------------------------------------- Event card */
.grid-events {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}

.ecard {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  color: inherit;
}
.ecard:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg);
               border-color: var(--border-strong); text-decoration: none; }
.ecard:hover .ecard-title { color: var(--brand-600); }
html[data-theme="dark"] .ecard:hover .ecard-title { color: var(--brand-300); }

.cover {
  position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center;
  overflow: hidden; color: #fff;
}
.cover::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 15% 10%, rgba(255,255,255,.28), transparent 55%),
              linear-gradient(180deg, transparent 45%, rgba(0,0,0,.32));
}
.cover .glyph { font-size: 2.9rem; filter: drop-shadow(0 4px 12px rgba(0,0,0,.3)); z-index: 1; }
.cover .cover-cat {
  position: absolute; left: 12px; top: 12px; z-index: 2;
  padding: 4px 11px; border-radius: 99px; font-size: .76rem; font-weight: 600;
  background: rgba(255,255,255,.92); color: #14162b; backdrop-filter: blur(6px);
}
.cover .cover-date {
  position: absolute; right: 12px; top: 12px; z-index: 2; text-align: center;
  background: rgba(255,255,255,.94); color: #14162b; border-radius: 10px;
  padding: 5px 10px; line-height: 1.15; box-shadow: var(--shadow-sm);
}
.cover .cover-date .m { font-size: .66rem; font-weight: 700; color: #dc2626; letter-spacing: .04em; }
.cover .cover-date .d { font-size: 1.15rem; font-weight: 800; }
.cover .cover-fee {
  position: absolute; left: 12px; bottom: 12px; z-index: 2; font-weight: 700;
  font-size: .95rem; text-shadow: 0 1px 6px rgba(0,0,0,.5);
}

/* 12 種封面主題 —— 全部走自然、溫暖的色調 */
.th0  { background: linear-gradient(135deg, #F15E75, #F0956B); }  /* 珊瑚日落 */
.th1  { background: linear-gradient(135deg, #E8955F, #D2603F); }  /* 陶土 */
.th2  { background: linear-gradient(135deg, #8FBE6C, #4E8F3A); }  /* 嫩芽 */
.th3  { background: linear-gradient(135deg, #5E9E86, #2F6E5E); }  /* 森林 */
.th4  { background: linear-gradient(135deg, #6BA8B8, #3B7A8C); }  /* 溪流 */
.th5  { background: linear-gradient(135deg, #F49AB0, #E2678C); }  /* 花瓣 */
.th6  { background: linear-gradient(135deg, #EDBE6A, #DD8F3E); }  /* 蜜光 */
.th7  { background: linear-gradient(135deg, #8C7A6B, #5A4A3E); }  /* 原木 */
.th8  { background: linear-gradient(135deg, #C489B8, #8E5C88); }  /* 暮色 */
.th9  { background: linear-gradient(135deg, #E2717C, #B4404F); }  /* 莓果 */
.th10 { background: linear-gradient(135deg, #A9C46C, #6E9A46); }  /* 草原 */
.th11 { background: linear-gradient(135deg, #7FA8C9, #4E7BA3); }  /* 遠山 */

.ecard-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.ecard-title { font-size: 1.02rem; font-weight: 700; line-height: 1.45; letter-spacing: -.01em;
               transition: color .16s; }
.ecard-meta { display: flex; flex-direction: column; gap: 5px; font-size: .84rem; color: var(--text-2); }
.ecard-meta .line { display: flex; align-items: center; gap: 7px; }
.ecard-meta svg { width: 14px; height: 14px; flex: none; color: var(--text-3); }
.ecard-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border);
              display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.progress { height: 5px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 99px;
                 background: linear-gradient(90deg, var(--brand-500), var(--clay-400)); transition: width .5s ease; }
.progress.warn span { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.progress.full span { background: linear-gradient(90deg, #94a3b8, #64748b); }

/* ---------------------------------------------------------------- Event detail */
.detail-hero { position: relative; aspect-ratio: 21 / 7; min-height: 220px; border-radius: var(--r-xl);
               overflow: hidden; display: grid; place-items: center; }
.detail-hero .glyph { font-size: 4.6rem; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 28px; align-items: start; }
.sticky-side { position: sticky; top: calc(var(--header-h) + 20px); }

.meta-list { display: flex; flex-direction: column; gap: 14px; }
.meta-item { display: flex; gap: 13px; align-items: flex-start; }
.meta-ico {
  width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-600);
}
html[data-theme="dark"] .meta-ico { background: rgba(241,94,117,.16); color: var(--brand-300); }
.meta-ico svg { width: 18px; height: 18px; }
.meta-item .k { font-size: .78rem; color: var(--text-3); }
.meta-item .v { font-weight: 600; font-size: .94rem; }

.ticket {
  border: 1.5px solid var(--border-strong); border-radius: var(--r); padding: 14px;
  cursor: pointer; transition: .16s; display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface);
}
.ticket:hover:not(.sold-out) { border-color: var(--brand-400); }
.ticket.active { border-color: var(--brand-500); background: var(--brand-50); box-shadow: var(--ring); }
html[data-theme="dark"] .ticket.active { background: rgba(241,94,117,.14); }
.ticket.sold-out { opacity: .55; cursor: not-allowed; }
.ticket input { margin-top: 3px; accent-color: var(--brand-600); width: 17px; height: 17px; flex: none; }
.ticket .price { font-weight: 800; font-size: 1.05rem; letter-spacing: -.02em; }
.ticket .free { color: var(--ok); }

.prose { color: var(--text-2); line-height: 1.85; font-size: .96rem; }
.prose h2 { font-size: 1.24rem; margin: 1.6em 0 .6em; color: var(--text); }
.prose h3 { font-size: 1.06rem; margin: 1.4em 0 .5em; color: var(--text); }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.35em; margin: 0 0 1em; }
.prose li { margin-bottom: .4em; }
.prose strong { color: var(--text); font-weight: 700; }
.prose code { background: var(--bg-soft); padding: 2px 6px; border-radius: 6px; font-size: .88em; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .92rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.prose th { background: var(--bg-soft); font-weight: 600; color: var(--text); }
.prose blockquote { margin: 1em 0; padding: 2px 0 2px 16px; border-left: 3px solid var(--brand-300); color: var(--text-3); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 1.8em 0; }

/* ---------------------------------------------------------------- Tables */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); }
table.data { width: 100%; border-collapse: collapse; font-size: .89rem; }
table.data th, table.data td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
table.data th {
  font-size: .78rem; font-weight: 600; color: var(--text-3); text-transform: none;
  background: var(--surface-2); position: sticky; top: 0; white-space: nowrap; z-index: 2;
  letter-spacing: .02em;
}
table.data tbody tr { transition: background .14s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .84rem; font-weight: 600; }

/* ---------------------------------------------------------------- Stats */
.stat-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 18px 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat .k { font-size: .82rem; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 1.85rem; font-weight: 800; letter-spacing: -.03em; margin-top: 4px; line-height: 1.15; }
.stat .sub { font-size: .78rem; color: var(--text-3); }
.stat::after {
  content: ''; position: absolute; right: -26px; top: -26px; width: 84px; height: 84px;
  border-radius: 50%; background: var(--brand-50); opacity: .8;
}
html[data-theme="dark"] .stat::after { background: rgba(241,94,117,.11); }
.stat > * { position: relative; }

/* ---------------------------------------------------------------- Misc */
.empty { text-align: center; padding: 64px 24px; color: var(--text-3); }
.empty .ico { font-size: 3rem; margin-bottom: 12px; opacity: .65; }
.empty h3 { color: var(--text-2); }

.skeleton {
  background: linear-gradient(90deg, var(--bg-soft) 25%, var(--border) 37%, var(--bg-soft) 63%);
  background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: var(--r);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.sk-card { height: 300px; border-radius: var(--r-lg); }

.divider { height: 1px; background: var(--border); margin: 24px 0; border: 0; }

.alert {
  display: flex; gap: 11px; padding: 13px 16px; border-radius: var(--r);
  font-size: .89rem; line-height: 1.6; align-items: flex-start;
}
.alert svg { width: 17px; height: 17px; flex: none; margin-top: 2px; }
.alert-info   { background: var(--info-bg);   color: var(--info); }
.alert-warn   { background: var(--warn-bg);   color: var(--warn); }
.alert-danger { background: var(--danger-bg); color: var(--danger); }
.alert-ok     { background: var(--ok-bg);     color: var(--ok); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  padding: 11px 16px; border: none; background: none; font-family: inherit; font-size: .92rem;
  font-weight: 600; color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap; transition: .16s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand-600); border-bottom-color: var(--brand-600); }
html[data-theme="dark"] .tab.active { color: var(--brand-300); border-bottom-color: var(--brand-400); }

.pagination { display: flex; gap: 6px; justify-content: center; align-items: center; margin-top: 36px; }
.pagination button {
  min-width: 38px; height: 38px; padding: 0 11px; border-radius: 10px; font-family: inherit;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  cursor: pointer; font-size: .89rem; font-weight: 600; transition: .14s;
}
.pagination button:hover:not(:disabled) { border-color: var(--brand-400); color: var(--brand-600); }
.pagination button.active { background: var(--text); border-color: var(--text); color: var(--bg); }
html[data-theme="dark"] .pagination button.active { background: var(--brand-500); border-color: var(--brand-500); color: #fff; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* Toast */
#toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px; min-width: 260px; max-width: 380px;
  padding: 13px 16px; border-radius: var(--r); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: .9rem;
  animation: toastIn .28s cubic-bezier(.2, .9, .3, 1.2); pointer-events: auto;
  border-left: 3px solid var(--brand-500);
}
.toast.ok    { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }
.toast.warn  { border-left-color: var(--warn); }
.toast .ti { font-size: 1.05rem; line-height: 1.3; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px) scale(.96); } }
.toast.out { animation: toastOut .22s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* Modal */
.backdrop {
  position: fixed; inset: 0; background: rgba(10, 12, 24, .55); backdrop-filter: blur(3px);
  z-index: 150; display: grid; place-items: center; padding: 20px;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 460px; max-height: 88vh; overflow: auto;
  animation: modalIn .24s cubic-bezier(.2, .9, .3, 1.1); border: 1px solid var(--border);
}
.modal.wide { max-width: 720px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.modal-head { padding: 20px 24px 0; }
.modal-body { padding: 16px 24px; }
.modal-foot { padding: 0 24px 22px; display: flex; gap: 10px; justify-content: flex-end; }

/* Ticket stub（報名憑證） */
.stub {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  overflow: hidden; box-shadow: var(--shadow-md);
}
.stub-top { padding: 26px; background: linear-gradient(135deg, var(--brand-500), var(--clay-500)); color: #fff; }
.stub-perf {
  height: 22px; background:
    radial-gradient(circle at 11px 0, transparent 11px, var(--surface) 11px) repeat-x;
  background-size: 22px 22px; margin-top: -11px; position: relative; z-index: 1;
}
.stub-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.7rem;
  font-weight: 800; letter-spacing: .16em;
}
.qr { display: grid; place-items: center; padding: 12px; background: #fff; border-radius: var(--r); }
.qr canvas { image-rendering: pixelated; width: 148px; height: 148px; }

/* Editor 專用 */
.builder-item {
  border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2);
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.builder-head { display: flex; align-items: center; gap: 8px; }
.grip { color: var(--text-3); cursor: grab; font-size: 1.05rem; user-select: none; }
.mini-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.theme-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-dot { width: 34px; height: 34px; border-radius: 10px; cursor: pointer;
             border: 2px solid transparent; transition: .16s; }
.theme-dot:hover { transform: scale(1.09); }
.theme-dot.active { border-color: var(--text); transform: scale(1.09); box-shadow: var(--shadow-md); }

/* Footer */
.site-footer {
  margin-top: 72px; border-top: 1px solid var(--border); background: var(--surface);
  padding: 40px 0 28px; font-size: .88rem; color: var(--text-2);
}
.footer-grid { display: grid; gap: 28px; grid-template-columns: 1.6fr repeat(3, 1fr); }
.footer-grid h4 { font-size: .85rem; color: var(--text); margin-bottom: 12px; }
.footer-grid a { color: var(--text-2); display: block; padding: 3px 0; }
.footer-grid a:hover { color: var(--brand-600); }
.footer-bottom { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border);
                 display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
                 color: var(--text-3); font-size: .82rem; }

/* Auth page */
.auth-wrap { min-height: calc(100vh - var(--header-h)); display: grid; grid-template-columns: 1fr 1fr; }
.auth-side {
  background: linear-gradient(150deg, var(--brand-500), var(--clay-500) 55%, var(--leaf-600));
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center;
  position: relative; overflow: hidden;
}
.auth-side::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.5) 1px, transparent 1px);
  background-size: 24px 24px; opacity: .16;
}
.auth-side > * { position: relative; z-index: 1; }
.auth-form { display: grid; place-items: center; padding: 48px 24px; }
.auth-form .inner { width: 100%; max-width: 380px; }

/* ==========================================================================
   行動裝置
   斷點：1000px（平板）／ 720px（手機）
   手機採底部導覽列，符合單手操作；所有點擊目標 ≥ 44px
   ========================================================================== */

@media (max-width: 1000px) {
  .detail-layout { grid-template-columns: 1fr; }
  /* 手機上先看到票種與報名按鈕，再看長篇說明 */
  .detail-layout > aside { order: -1; }
  .sticky-side { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .writer { grid-template-columns: 1fr; }
  .writer-preview { position: static; max-height: none; }
  .writer textarea { min-height: 40vh; }
}

@media (max-width: 720px) {
  :root { --header-h: 58px; }

  /* 手指不像滑鼠精準：所有可點元素在手機上放大到 44px */
  .icon-btn { width: 44px; height: 44px; }
  .btn-sm { min-height: 40px; padding: 9px 15px; font-size: .9rem; }
  .chip { min-height: 44px; padding: 11px 18px; }
  .tab { min-height: 46px; }
  .pagination button { min-width: 44px; height: 44px; }
  .theme-dot { width: 40px; height: 40px; }
  .menu a, .menu button { padding: 13px 14px; font-size: .95rem; }
  table.data td input[type="checkbox"] { width: 22px !important; height: 22px !important; }

  body {
    /* 底部導覽列的高度 + 瀏海機的安全區 */
    padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px));
  }

  .container { padding: 0 16px; }

  /* ---- 頁首：手機只留 Logo 與兩個動作 ---- */
  .nav, .mobile-toggle { display: none !important; }
  .site-header .container { gap: 12px; }
  .logo { font-size: 1.05rem; }
  .logo-mark { width: 30px; height: 30px; }

  /* ---- 底部導覽列 ---- */
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .bottom-nav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; padding: 9px 2px 7px; min-height: 56px;
    color: var(--text-3); font-size: .68rem; font-weight: 600; text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-nav a svg { width: 21px; height: 21px; }
  .bottom-nav a.active { color: var(--brand-600); }
  html[data-theme="dark"] .bottom-nav a.active { color: var(--brand-400); }
  .bottom-nav a:active { background: var(--bg-soft); }

  /* ---- 版面 ---- */
  .hero { padding: 32px 0 30px; }
  .hero .lead { font-size: 1rem; margin-bottom: 22px; }
  .hero-stats { gap: 20px; margin-top: 26px; }
  .hero-stats b { font-size: 1.3rem; }
  .searchbar { padding: 6px 6px 6px 16px; }
  .searchbar input { font-size: 1rem; }
  .searchbar .btn { padding: 10px 18px; }

  .card-pad, .card-body { padding: 18px 16px; }
  .card-head { padding: 15px 16px; flex-wrap: wrap; }
  .grid-events, .grid-posts { grid-template-columns: 1fr; gap: 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat { padding: 14px 15px; }
  .stat .v { font-size: 1.5rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .site-footer { margin-top: 48px; }

  /* 編輯器裡寫死的多欄格線，手機一律變單欄 */
  .mini-grid { grid-template-columns: 1fr !important; }

  /* ---- 表格改成卡片 ---- */
  table.data thead { display: none; }
  table.data, table.data tbody { display: block; }
  table.data tr {
    display: block; border: 1px solid var(--border); border-radius: var(--r);
    padding: 12px 14px; margin-bottom: 12px; background: var(--surface);
  }
  table.data tr:hover { background: var(--surface); }
  table.data td {
    display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
    border: none; padding: 6px 0; text-align: right;
  }
  table.data td::before {
    content: attr(data-label); color: var(--text-3); font-size: .82rem;
    font-weight: 500; text-align: left; flex: none; white-space: nowrap;
  }
  table.data td:empty, table.data td[data-label=""]:not(:last-child) { display: none; }
  /* 第一欄（主要內容）與最後一欄（操作鈕）不做左右對齊 */
  table.data td:first-child, table.data td:last-child {
    display: block; text-align: left; padding: 2px 0;
  }
  table.data td:first-child::before, table.data td:last-child::before { content: none; }
  table.data td:last-child {
    margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
    display: flex; gap: 8px; flex-wrap: wrap;
  }
  table.data td:last-child .btn { flex: 1 1 auto; justify-content: center; }
  .table-wrap { overflow: visible; max-height: none !important; }

  /* ---- 對話框改成由下往上的 bottom sheet ---- */
  .backdrop { padding: 0; align-items: flex-end; }
  .modal {
    max-width: none; width: 100%; max-height: 92vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    animation: sheetIn .26s cubic-bezier(.2, .9, .3, 1.05);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  @keyframes sheetIn { from { transform: translateY(100%); } }
  .modal-head { padding: 18px 20px 0; position: relative; }
  .modal-head::before {
    content: ''; position: absolute; left: 50%; top: 8px; transform: translateX(-50%);
    width: 38px; height: 4px; border-radius: 99px; background: var(--border-strong);
  }
  .modal-body { padding: 14px 20px; }
  .modal-foot {
    padding: 12px 20px calc(18px + env(safe-area-inset-bottom, 0px));
    position: sticky; bottom: 0; background: var(--surface);
    border-top: 1px solid var(--border); flex-direction: column-reverse; gap: 8px;
  }
  .modal-foot .btn { width: 100%; }

  /* ---- 地圖探索 ---- */
  .explore-layout { grid-template-columns: 1fr; height: auto; }
  .explore-panel { border-right: none; }
  .explore-map { height: calc(100vh - var(--header-h) - 62px - 190px); min-height: 300px; }
  .explore-layout[data-view="list"] .explore-map { display: none; }
  .explore-layout[data-view="map"] .explore-results { display: none; }
  .explore-filters { padding: 14px 16px; }
  .view-toggle { display: inline-flex; }
  .map-controls { right: 10px; top: 10px; }
  .map-btn { width: 40px; height: 40px; }

  /* ---- 活動詳情 ---- */
  .detail-hero { aspect-ratio: 16/9; min-height: 150px; border-radius: var(--r-lg); }
  .detail-hero .glyph { font-size: 3.2rem; }
  .tabs { gap: 0; }
  .tab { padding: 12px 13px; font-size: .9rem; }

  /* ---- 文章 ---- */
  .article { font-size: 1.02rem; line-height: 1.9; }
  .article h2 { font-size: 1.25rem; }
  .article h3 { font-size: 1.1rem; }
  .post-hero { aspect-ratio: 16/9; min-height: 150px; border-radius: var(--r-lg); }
  .post-hero .glyph { font-size: 3rem; }
  .event-cta { padding: 16px; }
  .event-cta .btn { width: 100%; }

  /* ---- 收件匣 ---- */
  .inbox { grid-template-columns: 1fr; min-height: 0; }
  .inbox-list { max-height: 320px; border-right: none; border-bottom: 1px solid var(--border); }
  .inbox-body { max-height: none; padding: 18px 16px; }

  /* ---- 票根 ---- */
  .stub-top { padding: 20px; }
  .stub-code { font-size: 1.4rem; letter-spacing: .12em; }

  /* ---- 提示訊息 ---- */
  #toasts { left: 16px; right: 16px; bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
  .toast { max-width: none; }

  /* ---- 編輯器：儲存列固定在底部導覽列上方 ---- */
  .editor-actions {
    position: fixed; left: 0; right: 0;
    bottom: calc(62px + env(safe-area-inset-bottom, 0px));
    z-index: 80; display: flex; gap: 8px; padding: 10px 16px;
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    backdrop-filter: blur(12px); border-top: 1px solid var(--border);
  }
  .editor-actions .btn { flex: 1; }
  .editor-actions .btn-icon-only { flex: 0 0 auto; }
  .has-editor-actions { padding-bottom: calc(132px + env(safe-area-inset-bottom, 0px)); }
}

/* 手機橫向或小平板：欄位別擠成一欄 */
@media (min-width: 560px) and (max-width: 720px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-events, .grid-posts { grid-template-columns: repeat(2, 1fr); }
}

/* 桌機不顯示底部導覽列 */
.bottom-nav { display: none; }

@media print {
  .site-header, .site-footer, .no-print { display: none !important; }
  body { background: #fff; }
}

/* ==========================================================================
   v0.2 —— 地圖探索、報名憑證頁、收件匣、圖表
   ========================================================================== */

/* ---------------------------------------------------------------- 地圖 */
.map-root {
  position: relative; overflow: hidden; border-radius: var(--r-lg);
  background: #e8eaf0; border: 1px solid var(--border); touch-action: none;
  user-select: none; -webkit-user-select: none;
}
html[data-theme="dark"] .map-root { background: #1a1d29; }
.map-canvas { position: absolute; inset: 0; cursor: grab; }
.map-root.dragging .map-canvas { cursor: grabbing; }
.map-tiles, .map-overlay { position: absolute; inset: 0; }
.map-overlay { pointer-events: none; }
.map-overlay > * { pointer-events: auto; }
.map-tile {
  position: absolute; width: 256px; height: 256px; left: 0; top: 0;
  will-change: transform; max-width: none;
}
.map-tile.failed { opacity: 0; }
html[data-theme="dark"] .map-tile { filter: invert(0.92) hue-rotate(180deg) saturate(0.7) brightness(1.05); }

.map-root.tiles-offline .map-tiles {
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
}
.map-offline {
  display: none; position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  background: var(--warn-bg); color: var(--warn); padding: 7px 14px; border-radius: 99px;
  font-size: .8rem; z-index: 5; white-space: nowrap;
}
.map-root.tiles-offline .map-offline { display: block; }

.map-controls { position: absolute; right: 12px; top: 12px; display: flex;
                flex-direction: column; gap: 6px; z-index: 6; }
.map-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 1rem; font-weight: 700;
  cursor: pointer; box-shadow: var(--shadow-sm); display: grid; place-items: center;
  font-family: inherit; transition: .14s;
}
.map-btn:hover { background: var(--bg-soft); transform: translateY(-1px); }
.map-attrib {
  position: absolute; right: 0; bottom: 0; z-index: 4; font-size: .68rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--text-3); padding: 3px 8px; border-radius: 8px 0 0 0;
}

.map-marker {
  position: absolute; transform: translate(-50%, -100%); border: none; background: none;
  cursor: pointer; padding: 0; line-height: 1; filter: drop-shadow(0 3px 5px rgba(0,0,0,.35));
  transition: transform .14s;
}
.map-marker:hover, .map-marker.active { transform: translate(-50%, -100%) scale(1.22); z-index: 3; }
.map-marker .pin { position: relative; display: block; width: 38px; height: 38px; }
.map-marker .pin img { width: 100%; height: 100%; object-fit: contain; display: block; }
.map-marker .pin em {
  position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%);
  font-size: 13px; font-style: normal; line-height: 1;
}
.map-marker.active .pin { filter: drop-shadow(0 0 0 2px #fff) saturate(1.15); }
.map-marker.active { z-index: 4; }
.map-marker .pin-badge {
  position: absolute; left: 50%; top: -8px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); font-size: .64rem; font-weight: 700;
  padding: 1px 6px; border-radius: 99px; white-space: nowrap;
}
html[data-theme="dark"] .map-marker .pin-badge { background: var(--brand-500); color: #fff; }

.map-cluster {
  position: absolute; transform: translate(-50%, -50%); border-radius: 50%; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, var(--brand-400), var(--brand-600));
  color: #fff; border: 3px solid rgba(255,255,255,.55); display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(221,60,85,.42); font-family: inherit; line-height: 1.1;
  transition: transform .14s;
}
.map-cluster:hover { transform: translate(-50%, -50%) scale(1.09); z-index: 3; }
.map-cluster b { font-size: 1rem; }
.map-cluster span { font-size: .58rem; opacity: .9; }

/* 探索頁版面：桌面並列、行動可切換（§3.3） */
.explore-layout { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: 0;
                  height: calc(100vh - var(--header-h)); }
.explore-panel { overflow-y: auto; border-right: 1px solid var(--border);
                 background: var(--surface); }
.explore-map { position: relative; }
.explore-map .map-root { position: absolute; inset: 0; border-radius: 0; border: none; }
.explore-filters { padding: 16px 18px; border-bottom: 1px solid var(--border);
                   position: sticky; top: 0; background: var(--surface); z-index: 8; }
.explore-results { padding: 10px 12px 40px; }
.mini-card {
  display: flex; gap: 11px; padding: 11px; border-radius: var(--r); cursor: pointer;
  border: 1px solid transparent; transition: .14s; color: inherit; text-decoration: none;
}
.mini-card:hover { background: var(--surface-2); border-color: var(--border); text-decoration: none; }
.mini-card.active { background: var(--brand-50); border-color: var(--brand-300); }
html[data-theme="dark"] .mini-card.active { background: rgba(241,94,117,.16); }
.mini-cover { width: 62px; height: 62px; border-radius: 11px; flex: none; display: grid;
              place-items: center; font-size: 1.5rem; color: #fff; }
.view-toggle { display: none; }

@media (max-width: 900px) {
  .explore-layout { grid-template-columns: 1fr; height: auto; }
  .explore-panel { border-right: none; }
  .explore-map { height: 62vh; }
  .explore-layout[data-view="list"] .explore-map { display: none; }
  .explore-layout[data-view="map"] .explore-panel .explore-results { display: none; }
  .view-toggle { display: inline-flex; }
}

/* 地圖選點（編輯器用） */
.geo-picker { height: 300px; }
.geo-hint { display: flex; gap: 8px; align-items: center; font-size: .82rem; }

/* ---------------------------------------------------------------- 圖表 */
.chart { width: 100%; height: 190px; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-label { fill: var(--text-3); font-size: 10px; }
.chart .bar { fill: url(#barGrad); transition: opacity .15s; }
.chart .bar:hover { opacity: .78; }
.chart .line { fill: none; stroke: var(--brand-500); stroke-width: 2.2;
               stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: url(#areaGrad); }
.chart .dot { fill: var(--brand-600); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--text-2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block;
            margin-right: 5px; vertical-align: -1px; }

/* ---------------------------------------------------------------- 收件匣 */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 0;
         border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border);
         min-height: 560px; background: var(--surface); }
.inbox-list { border-right: 1px solid var(--border); overflow-y: auto; max-height: 74vh; }
.inbox-item { padding: 13px 16px; border-bottom: 1px solid var(--border); cursor: pointer;
              transition: .14s; }
.inbox-item:hover { background: var(--surface-2); }
.inbox-item.active { background: var(--brand-50); box-shadow: inset 3px 0 0 var(--brand-600); }
html[data-theme="dark"] .inbox-item.active { background: rgba(241,94,117,.15); }
.inbox-body { padding: 22px; overflow-y: auto; max-height: 74vh; }
.mail-frame { border: 1px solid var(--border); border-radius: var(--r); padding: 18px;
              background: #fff; }
html[data-theme="dark"] .mail-frame { background: #f7f8fb; color: #14162b; }
@media (max-width: 820px) { .inbox { grid-template-columns: 1fr; }
  .inbox-list { max-height: 300px; border-right: none; border-bottom: 1px solid var(--border); } }

/* ---------------------------------------------------------------- 其他 */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px;
                    width: 2px; background: var(--border); }
.timeline-item { position: relative; padding: 6px 0 14px; }
.timeline-item::before { content: ''; position: absolute; left: -19px; top: 12px;
                         width: 9px; height: 9px; border-radius: 50%;
                         background: var(--brand-500); box-shadow: 0 0 0 3px var(--surface); }
.tag-pick { display: flex; gap: 7px; flex-wrap: wrap; }
.file-drop {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r); padding: 18px;
  text-align: center; cursor: pointer; transition: .14s; background: var(--surface-2);
}
.file-drop:hover, .file-drop.over { border-color: var(--brand-400); background: var(--brand-50); }
html[data-theme="dark"] .file-drop:hover { background: rgba(241,94,117,.12); }
.copyable { display: flex; gap: 8px; align-items: center; background: var(--surface-2);
            border: 1px solid var(--border); border-radius: var(--r); padding: 9px 12px;
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem;
            word-break: break-all; }

/* ==========================================================================
   自然筆記（部落格）
   ========================================================================== */

.post-hero {
  position: relative; aspect-ratio: 21 / 8; min-height: 200px; border-radius: var(--r-xl);
  display: grid; place-items: center; overflow: hidden; color: #fff;
}
.post-hero .glyph { font-size: 4rem; filter: drop-shadow(0 4px 14px rgba(0,0,0,.3)); }

.article {
  font-size: 1.04rem; line-height: 1.95; color: var(--text-2); letter-spacing: .01em;
}
.article h2 { font-size: 1.42rem; margin: 2em 0 .6em; color: var(--text); letter-spacing: -.01em; }
.article h3 { font-size: 1.16rem; margin: 1.7em 0 .5em; color: var(--text); }
.article h2:first-child, .article h3:first-child { margin-top: 0; }
.article p { margin: 0 0 1.35em; }
.article ul, .article ol { padding-left: 1.4em; margin: 0 0 1.35em; }
.article li { margin-bottom: .55em; }
.article strong { color: var(--text); font-weight: 700; }
.article blockquote {
  margin: 1.6em 0; padding: 14px 20px; border-left: 3px solid var(--brand-400);
  background: var(--sand-100); border-radius: 0 var(--r) var(--r) 0; color: var(--text-2);
}
.article code { background: var(--bg-soft); padding: 2px 7px; border-radius: 6px; font-size: .9em; }
.article table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: .95rem; }
.article th, .article td { border: 1px solid var(--border); padding: 10px 13px; text-align: left; }
.article th { background: var(--bg-soft); color: var(--text); font-weight: 600; }
.article hr { border: none; border-top: 1px solid var(--border); margin: 2.2em 0; }
.article a { text-decoration: underline; text-underline-offset: 3px; }

.byline { display: flex; align-items: center; gap: 12px; }
.byline-avatar {
  width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-500), var(--clay-400)); color: #fff;
  font-weight: 700; font-size: 1.05rem; object-fit: cover;
}
.byline-avatar.lg { width: 68px; height: 68px; font-size: 1.5rem; }

.pcard {
  display: flex; flex-direction: column; overflow: hidden; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease; color: inherit;
}
.pcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); text-decoration: none; }
.pcard:hover .pcard-title { color: var(--brand-600); }
html[data-theme="dark"] .pcard:hover .pcard-title { color: var(--brand-400); }
.pcard-cover { aspect-ratio: 16 / 9; display: grid; place-items: center; font-size: 2.4rem;
               color: #fff; position: relative; }
.pcard-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pcard-title { font-size: 1.04rem; font-weight: 700; line-height: 1.5; transition: color .16s; }
.pcard-foot { margin-top: auto; padding-top: 11px; border-top: 1px solid var(--border);
              display: flex; align-items: center; gap: 9px; font-size: .8rem; color: var(--text-3); }

.grid-posts { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

/* 文章裡的行程導流卡 */
.event-cta {
  border: 1.5px solid var(--brand-200); background: linear-gradient(135deg, var(--sand-100), var(--brand-50));
  border-radius: var(--r-lg); padding: 20px; display: flex; gap: 16px; align-items: center;
  flex-wrap: wrap;
}
html[data-theme="dark"] .event-cta {
  background: linear-gradient(135deg, var(--surface-2), rgba(241,94,117,.10));
  border-color: rgba(241,94,117,.3);
}
.event-cta .cta-cover { width: 72px; height: 72px; border-radius: var(--r); flex: none;
                        display: grid; place-items: center; font-size: 1.9rem; color: #fff; }

/* 編輯器：撰寫與預覽並列 */
.writer { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 18px;
          align-items: start; }
.writer textarea {
  min-height: 62vh; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .92rem; line-height: 1.8;
}
.writer-preview { position: sticky; top: calc(var(--header-h) + 16px); max-height: 78vh;
                  overflow-y: auto; }
@media (max-width: 940px) { .writer { grid-template-columns: 1fr; }
  .writer-preview { position: static; max-height: none; } }

/* ---------------------------------------------------------------- 密碼欄位 */
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 50px; }
.pw-toggle {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: none; background: none; cursor: pointer;
  color: var(--text-3); border-radius: 10px; display: grid; place-items: center;
  transition: .14s; padding: 0;
}
.pw-toggle:hover { color: var(--text); background: var(--bg-soft); }
.pw-toggle:focus-visible { outline: none; box-shadow: var(--ring); }
.pw-toggle svg { width: 19px; height: 19px; }
.pw-toggle[aria-pressed="true"] { color: var(--brand-600); }
html[data-theme="dark"] .pw-toggle[aria-pressed="true"] { color: var(--brand-400); }

.pw-meter { display: flex; gap: 4px; margin-top: 7px; align-items: center; }
.pw-meter i { height: 4px; flex: 1; border-radius: 99px; background: var(--border); transition: .2s; }
.pw-meter.weak i:nth-child(-n+1),
.pw-meter.fair i:nth-child(-n+2),
.pw-meter.good i { background: var(--brand-500); }
.pw-meter.weak i:nth-child(-n+1) { background: var(--danger); }
.pw-meter.fair i:nth-child(-n+2) { background: var(--warn); }
.pw-meter.good i { background: var(--ok); }
.pw-meter span { font-size: .8rem; color: var(--text-3); flex: none; min-width: 3.4em; }

/* 設定頁 */
.settings-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.avatar-edit { position: relative; width: 84px; height: 84px; flex: none; cursor: pointer; }
.avatar-edit .byline-avatar { width: 84px; height: 84px; font-size: 1.9rem; }
.avatar-edit::after {
  content: '📷'; position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px;
  border-radius: 50%; background: var(--surface); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 14px; box-shadow: var(--shadow-sm);
}

/* ---------------------------------------------------------------- 圖片上傳 */
.img-upload {
  position: relative; width: 100%; border-radius: var(--r-lg); overflow: hidden;
  border: 1.5px dashed var(--border-strong); background: var(--surface-2);
  cursor: pointer; transition: .16s; display: grid; place-items: center;
}
.img-upload:hover, .img-upload.over { border-color: var(--brand-400); background: var(--brand-50); }
html[data-theme="dark"] .img-upload:hover,
html[data-theme="dark"] .img-upload.over { background: rgba(241,94,117,.1); }
.img-upload.has-image { border-style: solid; border-color: var(--border); cursor: default; }
.img-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.img-empty { text-align: center; padding: 18px; pointer-events: none; }
.img-upload.has-image .img-empty { display: none; }
.img-actions {
  position: absolute; right: 10px; bottom: 10px; display: none; gap: 8px; z-index: 2;
}
.img-upload.has-image .img-actions { display: flex; }
.img-actions .btn {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
}
.img-busy {
  position: absolute; inset: 0; display: none; place-items: center; z-index: 3;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(3px); font-size: .9rem; gap: 8px;
}
.img-upload.busy .img-busy { display: grid; }

/* 有宣傳圖時的封面 */
.cover img.cover-photo, .detail-hero img.cover-photo, .post-hero img.cover-photo,
.mini-cover img.cover-photo, .pcard-cover img.cover-photo {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0;
}
.cover.has-photo .glyph, .detail-hero.has-photo .glyph, .post-hero.has-photo .glyph { display: none; }
.mini-cover { position: relative; overflow: hidden; }
