:root {
  color-scheme: light;
  --bg: #f8f9fa;
  --surface: #ffffff;
  --surface-alt: #f1f3f4;
  --text: #1f1f1f;
  --text-muted: #5f6368;
  --accent: #0b57d0;
  --accent-soft: #e8f0fe;
  --border: #dadce0;
  --progress: #1a73e8;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131314;
  --surface: #1f1f1f;
  --surface-alt: #2d2e30;
  --text: #e3e3e3;
  --text-muted: #9aa0a6;
  --accent: #8ab4f8;
  --accent-soft: rgba(138, 180, 248, 0.14);
  --border: #3c4043;
  --progress: #8ab4f8;
}

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

[hidden] { display: none !important; }

body {
  -webkit-font-smoothing: antialiased;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.25s ease, color 0.25s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.header-search {
  position: relative;
  flex: 1 1 240px;
  max-width: 560px;
  margin: 0 0.5rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.profile-menu {
  position: relative;
}

.country-menu {
  position: relative;
}

.country-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.country-toggle:hover { border-color: var(--accent); box-shadow: 0 1px 3px rgba(60,64,67,0.3); }

.country-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 170px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(60,64,67,0.3), 0 4px 12px rgba(60,64,67,0.25);
  padding: 0.4rem;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.country-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.flag-icon {
  width: 26px;
  height: 13px;
  flex-shrink: 0;
  border-radius: 3px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.14);
}

.country-option:hover { background: var(--surface-alt); }

.country-option.active { color: var(--accent); }

.profile-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1.05rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.profile-toggle .ico {
  width: 15px;
  height: 15px;
  color: var(--accent);
  flex-shrink: 0;
}

.profile-toggle:hover { border-color: var(--accent); }

.profile-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(600px, calc(100vw - 2rem));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(60,64,67,0.3), 0 4px 12px rgba(60,64,67,0.25);
  padding: 1.25rem;
  z-index: 80;
  text-align: left;
}

.profile-panel h3 { font-size: 1.05rem; }

@media (max-width: 720px) {
  .header-inner { flex-wrap: wrap; }
  .header-search { order: 3; flex-basis: 100%; max-width: none; margin: 0; }
}

h1 { font-size: 1.4rem; }
h1 small {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

#themeToggle {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
  width: 100%;
  flex: 1;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

select, input {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.chain-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.chain-badge {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.chain-heading h2 {
  font-size: 1.35rem;
}

.chain-intro {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: 60ch;
}

.chain-intro:empty {
  display: none;
}

.chain-intro a {
  color: var(--accent);
  font-weight: 600;
}

.chain-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  display: block;
}

.chain-badge--logo {
  width: auto;
  height: auto;
  background: none;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}

.food-img {
  width: 84px;
  height: 84px;
  object-fit: contain;
  flex-shrink: 0;
  background: var(--surface-alt);
  border-radius: 14px;
  padding: 6px;
}

.cart-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.cart-summary p { margin-bottom: 0.6rem; }

.sort-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem 1rem;
  margin: -0.5rem 0 1rem;
}

.sort-bar .control-group {
  flex: 1 1 150px;
  min-width: 0;
}

.sort-bar .sort-search {
  flex: 2 1 220px;
}

.sort-bar select,
.sort-bar input {
  width: 100%;
}

.progress-bar {
  height: 10px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.9rem;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--progress);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 1rem;
}

