/* ScriptTime — original stylesheet. Mobile-first, no frameworks, no external assets. */

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1b1e2a;
  --muted: #68708a;
  --line: #e4e8f2;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --accent-ink: #3c36c4;
  --green: #15803d;
  --green-bg: #e7f6ec;
  --amber: #b45309;
  --amber-bg: #fdf2df;
  --red: #b91c1c;
  --red-bg: #fdecec;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(27, 30, 42, 0.07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 18px;
}

/* Header */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.2px;
}

.brand-mark { color: var(--accent); margin-right: 6px; }

.lang-toggle {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg);
}

.lang-btn {
  border: 0;
  background: transparent;
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.lang-btn.active {
  background: var(--accent);
  color: #fff;
}

/* Hero */
.hero { padding: 30px 0 18px; }

.hero h1 {
  font-size: 1.65rem;
  line-height: 1.35;
  margin: 0 0 10px;
  letter-spacing: -0.2px;
}

.lede { color: var(--muted); margin: 0; font-size: 1rem; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px;
  margin: 18px 0;
}

.field-label {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0 0 8px;
}

.hint { color: var(--muted); font-size: 0.85rem; margin: 8px 0 0; }

/* Tool */
textarea {
  width: 100%;
  min-height: 170px;
  resize: vertical;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--ink);
  background: #fbfcff;
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.toolbar { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

.btn {
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 16px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
}

.btn.ghost:hover { border-color: var(--accent); color: var(--accent-ink); }

/* Speed chips */
.speed-row { margin-top: 18px; }

.chips { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }

.chip {
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 18px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 6px;
  text-align: center;
}

.stat-num { display: block; font-size: 1.35rem; font-weight: 800; }

.stat-label { display: block; font-size: 0.75rem; color: var(--muted); margin-top: 2px; }

/* Result */
.result { margin-top: 20px; border-top: 1px dashed var(--line); padding-top: 18px; }

.result-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 6px 0 4px;
}

.result-time {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}

.badge {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge.ok { background: var(--green-bg); color: var(--green); }
.badge.warn { background: var(--amber-bg); color: var(--amber); }
.badge.over { background: var(--red-bg); color: var(--red); }

.speed-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.9rem;
}

.speed-table th,
.speed-table td {
  text-align: left;
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.speed-table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; }

.speed-table tr.current td { font-weight: 700; color: var(--accent-ink); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Paragraph breakdown */
.breakdown { margin-top: 20px; border-top: 1px dashed var(--line); padding-top: 16px; }

.para-list { list-style: none; margin: 10px 0 0; padding: 0; }

.para-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.para-list li:last-child { border-bottom: 0; }

.para-name { color: var(--muted); min-width: 3.2em; }

.para-bar {
  flex: 1;
  height: 8px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}

.para-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.para-time { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 3.4em; text-align: right; }

/* FAQ */
.faq h2 { margin: 0 0 6px; font-size: 1.2rem; }

.faq details {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.faq details:first-of-type { border-top: 0; }

.faq summary {
  font-weight: 700;
  cursor: pointer;
  font-size: 0.95rem;
}

.faq summary::marker { color: var(--accent); }

.faq p { color: var(--muted); font-size: 0.92rem; margin: 8px 0 2px; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 26px;
  padding: 18px 0 34px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

/* Larger screens */
@media (min-width: 640px) {
  .hero h1 { font-size: 2rem; }
  .card { padding: 28px 30px; }
  .result-time { font-size: 3.2rem; }
}
