body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background-color: #f7faff;
  color: #333;
  text-align: center;
  padding: 30px;
  margin: 0;
}

/* Theme roots via body class */
.theme-light body,
body.theme-light {
  background: linear-gradient(120deg, #c7d2fe 0%, #a7f3d0 100%);
  color: #333;
}

.theme-dark body,
body.theme-dark {
  background-color: #0b1418;
  color: #e6fffa;
}

h1 {
  margin-bottom: 20px;
  font-size: 24px;
}

.card {
  display: none;
  margin: 20px auto 30px;
  max-width: 480px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  transition: opacity 0.3s ease, transform 0.22s ease;
  transform-origin: top center;
}

.card--light {
  background: linear-gradient(90deg, #f7faff 70%, #e3f0ff 100%);
  border: 1px solid #6366f1;
  /* indigo-500 for stronger edge */
  box-shadow:
    0 14px 34px rgba(79, 70, 229, 0.32),
    0 6px 14px rgba(0, 0, 0, 0.10);
}

.card--light:hover {
  border-color: #4f46e5; /* indigo-600 on hover */
  box-shadow:
    0 18px 44px rgba(79, 70, 229, 0.38),
    0 8px 18px rgba(0, 0, 0, 0.12);
}

.card--dark {
  color: #e6fffa;
  background: #0f2027;
  /* fallback if gradient is not desired */
  background-size: cover;
  border: 1px solid #0d9488;
  /* teal-600 */
  box-shadow: 0 10px 28px rgba(13, 148, 136, 0.22);
}

.card.active {
  display: table;
  opacity: 1;
}

/* Visual state when a card has just been copied via hover */
.card.copied {
  opacity: 0.55;
  transform: scale(1.05);
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  margin: 5px;
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, transform 0.08s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid transparent;
  outline: none;
}

.toggle-btn {
  background-color: #2a4d69;
  color: #fff;
}

.toggle-btn:hover {
  background-color: #1c3449;
}

.copy-btn {
  background-color: #2ae98b;
  color: #000;
}

.copy-btn:hover {
  background-color: #1fa864;
  color: #fff;
}

.copy-html-btn {
  background-color: #f59e0b;
  color: #000;
}

.copy-html-btn:hover {
  background-color: #d97706;
  color: #fff;
}

/* Button theme variants */
body.theme-dark .toggle-btn {
  background: linear-gradient(180deg, #475569 0%, #334155 100%);
  /* slate-600 -> slate-700 */
  color: #fff;
  /* base white text in dark */
}

body.theme-dark .toggle-btn:hover {
  background-color: #e2e8f0;
  /* slate-200 */
  color: #000;
  /* invert on hover */
  box-shadow: 0 6px 16px rgba(226, 232, 240, 0.25);
}

body.theme-dark .copy-btn {
  background: linear-gradient(180deg, #14b8a6 0%, #0d9488 100%);
  /* teal-500 -> teal-600 */
  color: #fff;
  /* base white text in dark */
}

body.theme-dark .copy-btn:hover {
  background-color: #99f6e4;
  /* teal-200 */
  color: #000;
  /* invert on hover */
  box-shadow: 0 6px 16px rgba(20, 184, 166, 0.35);
}

body.theme-dark .copy-html-btn {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  /* amber-500 -> amber-600 */
  color: #000;
  /* black text in dark */
}

body.theme-dark .copy-html-btn:hover {
  background-color: #fbbf24;
  /* amber-400 */
  color: #000;
  /* keep black text on hover */
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.35);
}

/* Explicit light theme button styles for parity */
body.theme-light .toggle-btn {
  background: linear-gradient(180deg, #c7d2fe 0%, #818cf8 100%);
  /* indigo-200 -> indigo-500 */
  color: #000;
  /* black text in light */
  border-color: #4f46e5;
  /* indigo-600 */
}

body.theme-light .toggle-btn:hover {
  background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
  /* indigo-500 -> 600 */
  border-color: #4338ca;
  /* indigo-700 */
  color: #fff;
  /* invert on hover */
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.35);
}

body.theme-light .copy-btn {
  background: linear-gradient(180deg, #6ee7b7 0%, #10b981 100%);
  /* emerald-300 -> 500 */
  color: #000;
  border-color: #059669;
  /* emerald-600 */
}

body.theme-light .copy-btn:hover {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  /* emerald-500 -> 600 */
  border-color: #047857;
  /* emerald-700 */
  color: #fff;
  /* already invert to white */
  box-shadow: 0 8px 18px rgba(16, 185, 129, 0.35);
}

body.theme-light .copy-html-btn {
  background: linear-gradient(180deg, #fed7aa 0%, #f59e0b 100%);
  /* orange-200 -> amber-500 */
  color: #000;
  border-color: #d97706;
  /* amber-600 */
}

body.theme-light .copy-html-btn:hover {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  /* amber-500 -> 600 */
  border-color: #b45309;
  /* amber-700 */
  color: #000;
  /* keep black text */
  box-shadow: 0 8px 18px rgba(245, 158, 11, 0.35);
}

/* Subtle pressed + focus states for better feel */
.btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.10);
}

.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.35);
  /* indigo focus ring */
}

.loader-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #FFF;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.25s ease;
  will-change: opacity;
}

