[hidden] { display: none !important; }

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

.tool {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(760px, 100% - 2.5rem);
  padding: 40px 0 72px;
}

.tool h1 {
  color: var(--text-primary);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  letter-spacing: -0.02em;
  text-align: center;
}

.lead { margin-top: 12px; text-align: center; }

/* Entry */
.entry { display: flex; gap: 10px; margin-top: 32px; }

.entry input {
  flex: 1;
  min-width: 0;
  padding: 13px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font: inherit;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.entry input::placeholder { color: var(--text-muted); }
.entry input:hover { border-color: var(--border-muted); }

.entry input:focus {
  outline: none;
  border-color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(95, 255, 191, 0.12);
}

.tries { margin-top: 14px; color: var(--text-muted); font-size: 0.78rem; text-align: center; }

.chip {
  margin: 4px 2px;
  padding: 3px 10px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-light);
  font-size: 0.76rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.chip:hover { border-color: var(--text-primary); color: var(--text-primary); }

.msg { min-height: 1.4em; margin-top: 10px; color: var(--error); font-size: 0.85rem; text-align: center; }

/* Result */
#result { margin-top: 18px; animation: rise 0.45s var(--ease) both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.banner {
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-left: 3px solid var(--success);
  border-radius: 6px;
  color: var(--text-light);
  font-size: 0.9rem;
  text-align: center;
}

.banner.alert { border-left-color: var(--error); }
.banner.notice { border-left-color: var(--warning); }
.banner strong { color: var(--text-primary); }

/* Where the link really goes */
.dest {
  margin-top: 16px;
  padding: 18px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  text-align: center;
}

.dest-label { display: block; color: var(--text-muted); font-size: 0.75rem; }

.dest-host {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: clamp(1.05rem, 3.4vw, 1.45rem);
  overflow-wrap: anywhere;
}

.h-reg {
  padding: 1px 6px;
  background: rgba(95, 255, 191, 0.12);
  border-radius: 4px;
  color: var(--text-primary);
  font-weight: 700;
}

.h-user { color: var(--error); text-decoration: line-through; }
.h-user-note { color: var(--error); }

.dest-url { display: block; margin-top: 8px; color: var(--text-muted); font-size: 0.78rem; overflow-wrap: anywhere; }

/* Findings */
.finds { display: grid; gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; }

.find {
  padding: 11px 14px;
  background: var(--bg-secondary);
  border-left: 3px solid var(--border-muted);
  border-radius: 6px;
}

.find.danger { border-left-color: var(--error); }
.find.warn { border-left-color: var(--warning); }
.find.ok { border-left-color: var(--success); }

.find h3 { color: var(--text-primary); font-size: 0.88rem; font-weight: 700; }
.find p { margin-top: 3px; color: var(--text-light); font-size: 0.8rem; line-height: 1.55; }
.find .btn { margin-top: 10px; padding: 6px 12px; font-size: 0.78rem; }

/* Breakdown */
.cards { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 16px; }

@media (min-width: 720px) {
  .cards.two { grid-template-columns: 1fr 1fr; }
}

.mcard {
  padding: 16px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.mcard h3 { margin-bottom: 8px; color: var(--text-light); font-size: 0.85rem; font-weight: 400; }
.mcard dl { margin: 0; }

.mrow {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  padding: 7px 0;
  border-top: 1px solid var(--bg-secondary);
  font-size: 0.82rem;
}

.mrow dt { color: var(--text-muted); }
.mrow dd { color: var(--text-primary); overflow-wrap: anywhere; }
.mrow dd .tag { margin-left: 8px; padding: 1px 7px; border: 1px solid var(--border-color); border-radius: 999px; color: var(--text-muted); font-size: 0.68rem; }
.mrow dd .tag.hot { border-color: var(--warning); color: var(--warning); }

.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 24px; }
.btn-solid:hover { transform: translateY(-2px); }

.fine { margin-top: 20px; color: var(--text-muted); font-size: 0.74rem; text-align: center; }

/* Copy feedback: color and text only */
.copied { border-color: var(--success) !important; color: var(--success) !important; transform: none !important; }

@media (max-width: 480px) {
  .entry { flex-direction: column; }
  .mrow { grid-template-columns: 1fr; gap: 0; }
  .actions .btn { flex: 1 1 100%; }
}

/* Letter-by-letter check */
.letters-card { margin-top: 16px; --k-foreign: var(--error); --k-hidden: var(--error); --k-leet: var(--warning); --k-ambig: #A9A5FF; }

.letters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(1.1rem, 4.5vw, 1.5rem);
}

.ch {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 1ch;
  padding: 2px 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-muted);
  line-height: 1.3;
}

.ch.k-dot { padding-inline: 1px; }
.ch .cp { font-size: 0.55rem; letter-spacing: 0; }
.ch.k-foreign, .ch.k-hidden, .ch.k-leet { background: color-mix(in srgb, currentColor 14%, transparent); border: 1px solid currentColor; font-weight: 700; }
.ch.k-foreign { color: var(--k-foreign); }
.ch.k-hidden { color: var(--k-hidden); border-style: dashed; }
.ch.k-leet { color: var(--k-leet); }
.ch.k-ambig { color: var(--k-ambig); font-weight: 700; text-decoration: underline wavy; text-underline-offset: 4px; }

