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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #0f1117;
  color: #e2e8f0;
  min-height: 100vh;
  padding: 32px 16px 64px;
  transition: background 0.2s, color 0.2s;
}

body.light {
  background: #f1f5f9;
  color: #1e293b;
}

/* ── 固定右上角工具列 ── */
#topbar {
  position: fixed;
  top: 12px; right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 999;
}

.container {
  max-width: 960px;
  margin: 0 auto;
}

h1 {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}
body.light h1 { color: #1e293b; }

.subtitle {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 32px;
}

/* ── Steps ── */
.step {
  background: #1e2130;
  border: 1px solid #2d3348;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
  transition: background 0.2s, border-color 0.2s;
}
body.light .step { background: #fff; border-color: #cbd5e1; }

.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #3b82f6;
  color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.step-title {
  font-size: 15px; font-weight: 600;
  color: #f1f5f9;
}
body.light .step-title { color: #1e293b; }

.step p {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.6;
  margin-bottom: 10px;
}
body.light .step p { color: #64748b; }

/* ── Code block ── */
.code-block {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 12px 16px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
  color: #79c0ff;
  word-break: break-all;
  margin-bottom: 10px;
}
body.light .code-block { background: #f8fafc; border-color: #cbd5e1; color: #2563eb; }

/* ── Input ── */
.input-row { display: flex; gap: 8px; }

input[type="text"] {
  flex: 1;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 10px 14px;
  color: #e2e8f0;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
input[type="text"]:focus { border-color: #3b82f6; }
input[type="text"]::placeholder { color: #4b5563; }
body.light input[type="text"] { background: #fff; border-color: #cbd5e1; color: #1e293b; }
body.light input[type="text"]::placeholder { color: #94a3b8; }

/* ── Buttons ── */
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  white-space: nowrap;
}
.btn:hover { opacity: 0.85; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary { background: #3b82f6; color: #fff; }
.btn-success { background: #22c55e; color: #fff; }
.btn-ghost {
  background: transparent;
  border: 1px solid #30363d;
  color: #94a3b8;
  padding: 6px 12px;
  font-size: 12px;
}
body.light .btn-ghost { border-color: #cbd5e1; color: #64748b; }

.btn-icon {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #30363d;
  background: #1e2130;
  color: #94a3b8;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.btn-icon:hover { background: #2d3348; border-color: #475569; }
body.light .btn-icon { background: #fff; border-color: #cbd5e1; color: #64748b; }
body.light .btn-icon:hover { background: #f1f5f9; }

/* ── Account list ── */
.account-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

.account-item {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.account-item:hover { border-color: #3b82f6; background: #161b27; }
.account-item.selected { border-color: #22c55e; background: #0d1f14; }
body.light .account-item { background: #f8fafc; border-color: #cbd5e1; }
body.light .account-item:hover { background: #eff6ff; border-color: #3b82f6; }
body.light .account-item.selected { background: #f0fdf4; border-color: #22c55e; }

.account-name { font-size: 14px; font-weight: 600; color: #f1f5f9; }
body.light .account-name { color: #1e293b; }
.account-meta { font-size: 11px; color: #64748b; margin-top: 2px; }

.badge { font-size: 11px; padding: 2px 8px; border-radius: 4px; background: #1e3a5f; color: #60a5fa; }
body.light .badge { background: #dbeafe; color: #1d4ed8; }

/* ── Log ── */
.log-box {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 12px 16px;
  font-family: 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.8;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 12px;
}
body.light .log-box { background: #f8fafc; border-color: #cbd5e1; }

.log-info  { color: #60a5fa; }
.log-ok    { color: #4ade80; }
.log-warn  { color: #fbbf24; }
.log-error { color: #f87171; }

/* ── Player card ── */
.player-card {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
body.light .player-card { background: #f8fafc; border-color: #cbd5e1; }

.player-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #3b82f6;
  flex-shrink: 0;
  background: #1e2130;
}

.player-info { flex: 1; }

.player-name { font-size: 16px; font-weight: 700; color: #f1f5f9; margin-bottom: 4px; }
body.light .player-name { color: #1e293b; }

.player-meta { font-size: 12px; color: #64748b; display: flex; flex-wrap: wrap; gap: 10px; }
.player-meta span { display: flex; align-items: center; gap: 4px; }

/* ── Summary grid ── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.summary-card {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}
body.light .summary-card { background: #f8fafc; border-color: #cbd5e1; }

.summary-value { font-size: 24px; font-weight: 700; color: #f1f5f9; }
body.light .summary-value { color: #1e293b; }

.summary-label { font-size: 11px; color: #64748b; margin-top: 4px; }

/* ── Download area ── */
.download-area { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

#setup-section.collapsed { display: none; }



.hidden { display: none !important; }

footer {
  margin-top: 32px;
  padding: 10px 16px;
  border-top: 1px solid #2d3348;
  text-align: center;
  font-size: 11px;
  color: #475569;
  transition: border-color 0.2s;
}
footer a { color: #60a5fa; text-decoration: none; }
footer a:hover { text-decoration: underline; }
body.light footer { border-color: #cbd5e1; color: #94a3b8; }
body.light footer a { color: #2563eb; }

#modal-box, #modal-export-box {
  background: #1e2130;
  border: 1px solid #2d3348;
  color: #94a3b8;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
#modal-box > div:first-child, #modal-export-box > div:first-child { color: #f1f5f9; }
body.light #modal-box, body.light #modal-export-box { background: #fff; border-color: #cbd5e1; color: #64748b; }
body.light #modal-box > div:first-child, body.light #modal-export-box > div:first-child { color: #1e293b; }

#modal-export-summary { color: inherit; }

/* ── JSON 上傳錯誤提示 ── */
#upload-error {
  display: none;
  position: fixed;
  top: 52px;
  right: 16px;
  z-index: 998;
  max-width: 320px;
  padding: 8px 12px;
  background: #2d1515;
  border: 1px solid #f87171;
  border-radius: 8px;
  color: #f87171;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
body.light #upload-error {
  background: #fff5f5;
  border-color: #f87171;
  color: #dc2626;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

kbd {
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 11px;
  color: #e2e8f0;
}
body.light kbd {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #1e293b;
}
