:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #eef4ef;
  --text: #1d2520;
  --muted: #69736d;
  --line: #dbe2dc;
  --brand: #136f63;
  --brand-dark: #0d4f48;
  --accent: #d95f43;
  --shadow: 0 18px 48px rgba(27, 39, 33, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 26px 0 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 900;
}

h2 {
  font-size: 1.2rem;
}

.hero-copy {
  max-width: 680px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid #cfe0d4;
  border-radius: 8px;
  color: var(--brand-dark);
  font-weight: 800;
}

.badge-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  background: var(--brand);
  border-radius: 50%;
  color: #fff;
}

.notice,
.panel,
.toolbar,
.result-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.notice {
  padding: 16px 18px;
  border-left: 5px solid var(--accent);
}

.panel {
  margin-top: 18px;
  padding: 20px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.steps {
  margin: 0;
  padding-left: 1.35rem;
  color: var(--muted);
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.upload-modes {
  display: grid;
  gap: 18px;
}

.mode-block {
  display: grid;
  gap: 10px;
}

.mode-block h3 {
  margin: 0;
  font-size: 1rem;
}

.mode-block p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.file-card {
  display: grid;
  gap: 8px;
  min-height: 168px;
  padding: 18px;
  border: 1.5px dashed #a9b8ad;
  border-radius: 8px;
  background: #fbfcfb;
  cursor: pointer;
}

.file-card.compact {
  min-height: 116px;
}

.file-card:hover {
  border-color: var(--brand);
  background: #f4faf6;
}

.file-card input {
  width: 100%;
}

.file-title {
  font-weight: 900;
}

.file-help,
.file-name,
.status-text {
  color: var(--muted);
  font-size: 0.92rem;
}

.status-text.error {
  color: #b43d25;
  font-weight: 800;
}

.warning-box {
  margin-top: 14px;
  padding: 12px 14px;
  background: #fff5e8;
  border: 1px solid #e6b980;
  border-left: 5px solid #c96f1d;
  border-radius: 8px;
  color: #79410f;
  font-weight: 800;
}

.file-name {
  display: block;
  align-self: end;
  overflow-wrap: anywhere;
}

.file-name span {
  display: block;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.primary-btn,
.ghost-btn,
.text-btn {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.primary-btn {
  padding: 0 24px;
  background: var(--brand);
  color: #fff;
}

.primary-btn:hover {
  background: var(--brand-dark);
}

.ghost-btn,
.text-btn {
  padding: 0 16px;
  background: #edf3ee;
  color: var(--brand-dark);
}

.download-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.download-link.disabled {
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.45;
}

.ghost-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.debug-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.debug-files {
  margin-top: 16px;
}

.debug-files h3,
.account-checker h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.debug-file-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.debug-file-row {
  padding: 10px 12px;
  background: #f8faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-wrap: anywhere;
}

.debug-file-warning {
  margin-top: 6px;
  color: #b43d25;
  font-weight: 800;
}

.account-checker {
  margin-top: 18px;
}

.account-check-row {
  display: flex;
  gap: 10px;
}

.account-check-row input {
  flex: 1 1 auto;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #b9c5bd;
  border-radius: 8px;
}

.account-check-result {
  margin-top: 10px;
  padding: 12px;
  background: #f8faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.similar-note {
  grid-column: 1 / -1;
  margin-top: 6px;
  color: #9a4a19;
  font-size: 0.88rem;
}

.stat-item,
.debug-item {
  padding: 14px;
  background: #f7f9f7;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.clickable-stat {
  cursor: pointer;
}

.clickable-stat:hover,
.clickable-stat:focus-visible {
  border-color: var(--brand);
  outline: none;
  background: #eef7f0;
}

.priority-stat {
  border-color: #b9d9c3;
}

.stat-value,
.debug-value {
  display: block;
  color: var(--brand-dark);
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
}

.stat-label,
.debug-label {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-top: 18px;
  padding: 16px;
}

.search-box {
  display: grid;
  flex: 1 1 260px;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.search-box input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #b9c5bd;
  border-radius: 8px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.result-section {
  overflow: hidden;
}

.result-section-highlight {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(19, 111, 99, 0.16), var(--shadow);
}

.section-toggle {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 0 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  text-align: left;
}

.section-count {
  min-width: 42px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #edf3ee;
  color: var(--brand-dark);
  text-align: center;
}

.result-body {
  padding: 10px;
}

.result-body.collapsed {
  display: none;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.account-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.account-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 10px 12px;
  background: #f8faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.username {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-weight: 800;
}

.profile-link {
  flex: 0 0 auto;
  color: var(--brand);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.profile-link:hover {
  text-decoration: underline;
}

.list-footer {
  display: flex;
  justify-content: center;
  padding: 12px 0 4px;
}

.show-more-btn {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #b9c5bd;
  border-radius: 8px;
  background: #fff;
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 800;
}

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid #b9c5bd;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-weight: 900;
}

.back-to-top:hover,
.back-to-top:focus-visible {
  background: var(--brand-dark);
  outline: none;
}

@media (max-width: 880px) {
  .hero,
  .upload-grid,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .privacy-badge {
    width: 100%;
    min-width: 0;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .debug-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 16px;
  }

  .panel,
  .toolbar {
    padding: 14px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .action-row > button,
  .toolbar > button {
    width: 100%;
  }

  .account-item {
    grid-template-columns: 1fr;
  }

  .account-check-row {
    flex-direction: column;
  }

  .back-to-top {
    right: 12px;
    bottom: 12px;
  }
}
