:root {
  --accent:#E8611C;
  --accent-dk:#C94F13;
  --accent-lt:#FDECE3;
  --bg: #F4F4F5;
  --card: #FFFFFF;
  --ink: #1A1A1A;
  --ink-soft: #8A8F98;
  --line: #ECECEE;
  --nav:#6741D9;
  --green: #2F9E58;
  --green-track: #ECECEE;
  --red: #D64545;
  --red-bg: #FBEAEA;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  font-family: var(--sans);
  color: var(--ink);
  padding: 60px 20px;
}

.card {
  max-width: 720px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 10px 30px rgba(20,20,30,.06);
  padding: 40px 44px 34px;
}

/* ---------- Back link ---------- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--nav);
  text-decoration: none;
  margin-bottom: 22px;
}
.back-link:hover { text-decoration: underline; }

/* ---------- Header ---------- */

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

.tool-logo {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--accent-lt);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-logo svg {
  width: 22px;
  height: 22px;
}

.header h1 {
  font-size: 26px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.01em;
}

/* ---------- Form ---------- */

#check-form {
  display: flex;
  gap: 10px;
}

#url {
  flex: 1;
  min-width: 0;
  height: 52px;
  font-size: 14.5px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #FAFAFA;
  color: var(--ink);
  font-family: var(--sans);
  transition: border-color .15s;
}

#url:focus {
  outline: none;
  border-color: var(--accent);
}

#submit-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 52px;
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 12px;
  padding: 0 26px;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--sans);
  transition: background 0.15s ease;
}

#submit-btn:hover { background: var(--accent-dk); }
#submit-btn:disabled { cursor: not-allowed; opacity: 0.9; }

#submit-btn.scanning {
  background: var(--ink);
}

#submit-btn.cancel{
  background:#1B1F27; border:1.5px solid #E8952C; color:#E8952C;
  text-transform:uppercase; letter-spacing:.04em; font-weight:800;
}
#submit-btn.cancel:hover{background:#252A35;}
#submit-btn.cancel:disabled{background:#1B1F27; color:#a9793a; border-color:#a9793a; opacity:.7;}

.spinner {
  width: 15px;
  height: 15px;
  animation: spin 0.8s linear infinite;
}
#submit-btn.cancel .spinner{
  color:#E8952C;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Progress ---------- */

.progress-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
}
.progress-row[hidden],
.error-box[hidden],
.results[hidden] {
  display: none;
}

.progress-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.progress-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--green-track);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.progress-label {
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ---------- Error ---------- */

.error-box {
  margin-top: 22px;
  padding: 14px 16px;
  background: var(--red-bg);
  border-radius: 10px;
  color: var(--red);
  font-size: 13.5px;
}

/* ---------- Results ---------- */

.results {
  margin-top: 26px;
}

.results-summary {
  font-weight: 700;
  font-size: 14.5px;
  margin: 0 0 14px;
}

.results-summary .count { color: var(--red); }

.clean-summary {
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--green-track);
  background: #E7F6EC;
  color: var(--green);
  font-weight: 700;
  font-size: 15px;
}

.error-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.error-item {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.error-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.error-word-group {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
  min-width: 0;
}

.error-word {
  font-weight: 700;
  color: var(--red);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
}

.error-arrow {
  color: var(--ink-soft);
  font-size: 13px;
}

.error-suggestion {
  font-weight: 600;
  color: var(--green);
}

.no-suggestion {
  font-size: 13px;
  color: var(--ink-soft);
  font-style: italic;
}

.error-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tag-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-dk);
  background: var(--accent-lt);
  border-radius: 20px;
  padding: 3px 9px;
}

.count-badge {
  font-size: 11.5px;
  color: var(--ink-soft);
}

.error-context {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.context-mistake {
  color: var(--red);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-decoration-color: var(--red);
}

.error-page {
  display: inline-block;
  font-size: 12px;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px dotted var(--ink-soft);
}

.error-page:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

@media (max-width: 600px) {
  body{ padding: 28px 14px; }
  .card { padding: 26px 20px 22px; border-radius:16px; }
  .header{ gap:12px; }
  .header h1{ font-size:20px; }
  .tool-logo{ width:36px; height:36px; }
  .tool-logo svg{ width:19px; height:19px; }
  #check-form { flex-direction: column; }
  #submit-btn { padding: 12px; justify-content: center; height:auto; width:100%; }
}
