/* ══════════════════════════════════════════════════════════
 *  共用樣式 —— 四個頁面長得像同一套系統
 * ══════════════════════════════════════════════════════════ */

:root {
  --bg:        #0a0a0c;
  --surface:   #141418;
  --surface-2: #1c1c22;
  --line:      #2a2a33;
  --line-soft: #232329;

  --text:      #ececf0;
  --text-dim:  #8b8b96;
  --text-mute: #5c5c68;

  --accent:      #3b82f6;
  --accent-dark: #2563eb;
  --ok:          #34d399;
  --warn:        #fbbf24;
  --err:         #f87171;

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;

  --shadow: 0 4px 24px rgba(0, 0, 0, .4);
}

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Microsoft JhengHei",
               "PingFang TC", "Noto Sans TC", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ── 版面 ───────────────────────────────────────────────── */

.page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 32px 20px 48px;
}

.wrap { max-width: 820px; margin: 0 auto; }

.head { margin-bottom: 28px; }

.head h1 {
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -.02em;
  margin-bottom: 4px;
}

.head p {
  color: var(--text-dim);
  font-size: .95rem;
}

/* ── 卡片 ───────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 22px;
  margin-bottom: 16px;
}

.card > h2 {
  font-size: 1.02rem;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 步驟編號的小圓圈 */
.card > h2 .step {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.hint {
  font-size: .87rem;
  color: var(--text-mute);
  margin-top: 12px;
}

.hint a { color: var(--accent); text-decoration: none; }
.hint a:hover { text-decoration: underline; }

/* ── 按鈕 ───────────────────────────────────────────────── */

button, .btn {
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

button:hover:not(:disabled),
.btn:hover { background: var(--accent-dark); }

button:active:not(:disabled) { transform: scale(.985); }

button:disabled {
  background: var(--surface-2);
  color: var(--text-mute);
  cursor: not-allowed;
}

button.ghost, .btn.ghost {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
}

button.ghost:hover:not(:disabled),
.btn.ghost:hover { background: #26262e; border-color: #3a3a46; }

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── 輸入框 ─────────────────────────────────────────────── */

input[type=text], input[type=password] {
  flex: 1;
  min-width: 200px;
  padding: 12px 14px;
  font-size: .95rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
}

input:focus {
  outline: none;
  border-color: var(--accent);
}

input::placeholder { color: var(--text-mute); }

/* ── 記錄視窗 ───────────────────────────────────────────── */

.log {
  background: #08080a;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 13px 15px;
  font-size: .85rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  line-height: 1.7;
  max-height: 240px;
  overflow-y: auto;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
}

.log .ok   { color: var(--ok); }
.log .err  { color: var(--err); }
.log .warn { color: var(--warn); }
.log .dim  { color: var(--text-mute); }

/* ── 狀態列 ─────────────────────────────────────────────── */

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  border-radius: var(--r-sm);
  font-size: .9rem;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  color: var(--text-dim);
}

.status .led {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-mute);
}

.status.ok  { background: #0d1f16; border-color: #1c5c3a; color: #86efac; }
.status.ok  .led { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

.status.bad { background: #241315; border-color: #7f2222; color: #fca5a5; }
.status.bad .led { background: var(--err); }

.status.busy .led { background: var(--warn); animation: pulse 1.2s infinite; }

@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .25 } }

/* ── 進度條 ─────────────────────────────────────────────── */

.bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 14px;
}

.bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 99px;
  transition: width .35s ease;
}

/* ── 導覽列（頁尾切換）──────────────────────────────────── */

.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
}

.nav a {
  font-size: .88rem;
  color: var(--text-dim);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-soft);
  transition: .15s;
}

.nav a:hover { color: var(--text); border-color: var(--line); background: var(--surface); }

/* ── 影片格狀清單 ───────────────────────────────────────── */

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

/* 手機上維持兩欄，不要縮成一欄 */
@media (max-width: 420px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .page { padding: 24px 14px 40px; }
  .card { padding: 18px 16px; }
  .head h1 { font-size: 1.5rem; }
}
