/* --- Begin Menu Styles (NEW) --- */
header {
  position: sticky;
  top: 0;
  z-index: 10000;
  width: 100%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  display: block;
  margin: 0;
  padding: 0;
}
.menu-container {
  max-width: 840px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: 0.75rem 1rem;
  box-sizing: border-box;
  position: relative;
}
.site-logo {
  font-weight: 800;
  font-size: 1.27rem;
  color: #4c72b0;
  letter-spacing: 0.01em;
  text-decoration: none;
  margin-right: 2rem;
  display: flex;
  align-items: center;
  gap: 0.2em;
  white-space: nowrap;
  user-select: none;
}

/* Hamburger icon */
.menu-toggle {
  background: none;
  border: none;
  display: none;
  padding: 0.4em 0.7em;
  margin-left: auto;
  margin-right: 0;
  cursor: pointer;
  z-index: 20001;
  align-items: center;
  justify-content: center;
  height: 42px;
  min-width: 42px;
}
.menu-toggle:focus {
  outline: 2px solid #dd8452;
  outline-offset: 2px;
}
.hamburger, .hamburger::before, .hamburger::after {
  display: block;
  background: #4c72b0;
  border-radius: 3px;
  height: 3.7px;
  width: 30px;
  position: relative;
  transition: 0.3s all cubic-bezier(0.45,0,0.55,1);
}
.hamburger {
  margin: 0 auto;
}
.hamburger::before, .hamburger::after {
  content: "";
  position: absolute;
  left: 0;
  transition: 0.3s all cubic-bezier(0.45,0,0.55,1);
}
.hamburger::before {
  top: -9px;
}
.hamburger::after {
  top: 9px;
}
.menu-toggle[aria-expanded="true"] .hamburger {
  background: transparent;
}
.menu-toggle[aria-expanded="true"] .hamburger::before {
  top: 0;
  transform: rotate(45deg);
}
.menu-toggle[aria-expanded="true"] .hamburger::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Main nav */
nav#mainMenu {
  display: flex;
  gap: 2rem;
  margin-left: 0.7rem;
  font-size: 1.12rem;
  font-weight: 600;
  align-items: center;
  z-index: 10;
}
nav#mainMenu a {
  color: #4c72b0;
  padding: 0.4em 1.1em;
  border-radius: 8px;
  text-decoration: none;
  position: relative;
  background: none;
  transition: background 0.2s, color 0.22s;
  font-weight: 600;
  outline: none;
}
nav#mainMenu a[aria-current="page"] {
  font-weight: 700;
  color: #dd8452;
  background: #fff4e6;
}
nav#mainMenu a:hover,
nav#mainMenu a:focus {
  color: #dd8452;
  background: #fff4e6;
}
nav#mainMenu a::after {
  content: "";
  display: block;
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: 7px;
  height: 2px;
  background: #dd8452;
  border-radius: 2px;
  transform: scaleX(0);
  transition: transform 0.22s;
}
nav#mainMenu a[aria-current="page"]::after,
nav#mainMenu a:hover::after,
nav#mainMenu a:focus::after {
  transform: scaleX(1);
}

/* Hide menu-toggle on desktop, show only on mobile */
@media (max-width: 639px) {
  .menu-toggle {
    display: flex;
  }
  .menu-container {
    padding: 0.57rem 0.8rem;
    min-height: 50px;
  }
  nav#mainMenu {
    position: fixed;
    inset: 0 0 0 0;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    width: 100vw;
    background: rgba(255,255,255,0.99);
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0;
    padding-top: 80px;
    padding-left: 0;
    transform: translateY(-120%);
    transition: transform 0.3s cubic-bezier(0.61,0,0.37,1);
    box-shadow: 0 8px 32px rgba(76,114,176,0.14);
    font-size: 1.07rem;
    z-index: 11001;
    overflow-x: hidden;
  }
  nav#mainMenu.open {
    transform: translateY(0);
  }
  body.nav-open {
    overflow: hidden !important;
    touch-action: none;
  }
  nav#mainMenu a {
    display: block;
    width: 100%;
    margin: 0;
    padding: 1.1em 2em;
    border-radius: 0;
    font-size: 1.16rem;
    border-bottom: 1px solid #f2e0cc;
    background: none;
  }
  nav#mainMenu a:last-child {
    border-bottom: none;
  }
  .site-logo {
    font-size: 1.12rem;
    margin-right: 1rem;
  }
}
/* --- End Menu Styles --- */

