/* Self-hosted OFL Noto Sans Thai. Loaded after the original styles. */
@font-face {
  font-family: "Noto Sans Thai";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/noto-sans-thai-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Noto Sans Thai";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/noto-sans-thai-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Noto Sans Thai";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/noto-sans-thai-thai-400-normal.woff2") format("woff2");
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "Noto Sans Thai";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/noto-sans-thai-thai-700-normal.woff2") format("woff2");
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}

html, body, button, input, select, textarea {
  font-family: "Noto Sans Thai", system-ui, sans-serif;
}

:root {
  --muted: #3e4a44;
  --td-muted: #3d5248;
}

.diary-total span small,
.td-macro > span small,
.credit-card small,
.portion-row small {
  display: block;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0;
  color: var(--td-muted, #3d5248);
}

.td-date-short { display: none; }
.td-nav .nav-btn .nav-label,
.td-nav .nav-btn .nav-label span {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}
.nav-label { display: block; }
.nav-label-short { display: none; }

.credit-card, .portion-row { margin: 12px 0; }
.credit-card { padding: 16px; border-radius: 18px; background: #fff; }
.credit-card h2 { margin: 0 0 6px; font-size: 18px; }
.credit-card p, .credit-card label { color: #24352d; line-height: 1.5; }
.credit-card label { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-weight: 700; }
.portion-row { display: flex; gap: 8px; }
.portion-row button {
  flex: 1;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid #d5e0d8;
  background: #f4faf6;
  color: #0b4125;
  font-weight: 800;
}

/* Toasts sit above the tab bar so they never cover the date pill. */
#toast {
  top: auto !important;
  bottom: calc(96px + env(safe-area-inset-bottom));
  max-width: min(92vw, 440px);
  line-height: 1.45;
  text-align: center;
  transform: translate(-50%, 12px);
}
#toast.show { transform: translate(-50%, 0); }
#toast.undo-toast { bottom: calc(96px + env(safe-area-inset-bottom)); }

@media (max-width: 700px) {
  .td-shell p,
  .td-shell small,
  .td-kicker,
  .td-date-pill b,
  .diary-total span,
  .page-title,
  .date-strip,
  .muted,
  label {
    font-size: 13px !important;
    line-height: 1.5;
  }
  .td-greeting h2,
  .td-greeting p,
  .td-hero-title,
  .td-shell h1,
  .td-shell h2,
  .page-title,
  .progress-title h1,
  .ranking-topbar b,
  .ranking-topbar small {
    line-height: 1.5 !important;
    overflow: visible;
  }
  .td-brand { max-width: 108px; }
  .td-brand small {
    font-size: 8px !important;
    letter-spacing: 0 !important;
    line-height: 1.35 !important;
    white-space: normal;
    max-width: 108px;
  }
  .td-header-actions {
    min-width: 0;
    max-width: 100%;
    align-items: center;
  }
  .td-date-pill {
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    padding: 7px 10px 8px !important;
  }
  .td-date-long { display: none !important; }
  .td-date-short {
    display: inline !important;
    white-space: nowrap;
    line-height: 1.5;
  }
  .td-date-pill b {
    display: block;
    overflow: visible;
    white-space: nowrap;
    font-size: 13px !important;
    line-height: 1.5 !important;
    padding-top: 1px;
  }

  /* Water is its own row so the amount and +ml button stay on one line. */
  .td-macros {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }
  .td-macros .td-water {
    grid-column: 1 / -1;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 10px;
  }
  .td-water-open b,
  .td-macro b,
  .td-macro b small {
    white-space: nowrap;
  }
  .td-water .td-water-add {
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 76px;
  }

  .bottom-nav.td-nav {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    overflow: visible !important;
    width: 100%;
    max-width: 100%;
    height: auto !important;
    min-height: 74px;
    align-items: end;
    gap: 0 !important;
    padding: 2px 1px max(8px, env(safe-area-inset-bottom)) !important;
    contain: none;
  }
  .bottom-nav.td-nav .nav-btn {
    min-width: 0 !important;
    width: 100%;
    max-width: 100%;
    font-size: 11px !important;
    line-height: 1.4 !important;
    gap: 1px !important;
    padding: 2px 0 6px !important;
    overflow: visible;
  }
  .bottom-nav.td-nav .nav-btn > span:not(.nav-label-short):not(.nav-label-long) {
    font-size: 16px !important;
    line-height: 1.15;
  }
  .bottom-nav.td-nav .nav-btn .nav-label,
  .bottom-nav.td-nav .nav-btn .nav-label span {
    font-size: 13px !important;
    line-height: 1.45 !important;
    font-weight: 800;
  }
  .bottom-nav.td-nav .nav-label-long { display: none !important; }
  .bottom-nav.td-nav .nav-label-short {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: visible;
    line-height: 1.45;
    padding-top: 1px;
  }
  .bottom-nav.td-nav .td-nav-add .add-main {
    width: 42px !important;
    height: 42px !important;
    margin-top: -12px !important;
    font-size: 22px !important;
  }
  .td-nav-profile { display: flex !important; }
  .td-nav-motto { display: none !important; }
  .shell, .td-shell { padding-bottom: 118px !important; }

  /* Progress and ranking chips that used to scroll off a 360px screen. */
  .progress-tabs,
  .range-tabs,
  .goal-tabs,
  .editor-mode-tabs,
  .wardrobe-tabs {
    display: flex;
    flex-wrap: wrap;
    overflow: visible !important;
    gap: 6px;
  }
  .progress-tabs button,
  .range-tabs button,
  .goal-tabs button {
    flex: 0 1 auto;
    min-width: 0;
    line-height: 1.45;
    padding-top: 8px;
    padding-bottom: 8px;
  }
}

/* Five equal slots. The plus is the middle column. */
.bottom-nav.td-nav {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  transform: none !important;
  width: 100% !important;
  max-width: none !important;
  height: auto !important;
  min-height: 0 !important;
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  align-items: end !important;
  justify-items: stretch !important;
  gap: 0 !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px)) !important;
  overflow: visible !important;
  z-index: 40 !important;
}
.bottom-nav.td-nav .nav-btn {
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 0 2px !important;
  gap: 1px !important;
  overflow: visible !important;
}
.bottom-nav.td-nav .nav-btn .nav-label {
  display: block !important;
  max-width: 100%;
  font-size: 11px !important;
  font-weight: 800 !important;
  line-height: 1.25 !important;
  letter-spacing: 0 !important;
  white-space: normal !important;
  text-align: center !important;
}
.bottom-nav.td-nav .nav-label-long { display: block !important; }
.bottom-nav.td-nav .nav-label-short { display: none !important; }
.bottom-nav.td-nav .td-nav-add .add-main {
  width: 40px !important;
  height: 40px !important;
  margin-top: 0 !important;
  font-size: 22px !important;
}
.td-nav-challenge,
.challenge-entry,
.competition-tracker { display: none !important; }
html { scroll-padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)); }
.shell,
.td-shell {
  padding-bottom: calc(128px + env(safe-area-inset-bottom, 0px)) !important;
}
.td-hero:not(.td-hero-avatar) .td-hero-layout {
  grid-template-columns: minmax(120px, 170px) minmax(0, 1fr);
}
@media (max-width: 600px) {
  .td-hero:not(.td-hero-avatar) .td-hero-layout {
    grid-template-columns: 118px minmax(0, 1fr);
  }
}
@media (max-width: 360px) {
  .bottom-nav.td-nav .nav-btn .nav-label { font-size: 10px !important; }
}

