/* Theme: xanh đậm, responsive */
:root {
  --bg-deep: #0a1628;
  --bg-mid: #0f2840;
  --accent: #0d7a6a;
  --accent-light: #12a090;
  --text: #e8f1f0;
  --text-muted: #8fb3ad;
  --card: rgba(18, 45, 58, 0.72);
  --card-border: rgba(18, 168, 144, 0.22);
  --danger: #e85d5d;
  --ring-track: rgba(255, 255, 255, 0.12);
  --ring-fill: var(--accent-light);
  --radius: 16px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: linear-gradient(160deg, var(--bg-deep) 0%, var(--bg-mid) 45%, #0a2030 100%);
  line-height: 1.5;
}

.bg-pattern {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image: radial-gradient(circle at 20% 30%, var(--accent-light) 0, transparent 45%),
    radial-gradient(circle at 80% 70%, #0a5c7a 0, transparent 40%);
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2.5rem) clamp(1rem, 4vw, 1.5rem) 1.25rem;
}

.brand {
  margin: 0 0 1.25rem;
  text-align: center;
  font-size: clamp(1.2rem, 4.5vw, 1.55rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.toast {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  z-index: 200;
  transform: translate3d(-50%, 6px, 0);
  padding: 0.5rem 1.1rem;
  max-width: 90vw;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(12, 48, 52, 0.94);
  border: 1px solid rgba(18, 160, 144, 0.45);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.toast--visible {
  opacity: 1;
  transform: translate3d(-50%, 0, 0);
}

.foot {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0.75rem 1rem 1.5rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.9;
}

.card {
  margin-top: 1.5rem;
  padding: clamp(1.25rem, 4vw, 1.75rem);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  font-size: 1rem;
  padding: 0.75rem 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  outline: none;
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(18, 160, 144, 0.25);
}

.input--mono {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.95rem;
}

.form--inline {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.5rem;
}

.form--inline .input {
  flex: 1;
  min-width: 0;
}

.form--inline .btn {
  width: auto;
  min-width: 4.25rem;
  flex-shrink: 0;
  margin-top: 0;
  padding-left: 1rem;
  padding-right: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  width: 100%;
  transition: transform 0.12s, filter 0.12s, box-shadow 0.12s;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
  color: #fff;
  box-shadow: 0 4px 20px rgba(13, 122, 106, 0.35);
}

.btn--primary:hover {
  filter: brightness(1.06);
}

.btn--secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.btn--secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.alert {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
}

.alert--error {
  background: rgba(232, 93, 93, 0.15);
  border: 1px solid rgba(232, 93, 93, 0.4);
  color: #ffc9c9;
}

.countdown-wrap {
  position: relative;
  width: min(300px, 90vw);
  aspect-ratio: 1;
  margin: 1rem auto 1.25rem;
  cursor: pointer;
}

.ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
}

.ring__track {
  fill: none;
  stroke: var(--ring-track);
  stroke-width: 8;
}

.ring__progress {
  fill: none;
  stroke: var(--ring-fill);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 0;
  transition: stroke 0.35s ease, stroke-dashoffset 0.35s ease;
}

.ring--urgent .ring__progress {
  stroke: var(--danger);
}

.countdown-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.code {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: clamp(2.85rem, 14vw, 4.25rem);
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--text);
  transition: color 0.2s, transform 0.15s, opacity 0.15s;
}

.code-hint {
  margin: 0.35rem 0 0;
  padding: 0 0.5rem;
  max-width: 16rem;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-muted);
}

.code--btn {
  font: inherit;
  border: 0;
  background: transparent;
  padding: 0.15rem 0.35rem;
  margin: 0;
  cursor: pointer;
  border-radius: 8px;
  line-height: 1.2;
}

#totp-code {
  font-size: 40px;
  font-weight: 700;
}

.code--btn:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 3px;
}

.code--btn:hover:not(.code--urgent) {
  background: rgba(255, 255, 255, 0.06);
}

.code--urgent {
  color: var(--danger);
  animation: blink 0.55s ease-in-out infinite alternate;
}

@keyframes blink {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.45;
  }
}

.seconds {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.countdown-wrap.ring--urgent .seconds {
  color: var(--danger);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.actions .btn {
  width: 100%;
}

.slug-path {
  margin: 0;
  padding: 0 0.25rem;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-align: center;
  word-break: break-all;
}
