/* MLC2026 領幣頁樣式
 * 設計：白底 + drMarcoLab 深藍品牌色 + 課程活潑感（進度條、金幣、慶祝動畫）
 * 全部用原生 CSS，沒有框架、沒有外部字型（避免課堂網路問題）
 */

:root {
  --brand: #1e3a8a;         /* drMarcoLab 深藍 */
  --brand-soft: #2f4fb8;
  --brand-tint: #eef2ff;
  --gold: #f59e0b;
  --gold-soft: #fde68a;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #ffffff;
  --soft: #f8fafc;
  --ok: #15803d;
  --warn: #b45309;
  --err: #b91c1c;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(1200px 400px at 50% -180px, #eef2ff 0%, rgba(238, 242, 255, 0) 70%);
}

a { color: var(--brand); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86em; }

/* ── 頁首 ───────────────────────────────── */
.site-header {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 22px 20px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(30, 58, 138, .25);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 17px; letter-spacing: .2px; }
.brand-text small { color: var(--muted); font-size: 12px; }

.badge {
  font-size: 12.5px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  white-space: nowrap;
}
.badge-ok { color: var(--ok); border-color: #bbf7d0; background: #f0fdf4; }
.badge-warn { color: var(--warn); border-color: #fde68a; background: #fffbeb; }
.badge-idle { color: var(--muted); }

/* ── 版面 ───────────────────────────────── */
main {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  padding: 26px 26px 22px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  top: -90px; right: -70px;
  width: 260px; height: 260px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(245, 158, 11, .16) 0%, rgba(245, 158, 11, 0) 70%);
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }

/* ── 主標題區 ────────────────────────────── */
.hero-top {
  display: grid;
  grid-template-columns: 1fr 132px;
  gap: 18px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brand-soft);
  font-weight: 700;
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(26px, 4.6vw, 38px);
  line-height: 1.2;
  letter-spacing: -.01em;
}

.gold {
  color: var(--brand);
  background: linear-gradient(180deg, transparent 54%, var(--gold-soft) 54%, #fbbf24 100%);
  border-radius: 4px;
  padding: 0 5px 1px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.lede { margin: 0 0 12px; color: var(--muted); font-size: 15px; }

.token-line { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }

.pill {
  font-size: 12.5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-tint);
  color: var(--brand);
  border: 1px solid #dbe3ff;
}
.pill-ghost { background: #fff; color: var(--muted); border-color: var(--line); }

/* ── 金幣 ───────────────────────────────── */
.coin-wrap { display: grid; justify-items: center; gap: 6px; }

.coin {
  width: 112px; height: 112px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 32% 28%, #fff6d8 0%, var(--gold-soft) 34%, var(--gold) 72%, #d97706 100%);
  border: 3px solid #fff;
  box-shadow:
    0 0 0 6px rgba(245, 158, 11, .12),
    0 14px 26px rgba(217, 119, 6, .28),
    inset 0 -8px 16px rgba(180, 83, 9, .35),
    inset 0 8px 14px rgba(255, 255, 255, .75);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0;
  color: #7c2d12;
  animation: float 5s ease-in-out infinite;
}

.coin-symbol {
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .12em;
  line-height: 1;
}
.coin-amount { font-size: 15px; font-weight: 700; opacity: .85; }

.coin-shadow {
  width: 74px; height: 9px;
  border-radius: 999px;
  background: radial-gradient(ellipse at center, rgba(15, 23, 42, .16), rgba(15, 23, 42, 0) 72%);
  animation: shadowPulse 5s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-9px) rotate(2deg); }
}
@keyframes shadowPulse {
  0%, 100% { transform: scaleX(1); opacity: .9; }
  50% { transform: scaleX(.86); opacity: .55; }
}

/* 領取成功時金幣跳一下 */
.coin.pop { animation: pop .9s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.22) rotate(8deg); }
  60% { transform: scale(.95) rotate(-4deg); }
  100% { transform: scale(1); }
}

/* ── 進度條 ─────────────────────────────── */
.progress-block { margin: 22px 0 18px; }

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 7px;
}
.progress-head b { color: var(--ink); font-variant-numeric: tabular-nums; }

.bar {
  height: 14px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(135deg, rgba(30, 58, 138, .07) 0 6px, rgba(30, 58, 138, .02) 6px 12px),
    var(--brand-tint);
  border: 1px solid #dbe3ff;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 2px rgba(30, 58, 138, .06);
}

.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-soft) 62%, var(--gold) 100%);
  transition: width .8s cubic-bezier(.2, .9, .2, 1);
  position: relative;
}
.bar-fill::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.55) 50%, rgba(255,255,255,0) 100%);
  animation: shimmer 2.6s linear infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── 錢包 ───────────────────────────────── */
.wallet-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