.loader {
  color: #2a4d69;
  position: relative;
  font-size: 11px;
  background: #2a4d69;
  animation: escaleY 1s infinite ease-in-out;
  width: 1em;
  height: 4em;
  animation-delay: -0.16s;
}

.loader:before,
.loader:after {
  content: '';
  position: absolute;
  top: 0;
  left: 2em;
  background: #2a4d69;
  width: 1em;
  height: 4em;
  animation: escaleY 1s infinite ease-in-out;
}

.loader:before {
  left: -2em;
  animation-delay: -0.32s;
}

@keyframes escaleY {

  0%,
  80%,
  100% {
    box-shadow: 0 0;
    height: 4em;
  }

  40% {
    box-shadow: 0 -2em;
    height: 5em;
  }
}

.loader-wrapper.is-hidden {
  opacity: 0;
  visibility: hidden;
}

/* Screen-reader-only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Reduced motion: disable loader animation */
@media (prefers-reduced-motion: reduce) {

  .loader,
  .loader:before,
  .loader:after {
    animation: none !important;
  }
}

/* Toasts */
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10000;
  pointer-events: none;
  /* allow clicks to pass through when not over a toast */
}

.toast {
  min-width: 260px;
  max-width: 420px;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  background: #fff;
  color: #1b1b1b;
  border: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
  /* capture hover for close button */
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-left: 4px solid #16a34a;
}

.toast.error {
  border-left: 4px solid #dc2626;
}

.toast.info {
  border-left: 4px solid #2563eb;
}

.toast .icon {
  font-size: 16px;
}

.toast .message {
  flex: 1;
  text-align: left;
  font-weight: 500;
}

.toast .close-btn {
  background: transparent;
  border: none;
  color: #666;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}

.toast .close-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #111;
}

@media (max-width: 640px) {
  #toast-container {
    left: 16px;
    right: 16px;
    top: auto;
    bottom: 16px;
    /* show toasts near thumb reach on mobile */
  }

  .toast {
    min-width: 0;
    max-width: 100%;
  }
}

/* ---------- Mobile responsiveness ---------- */
@media (max-width: 640px) {
  body {
    padding: 16px;
  }

  h1 {
    font-size: 20px;
    margin-bottom: 14px;
  }

  .btn {
    width: 100%;
    justify-content: center;
    font-size: 15px;
    padding: 12px 14px;
  }

  .card {
    width: 100%;
    max-width: 100%;
    border-radius: 14px;
    margin: 14px 0 22px;
  }

  /* Convert table layout to stack vertically on small screens */
  .card tr,
  .card td {
    display: block;
    width: 100% !important;
    box-sizing: border-box;
  }

  /* Reduce cell paddings applied inline by TDs in HTML via a helper override */
  .card td[style] {
    padding: 14px !important;
    text-align: left !important;
  }

  /* Make avatar responsive */
  .card img {
    max-width: 100%;
    height: auto !important;
  }

  /* Specifically constrain the profile image which has fixed inline size */
  .card td:first-child img {
    width: 88px !important;
    height: 88px !important;
    display: block;
    margin: 0 auto 8px;
  }

  /* Left-align content for readability, but keep small spacing */
  .card .info {
    text-align: left;
  }
}

/* Ultra-small devices */
@media (max-width: 360px) {
  h1 {
    font-size: 18px;
  }

  .btn {
    font-size: 14px;
    padding: 11px 12px;
  }
}

/* --------- New semantic classes for refactor --------- */
.no-js-notice {
  padding: 12px;
  margin: 12px;
  background: #fff3cd;
  color: #664d03;
  border: 1px solid #ffe69c;
  border-radius: 8px;
}

.cell {
  padding: 24px;
  vertical-align: top;
}

.cell--content {
  text-align: left;
}

.avatar {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar--light {
  border: 3px solid #4f46e5; /* indigo-600 for stronger edge */
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18); /* subtle ring */
}

.avatar--dark {
  border: 2px solid #2ae98b;
}

.name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.name--light {
  color: #2a4d69;
}

.name--dark {
  color: #2ae98b;
}

.title {
  margin-bottom: 10px;
}

.title--light {
  color: #444;
}

.contact {
  margin-bottom: 7px;
}

.contact-icon {
  vertical-align: middle;
  margin-right: 6px;
}

.contact-icon--badge {
  background: #ffffff;
  padding: 2px;
  border-radius: 3px;
}

.contact-link {
  text-decoration: none;
}

.contact-link--light {
  color: #2a4d69;
}

.contact-link--dark {
  color: #2ae98b;
}

.social-link {
  text-decoration: none;
}

.social-link--light {
  color: #2a4d69;
}

.social-link--dark {
  color: #2ae98b;
}

.divider {
  margin: 0 10px;
  color: #888;
}

.divider--dark {
  color: #2ae98b;
}

.quote {
  margin-top: 14px;
  font-size: 13px;
  font-style: italic;
}

.quote--light {
  color: #555;
}

.quote--dark {
  color: #e6fffa;
}