:root {
  --md-sys-color-primary: #0b57d0;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #d3e3fd;
  --md-sys-color-on-primary-container: #041e49;
  --md-sys-color-surface: #ffffff;
  --md-sys-color-surface-container-low: #f8fafd;
  --md-sys-color-surface-container: #f0f4f9;
  --md-sys-color-surface-container-high: #e9eef6;
  --md-sys-color-on-surface: #1f1f1f;
  --md-sys-color-on-surface-variant: #444746;
  --md-sys-color-outline: #747775;
  --md-sys-color-outline-variant: #c4c7c5;
  --md-sys-color-error: #b3261e;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 40px 16px;
}

.m3-container {
  width: 100%;
  max-width: 880px;
}

.search-section {
  text-align: center;
  margin-top: 12vh;
  transition: margin-top 0.25s cubic-bezier(0.2, 0, 0, 1);
}

.search-section.compact {
  margin-top: 16px;
}

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.brand {
  font-size: 2.1rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--md-sys-color-on-surface);
}

.subtitle {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

.m3-search-bar {
  display: flex;
  align-items: center;
  background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 28px;
  padding: 6px 6px 6px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
  transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.m3-search-bar:focus-within {
  background: var(--md-sys-color-surface);
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 2px 6px rgba(11, 87, 208, 0.12), 0 6px 20px rgba(11, 87, 208, 0.08);
}

.search-icon {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 22px;
  margin-right: 12px;
}

#url-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: inherit;
  color: var(--md-sys-color-on-surface);
  background: transparent;
  min-width: 0;
}

#url-input::placeholder {
  color: var(--md-sys-color-outline);
}

.m3-filled-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border: none;
  border-radius: 20px;
  padding: 10px 22px;
  font-size: 0.92rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.m3-filled-btn:hover {
  background: #0842a0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.m3-filled-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.m3-filled-btn.m3-icon-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
}

.m3-filled-btn.m3-icon-btn .material-symbols-outlined {
  font-size: 22px;
}

.status-msg {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--md-sys-color-on-surface-variant);
}

.status-msg.error {
  color: var(--md-sys-color-error);
}

.hidden {
  display: none !important;
}

.results-section {
  margin-top: 32px;
}

.m3-card {
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.result-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--md-sys-color-surface-container-low);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.result-thumb {
  width: 96px;
  height: 60px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--md-sys-color-surface-container-high);
  flex-shrink: 0;
}

.result-meta {
  text-align: left;
  min-width: 0;
}

.m3-chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 8px;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  margin-bottom: 6px;
}

.result-title {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  word-break: break-word;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.m3-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.m3-table thead {
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.m3-table th,
.m3-table td {
  padding: 12px 20px;
  border-bottom: 1px solid #eef1f4;
  vertical-align: middle;
}

.m3-table tbody tr:last-child td {
  border-bottom: none;
}

.m3-table tbody tr:hover {
  background: var(--md-sys-color-surface-container-low);
}

.cell-name {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--md-sys-color-on-surface);
}

.cell-muted {
  color: var(--md-sys-color-on-surface-variant);
  white-space: nowrap;
}

.cell-action {
  text-align: right;
  white-space: nowrap;
}

.m3-tonal-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border: none;
  border-radius: 18px;
  padding: 7px 16px;
  font-size: 0.84rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, box-shadow 0.15s;
}

.m3-tonal-btn:hover {
  background: #c2d7fa;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.m3-tonal-btn .material-symbols-outlined {
  font-size: 17px;
}

/* Full responsiveness: 320px minimum to large desktop */
@media (max-width: 540px) {
  body {
    padding: 20px 10px;
  }

  .search-section {
    margin-top: 8vh;
  }

  .brand {
    font-size: 1.65rem;
  }

  .brand-icon {
    font-size: 28px;
  }

  .subtitle {
    font-size: 0.85rem;
    margin-bottom: 20px;
    padding: 0 4px;
  }

  .m3-search-bar {
    padding: 4px 4px 4px 12px;
    gap: 6px;
  }

  .search-icon {
    font-size: 20px;
    margin-right: 4px;
    flex-shrink: 0;
  }

  #url-input {
    font-size: 0.9rem;
    padding: 6px 4px;
  }

  .m3-filled-btn.m3-icon-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  .result-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px;
    gap: 10px;
  }

  .result-thumb {
    width: 100%;
    height: 150px;
  }

  .m3-table th,
  .m3-table td {
    padding: 10px 10px;
    font-size: 0.82rem;
  }

  .cell-name {
    max-width: 120px;
  }

  .m3-tonal-btn {
    padding: 6px 10px;
    font-size: 0.78rem;
  }
}

@media (min-width: 1200px) {
  .m3-container {
    max-width: 960px;
  }
}


