/* TypingWebsite certificate feature.
   Every selector is prefixed with "tw-cert" so nothing in style.css is touched or overridden. */

.tw-cert-wrap {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.tw-cert-btn {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid currentColor;
  border-radius: 8px;
  padding: 0.55em 1.2em;
  cursor: pointer;
  opacity: 0.9;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}
.tw-cert-btn:hover { opacity: 1; background: rgba(127, 127, 127, 0.14); }
.tw-cert-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; opacity: 1; }

/* inline placement: sits right beside the Restart button */
.tw-cert-inline {
  display: inline-block;
  margin: 0 0 0 0.6rem;
  vertical-align: middle;
}

/* floating placement: out of the page flow, so it can never push or cover page layout */
.tw-cert-float {
  position: fixed;
  z-index: 9000;
  margin: 0;
  display: block;
  right: 16px;
  bottom: 16px;
}

/* highlighted call-to-action: accent colour per tier, readable on every theme */
.tw-cert-btn.tw-cert-hero {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  font-weight: 700;
  color: var(--tw-cert-ink, #111);
  background: var(--tw-cert-bg, #F2C14E);
  border: 2px solid var(--tw-cert-bg, #F2C14E);
  border-radius: 10px;
  padding: 0.65em 1.25em;
  opacity: 1;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  animation: tw-cert-pulse 1.6s ease-out 3;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.tw-cert-btn.tw-cert-hero:hover { background: var(--tw-cert-bg, #F2C14E); filter: brightness(1.08); transform: translateY(-1px); }
.tw-cert-btn.tw-cert-hero:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.tw-cert-icon { flex: 0 0 auto; }

@keyframes tw-cert-pulse {
  0%   { box-shadow: 0 0 0 0 var(--tw-cert-glow, rgba(242,193,78,.55)), 0 6px 18px rgba(0,0,0,.35); }
  70%  { box-shadow: 0 0 0 16px rgba(0,0,0,0), 0 6px 18px rgba(0,0,0,.35); }
  100% { box-shadow: 0 0 0 0 rgba(0,0,0,0), 0 6px 18px rgba(0,0,0,.35); }
}
@media (prefers-reduced-motion: reduce) {
  .tw-cert-btn.tw-cert-hero { animation: none; transition: none; }
  .tw-cert-btn.tw-cert-hero:hover { transform: none; }
}

/* ---------- modal ---------- */

.tw-cert-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.7);
  font-family: inherit;
  box-sizing: border-box;
}
.tw-cert-overlay *, .tw-cert-overlay *::before, .tw-cert-overlay *::after { box-sizing: border-box; }

.tw-cert-dialog {
  width: min(760px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 24px;
  border-radius: 14px;
  background: #1a1b1f;
  color: #ececf0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.tw-cert-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.tw-cert-title { margin: 0; font-size: 1.15rem; font-weight: 600; }
.tw-cert-x {
  font: inherit; font-size: 1.5rem; line-height: 1;
  color: inherit; background: transparent; border: 0; cursor: pointer;
  padding: 2px 8px; border-radius: 6px; opacity: 0.7;
}
.tw-cert-x:hover { opacity: 1; background: rgba(255, 255, 255, 0.1); }

.tw-cert-label { display: block; margin-bottom: 6px; font-size: 0.9rem; opacity: 0.85; }
.tw-cert-input {
  width: 100%;
  font: inherit;
  color: #fff;
  background: #101114;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  padding: 0.65em 0.8em;
}
.tw-cert-input:focus { outline: 2px solid #8ab4ff; outline-offset: 1px; border-color: transparent; }
.tw-cert-hint { margin: 6px 0 0; font-size: 0.8rem; opacity: 0.6; min-height: 1.2em; }

.tw-cert-preview {
  display: block;
  width: 100%;
  height: auto;
  margin: 16px 0;
  border-radius: 6px;
  background: #f8f9fb;
}

.tw-cert-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.tw-cert-primary, .tw-cert-secondary {
  font: inherit;
  border-radius: 8px;
  padding: 0.6em 1.2em;
  cursor: pointer;
  border: 1px solid transparent;
}
.tw-cert-primary { background: #8ab4ff; color: #0d1b36; font-weight: 600; }
.tw-cert-primary:hover:not(:disabled) { background: #a5c4ff; }
.tw-cert-secondary { background: transparent; color: inherit; border-color: rgba(255, 255, 255, 0.3); }
.tw-cert-secondary:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); }
.tw-cert-primary:disabled, .tw-cert-secondary:disabled { opacity: 0.4; cursor: not-allowed; }
.tw-cert-primary:focus-visible, .tw-cert-secondary:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.tw-cert-sharebox { margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.tw-cert-sharetitle { margin: 0 0 10px; font-size: 0.9rem; opacity: 0.85; }
.tw-cert-note { margin: 10px 0 0; font-size: 0.8rem; opacity: 0.6; }

@media (max-width: 520px) {
  .tw-cert-dialog { padding: 16px; }
  .tw-cert-actions > button { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .tw-cert-btn { transition: none; }
}