.menu-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.menu-card:hover {
  box-shadow: 0 1px 3px rgba(60,64,67,0.2), 0 4px 10px rgba(60,64,67,0.15);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

[data-theme="dark"] .menu-card {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .menu-card:hover {
  box-shadow: 0 1px 3px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.35);
}

.card-main {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.menu-card h3 {
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.menu-card .category {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}

.menu-card .cals {
  font-size: 1.15rem;
  font-weight: 750;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.menu-card .cals small {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 0.1rem;
}

.menu-card .qty-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  margin-left: 0.35rem;
  vertical-align: 0.1rem;
}

.macros {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.macros .mdot { opacity: 0.45; }

.macros .mp-p { color: #16a34a; }
.macros .mp-f { color: #d97706; }
.macros .mp-c { color: #2563eb; }

[data-theme="dark"] .macros .mp-p { color: #4ade80; }
[data-theme="dark"] .macros .mp-f { color: #fbbf24; }
[data-theme="dark"] .macros .mp-c { color: #60a5fa; }

.grade {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  z-index: 2;
}

.grade svg {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
}

.grade-good { background: #dcfce7; color: #15803d; }

[data-theme="dark"] .grade-good { background: rgba(34, 197, 94, 0.18); color: #4ade80; }

.cals-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 0.55rem;
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.qty-controls button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.qty-controls button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.qty-controls [data-action="inc"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.qty-controls [data-action="inc"]:hover {
  filter: brightness(1.08);
  color: #fff;
}

[data-theme="dark"] .qty-controls [data-action="inc"] { color: #fff; }

.qty-controls .qty {
  min-width: 1.6rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.btn-secondary {
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}

.disclaimer {
  margin-top: 2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

.footer-note {
  font-size: 0.75rem;
  margin-top: 0.4rem;
  opacity: 0.8;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
  justify-content: center;
  text-align: left;
  max-width: 1100px;
  margin: 1.25rem auto 0;
}

.footer-links-group {
  flex: 1 1 220px;
  max-width: 320px;
}

.footer-links-title {
  font-size: 0.8rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.footer-links-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.footer-links-list a {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links-list a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ---------- FAQ section ---------- */
.faq-section {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem 1.5rem;
}

.faq-section h2 {
  font-size: 1.15rem;
  margin-bottom: 0.9rem;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 0.6rem;
  overflow: hidden;
}

.faq-item summary {
  padding: 0.85rem 1rem;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text-muted);
  flex-shrink: 0;
}

.faq-item[open] summary::after { content: "–"; }

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item p {
  padding: 0 1rem 0.95rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
}

@media (max-width: 480px) {
  main { padding: 1rem; }
  .header-inner { padding: 0.85rem 1rem; }
}

/* Theme toggle icons */
.theme-icon {
  width: 20px;
  height: 20px;
  display: block;
}
.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* Size switcher on menu cards */
.size-select {
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  width: fit-content;
  max-width: 100%;
}

/* Profile / calorie goal calculator */
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.profile-card h3 { margin-bottom: 0.25rem; }

.profile-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem 1rem;
}

.profile-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
}

.profile-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.btn-primary {
  padding: 0.6rem 1.5rem;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn-primary:hover { filter: brightness(1.1); }

.pf-result {
  font-size: 0.95rem;
  color: var(--text);
}

.pf-result strong { color: var(--accent); }

.chain-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.1rem 0.4rem;
  width: fit-content;
}

.all-chains {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}

.chain-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.chain-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 1px 3px rgba(60,64,67,0.25), 0 4px 10px rgba(60,64,67,0.18);
}

.chain-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chain-card-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.chain-card-badge {
  width: 56px;
  height: 56px;
  font-size: 1.3rem;
  border-radius: 12px;
  box-shadow: none;
  flex-shrink: 0;
}

.chain-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  text-align: center;
}

.chain-card-count {
  font-size: 0.78rem;
  color: var(--text-muted, #8a93a3);
}

.global-search {
  position: relative;
  margin-bottom: 1rem;
}

#globalSearch {
  width: 100%;
  padding: 0.8rem 1.1rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

#globalSearch:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(60,64,67,0.3), 0 4px 12px rgba(60,64,67,0.25);
  max-height: 26rem;
  overflow-y: auto;
  padding: 0.35rem;
  z-index: 60;
}

.sr-group {
  margin: 0.35rem 0.6rem 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.sr-empty {
  margin: 0.6rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.sr-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
}

.sr-item:hover,
.sr-item:focus-visible {
  background: var(--surface-alt);
  outline: none;
}

.sr-thumb {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}

.sr-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  border-radius: 10px;
}

.sr-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sr-name {
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-kcal {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
  flex-shrink: 0;
}

/* View toggle (Menu / Builder) */
.segmented {
  display: inline-flex;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--accent);
  color: var(--accent-text, #fff);
}

/* Custom builder */
.builder {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

#builderWrap:empty { display: none; }

.builder-head {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.builder-head-l h3 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.builder-modes {
  margin-bottom: 0.6rem;
}

.builder-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.bflag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
}

.bflag input {
  width: auto;
  accent-color: var(--accent);
}

.builder-totals {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.bt-cal strong {
  font-size: 1.5rem;
  color: var(--accent);
}

.bt-cal span {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: 0.25rem;
}

.bt-macros {
  display: flex;
  gap: 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.builder-group {
  margin-bottom: 1rem;
}

.builder-group h4 {
  margin: 0 0 0.45rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.bchip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  padding: 0.45rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.bchip small {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}

.bchip.on {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--bg));
  box-shadow: 0 0 0 1px var(--accent);
}

.bchip-count {
  font-style: normal;
  font-size: 0.7rem;
  color: var(--accent);
  margin-left: 0.3rem;
}

.builder-foot {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.builder-qty {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.macro-totals {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.chain-logo.wide {
  width: auto;
  max-width: 170px;
  height: 38px;
}

.chain-card-logo.wide {
  width: auto;
  max-width: 150px;
  height: 56px;
}

.sr-thumb.wide {
  width: auto;
  max-width: 110px;
  height: 44px;
}

[data-theme="dark"] .chain-logo.invert,
[data-theme="dark"] .chain-card-logo.invert,
[data-theme="dark"] .sr-thumb.invert {
  filter: invert(1) hue-rotate(180deg);
}

/* ---------- Homepage hero ---------- */
.home-hero {
  background: linear-gradient(120deg, #0b57d0 0%, #1967d2 55%, #4285f4 100%);
  border-radius: 16px;
  padding: 2.5rem 2rem 2rem;
  margin-bottom: 1.25rem;
  color: #fff;
}
.home-hero-text { text-align: center; margin-bottom: 1.75rem; }
.home-hero-text .hero-eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.35);
  padding: 0.28rem 0.8rem;
  border-radius: 999px;
  margin-bottom: 0.85rem;
}
.home-hero-text h2 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  color: #fff;
}
.home-hero-text p { margin: 0 auto; color: rgba(255,255,255,0.8); max-width: 46ch; }

.country-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
}
.country-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 148px;
  padding: 1.35rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.country-card:hover {
  transform: translateY(-3px);
  border-color: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}
.country-card:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.country-card .cc-flag-img {
  width: 3.4rem;
  height: 1.7rem;
  border-radius: 6px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4), 0 4px 10px rgba(0, 0, 0, 0.25);
}
.country-card .cc-name { font-weight: 700; font-size: 1.02rem; }
.country-card .cc-stats {
  min-height: 1.05em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.country-card:hover .cc-stats,
.country-card:focus-visible .cc-stats {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Homepage calorie calculator ---------- */
.calc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem 1.75rem 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
}
.calc-head { margin-bottom: 1.25rem; }
.calc-head h3 { margin: 0 0 0.3rem; font-size: 1.25rem; }
.calc-head p { margin: 0; color: var(--text-muted); font-size: 0.92rem; }
.calc-current { margin-top: 0.6rem !important; font-size: 0.95rem !important; color: var(--text) !important; }
.calc-current strong { color: var(--accent); font-size: 1.15rem; }
.calc-body .profile-grid { margin-bottom: 1rem; }
.calc-body .profile-grid label {
  font-size: 0.8rem;
  text-transform: none;
}
.calc-body .profile-actions { margin-top: 0.25rem; }
@media (max-width: 640px) {
  .home-hero { padding: 2rem 1.25rem 1.6rem; }
  .home-hero-text { margin-bottom: 1.4rem; }
  .country-cards { grid-template-columns: repeat(2, 1fr); }
  .calc-card { padding: 1.25rem 1.1rem; }
}

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .header-actions {
    position: relative;
    flex: 0 0 100%;
    justify-content: flex-end;
  }
  .header-actions .country-menu { flex: 0 0 auto; margin-right: auto; }
  .header-actions .profile-menu { position: static; flex: 0 0 auto; }
  .header-actions .profile-panel { right: 0; max-width: 100%; }
  .header-actions #themeToggle { flex-shrink: 0; }
}

@media (max-width: 640px) {
  main { padding: 1rem 0.85rem; }
  .header-inner { padding: 0.8rem 0.85rem; gap: 0.5rem; }
  h1 { font-size: 1.12rem; }
  h1 small { font-size: 0.72rem; }
  .country-toggle,
  .profile-toggle { padding: 0.45rem 0.8rem; font-size: 0.82rem; }
  .profile-toggle .ico { width: 14px; height: 14px; }
  #themeToggle { width: 38px; height: 38px; }
  .header-search { flex-basis: 100%; order: 3; margin: 0; max-width: none; }

  .country-panel { min-width: 0; left: 0; right: auto; max-width: calc(100vw - 1.7rem); }
  .profile-panel { width: calc(100vw - 1.7rem); padding: 1rem; }
  #themeToggle { flex-shrink: 0; }

  .chain-heading { margin-bottom: 0.9rem; }
  .chain-heading h2 { font-size: 1.15rem; }
  .chain-badge { width: 38px; height: 38px; font-size: 0.95rem; }
  /* The fallback initials need a square badge; restaurant wordmarks do not. */
  .chain-heading .chain-badge--logo {
    width: auto;
    height: auto;
    max-width: 40%;
  }
  .chain-heading .chain-badge--logo .chain-logo {
    max-width: 100%;
    object-fit: contain;
  }
  .chain-heading h2 { min-width: 0; overflow-wrap: anywhere; }


  .cart-summary { padding: 0.85rem 1rem; margin-bottom: 1rem; }

  .sort-bar { margin: -0.35rem 0 0.9rem; gap: 0.7rem; }
  .sort-bar .control-group,
  .sort-bar .sort-search { flex: 1 1 100%; }

  .menu-grid { gap: 0.75rem; }
  .menu-card { padding: 0.75rem 0.85rem; gap: 0.75rem; }
  .food-img { width: 62px; height: 62px; border-radius: 10px; padding: 4px; }
  .menu-card h3 { font-size: 0.95rem; }
  .menu-card .cals { font-size: 1.05rem; }
  .qty-controls button { width: 30px; height: 30px; }
  .size-select { max-width: 9.5rem; }

  .builder { padding: 1rem; }
  .builder-head { flex-direction: column; gap: 0.75rem; }
  .builder-totals { align-items: flex-start; width: 100%; }

  .all-chains { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 0.6rem; }
  .chain-card { padding: 0.75rem 0.5rem; gap: 0.4rem; }
  .chain-card-logo, .chain-card-badge { width: 46px; height: 46px; }
  .chain-card-logo.wide { width: auto; max-width: 84px; height: 44px; }
  .chain-card-name { font-size: 0.85rem; }
  .chain-logo.wide { max-width: 130px; height: 32px; }
  .sr-thumb.wide { max-width: 90px; height: 36px; }

  .calc-card { padding: 1.1rem 1rem; }
  .country-cards { gap: 0.6rem; }
  .country-card { min-height: 132px; padding: 1rem 0.6rem; }

  footer { padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
}

@media (max-width: 380px) {
  .header-actions { gap: 0.4rem; }
  .header-actions .country-toggle,
  .header-actions .profile-toggle { padding-inline: 0.6rem; }
  .country-cards { grid-template-columns: 1fr; }
  .country-card { min-height: 0; flex-direction: row; justify-content: flex-start; padding: 0.85rem 1rem; }
  .cc-name { margin-left: 0.5rem; }
}