/* --- Prominent Hero Heading (M3 Display) --- */
.hero-heading {
  font-size: clamp(1.5rem, 4.2vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--md-sys-color-on-surface, #1f1f1f);
  text-align: center;
  margin: 12px auto 10px;
  max-width: 780px;
}

/* --- Future Advertisement Empty Containers --- */
.ads-section {
  width: 100%;
  max-width: 1080px;
  margin: 20px auto;
  padding: 0 16px;
}

.ads-section .ad-slot {
  width: 100%;
  min-height: 0;
}

/* --- M3 Info Sections & Cards --- */
.info-section {
  width: 100%;
  max-width: 1080px;
  margin: 44px auto;
  padding: 0 16px;
}

.info-heading {
  text-align: center;
  margin-bottom: 28px;
}

.info-title {
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  font-weight: 700;
  color: var(--md-sys-color-on-surface, #1f1f1f);
  margin: 0 0 10px;
}

.text-accent {
  color: var(--md-sys-color-primary, #0b57d0);
}

.info-subtitle {
  font-size: 0.98rem;
  color: var(--md-sys-color-on-surface-variant, #444746);
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.55;
}

.info-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.info-card {
  background: var(--md-sys-color-surface-container-low, #f8f9fa);
  border: 1px solid var(--md-sys-color-outline-variant, #e0e3e7);
  border-radius: 24px;
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.info-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(11, 87, 208, 0.1);
}

.info-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  color: var(--md-sys-color-on-surface, #1f1f1f);
}

.info-card p {
  font-size: 0.94rem;
  line-height: 1.55;
  margin: 0;
  color: var(--md-sys-color-on-surface-variant, #444746);
}

.info-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--md-sys-color-primary-container, #d3e3fd);
  color: var(--md-sys-color-on-primary-container, #041e49);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.step-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--md-sys-color-primary, #0b57d0);
  color: var(--md-sys-color-on-primary, #ffffff);
  font-weight: 700;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.site-footer {
  text-align: center;
  padding: 28px 16px 36px;
  font-size: 0.88rem;
  color: var(--md-sys-color-on-surface-variant, #444746);
  border-top: 1px solid var(--md-sys-color-outline-variant, #e0e3e7);
  margin-top: 40px;
}

@media (max-width: 820px) {
  .info-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* --- M3 FAQ Accordion --- */
.faq-list {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--md-sys-color-surface-container-low, #f8f9fa);
  border: 1px solid var(--md-sys-color-outline-variant, #e0e3e7);
  border-radius: 18px;
  padding: 16px 20px;
}

.faq-item summary {
  font-weight: 600;
  font-size: 1rem;
  color: var(--md-sys-color-on-surface, #1f1f1f);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::after {
  content: '+';
  font-size: 1.25rem;
  color: var(--md-sys-color-primary, #0b57d0);
  font-weight: 500;
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-item p {
  margin: 10px 0 0;
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--md-sys-color-on-surface-variant, #444746);
}

/* --- M3 Footer --- */
.footer-inner {
  max-width: 1080px;
  margin: 0 auto 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  text-align: left;
}

.footer-brand strong {
  font-size: 1.1rem;
  color: var(--md-sys-color-on-surface, #1f1f1f);
}

.footer-brand p {
  margin: 4px 0 0;
  font-size: 0.88rem;
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--md-sys-color-primary, #0b57d0);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
}

.footer-links a:hover {
  text-decoration: underline;
}

.footer-copy {
  margin: 0;
  font-size: 0.84rem;
}

/* --- Desktop Layout & Footer Alignment Fix --- */
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

.m3-container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  flex: 1 0 auto;
}

.search-section {
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
}

.site-footer {
  width: 100%;
  margin-top: auto;
  background: var(--md-sys-color-surface-container-low, #f8f9fa);
}

.footer-inner {
  max-width: 1120px;
  padding: 0 24px;
}

/* --- M3 Top Navigation Header --- */
.site-header {
  width: 100%;
  background: var(--md-sys-color-surface, #ffffff);
  border-bottom: 1px solid var(--md-sys-color-outline-variant, #e0e3e7);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-nav {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--md-sys-color-on-surface, #1f1f1f);
}

.nav-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-link {
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant, #444746);
}

.nav-link:hover {
  color: var(--md-sys-color-primary, #0b57d0);
}

.lang-select {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--md-sys-color-outline-variant, #e0e3e7);
  background: var(--md-sys-color-surface-container-low, #f8f9fa);
  color: var(--md-sys-color-on-surface, #1f1f1f);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
}

@media (max-width: 640px) {
  .nav-link {
    display: none;
  }
}

/* --- Reference-Style Navbar & Dropdowns (M3 Styled) --- */
.nav-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: auto;
}

.navbar-burger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
}

.navbar-burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--md-sys-color-on-surface, #1f1f1f);
  border-radius: 2px;
}

.navbar-menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  margin-left: 28px;
}

.navbar-start,
.navbar-end {
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar-item.has-dropdown {
  position: relative;
}

.navbar-link {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface, #1f1f1f);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.navbar-link::after {
  content: '▾';
  font-size: 0.8rem;
  color: var(--md-sys-color-primary, #0b57d0);
}

.navbar-link:hover {
  background: var(--md-sys-color-surface-container-low, #f1f3f4);
}

.navbar-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: var(--md-sys-color-surface, #ffffff);
  border: 1px solid var(--md-sys-color-outline-variant, #e0e3e7);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 8px;
  z-index: 200;
}

.navbar-end .navbar-dropdown {
  left: auto;
  right: 0;
}

.navbar-lang {
  min-width: 340px;
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  max-height: 360px;
  overflow-y: auto;
}

.has-dropdown:hover .navbar-dropdown,
.has-dropdown:focus-within .navbar-dropdown {
  display: block;
}

.has-dropdown:hover .navbar-lang,
.has-dropdown:focus-within .navbar-lang {
  display: grid;
}

.dropdown-item {
  display: block;
  padding: 8px 12px;
  font-size: 0.88rem;
  color: var(--md-sys-color-on-surface, #1f1f1f);
  text-decoration: none;
  border-radius: 8px;
}

.dropdown-item:hover {
  background: var(--md-sys-color-primary-container, #d3e3fd);
  color: var(--md-sys-color-on-primary-container, #041e49);
}

@media (max-width: 768px) {
  .nav-container {
    flex-wrap: wrap;
    padding: 8px 16px;
  }
  .navbar-brand {
    width: 100%;
  }
  .navbar-burger {
    display: flex;
  }
  .navbar-menu {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    margin-left: 0;
    padding: 12px 0;
    gap: 8px;
  }
  .navbar-menu.is-active {
    display: flex;
  }
  .navbar-dropdown,
  .navbar-lang {
    position: static;
    box-shadow: none;
    border: none;
    min-width: 100%;
    padding-left: 12px;
  }
}

/* --- Tighten Vertical Spacing & Collapse Unfilled Ads --- */
.search-section {
  margin-top: 40px;
  margin-bottom: 12px;
}

.ads-section {
  margin: 8px auto;
}

ins.adsbygoogle[data-ad-status="unfilled"] {
  display: none !important;
  height: 0 !important;
}

.info-section {
  margin: 28px auto;
}

/* --- Recent Searches (LocalStorage Cache, max 10 with Thumbnail Preview) --- */
.recent-searches {
  margin-top: 16px;
  text-align: left;
}

.recent-searches.hidden {
  display: none;
}

.recent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant, #444746);
  margin-bottom: 8px;
  padding: 0 4px;
}

.recent-clear {
  background: none;
  border: none;
  color: var(--md-sys-color-primary, #0b57d0);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 6px;
}

.recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 240px;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  border: 1px solid var(--md-sys-color-outline-variant, #e0e3e7);
  background: var(--md-sys-color-surface-container-low, #f8f9fa);
  color: var(--md-sys-color-on-surface, #1f1f1f);
  font-size: 0.84rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.recent-chip:hover {
  background: var(--md-sys-color-primary-container, #d3e3fd);
  border-color: var(--md-sys-color-primary, #0b57d0);
}

.recent-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.recent-thumb-icon {
  font-size: 18px;
  color: var(--md-sys-color-primary, #0b57d0);
  flex-shrink: 0;
}

.recent-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Google-Style Autocomplete Dropdown for Recent Searches --- */
.search-section {
  position: relative;
}

.recent-searches {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--md-sys-color-surface, #ffffff);
  border: 1px solid var(--md-sys-color-outline-variant, #e0e3e7);
  border-radius: 20px;
  box-shadow: 0 6px 20px rgba(32, 33, 36, 0.18);
  padding: 8px 0;
  z-index: 150;
  margin-top: 0;
}

.recent-dropdown-list {
  display: flex;
  flex-direction: column;
}

.recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 18px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.recent-row:hover {
  background: var(--md-sys-color-surface-container-low, #f1f3f4);
}

.recent-text {
  min-width: 0;
  flex: 1;
}

.recent-row .recent-title {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface, #1f1f1f);
}

.recent-url {
  font-size: 0.8rem;
  color: #1a73e8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Exact Google Single-Line Suggestion Row --- */
.recent-inline {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.9rem;
}

.recent-inline .recent-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
}

.recent-sep {
  color: #5f6368;
  margin: 0 4px;
  flex-shrink: 0;
}

.recent-inline .recent-url {
  color: #1a73e8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 2;
}

/* --- Remove all borders/lines in Google-style dropdown --- */
.recent-searches,
.recent-dropdown-list,
.recent-row {
  border: none !important;
  outline: none !important;
  box-shadow: none;
}

.recent-searches {
  box-shadow: 0 6px 20px rgba(32, 33, 36, 0.18);
}

/* --- Seamless Google Omnibox Integration --- */
.m3-search-bar.dropdown-open {
  border-radius: 24px 24px 0 0 !important;
  border-bottom-color: transparent !important;
  box-shadow: 0 4px 16px rgba(32, 33, 36, 0.18) !important;
}

.recent-searches {
  top: 100% !important;
  border-radius: 0 0 24px 24px !important;
  box-shadow: 0 8px 18px rgba(32, 33, 36, 0.18) !important;
}

.recent-match {
  font-weight: 700;
  color: var(--md-sys-color-primary, #0b57d0);
}
