:root {
  --bg-1: #eef4ff;
  --bg-2: #f7f9fc;
  --card: rgba(255, 255, 255, 0.94);
  --text: #172033;
  --muted: #6b7280;
  --line: #dbe2ea;
  --line-strong: #bfd0ff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #059669;
  --warn: #d97706;
  --error-bg: #fef2f2;
  --error-text: #b91c1c;
  --shadow: 0 18px 50px rgba(37, 99, 235, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top left, #dbeafe 0%, transparent 34%),
    radial-gradient(circle at top right, #e9d5ff 0%, transparent 26%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  min-height: 100vh;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 20px 56px;
}

.hero-card,
.result-card {
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 32px;
  margin-bottom: 22px;
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}

h1 {
  margin: 0 0 10px;
  font-size: 52px;
  line-height: 1.08;
  letter-spacing: -1px;
}

h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

.desc {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.form-block {
  display: grid;
  gap: 22px;
}

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

.upload-card,
.threshold-card {
  background: #fff;
  border: 1px solid #edf2f7;
  border-radius: 22px;
  padding: 22px;
}

.upload-title,
.threshold-card label {
  display: block;
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 16px;
}

.dropzone {
  position: relative;
  display: flex;
  min-height: 250px;
  border: 2px dashed var(--line-strong);
  border-radius: 22px;
  background: linear-gradient(180deg, #fbfdff 0%, #f5f9ff 100%);
  padding: 24px;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.dropzone:hover {
  border-color: var(--primary);
  background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
  transform: translateY(-1px);
}

.dropzone.dragover {
  border-color: var(--primary);
  background: #eaf2ff;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.10);
}

.dropzone.has-file {
  border-color: #93c5fd;
  background: #eff6ff;
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone-icon {
  font-size: 42px;
  line-height: 1;
}

.dropzone-main {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.5;
  color: #111827;
}

.dropzone-sub {
  color: var(--muted);
  font-size: 15px;
}

.picked-file {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #dbeafe;
  border-radius: 12px;
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 700;
  max-width: 100%;
  word-break: break-all;
}

input[type="number"] {
  width: 100%;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 18px;
  background: #fff;
  font-size: 28px;
  font-weight: 700;
  color: #111827;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input[type="number"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

.hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s ease;
  font-weight: 800;
}

.primary-btn {
  width: 100%;
  height: 68px;
  border-radius: 18px;
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: #fff;
  font-size: 24px;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.22);
}

.primary-btn:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
}

.alert {
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 18px;
  font-size: 15px;
}

.alert.error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid #fecaca;
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: #3730a3;
  font-size: 14px;
  font-weight: 700;
}

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

.stat-item {
  background: #fff;
  border: 1px solid #edf2f7;
  border-radius: 18px;
  padding: 18px;
}

.stat-label {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 10px;
  line-height: 1.5;
}

.stat-value {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.1;
}

.stat-value.success { color: var(--success); }
.stat-value.warn { color: var(--warn); }

.file-info {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
  display: grid;
  gap: 8px;
  font-size: 15px;
  line-height: 1.7;
}

.download-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.secondary-btn {
  min-width: 210px;
  height: 52px;
  padding: 0 22px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: #fff;
  font-size: 16px;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.16);
}

.secondary-btn.ghost {
  background: #eef2ff;
  color: #3730a3;
  box-shadow: none;
}

.secondary-btn:hover {
  transform: translateY(-1px);
}

@media (max-width: 980px) {
  .upload-grid,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  h1 {
    font-size: 40px;
  }

  .dropzone {
    min-height: 210px;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 16px 12px 28px;
  }

  .hero-card,
  .result-card {
    padding: 18px;
    border-radius: 20px;
  }

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

  h1 {
    font-size: 32px;
  }

  h2 {
    font-size: 24px;
  }

  .upload-title,
  .threshold-card label {
    font-size: 20px;
  }

  .dropzone-main {
    font-size: 18px;
  }

  .primary-btn {
    height: 58px;
    font-size: 20px;
  }

  .secondary-btn {
    width: 100%;
  }
}

.threshold-pair-card {
  background: #fff;
  border: 1px solid #edf2f7;
  border-radius: 22px;
  padding: 22px;
}

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

.threshold-pair-card label {
  display: block;
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 16px;
}

input[type="text"] {
  width: 100%;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 18px;
  background: #fff;
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

@media (max-width: 640px) {
  .pair-grid {
    grid-template-columns: 1fr;
  }

  .threshold-pair-card label {
    font-size: 20px;
  }

  input[type="text"] {
    font-size: 20px;
    height: 58px;
  }
}

.nav-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.nav-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 800;
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #dbeafe;
}

.nav-link-btn.active {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: #fff;
  border: 0;
}


.stat-help {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  min-height: 42px;
}

.nav-row-split {
  align-items: center;
  justify-content: space-between;
}

.nav-main,
.nav-account {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-logout-form {
  margin: 0;
}

.nav-quiet-btn {
  min-width: auto;
  height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  color: #475569;
  cursor: pointer;
  font: inherit;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: 100%;
  max-width: 460px;
}

.auth-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(37, 99, 235, 0.16);
  padding: 38px;
}

.auth-brand {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 22px;
  border-radius: 18px;
  background: linear-gradient(135deg, #1d4ed8 0%, #60a5fa 100%);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.24);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1px;
}

.auth-title,
.account-title {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.auth-desc {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.auth-form {
  display: grid;
  gap: 18px;
}

.field-group {
  display: grid;
  gap: 8px;
}

.field-group label {
  font-size: 15px;
  font-weight: 800;
  color: #334155;
}

.field-group input[type="text"],
.field-group input[type="password"] {
  width: 100%;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 16px;
  background: #fff;
  color: #111827;
  font-size: 17px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
}

.auth-footnote {
  margin: 20px 0 0;
  color: #94a3b8;
  font-size: 13px;
  text-align: center;
}

.account-page {
  max-width: 760px;
}

.account-card {
  padding: 32px;
}

.account-desc {
  margin-bottom: 24px;
  font-size: 16px;
}

.account-form {
  max-width: 520px;
}

.field-help {
  color: var(--muted);
  font-size: 13px;
}

.success-alert {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #ecfdf5;
  color: #047857;
  font-weight: 700;
}

@media (max-width: 640px) {
  .auth-card,
  .account-card {
    padding: 24px;
  }

  .auth-title,
  .account-title {
    font-size: 28px;
  }

  .nav-row-split,
  .nav-main,
  .nav-account {
    align-items: stretch;
  }

  .nav-row-split,
  .nav-account {
    flex-direction: column;
  }
}
