/* 淺色主題（背景是雲朵影片 /media/bg-loop.mp4），不跟著系統切換深色模式 */
:root {
  --bg: rgba(255, 255, 255, .62);      /* 卡片裡的小區塊、輸入框 */
  --card: rgba(255, 255, 255, .74);    /* 半透明白卡片，透出一點背景 */
  --text: #595959;
  --muted: #767676;
  --border: rgba(0, 0, 0, .08);
  --accent: #55555e;                   /* 石墨灰：按鈕、語言切換、名牌選取外框統一用這個顏色 */
  --accent-text: #ffffff;
  --accent-soft: #e6e6ea;
  --mark: #ffe58a;
  --mark-text: #3d2f00;
  --warn-bg: #fff4d6;
  --warn-text: #6b4b00;
  --error-bg: #fde8e8;
  --error-text: #8a1c1c;
  --mine: rgba(255, 236, 160, .7);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 24px rgba(80, 80, 100, .08);
  color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  /* 影片載入前、或影片不能播放時顯示的靜態畫面（影片第一格） */
  background: #ececee url(/media/bg-poster.jpg) center / cover fixed no-repeat;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans TC", "Noto Sans JP",
    "Microsoft JhengHei", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  line-height: 1.6;
}

button, input { font: inherit; color: inherit; }

.top, main {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

/* ---------------------------------------------------------------- header */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 8px;
}
.brand {
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--text);
  text-decoration: none;
}
.lang {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--card);
}
.lang button {
  border: 0;
  background: none;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
  color: var(--muted);
}
.lang button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

/* ---------------------------------------------------------------- headings */
h1 {
  font-size: clamp(26px, 5vw, 34px);
  line-height: 1.25;
  margin: 20px 0 4px;
}
.sub { margin: 0 0 20px; color: var(--muted); }
h2 { font-size: 18px; margin: 0 0 12px; }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--card);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

/* ---------------------------------------------------------------- search */
.search label { display: block; font-weight: 600; margin-bottom: 8px; }
.row { display: flex; gap: 8px; }
.row input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  font-size: 17px; /* 16px 以上，iOS 才不會自動放大 */
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.row input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}
.btn {
  border: 0;
  border-radius: 10px;
  padding: 12px 22px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.06); }
a.btn { display: inline-block; text-decoration: none; }
.go { margin: 16px 0 0; }

.help { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.help strong { color: var(--text); }

/* ---------------------------------------------------------------- result */
.result .who {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.result .name { font-weight: 700; font-size: 18px; word-break: break-all; }
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.stat {
  background: var(--bg);
  border-radius: 10px;
  padding: 14px 16px;
}
.stat .k { font-size: 13px; color: var(--muted); }
.stat .v { font-size: 24px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat .v.big { font-size: 34px; color: var(--accent); }
.stat .s { font-size: 13px; color: var(--muted); margin-top: 2px; }

.missing h2 { word-break: break-all; }
.missing ul { margin: 0 0 12px; padding-left: 1.2em; }
.missing li { margin-bottom: 4px; }
.hint {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-radius: 8px;
  padding: 8px 12px;
}


/* ---------------------------------------------------------------- top 10 */
.top10 ol { list-style: none; margin: 0; padding: 0; }
.top10 li {
  display: grid;
  grid-template-columns: 2.5em 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  border-top: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.top10 li:first-child { border-top: 0; }
.top10 li.mine { background: var(--mine); border-radius: 8px; }
.top10 li.empty { display: block; color: var(--muted); }
.top10 .r { color: var(--muted); font-weight: 700; text-align: right; }
.top10 .n {
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top10 .n:hover { text-decoration: underline; }
.top10 .p { font-weight: 600; }
.tag {
  margin-left: 6px;
  font-size: 12px;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 999px;
  padding: 1px 8px;
}

/* ---------------------------------------------------------------- status / notes */
.notice { border-radius: 10px; padding: 10px 14px; margin: 0 0 12px; }
.notice.warn { background: var(--warn-bg); color: var(--warn-text); }
.notice.error { background: var(--error-bg); color: var(--error-text); }
.errdetail { margin-top: 6px; font-size: 12px; opacity: .75; word-break: break-all; font-family: ui-monospace, Menlo, Consolas, monospace; }
.status { margin: 0; font-size: 14px; color: var(--muted); }
main { padding-bottom: 32px; }

/* ---------------------------------------------------------------- 下注方式 */
.howto ul { margin: 0; padding-left: 1.2em; }
.howto li { margin-bottom: 8px; }
.howto li:last-child { margin-bottom: 0; }
.howto li code { display: table; margin-top: 4px; }
code {
  font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: .95em;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .card { padding: 16px; }
  .stat .v.big { font-size: 30px; }
  .btn { padding: 12px 16px; }
}

.howto .help { margin-top: 12px; }

.howto .pinned { margin: 12px 0 8px; }
.examples { display: grid; gap: 8px; }
.example { background: var(--bg); border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.ex-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.ex-q { font-weight: 600; margin: 2px 0 6px; }
.ex-opts { list-style: none; margin: 0; padding: 0; }
.ex-opts li { margin: 2px 0; }
.ex-opt { font-weight: 600; }
.example code { background: var(--card); }
.ex-notes { margin-top: 8px; color: var(--muted); }
.ex-notes code { white-space: nowrap; }
.howto .ex-opts { padding-left: 0; }
.howto .ex-opts li { margin: 4px 0; }
.howto .ex-opts li code { display: inline; margin-top: 0; }
.ex-tr { color: var(--muted); margin: -4px 0 6px; }
.howto .bang { margin: 12px 0 0; font-size: 14px; }
.howto .bang code { background: var(--card); }
.howto .numbers { margin: 0 0 10px; }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- 背景影片 */
.bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
  pointer-events: none;
}
/* 系統設定「減少動態效果」時不播影片，停在靜態畫面 */
@media (prefers-reduced-motion: reduce) {
  .bg-video { display: none; }
}
