/* Scoped tool surface; shared navigation and analytics retain their own styles. */
body[data-app="ai-flavor-detector"] {
  --bg: #f6f6ef; --surface: #fff; --surface-2: #eef2e8;
  --tx: #193e36; --tx-2: #465e54; --tx-3: #596a63;
  --line: #d9dfd4; --afd-button: #225842; --afd-button-text: #fff;
  --afd-mark: #fff0c5; --afd-mark-text: #4a3400;
  background: var(--bg); color: var(--tx);
}
html[data-theme="dark"] body[data-app="ai-flavor-detector"] {
  --bg: #14201c; --surface: #1c2c25; --surface-2: #25392d;
  --tx: #e3eee5; --tx-2: #c1d4c7; --tx-3: #b2c3b6;
  --line: #3a5042; --afd-button: #a7cfb1; --afd-button-text: #173022;
  --afd-mark: #4b3c16; --afd-mark-text: #fff0b8;
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] body[data-app="ai-flavor-detector"] {
    --bg: #14201c; --surface: #1c2c25; --surface-2: #25392d;
    --tx: #e3eee5; --tx-2: #c1d4c7; --tx-3: #b2c3b6;
    --line: #3a5042; --afd-button: #a7cfb1; --afd-button-text: #173022;
    --afd-mark: #4b3c16; --afd-mark-text: #fff0b8;
  }
}
[data-app="ai-flavor-detector"] .wrap,
[data-app="ai-flavor-detector"] .hdr-in { max-width: 1040px; }
[data-app="ai-flavor-detector"] .hact { flex: 0 0 auto; }
#afd-app { overflow-wrap: anywhere; padding: 16px 0 32px; }
#afd-app [hidden] { display: none !important; }
#afd-app h1 { font-size: clamp(26px, 4vw, 38px); line-height: 1.35; margin: 20px 0 16px; }
#afd-app h2 { font-size: 20px; line-height: 1.5; margin: 0 0 12px; }
#afd-app h3 { font-size: 17px; margin: 0 0 8px; }
#afd-app p { line-height: 1.8; margin: 8px 0 14px; }
#afd-app a { color: var(--tx); text-decoration: underline; text-underline-offset: 3px; }
.afd-brand { font-weight: 800; letter-spacing: .06em; }
.afd-brand span { font-weight: 500; }
.afd-tag { margin-left: 12px; padding: 4px 8px; font-size: 12px; background: var(--surface-2); border-radius: 4px; letter-spacing: 0; }
.afd-intro { margin-bottom: 24px; }
.afd-muted, .afd-input-meta { color: var(--tx-3); font-size: 13px; }
.afd-card { padding: 24px; margin: 20px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
#afd-app label { display: block; font-weight: 700; margin-bottom: 12px; }
#afd-language { display: block; width: 100%; max-width: 100%; min-height: 44px; margin-bottom: 20px; padding: 8px; font: inherit; font-size: 14px; background: var(--bg); color: var(--tx); border: 1px solid var(--line); border-radius: 6px; }
#afd-input { width: 100%; min-height: 210px; resize: vertical; background: var(--bg); color: var(--tx); border: 1px solid var(--line); border-radius: 8px; padding: 14px; font: inherit; line-height: 1.8; }
#afd-input::placeholder { color: var(--tx-3); opacity: 1; }
.afd-input-meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.afd-actions, .afd-samples { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.afd-samples { border-top: 1px solid var(--line); padding-top: 16px; font-size: 13px; }
#afd-app button { min-height: 44px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--tx); font: inherit; cursor: pointer; }
#afd-app button:disabled { opacity: .5; cursor: not-allowed; }
#afd-app .afd-primary { background: var(--afd-button); color: var(--afd-button-text); border-color: var(--afd-button); font-weight: 700; }
#afd-app :is(button, a, textarea, select, summary):focus-visible { outline: 3px solid var(--afd-button); outline-offset: 3px; }
.afd-status { min-height: 1.5em; color: var(--tx-2); }
.afd-summary { border-left: 4px solid var(--afd-button); scroll-margin-top: 110px; }
.afd-next { padding: 22px 24px; margin: 24px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
#afd-app .afd-next h2 { font-size: 16px; }
.afd-products { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
#afd-app .afd-products p { font-size: 14px; color: var(--tx-2); }
.afd-products a { display: inline-block; padding: 8px 0; min-height: 44px; font-size: 14px; font-weight: 600; }
.afd-directory { display: inline-block; margin-top: 12px; padding: 8px 0; font-size: 13px; min-height: 44px; }
#afd-highlight { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 2; color: var(--tx); }
#afd-app mark { color: var(--afd-mark-text); background: var(--afd-mark); border-bottom: 2px solid currentColor; padding: 1px 2px; border-radius: 2px; scroll-margin-top: 120px; }
#afd-suggestions { list-style: none; margin: 0; padding: 0; }
#afd-suggestions li { padding: 16px 0; border-top: 1px solid var(--line); }
#afd-suggestions a { display: inline-block; padding: 8px 0; min-height: 44px; font-weight: 600; }
#afd-suggestions p { font-size: 14px; color: var(--tx-2); }
.afd-method summary { cursor: pointer; padding: 8px 0; min-height: 44px; font-weight: 700; }
#afd-app .afd-method h2 { margin-top: 20px; font-size: 16px; }
.afd-method p { color: var(--tx-2); font-size: 14px; }
@media (max-width: 640px) {
  .afd-card, .afd-next { padding: 18px; }
  .afd-products { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  #afd-app h2 { font-size: 18px; }
  .afd-samples > span { width: 100%; }
  [data-app="ai-flavor-detector"] .hdr-in { gap: 8px; flex-wrap: wrap; }
  [data-app="ai-flavor-detector"] .hact { width: auto; margin-left: auto; }
}

[data-app="ai-flavor-detector"] .seg { display: flex; gap: 4px; flex-wrap: wrap; }
[data-app="ai-flavor-detector"] .seg a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 12px; }
[data-app="ai-flavor-detector"] .seg a[aria-current="page"] { font-weight: 800; background: var(--surface-2); border-radius: 6px; }
#afd-next-title { scroll-margin-top: 120px; }