@keyframes sheetIn {
  from { transform: translate3d(0, 100%, 0); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.modal { animation-duration: 240ms; }
.food-row.just-added,
.td-meal.just-added { animation: mealRowIn 220ms ease-out both; }
@keyframes mealRowIn {
  from { opacity: 0; transform: translate3d(0, 8px, 0); }
  to { opacity: 1; transform: none; }
}
.meal-sheet-kicker { margin: 0 0 8px; color: var(--td-muted, #3d5248); line-height: 1.45; }
.meal-target { display: flex; align-items: center; gap: 8px; font-weight: 800; line-height: 1.45; }
.meal-target select { flex: 1; min-width: 0; min-height: 44px; line-height: 1.45; }
.memory-tabs { flex-wrap: wrap; overflow: visible; }
.memory-tabs button { line-height: 1.45; white-space: nowrap; }
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.quick-links button { flex: 1 1 140px; min-height: 44px; line-height: 1.45; border-radius: 12px; background: #eef4ef; }
.saved-meal-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; text-align: left; padding: 12px 0; border-bottom: 1px solid var(--line, #e5e9e6); }
.saved-meal-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.saved-meal-actions button { min-height: 36px; padding: 6px 8px; border-radius: 10px; background: #e7f3ea; line-height: 1.4; }
.draft-row { display: grid; grid-template-columns: minmax(0, 1fr) 88px auto; gap: 8px; align-items: center; margin: 8px 0; }
.draft-row input { min-height: 40px; }
.draft-pick { display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left; padding: 10px 0; border-bottom: 1px solid var(--line, #e5e9e6); line-height: 1.45; }
.draft-pick small, .saved-meal-row small, .draft-row small { display: block; line-height: 1.4; }
.diary-remain { margin: 4px 0 10px; line-height: 1.45; font-weight: 800; }
.diary-remain b { font-size: 22px; color: #0b4125; }
.td-profile-open {
  display: grid !important;
  place-items: center;
  order: 5;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  background: #0b4125;
  color: #fff;
  font-weight: 800;
  line-height: 1;
}
@media (max-width: 430px) {
  .td-header-actions { gap: 6px !important; max-width: 100%; }
  .td-date-pill { width: auto !important; max-width: 112px !important; min-width: 0 !important; }
  .td-profile-open { width: 36px; height: 36px; min-width: 36px; min-height: 36px; }
}

.food-search .search { width: 100%; min-height: 48px; }
.live-food-list, .live-food-wrap { min-width: 0; }
.live-food-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line, #e5e9e6);
}
.live-food {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 64px;
  padding: 10px 0;
  border: 0;
  background: transparent;
  text-align: left;
  line-height: 1.4;
}
.live-food b, .live-food small { display: block; }
.live-food small, .own-food-form .memory-empty { color: var(--td-muted, #3d5248); }
.live-food-macros { text-align: right; flex: 0 0 auto; }
.live-food-macros b { color: #0b4125; }
.live-food-tools { display: flex; flex-direction: column; gap: 4px; }
.live-food-tools button, .amount-back {
  min-height: 32px;
  border-radius: 10px;
  background: #eef4ef;
  padding: 4px 8px;
  line-height: 1.3;
}
.amount-modes { display: flex; gap: 8px; margin: 8px 0 10px; }
.amount-modes button, .portion-row button.active {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid #d5e0d8;
  background: #f4faf6;
  color: #0b4125;
  font-weight: 800;
}
.amount-modes button.active, .portion-row button.active { background: #0b4125; color: #fff; }
.own-food-form h3 { margin: 4px 0 6px; }
.own-food-form .field { margin-top: 8px; }
.food-source { font-style: normal; font-size: 11px; font-weight: 800; color: #0b4125; background: #e7f3ea; border-radius: 999px; padding: 1px 6px; }
.meal-live-totals { background: #f4faf6; border-radius: 16px; padding: 12px 14px; margin: 8px 0 12px; }
.meal-live-totals b { display: block; font-size: 28px; color: #0b4125; line-height: 1.15; }
.meal-live-totals span, .meal-live-totals small { display: block; line-height: 1.45; }
.saved-meal-actions .saved-meal-plus {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #0b4125;
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  opacity: 1;
}
.syrup-facts, .syrup-note { margin: 8px 0; line-height: 1.5; color: #3d5248; }
.syrup-facts b { color: #0b4125; }
.syrup-wording { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.syrup-wording span { border-radius: 999px; background: #e7f3ea; color: #0b4125; padding: 4px 8px; font-size: 13px; font-weight: 800; }
.syrup-order-soft {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  border: 1px solid #c5d7cb;
  border-radius: 14px;
  background: #f7fbf8;
  color: #0b4125;
  font-weight: 700;
}
.order-channel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid #e5e9e6;
  border-radius: 14px;
  background: #fff;
  color: #0b4125;
  font-weight: 800;
  text-decoration: none;
}
.order-channel.is-soon { color: #5c6b63; background: #f4f6f4; cursor: default; }
.order-channel small { font-weight: 800; }
.round9-menu { margin: 8px 0 16px; }
.round9-menu h2 { margin: 0 0 8px; font-size: 18px; }
.home-tip h3 { margin: 14px 0 4px; font-size: 16px; }
.home-tip ol { margin: 6px 0 8px; padding-left: 1.2em; line-height: 1.55; }
.home-tip p { line-height: 1.55; }
.draft-amount { margin: 8px 0 12px; }
.nutrition-preview b { display: block; font-size: 22px; color: #0b4125; line-height: 1.2; }
#amountPreview b { display: block; font-size: 28px; color: #0b4125; line-height: 1.2; }
#amountPreview span, #amountPreview small { display: block; line-height: 1.45; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .launch-mark, .shell.screen-ready, .modal, .modal-back {
    animation: none !important;
    transform: none !important;
  }
}
