:root {
  --ink: #1b1f24;
  --ink-soft: #5b6472;
  --line: #e3e7ec;
  --surface: #ffffff;
  --bg: #f5f6f8;
  --accent: #0f766e;
  --accent-soft: #e6f5f2;
  --warn: #b45309;
  --warn-soft: #fff5e6;
  --danger: #b42318;
  --radius: 8px;
}

* { box-sizing: border-box; }

/* hidden 属性必须压过下面的 display 规则，否则登录框会和主界面同时显示 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

body { padding-bottom: 88px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 16px;
}

.brand svg, .tab svg, .btn svg, .icon-btn svg, .result-head svg, .suggest h3 svg, .drop svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 16px 14px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  background: #eef1f4;
  border-radius: var(--radius);
}

.seg-item {
  border: 0;
  border-radius: 6px;
  padding: 9px 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.35;
}

.seg-item.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
}

.mode-desc {
  margin: 10px 2px 16px;
  color: var(--ink-soft);
  font-size: 13px;
}

.tabs {
  display: flex;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 8px 2px 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 30px 16px;
  border: 1.5px dashed #c7cfd8;
  border-radius: var(--radius);
  background: #fbfcfd;
  cursor: pointer;
  text-align: center;
}

.drop.filled {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop-main { font-size: 15px; font-weight: 600; }
.drop-sub { font-size: 12.5px; color: var(--ink-soft); word-break: break-all; }

textarea {
  width: 100%;
  min-height: 190px;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  background: #fbfcfd;
}

textarea:focus, input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.counter, .hint, .note { color: var(--ink-soft); font-size: 12.5px; }
.counter { text-align: right; margin: 6px 0 0; }
.hint { margin: 12px 0 0; }
.note {
  margin: 12px 0 0;
  background: var(--warn-soft);
  color: var(--warn);
  border-radius: var(--radius);
  padding: 9px 12px;
}
.error {
  margin: 12px 0 0;
  background: #fef3f2;
  color: var(--danger);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 13px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 11px 16px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: #0c5f59; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: #f2f4f6; }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.btn.wide { width: 100%; margin-top: 16px; }

.icon-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 7px;
  color: var(--ink-soft);
  cursor: pointer;
  display: inline-flex;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}

.bar {
  height: 8px;
  border-radius: 99px;
  background: #e9edf1;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.4s ease;
}

.result-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--accent);
}

.result-head h2 { margin: 0; font-size: 17px; color: var(--ink); }
.result-head .hint { margin: 4px 0 0; }

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.suggest {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #fbfcfd;
}

.suggest h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 8px;
  font-size: 14px;
}

.suggest ul { margin: 0; padding-left: 20px; font-size: 13.5px; color: var(--ink); }
.suggest li { margin-bottom: 6px; }

.diffs-title {
  font-size: 15px;
  margin: 6px 2px 12px;
  display: flex;
  justify-content: space-between;
}

.diffs-title span { color: var(--ink-soft); font-weight: 400; font-size: 13px; }

.diff-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.diff-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.tag {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 12px;
}

.diff-block { margin: 0 0 8px; font-size: 14px; }
.diff-block:last-child { margin-bottom: 0; }
.diff-label { font-size: 12px; color: var(--ink-soft); display: block; margin-bottom: 2px; }
.before { color: #6b7280; }
.after { color: var(--ink); }
.diff-warn { color: var(--warn); font-size: 12.5px; margin: 6px 0 0; }

.usage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.usage-head h3 { margin: 0; font-size: 15px; }
.usage-list { margin-top: 10px; font-size: 13px; }
.usage-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
}

.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
}

.gate-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gate-card h1 { margin: 0; font-size: 20px; }
.gate-tip { margin: 0; color: var(--ink-soft); font-size: 13.5px; }

.gate-card input {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
}

.gate-error {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

@media (max-width: 420px) {
  .actions { grid-template-columns: 1fr; }
  .wrap { padding: 14px 12px 40px; }
  .btn.wide { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  .bar-fill { transition: none; }
}