.letters-note { margin-top: 12px; color: var(--text-light); font-size: 0.8rem; line-height: 1.55; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid var(--bg-secondary); list-style: none; color: var(--text-muted); font-size: 0.74rem; }
.legend li { display: flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border: 1px solid currentColor; border-radius: 3px; }
.sw.k-foreign { color: var(--error); }
.sw.k-hidden { color: var(--error); border-style: dashed; }
.sw.k-leet { color: var(--warning); }
.sw.k-ambig { color: #A9A5FF; border-style: dotted; }

/* Verdict colour */
.banner.alert strong { color: var(--error); }
.banner.notice strong { color: var(--warning); }

/* Explainer */
.learn { margin-top: 32px; --k-foreign: var(--error); --k-leet: var(--warning); --k-ambig: #A9A5FF; }

.learn summary { color: var(--text-light); font-size: 0.9rem; text-align: center; cursor: pointer; }
.learn summary:hover { color: var(--text-primary); }

.learn-list { margin: 18px 0 0; padding: 0; list-style: none; }

.learn-list li {
  position: relative;
  padding: 10px 0 10px 18px;
  border-top: 1px solid var(--bg-secondary);
  color: var(--text-light);
  font-size: 0.88rem;
  line-height: 1.65;
}

.learn-list li::before {
  content: "";
  position: absolute;
  top: 1.1em;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-muted);
}

.learn-list li.d-foreign::before { background: var(--k-foreign); }
.learn-list li.d-leet::before { background: var(--k-leet); }
.learn-list li.d-ambig::before { background: var(--k-ambig); }

.learn-list b { color: var(--text-primary); font-weight: 700; }
.learn-list code { color: var(--text-primary); font-size: 0.85rem; overflow-wrap: anywhere; }

.learn-rule { margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--bg-secondary); color: var(--text-primary); font-size: 0.88rem; text-align: center; }

/* Optional online check */
.online { margin-top: 28px; padding: 16px 18px; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 12px; text-align: center; }
.online h3 { color: var(--text-light); font-size: 0.85rem; font-weight: 400; }
.online-lead { margin-top: 6px; color: var(--text-muted); font-size: 0.8rem; line-height: 1.55; }
.online-btn { margin-top: 12px; }
.online-btn:disabled { opacity: 0.6; cursor: progress; }

/* Warning panel: smooth open and close */
.online-warn {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.5s var(--ease), opacity 0.35s ease;
}

.online-warn.open { grid-template-rows: 1fr; opacity: 1; }
.warn-in { min-height: 0; overflow: hidden; }
.warn-box { margin-top: 14px; padding: 14px 16px; background: var(--bg-secondary); border-left: 3px solid var(--warning); border-radius: 6px; text-align: left; }
.warn-box strong { color: var(--text-primary); font-size: 0.88rem; }
.warn-box ul { margin: 8px 0 0; padding-left: 18px; color: var(--text-light); font-size: 0.82rem; line-height: 1.6; }
.warn-box li + li { margin-top: 4px; }
.warn-box .actions { justify-content: flex-start; margin-top: 16px; }

/* Checkbox */
.check { position: relative; display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; color: var(--text-light); font-size: 0.8rem; line-height: 1.5; cursor: pointer; }
.check input { position: absolute; width: 18px; height: 18px; margin: 0; opacity: 0; cursor: pointer; }
.check .box { display: grid; flex: none; place-items: center; width: 18px; height: 18px; margin-top: 1px; background: var(--bg-surface); border: 1.5px solid var(--border-muted); border-radius: 5px; transition: background 0.2s ease, border-color 0.2s ease; }
.check .box svg { width: 12px; height: 12px; fill: none; stroke: var(--bg-primary, #002B36); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.check .box path { stroke-dasharray: 16; stroke-dashoffset: 16; transition: stroke-dashoffset 0.3s var(--ease); }
.check:hover .box { border-color: var(--text-primary); }
.check input:checked + .box { background: var(--success); border-color: var(--success); }
.check input:checked + .box path { stroke-dashoffset: 0; }
.check input:checked ~ span:last-child { color: var(--text-primary); }
.check input:focus-visible + .box { outline: 2px solid var(--text-primary); outline-offset: 2px; }

/* Results */
#onlineOut { margin-top: 14px; text-align: left; }
#onlineOut:empty { display: none; }
#onlineOut .find { animation: rise 0.4s var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  #onlineOut .find { animation: none; }
  .online-warn, .check .box, .check .box path { transition: none; }
}

.check small { display: block; margin-top: 3px; color: var(--text-muted); font-size: 0.74rem; line-height: 1.5; }

/* Very light "checking" animation: soft pulse and trailing dots */
.online.busy .online-btn { animation: soft-pulse 1.6s ease-in-out infinite; }
.online.busy .online-btn .lbl::after { content: "..."; display: inline-block; width: 0; overflow: hidden; vertical-align: bottom; animation: dots 1.4s steps(4, end) infinite; }
@keyframes soft-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 0.95; } }
@keyframes dots { to { width: 3ch; } }

@media (prefers-reduced-motion: reduce) {
  .online.busy .online-btn, .online.busy .online-btn .lbl::after { animation: none; }
  .online.busy .online-btn .lbl::after { width: 3ch; }
}