.btn {
  font: inherit;
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 12px 18px;
  font-weight: 650;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .18s ease, background .18s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: .55; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 18px rgba(30, 58, 138, .22);
}
.btn-primary:hover:not(:disabled) { background: #1b3479; }

.btn-claim {
  width: 100%;
  margin-top: 14px;
  padding: 15px 18px;
  font-size: 16.5px;
  color: #3f2a06;
  background: linear-gradient(180deg, #fde68a 0%, var(--gold) 100%);
  border-color: #f3c14b;
  box-shadow: 0 10px 22px rgba(245, 158, 11, .28);
}
.btn-claim:hover:not(:disabled) { filter: brightness(1.03); }
.btn-claim:disabled {
  background: linear-gradient(180deg, #fffaeb 0%, #fef3c7 100%);
  border-color: #fde68a;
  color: #a16207;
  box-shadow: none;
  opacity: 1;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--soft);
  font-size: 13.5px;
  font-family: ui-monospace, Menlo, monospace;
}
.btn-ghost {
  background: #fff;
  color: var(--brand);
  border-color: #dbe3ff;
  box-shadow: none;
  font-size: 13.5px;
  padding: 10px 14px;
}
.btn-ghost:hover { background: var(--brand-tint); }

/* 多錢包選擇（偵測到兩個以上擴充時才出現） */
.wallet-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px dashed #dbe3ff;
  border-radius: 12px;
  background: var(--brand-tint);
}
.wp-label { font-size: 12.5px; color: var(--brand); }
.wp-btn {
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #dbe3ff;
  background: #fff;
  color: var(--brand);
  cursor: pointer;
}
.wp-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.chip .dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(21, 128, 61, .14);
}

/* ── 輸入 ───────────────────────────────── */
.field { display: block; }
.field > span {
  display: block;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  margin-bottom: 7px;
}

input[type="password"] {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  transition: border-color .16s ease, box-shadow .16s ease;
}
input[type="password"]:focus {
  outline: none;
  border-color: var(--brand-soft);
  box-shadow: 0 0 0 4px rgba(47, 79, 184, .12);
}

/* ── 狀態訊息 ────────────────────────────── */
.status {
  margin-top: 14px;
  font-size: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--muted);
  word-break: break-word;
}
.status.ok { color: var(--ok); background: #f0fdf4; border-color: #bbf7d0; }
.status.warn { color: var(--warn); background: #fffbeb; border-color: #fde68a; }
.status.err { color: var(--err); background: #fef2f2; border-color: #fecaca; }
.status b { color: inherit; }

/* ── 統計卡 ─────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.stat {
  padding: 16px 18px;
  display: grid;
  gap: 2px;
  position: relative;
  overflow: hidden;
  transition: transform .16s ease, box-shadow .18s ease;
}
.stat:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(15,23,42,.05), 0 16px 34px rgba(15,23,42,.09); }
.stat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-soft) 55%, var(--gold) 100%);
  opacity: .85;
}
.stat:nth-child(2)::before { background: linear-gradient(90deg, var(--brand-soft) 0%, #93c5fd 100%); }
.stat:nth-child(3)::before { background: linear-gradient(90deg, var(--gold) 0%, var(--gold-soft) 100%); }
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-value {
  color: var(--brand);
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.stat-value.small { font-size: 16px; font-weight: 650; }

/* ── 技術資訊 ────────────────────────────── */
.tech { padding: 6px 20px 16px; }
.tech summary {
  cursor: pointer;
  padding: 12px 0;
  font-weight: 650;
  font-size: 14px;
  color: var(--brand);
  list-style: none;
}
.tech summary::-webkit-details-marker { display: none; }
.tech summary::before { content: "▸ "; display: inline-block; transition: transform .16s ease; }
.tech[open] summary::before { content: "▾ "; }

.tech dl { margin: 0; display: grid; gap: 8px; }
.tech dl > div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  font-size: 13px;
  padding: 6px 0;
  border-top: 1px dashed var(--line);
}
.tech dt { color: var(--muted); }
.tech dd { margin: 0; word-break: break-all; }

.tech-note {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

/* ── 頁尾 ───────────────────────────────── */
.site-footer {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px 30px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
}

/* ── 彩帶 ───────────────────────────────── */
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}
.confetti i {
  position: absolute;
  width: 9px; height: 14px;
  border-radius: 2px;
  opacity: .95;
  animation: fall 2.4s cubic-bezier(.25, .6, .4, 1) forwards;
}
@keyframes fall {
  0% { transform: translate3d(0, -12vh, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate3d(var(--drift, 0px), 108vh, 0) rotate(720deg); opacity: 0; }
}

.hidden { display: none !important; }

/* ── 手機 ───────────────────────────────── */
@media (max-width: 620px) {
  .site-header { padding: 16px 16px 4px; }
  main { padding: 6px 16px 32px; gap: 14px; }
  .hero { padding: 20px 18px 18px; }
  .hero-top { grid-template-columns: 1fr; }
  .coin-wrap { justify-items: start; }
  .coin { width: 84px; height: 84px; }
  .coin-symbol { font-size: 17px; }
  .coin-amount { font-size: 12px; }
  .stats { grid-template-columns: 1fr; }
  .tech dl > div { grid-template-columns: 1fr; gap: 2px; }
  .site-footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .coin, .coin-shadow, .bar-fill::after { animation: none !important; }
  .confetti i { animation: none !important; display: none; }
}