/* Discord badge base styles - apply on all screens */
.discord-badge {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background-color: #5865f2;
  color: white;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 24px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(88,101,242,0.7);
  z-index: 11000;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  user-select: none;
  white-space: nowrap;
}
.discord-badge:hover,
.discord-badge:focus {
  background-color: #4752c4;
  box-shadow: 0 8px 24px rgba(71,82,196,0.9);
  outline: none;
}
.discord-badge svg {
  flex-shrink: 0;
}
/* Small screen tweaks */
@media screen and (max-width: 480px) {
  .discord-badge {
    font-size: 0.9rem;
    padding: 8px 12px;
  }
}
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
#page-wrapper {
  flex: 1 0 auto; /* grow and shrink but no overflow */
  display: flex;
  flex-direction: column;
  max-width: 840px;   /* same as main content container */
  margin: 0 auto;     /* center horizontally */
  width: 100%;
  box-sizing: border-box;
}
main {
  flex: 1 0 auto; /* take remaining vertical space */
  padding-bottom: 2rem; /* optional padding */
  display: flex;
  flex-direction: column;
}
footer {
  flex-shrink: 0; /* do not shrink */
  background-color: #fff;
  border-top: 1.5px solid #ddd6d6;
  padding: 1rem 1.5rem;
  text-align: center;
  color: #64748b;
  font-weight: 600;
  font-size: 0.9rem;
  user-select: none;
  box-sizing: border-box;
  width: 100%;
}
/* === Global Styles === */
/* Box sizing */
*, *::before, *::after { box-sizing: border-box; }
/* Body and layout */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-x: hidden;
}
body {
  margin: 0;
  padding: 0 1rem 4rem 1rem; /* no padding top to prevent sticky header gap */
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f9f9fc;
  color: #18294c;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
/* Links */
a {
  color: #4c72b0;
  text-decoration: none;
  transition: color 0.3s ease;
}
a:hover, a:focus {
  color: #dd8452;
  outline: none;
}
/* Main container */
main {
  max-width: 840px;
  margin: 0 auto 5rem auto;
  padding: 2rem 1rem 0 1rem; /* moved vertical padding inside main */
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 140px);
}
/* Headings */
h1 {
  font-weight: 800;
  font-size: 2.8rem;
  margin-bottom: 0.5rem;
  color: #4c72b0;
  text-align: center;
  user-select: none;
}
/* Beta notice */
#beta-notice {
  max-width: 720px;
  margin: 0 auto 1rem auto;
  padding: 0.75rem 1rem;
  background-color: #fff3cd;
  color: #856404;
  border: 1.5px solid #ffeeba;
  border-radius: 8px;
  font-weight: 600;
  text-align: center;
  font-size: 1rem;
  line-height: 1.4;
  user-select: none;
}
/* Explanation text */
#explanation,
#explanation-text {
  max-width: 720px;
  margin: 0 auto 2rem auto;
  font-size: 1.15rem;
  color: #334156;
  line-height: 1.6;
  text-align: center;
  user-select: none;
}
/* Last updated date */
#last-updated {
  max-width: 720px;
  margin: 0.5rem auto 2.5rem auto;
  font-size: 0.9rem;
  font-style: italic;
  color: #64748b;
  text-align: center;
  user-select: none;
}
/* Search input */
#search-epg,
input[type="text"] {
  max-width: 840px;
  margin: 0 auto 1rem auto;
  display: block;
  width: 100%;
  font-size: 1.15rem;
  padding: 0.5rem 1rem;
  border: 1.5px solid #ddd6d6;
  border-radius: 12px;
  outline-offset: 3px;
  outline-color: #dd8452;
  user-select: text;
  box-shadow: inset 0 2px 4px rgb(0 0 0 / 0.06);
  transition: border-color 0.3s ease;
  background-color: #fff;
  color: #18294c;
}
#search-epg:focus,
input[type="text"]:focus {
  border-color: #dd8452;
  outline: none;
  background-color: #fff;
}
/* Forms */
form {
  margin-bottom: 2rem;
  text-align: center;
}
/* Select dropdown */
select {
  width: 100%;
  max-width: 360px;
  padding: 0.5rem 0.8rem;
  margin: 0.5rem 0 1.7rem 0;
  border-radius: 10px;
  border: 2px solid #ddd6d6;
  font-size: 1rem;
  transition: border-color 0.3s ease;
  background-color: #fff;
  color: #18294c;
  user-select: none;
}
select:focus {
  border-color: #dd8452;
  outline: none;
  background-color: #fff;
}
/* Buttons */
button,
input[type="submit"] {
  background: linear-gradient(135deg, #4c72b0 0%, #dd8452 100%);
  color: white;
  font-weight: 700;
  cursor: pointer;
  border: none;
  border-radius: 24px;
  padding: 1rem 2rem;
  font-size: 1.25rem;
  text-align: center;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  user-select: none;
  max-width: 220px;
  align-self: center;
  box-shadow: 0 8px 28px rgba(221,132,82,0.5);
  display: inline-block;
}
button:hover, button:focus-visible,
input[type="submit"]:hover, input[type="submit"]:focus-visible {
  box-shadow: 0 12px 40px rgba(221,132,82,0.7);
  transform: scale(1.05);
  outline: none;
}
/* Smaller buttons for copy/toggle */
button.copy-btn {
  background: transparent;
  border: none;
  color: #dd8452;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.3s ease;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  user-select: none;
}
button.copy-btn:hover { color: #4c72b0; }
button.copy-btn:focus { outline: 2px solid #dd8452; outline-offset: 3px; }
button.toggle-btn {
  background: transparent;
  border: 1.5px solid #dd8452;
  color: #dd8452;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background-color 0.3s ease, color 0.3s ease;
  flex-shrink: 0;
  user-select: none;
}
button.toggle-btn:hover, button.toggle-btn:focus {
  background-color: #dd8452;
  color: white;
  outline: none;
}
/* Toast notification */
#toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background-color: #4c72b0;
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 24px;
  box-shadow: 0 8px 15px rgba(76,114,176,0.5);
  opacity: 0;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.4s ease;
  font-weight: 700;
  font-size: 1rem;
  z-index: 1100;
}
#toast.show {
  opacity: 1;
  pointer-events: auto;
}
/* EPG Source List */
#epg-source-list {
  max-width: 840px;
  margin: 0 auto 1.5rem auto;
  border: 1.5px solid #ddd6d6;
  border-radius: 12px;
  background: #fafafa;
  max-height: 320px;
  overflow-y: auto;
  padding: 0.5rem 1rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 1rem;
  row-gap: 0.6rem;
}
#epg-source-list::-webkit-scrollbar {
  width: 8px;
}
#epg-source-list::-webkit-scrollbar-thumb {
  background-color: #dd8452;
  border-radius: 20px;
}
#epg-source-list label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #fff;
  padding: 0.5rem 0.9rem;
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(76,114,176,0.1);
  cursor: pointer;
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
  user-select: none;
  margin: 0;
}
#epg-source-list label:hover,
#epg-source-list label:focus-within {
  background-color: #fff2e6;
  box-shadow: 0 6px 18px rgba(221, 132, 82, 0.3);
}
#epg-source-list input[type="checkbox"] {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2.5px solid #ddd6d6;
  accent-color: #dd8452;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.3s ease;
}
#epg-source-list input[type="checkbox"]:focus-visible {
  outline-offset: 4px;
  outline: 2px solid #dd8452;
  border-color: #dd8452;
}
/* Generate button */
#generate-btn {
  background: linear-gradient(135deg, #4c72b0 0%, #dd8452 100%);
  box-shadow: 0 8px 28px rgba(221, 132, 82, 0.5);
  color: white;
  font-weight: 700;
  font-size: 1.3rem;
  border: none;
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  padding: 1rem 0;
  border-radius: 24px;
  cursor: pointer;
  user-select: none;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  display: block;
}
#generate-btn:hover, #generate-btn:focus-visible {
  box-shadow: 0 12px 40px rgba(221,132,82,0.7);
  transform: scale(1.05);
  outline: none;
}
/* Generated links container */
#generated-links {
  max-width: 100vw;          /* full viewport width max */
  box-sizing: border-box;
  padding: 1rem;
  overflow-x: auto;          /* allow horizontal scroll if absolutely needed */
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(76,114,176,0.12);
  margin-top: 3rem;
  display: none;             /* default hidden */
  flex-direction: column;
  gap: 1.1rem;
  user-select: text;
}
#generated-links.visible {
  display: flex;             /* visible state */
}
.link-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;             /* allow buttons to wrap below */
  width: 100%;
}
.link-row a.generated-link {
  flex-grow: 1;              /* take remaining space */
  min-width: 0;              /* allow shrink */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #4c72b0;
  font-weight: 600;
  text-decoration: none;
}
.link-row button.copy-btn,
.link-row button.toggle-btn {
  flex-shrink: 0;            /* prevent buttons shrinking */
  margin-top: 0.4rem;        /* add small spacing when wrapped */
}
.link-row a.generated-link:hover,
.link-row a.generated-link:focus {
  text-decoration: underline;
  outline: none;
}
/* Section info (FAQ) */
section.info {
  max-width: 840px;
  margin: 3rem auto 2rem auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(76,114,176,0.1);
  padding: 2rem 2.5rem;
  color: #18294c;
  font-weight: 600;
  line-height: 1.5;
}
section.info h2 {
  font-weight: 700;
  font-size: 1.9rem;
  margin-bottom: 1rem;
  user-select: none;
}
section.info p {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}
section.info ol {
  padding-left: 1.75rem;
  font-weight: normal;
  margin-top: 0;
}
section.info ol li {
  margin-bottom: 0.8rem;
}
section.info h2::before {
  content: "❓ ";
}
/* Preview Container (sample.php) */
#preview-container {
  margin-top: 3rem;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(76,114,176,0.12);
  max-width: 840px;
  width: 100%;
  padding: 2rem 2rem;
  color: #18294c;
}
#preview-container::-webkit-scrollbar {
  width: 9px;
}
#preview-container::-webkit-scrollbar-thumb {
  background-color: #dd8452;
  border-radius: 12px;
}
#preview-container::-webkit-scrollbar-track {
  background-color: #f9f9fc;
}
/* EPG Sample Program Styles */
.epg-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  align-items: flex-start;
  border-bottom: 1px solid #ddd;
  padding-bottom: 1.5rem;
}
.channel-icon {
  width: 90px;
  height: 90px;
  flex-shrink: 0;
  border-radius: 15px;
  object-fit: contain;
  box-shadow: 0 0 10px rgba(76,114,176,0.15);
  border: 1px solid #ccc;
}
.channel-name {
  font-weight: 700;
  font-size: 1.5rem;
  margin: 0 0 1rem 0;
  color: #3b4a75;
}
.programs {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.program {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: #f9fbfe;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.04);
  border: 1px solid #e0e6f0;
  transition: background-color 0.3s ease;
}
.program:hover {
  background-color: #fff8f0;
}
.prog-icon {
  width: 100px;
  height: 75px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 0 6px rgba(76,114,176,0.2);
  border: 1px solid #ccc;
}
.prog-info {
  flex: 1;
  min-width: 0;
}
.prog-title {
  font-weight: 700;
  font-size: 1.2rem;
  margin: 0 0 0.4rem 0;
  color: #2b3658;
}
.prog-time {
  font-size: 1rem;
  color: #6b7b9c;
  margin-bottom: 0.4rem;
  font-family: monospace;
}
.prog-desc {
  font-style: italic;
  font-size: 1rem;
  color: #556080;
  margin: 0;
}
/* Search Channels Grid */
#results {
  display: grid;
  grid-template-columns: 3.5fr 1.3fr 1.2fr 3fr;
  gap: 0.8rem 1.5rem;
  align-items: center;
  border: 1.5px solid #ddd6d6;
  border-radius: 12px;
  padding: 0.8rem 1rem;
  box-shadow: 0 8px 30px rgba(76,114,176,0.05);
  background: #fff;
  max-width: 840px;
  margin: 0 auto 2rem auto;
}
#results > div {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid #ddd6d6;
}
#results > div.header {
  font-weight: 700;
  color: #dd8452;
  border-bottom: 2px solid #dd8452;
  user-select: none;
}
#results > div:last-child,
#results > div:nth-last-child(2),
#results > div:nth-last-child(3),
#results > div:nth-last-child(4) {
  border-bottom: none;
}
.flag {
  font-size: 1.6rem;
  display: inline-block;
  margin-right: 0.4rem;
  user-select: none;
}
.link-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
  overflow: hidden;
  width: 100%;
}
.link-row a.generated-link {
  text-decoration: none;
  color: #4c72b0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  min-width: 0;
  flex-grow: 1;
}
.link-row a.generated-link:hover,
.link-row a.generated-link:focus {
  text-decoration: underline;
  outline: none;
}
/* No results message */
.no-results {
  margin-top: 1rem;
  font-style: italic;
  color: #64748b;
  text-align: center;
}
/* Responsive adjustments */
@media (max-width: 840px) {
  #results {
    grid-template-columns: 1.5fr 1fr 1fr 2.3fr;
  }
}
@media (max-width: 640px) {
  body {
    padding-top: 0; /* fix: no padding top so sticky header is flush to top */
    padding-left: 1rem;
    padding-right: 1rem;
    padding-bottom: 4rem;
    min-height: auto;
  }
  main {
    margin: 0 auto 1.5rem auto;
    padding-top: 2rem; /* moved vertical space below header */
    min-height: calc(100vh - 120px);
  }
  select {
    max-width: 100%;
  }
  button,
  input[type="submit"] {
    max-width: 100%;
    font-size: 1.1rem;
  }
  #preview-container {
    padding: 1.5rem 1rem;
    max-height: 500px;
    margin-top: 2rem;
  }
  .epg-row {
    flex-direction: column;
    gap: 1rem;
    border-bottom: none;
    padding-bottom: 1rem;
  }
  .channel-icon {
    width: 70px;
    height: 70px;
    margin-bottom: 0.8rem;
    border-radius: 12px;
  }
  .channel-name {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    text-align: center;
  }
  .program {
    flex-direction: column;
    gap: 0.75rem;
    background: #fff9f2;
    border: 1px solid #f0d8bb;
    padding: 1rem 1rem;
  }
  .prog-icon {
    width: 100%;
    height: auto;
    border-radius: 14px;
    margin-bottom: 0.5rem;
  }
  .prog-title {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
  }
  .prog-time {
    font-size: 1rem;
    color: #a58350;
    margin-bottom: 0.25rem;
  }
  .prog-desc {
    font-size: 1rem;
    color: #7a6b55;
  }
  #results {
    grid-template-columns: 1fr 1fr 1fr 2fr;
    font-size: 0.9rem;
  }
  button.copy-btn, button.toggle-btn {
    font-size: 1.1rem;
    padding: 3px 6px;
  }
  /* Prevent horizontal overflow inside containers on mobile */
  #beta-notice,
  #explanation,
  #last-updated,
  #epg-source-list,
  h1 {
    max-width: 100%;
    box-sizing: border-box;
    padding-left: 1rem;
    padding-right: 1rem;
    overflow-wrap: break-word;
    word-break: break-word;
  }
  /* Adjust heading size on mobile */
  h1 {
    font-size: 2rem;
    margin-left: 0;
    margin-right: 0;
  }
  /* EPG List: single column on mobile */
  #epg-source-list {
    grid-template-columns: 1fr;
  }
  .link-row {
    flex-wrap: wrap;          /* allow wrap on small screens */
    align-items: center;
    gap: 0.5rem;
    width: 100%;
  }
  .link-row a.generated-link {
    flex-grow: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .link-row button.copy-btn,
  .link-row button.toggle-btn {
    flex-shrink: 0;           /* prevent shrinking */
    margin-top: 0.35rem;      /* spacing below the link when wrapped */
  }
}
@media (max-width: 430px) {
  .link-row {
    flex-direction: column;   /* stack all items vertically */
    align-items: stretch;
    gap: 0.5rem;
  }
  .link-row a.generated-link {
    white-space: normal;      /* allow wrapping */
    overflow: visible;        /* show full text */
    text-overflow: clip;
    flex-grow: 0;
    min-width: auto;
    word-break: break-word;   /* break long words if needed */
  }
  .link-row button.copy-btn,
  .link-row button.toggle-btn {
    width: 100%;              /* buttons full width */
    flex-shrink: 0;
    margin-top: 0;
  }
}
/* Search Channels Table */
#results-table {
  width: 100%;
  max-width: 840px;
  margin: 1.5rem auto;
  border-collapse: collapse;
  box-shadow: 0 8px 30px rgba(76, 114, 176, 0.05);
  background-color: #fff;
  border-radius: 12px;
  overflow-x: auto;
  display: block; /* allows horizontal scroll if needed on mobile */
}
#results-table thead tr {
  border-bottom: 2px solid #dd8452;
  background-color: #fef6f0;
}
#results-table th,
#results-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
  color: #2b3658;
  font-weight: normal;
  vertical-align: middle;
}
#results-table th {
  color: #dd8452;
  font-weight: 700;
  user-select: none;
  white-space: nowrap;
}
#results-table tbody tr:hover {
  background-color: #fff8f0;
}
/* Flags */
.flag {
  margin-right: 0.4rem;
  font-size: 1.4rem;
  user-select: none;
}
/* Responsive adjustments */
@media (max-width: 640px) {
  #results-table thead {
    display: none;
  }
  #results-table tbody tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid #ddd6d6;
    border-radius: 12px;
    padding: 1rem;
    background: #fff;
  }
  #results-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border: none;
    border-bottom: 1px solid #ddd6d6;
    font-size: 1rem;
  }
  #results-table tbody td:last-child {
    border-bottom: none;
  }
  #results-table tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #dd8452;
    flex-basis: 40%;
    white-space: nowrap;
  }
  /* Allow link wrapping in last cell */
  #results-table tbody td:last-child a.generated-link {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
  /* Stack buttons nicer on small screens */
  #results-table .link-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  #results-table button.copy-btn,
  #results-table button.toggle-btn {
    flex: 1 1 auto;
    min-width: 48%;
    font-size: 1rem;
    padding: 0.5rem 1rem;
  }
}