:root {
  --bg: #0f1115;
  --panel: #171a21;
  --border: #272c38;
  --text: #e6e8ee;
  --muted: #98a0b3;
  --accent: #4c8dff;
  --ok: #3ecf8e;
  --err: #ff6b6b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 48px 20px 80px; }

h1 { margin: 0 0 4px; font-size: 28px; }
h2 { margin: 0; font-size: 18px; }
.sub { margin: 0 0 28px; color: var(--muted); }

form {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.field { margin-bottom: 16px; }
.row { display: flex; gap: 16px; }
.row .field { flex: 1; }

label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }

input, select {
  width: 100%;
  padding: 10px 12px;
  background: #0d1016;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
}

input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

button {
  padding: 10px 18px;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
button:hover { filter: brightness(1.1); }
button[disabled] { opacity: .6; cursor: not-allowed; }

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 500;
  padding: 6px 12px;
  font-size: 13px;
}

.result { display: block; margin-top: 20px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.card.error { border-color: var(--err); color: var(--err); }

.short {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.short a { color: var(--ok); font-size: 18px; font-weight: 600; text-decoration: none; word-break: break-all; }
.short a:hover { text-decoration: underline; }

.meta { margin-top: 6px; font-size: 13px; color: var(--muted); word-break: break-all; }

.listing { margin-top: 40px; }
.listing-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #23293a;
  color: var(--muted);
}

@media (max-width: 560px) {
  .row { flex-direction: column; gap: 0; }
}

/* Toggle switch. Cả hàng là <label> nên bấm đâu cũng đổi trạng thái. */
.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 20px;
  padding: 14px 16px;
  background: #0d1016;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.switch:hover { border-color: #333a4a; }

.switch-text { display: flex; flex-direction: column; gap: 3px; }
.switch-title { font-size: 15px; color: var(--text); }
.switch-desc { font-size: 12px; line-height: 1.45; color: var(--muted); }

/* Input thật vẫn nằm trong DOM và focus được, chỉ ẩn về mặt hình ảnh, nên
   keyboard và screen reader vẫn hoạt động bình thường. */
.switch-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  clip-path: inset(50%);
}

.switch-track {
  position: relative;
  flex: none;
  width: 44px;
  height: 24px;
  background: #2b3242;
  border-radius: 999px;
  transition: background .15s ease;
}

.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #8b93a7;
  border-radius: 50%;
  transition: transform .15s ease, background .15s ease;
}

.switch-input:checked + .switch-track { background: var(--accent); }
.switch-input:checked + .switch-track .switch-knob {
  transform: translateX(20px);
  background: #fff;
}

.switch-input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .switch-track, .switch-knob { transition: none; }
}

/* Trang trung gian "bấm để tiếp tục". */
.wrap-narrow { max-width: 520px; padding-top: 96px; }

.interstitial { padding: 28px 24px; text-align: center; }

.interstitial .eyebrow {
  margin: 0 0 14px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.dest-host {
  margin: 0 0 8px;
  font-size: 24px;
  word-break: break-all;
}

.dest-url {
  margin: 0 0 24px;
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
}

.btn-go {
  display: inline-block;
  padding: 12px 28px;
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}
.btn-go:hover { filter: brightness(1.1); }
.btn-go:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

.interstitial .hint { margin-top: 18px; }
