/* Clearli Premium Coach — Gemini-style mobile chat sheet */

.premium-coach-trigger {
  flex-shrink: 0;
  align-self: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: transform 0.1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.premium-coach-trigger:hover {
  transform: scale(1.08);
}

.premium-coach-trigger:active {
  transform: scale(0.94);
}

.premium-coach-trigger.is-opening {
  opacity: 0.72;
  pointer-events: none;
}

.premium-coach-trigger-lottie-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Match bento-food-insight-lottie-player (coffee lottie) scale everywhere */
.premium-coach-trigger:not(.ika-coach-trigger--flat) .premium-coach-trigger-lottie,
.premium-coach-trigger:not(.ika-coach-trigger--flat) .premium-coach-trigger-lottie-wrap dotlottie-wc {
  width: 100%;
  height: 100%;
  display: block;
  transform: scale(1.6);
  transform-origin: center center;
}

@media (max-width: 400px) {
  .premium-coach-trigger {
    width: 36px;
    height: 36px;
  }
}

body.premium-coach-open {
  overflow: hidden;
}

/* Pocket Dietician stays mounted; hide from paint/compositing while Ika is on top */
body.premium-coach-open #protocol-filter-overlay.active,
body.premium-coach-upgrade-open #protocol-filter-overlay.active {
  visibility: hidden;
  pointer-events: none;
}

body.premium-coach-open #protocol-insight-modal-overlay,
body.premium-coach-upgrade-open #protocol-insight-modal-overlay {
  visibility: hidden;
  pointer-events: none;
}

/* ── Modal shell ── */
.premium-coach-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.premium-coach-modal.is-open {
  display: flex;
}

.premium-coach-bg .clearli-gx-sky-bright-lighten {
  display: none;
}

.premium-coach-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.premium-coach-sheet {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  margin: 0;
  border-radius: 28px 28px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: premiumCoachSlideUp 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 -8px 40px rgba(245, 158, 11, 0.15);
  font-family: 'Space Mono', monospace;
}

@keyframes premiumCoachSlideUp {
  from { transform: translateY(100%); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

/* ── Lottie backdrop — uses .clearli-gx-sky-bright* from galaxies-backdrop.css (same as About) ── */
.premium-coach-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.premium-coach-bg-scrim {
  display: none !important;
}

/* ── Foreground content ── */
.premium-coach-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.premium-coach-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top, 0)) 18px 10px;
  flex-shrink: 0;
}

.premium-coach-header-text {
  min-width: 0;
  flex: 1;
}

.premium-coach-header h2 {
  margin: 0;
  font-family: 'Space Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: #1e1b4b;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 12px rgba(255, 255, 255, 0.55);
}

.premium-coach-subtitle {
  margin: 4px 0 0;
  font-family: 'Space Mono', monospace;
  color: #475569;
  font-size: 0.75rem;
  line-height: 1.4;
  font-weight: 600;
}

.premium-coach-close {
  flex-shrink: 0;
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: rgba(255, 255, 255, 0.75);
  color: #3730a3;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(49, 46, 129, 0.12);
}

/* ── Messages ── */
.premium-coach-messages-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.premium-coach-jump-latest {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 4;
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-family: 'Space Mono', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #3730a3;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 18px rgba(79, 70, 229, 0.16);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: premiumCoachJumpIn 0.2s ease;
}

.premium-coach-jump-latest:hover {
  background: #fff;
}

@keyframes premiumCoachJumpIn {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.premium-coach-messages {
  flex: 1;
  padding: 8px 16px 12px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.premium-coach-bubble {
  display: flex;
  align-items: flex-end;
  max-width: 92%;
}

.premium-coach-bubble--enter {
  animation: premiumCoachBubbleIn 0.22s ease;
}

@keyframes premiumCoachBubbleIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.premium-coach-bubble-body {
  border-radius: 20px;
  padding: 12px 16px;
  line-height: 1.55;
  font-size: 0.85rem;
  font-family: 'Space Mono', monospace;
  box-shadow: 0 2px 14px rgba(15, 23, 42, 0.06);
}

.premium-coach-bubble-body p {
  margin: 0 0 0.65em;
  white-space: pre-wrap;
  word-break: break-word;
}

.premium-coach-bubble-body p:last-child {
  margin-bottom: 0;
}

.premium-coach-bubble--assistant .premium-coach-bubble-body .premium-coach-msg-heading {
  margin-top: 0.4em;
  margin-bottom: 0.35em;
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffae00;
  letter-spacing: 0.02em;
}

.premium-coach-msg-heading {
  margin-top: 0.4em;
  margin-bottom: 0.35em;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.premium-coach-msg-heading:first-child {
  margin-top: 0;
}

.premium-coach-bubble--assistant .premium-coach-bubble-body .premium-coach-msg-label {
  font-weight: 700;
  color: #ffae00;
}

.premium-coach-msg-label {
  font-weight: 700;
}

.premium-coach-stream-placeholder {
  opacity: 0.5;
}

.premium-coach-msg-list {
  margin: 0.35em 0 0.65em;
  padding-left: 1.15em;
}

.premium-coach-msg-list li {
  margin-bottom: 0.35em;
}

.premium-coach-bubble--assistant .premium-coach-bubble-body strong {
  font-weight: 700;
  color: #ffae00;
}

.premium-coach-bubble-body strong {
  font-weight: 700;
}

/* User — Gemini-style right pill */
.premium-coach-bubble--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.premium-coach-bubble--user .premium-coach-bubble-body {
  background: linear-gradient(135deg, #60a5fa 0%, #2563eb 42%, #005eff 100%);
  color: #ffffff;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-bottom-right-radius: 6px;
  box-shadow:
    0 4px 14px rgba(0, 94, 255, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  text-shadow: 0 1px 2px rgba(0, 40, 120, 0.35);
}

.premium-coach-bubble--user .premium-coach-bubble-body strong,
.premium-coach-bubble--user .premium-coach-msg-heading,
.premium-coach-bubble--user .premium-coach-msg-label {
  color: #fef08a;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 30, 80, 0.45);
}

/* Coach — Ika */
.premium-coach-bubble--assistant {
  align-self: flex-start;
}

.premium-coach-bubble--assistant .premium-coach-bubble-body {
  background: white;
  opacity: 0.95;
  color: navy;
  border: 1.5px solid rgb(0, 28, 183);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom-left-radius: 6px;
  font-weight: 400;
}

.premium-coach-bubble--assistant .premium-coach-bubble-body p:not(.premium-coach-msg-heading),
.premium-coach-bubble--assistant .premium-coach-bubble-body li {
  font-weight: 400;
  color: navy;
}

.premium-coach-bubble--assistant .premium-coach-bubble-body p.premium-coach-msg-heading {
  color: #00810f;
  font-weight: 800;
}

.premium-coach-error {
  margin: 0 16px 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(254, 226, 226, 0.92);
  color: #991b1b;
  font-size: 0.75rem;
  font-family: 'Space Mono', monospace;
  flex-shrink: 0;
}

/* ── Composer — Gemini floating pill ── */
.premium-coach-composer-area {
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.premium-coach-footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 5px;
  padding: 2px 14px 2px;
  min-width: 0;
}

.premium-coach-footer-row .premium-coach-disclaimer-toast {
  order: 1;
  flex: 0 0 auto;
}

.premium-coach-suggestions {
  order: 2;
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.premium-coach-footer-row .premium-coach-suggestion {
  flex: 0 1 auto;
  width: auto;
  max-width: 100%;
}

.premium-coach-disclaimer-toast {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(99, 102, 241, 0.32);
  background: rgba(255, 255, 255, 0.78);
  color: #3730a3;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.15s ease, transform 0.12s ease;
}

.premium-coach-disclaimer-toast:hover {
  background: rgba(255, 255, 255, 0.94);
}

.premium-coach-disclaimer-toast:active {
  transform: scale(0.96);
}

.premium-coach-disclaimer-toast-icon {
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
}

.premium-coach-suggestion {
  flex: 0 1 auto;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  position: relative;
  margin-bottom: 4px;
  padding: 7px 11px;
  border-radius: 16px 16px 16px 6px;
  border: 1px solid rgba(196, 181, 253, 0.38);
  background: rgb(163, 130, 255);
  color: #ffffff;
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  display: inline-block;
  box-sizing: border-box;
  box-shadow:
    0 2px 8px rgba(91, 33, 182, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.12s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.premium-coach-suggestion:hover:not(:disabled) {
  transform: translateY(-1px);
}

.premium-coach-suggestion:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 520px) {
  .premium-coach-footer-row {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding-top: 0;
  }

  .premium-coach-disclaimer-toast {
    align-self: flex-start;
  }

  .premium-coach-suggestions {
    width: 100%;
  }

  .premium-coach-suggestion {
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 5px;
    max-width: 100%;
    width: auto;
  }
}

.premium-coach-disclaimer-overlay[hidden] {
  display: none !important;
}

.premium-coach-disclaimer-overlay:not([hidden]) {
  display: flex;
}

.premium-coach-disclaimer-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(49, 46, 129, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.premium-coach-disclaimer-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.premium-coach-disclaimer-dialog {
  width: min(360px, 100%);
  padding: 22px 20px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(99, 102, 241, 0.28);
  text-align: center;
}

.premium-coach-disclaimer-dialog h3 {
  margin: 0 0 12px;
  font-family: 'Space Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e1b4b;
}

.premium-coach-disclaimer-dialog p {
  margin: 0 0 18px;
  font-family: 'Space Mono', monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #475569;
  text-align: left;
}

.premium-coach-disclaimer-close {
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #fff;
  font-family: 'Space Mono', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.premium-coach-composer {
  flex-shrink: 0;
  padding: 0 14px 12px;
}

.premium-coach-composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(99, 102, 241, 0.22);
  box-shadow:
    0 4px 24px rgba(79, 70, 229, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.premium-coach-composer textarea {
  flex: 1;
  resize: none;
  min-height: 28px;
  max-height: 200px;
  overflow-y: hidden;
  border: none;
  padding: 8px 0;
  font-family: 'Space Mono', monospace;
  font-size: 1rem;
  line-height: 1.4;
  background: transparent;
  color: #1e1b4b;
  outline: none;
}

.premium-coach-composer textarea::placeholder {
  color: #64748b;
}

.premium-coach-send {
  flex-shrink: 0;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.premium-coach-send:hover:not(:disabled) {
  transform: scale(1.04);
}

.premium-coach-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.premium-coach-send.is-streaming .premium-coach-send-icon {
  animation: premiumCoachPulse 1s ease infinite;
}

@keyframes premiumCoachPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ── Tablet / desktop ── */
@media (min-width: 768px) {
  .premium-coach-modal {
    align-items: center;
    padding: 24px;
  }

  .premium-coach-sheet {
    width: min(520px, 100%);
    height: min(96dvh, 920px);
    max-height: min(96dvh, 920px);
    border-radius: 28px;
  }

  .premium-coach-messages {
    padding: 12px 20px 16px;
  }

  .premium-coach-bubble {
    max-width: 85%;
  }
}

/* ── Night mode ── */
body.night-mode .premium-coach-backdrop {
  background: rgba(77, 50, 159, 0.754);
}

body.night-mode .premium-coach-sheet {
  box-shadow: 0 -8px 40px rgba(46, 139, 87, 0.18);
}

body.night-mode .premium-coach-bg.clearli-gx-sky-bright {
  background: linear-gradient(165deg, #1a4d38 0%, #134e35 45%, #0d3324 100%);
}

body.night-mode .premium-coach-bg .clearli-gx-sky-bright-lighten {
  display: none;
}

body.night-mode .premium-coach-bg {
  background: linear-gradient(165deg, #1a4d38 0%, #134e35 45%, #0d3324 100%);
}

body.night-mode .premium-coach-bg-lighten,
body.night-mode .premium-coach-bg-scrim {
  display: none;
}

body.night-mode .premium-coach-header h2 {
  color: #ecfdf5;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.15);
}

body.night-mode .premium-coach-subtitle {
  color: rgba(167, 243, 208, 0.65);
}

body.night-mode .premium-coach-close {
  background: rgba(15, 40, 32, 0.85);
  color: #a7f3d0;
  border: none;
  box-shadow: none;
}

body.night-mode .premium-coach-bubble--user .premium-coach-bubble-body {
  background: linear-gradient(135deg, #1a7a52 0%, #2E8B57 100%);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
}

body.night-mode .premium-coach-bubble--assistant .premium-coach-bubble-body {
  background: linear-gradient(
    145deg,
    rgba(22, 48, 36, 0.58) 0%,
    rgba(10, 28, 22, 0.65) 100%
  );
  color: #ecfdf5;
  border: 1px solid rgba(167, 243, 208, 0.22);
  backdrop-filter: blur(10px) saturate(1.08);
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
  box-shadow:
    0 4px 18px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

body.night-mode .premium-coach-bubble--assistant .premium-coach-bubble-body p:not(.premium-coach-msg-heading),
body.night-mode .premium-coach-bubble--assistant .premium-coach-bubble-body li {
  font-weight: 400;
  color: #f0fdf4;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}

body.night-mode .premium-coach-bubble--assistant .premium-coach-bubble-body p.premium-coach-msg-heading {
  color: #ffae00;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

body.night-mode .premium-coach-bubble--assistant .premium-coach-bubble-body .premium-coach-msg-heading,
body.night-mode .premium-coach-bubble--assistant .premium-coach-bubble-body .premium-coach-msg-label,
body.night-mode .premium-coach-bubble--assistant .premium-coach-bubble-body strong {
  color: #ffae00;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

body.night-mode .premium-coach-composer-inner {
  background: rgba(15, 40, 32, 0.92);
  border-color: rgba(74, 222, 128, 0.2);
}

body.night-mode .premium-coach-composer textarea {
  color: #ecfdf5;
}

body.night-mode .premium-coach-composer textarea::placeholder {
  color: #64748b;
}

body.night-mode .premium-coach-send {
  background: linear-gradient(145deg, #2E8B57, #3CB371);
}

body.night-mode .premium-coach-jump-latest {
  color: #0f5132;
  box-shadow: 0 4px 18px rgba(15, 81, 50, 0.18);
}

body.night-mode .premium-coach-disclaimer-overlay {
  background: rgba(8, 28, 22, 0.52);
}

body.night-mode .premium-coach-disclaimer-close {
  background: linear-gradient(145deg, #2E8B57, #3CB371);
}

body.night-mode .premium-coach-disclaimer-toast {
  background: rgba(8, 24, 18, 0.75);
  border-color: rgba(74, 222, 128, 0.25);
  color: rgba(236, 253, 245, 0.9);
}

body.night-mode .premium-coach-suggestion {
  background: rgba(15, 40, 32, 0.94);
  border-color: rgba(74, 222, 128, 0.35);
  color: #ecfdf5;
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body.night-mode .premium-coach-suggestion::after {
  background: rgba(15, 40, 32, 0.94);
  border-right-color: rgba(74, 222, 128, 0.35);
  border-bottom-color: rgba(74, 222, 128, 0.35);
}

body.night-mode .premium-coach-disclaimer-dialog {
  background: rgba(15, 40, 32, 0.98);
  border-color: rgba(74, 222, 128, 0.22);
}

body.night-mode .premium-coach-disclaimer-dialog h3 {
  color: #ecfdf5;
}

body.night-mode .premium-coach-disclaimer-dialog p {
  color: rgba(167, 243, 208, 0.88);
}

/* ── Trigger slots ── */
.bento-coach-slot {
  display: inline-flex;
  align-items: center;
}

.bento-coach-slot--with-hint {
  position: relative;
  flex-direction: column;
  align-items: center;
  overflow: visible;
}

.ftm-ika-hint-bubble {
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  z-index: 2;
  padding: 2px 5px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(34, 0, 255, 0.22);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  color: #2200ff;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%) scale(0.55) translateY(4px);
  transform-origin: center bottom;
  animation: ftm-ika-hint-pop 0.42s cubic-bezier(0.34, 1.4, 0.64, 1) 0.55s forwards;
}

.ftm-ika-hint-bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid rgba(255, 255, 255, 0.96);
  filter: drop-shadow(0 1px 0 rgba(34, 0, 255, 0.12));
}

.ftm-ika-hint-bubble.is-dismissed {
  animation: ftm-ika-hint-out 0.2s ease forwards;
}

@keyframes ftm-ika-hint-pop {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.55) translateY(4px);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) scale(1) translateY(0);
  }
}

@keyframes ftm-ika-hint-out {
  to {
    opacity: 0;
    transform: translateX(-50%) scale(0.8) translateY(-2px);
  }
}

body.night-mode .ftm-ika-hint-bubble {
  background: rgba(30, 41, 59, 0.96);
  border-color: rgba(129, 140, 248, 0.35);
  color: #c7d2fe;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

body.night-mode .ftm-ika-hint-bubble::after {
  border-top-color: rgba(30, 41, 59, 0.96);
}

.protocol-coach-slot {
  display: flex;
  justify-content: center;
  align-items: center;
  width: auto;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}

.protocol-coach-slot .premium-coach-trigger {
  width: 44px;
  height: 44px;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
  filter: none;
}

.protocol-coach-slot .premium-coach-trigger-lottie-wrap {
  width: 44px;
  height: 44px;
  overflow: visible;
}

.protocol-coach-slot .premium-coach-trigger-lottie-wrap dotlottie-wc,
.protocol-coach-slot .premium-coach-trigger-lottie {
  width: 100%;
  height: 100%;
  display: block;
  transform: scale(2.3);
  transform-origin: center center;
}

/* ── Shared Ika trigger slots (Clear Guide, food log custom, etc.) ──
   Flat trigger = no circular clip / overflow:hidden on the coach button. */
.spotting-fake-modal__ika-slot,
.fl-custom-coach-slot.spotting-fake-modal__ika-slot {
  flex: 0 0 100px;
  width: 100px;
  height: 100px;
  min-width: 100px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  overflow: visible;
}

.ika-coach-trigger--flat {
  width: 100px !important;
  height: 100px !important;
  min-width: 100px !important;
  min-height: 100px !important;
  max-width: 100px !important;
  max-height: 100px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  overflow: visible !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: transparent !important;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.28));
  flex-shrink: 0 !important;
}

.ika-coach-trigger--flat:hover,
.ika-coach-trigger--flat:active,
.ika-coach-trigger--flat.is-opening {
  transform: none !important;
}

.ika-coach-trigger--flat .premium-coach-trigger-lottie-wrap {
  display: block !important;
  width: 100px !important;
  height: 100px !important;
  min-width: 100px !important;
  min-height: 100px !important;
  overflow: visible !important;
  flex-shrink: 0 !important;
  pointer-events: none;
}

.ika-coach-trigger--flat .premium-coach-trigger-lottie-wrap dotlottie-wc,
.ika-coach-trigger--flat .premium-coach-trigger-lottie {
  width: 100px !important;
  height: 100px !important;
  min-width: 100px !important;
  min-height: 100px !important;
  max-width: 100px !important;
  max-height: 100px !important;
  display: block !important;
  transform: none !important;
  transform-origin: center center;
  aspect-ratio: 1;
  flex-shrink: 0 !important;
}

@media (max-width: 400px) {
  .spotting-fake-modal__ika-slot,
  .fl-custom-coach-slot.spotting-fake-modal__ika-slot {
    flex: 0 0 100px;
    width: 100px;
    height: 100px;
    min-width: 100px;
    min-height: 100px;
  }

  .ika-coach-trigger--flat,
  .ika-coach-trigger--flat .premium-coach-trigger-lottie-wrap,
  .ika-coach-trigger--flat .premium-coach-trigger-lottie-wrap dotlottie-wc {
    width: 100px !important;
    height: 100px !important;
    min-width: 100px !important;
    min-height: 100px !important;
  }
}

/* Pocket Dietician — protocol description card (matches blue protocol blocks) */
.protocol-filter-modal .protocol-foods-description,
.protocol-filter-modal #protocol-foods-description {
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.5;
  background: linear-gradient(135deg, #60a5fa 0%, #2563eb 42%, #005eff 100%);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow:
    0 4px 14px rgba(0, 94, 255, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  text-align: left;
}

.protocol-filter-modal .protocol-foods-description-text {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 40, 120, 0.35);
}

.protocol-coach-slot + #protocol-foods-grid-view .protocol-foods-grid {
  padding-top: 0;
}

.fl-coach-slot {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
}

.fl-topbar {
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ── Medical disclaimer (legacy — replaced by toast in composer footer) ── */
.premium-coach-disclaimer {
  display: none;
}

body.night-mode .premium-coach-disclaimer {
  display: none;
}

/* ── Subscribe upsell (lifetime teaser exhausted) — bright blue · Space Mono ── */
.premium-coach-upgrade-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + env(safe-area-inset-top, 0px))
    calc(16px + env(safe-area-inset-right, 0px))
    calc(16px + env(safe-area-inset-bottom, 0px))
    calc(16px + env(safe-area-inset-left, 0px));
  box-sizing: border-box;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease;
  font-family: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.premium-coach-upgrade-modal.is-open {
  pointer-events: auto;
  opacity: 1;
}

.premium-coach-upgrade-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(186, 230, 253, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.premium-coach-upgrade-card {
  position: relative;
  width: min(400px, 100%);
  padding: 28px 24px 22px;
  border-radius: 22px;
  background: linear-gradient(165deg, #f0f9ff 0%, #dbeafe 48%, #bfdbfe 100%);
  border: 2px solid rgba(59, 130, 246, 0.42);
  box-shadow:
    0 16px 48px rgba(37, 99, 235, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.65) inset;
  text-align: center;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.24s cubic-bezier(0.34, 1.2, 0.64, 1);
  overflow: hidden;
  font-family: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.premium-coach-upgrade-illustration {
  position: relative;
  z-index: 1;
  display: block;
  width: min(140px, 42vw);
  height: auto;
  margin: 0 auto 10px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(37, 99, 235, 0.2));
}

.premium-coach-upgrade-eyebrow {
  position: relative;
  z-index: 1;
  margin: 0 0 6px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #2563eb;
}


.premium-coach-trial-pill {
  margin: 6px 0 0;
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #065f46;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

body.night-mode .premium-coach-trial-pill {
  color: #ecfdf5;
  background: rgba(15, 61, 42, 0.65);
  border-color: rgba(74, 222, 128, 0.25);
}

.premium-coach-upgrade-modal.is-open .premium-coach-upgrade-card {
  transform: translateY(0) scale(1);
}

.premium-coach-upgrade-card h2 {
  position: relative;
  z-index: 1;
  margin: 0 0 10px;
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  color: #1e3a8a;
  letter-spacing: -0.03em;
}

.premium-coach-upgrade-lead {
  position: relative;
  z-index: 1;
  margin: 0 0 20px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.55;
  color: rgba(30, 58, 138, 0.82);
}

.premium-coach-upgrade-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.premium-coach-upgrade-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: 999px;
  font-family: inherit;
  background: linear-gradient(135deg, #60a5fa 0%, #2563eb 42%, #005eff 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow:
    0 4px 14px rgba(0, 94, 255, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.premium-coach-upgrade-dismiss {
  padding: 8px 16px;
  border: none;
  background: transparent;
  font-family: inherit;
  color: rgba(37, 99, 235, 0.65);
  font-size: 0.82rem;
  font-weight: 400;
  cursor: pointer;
}

body.night-mode .premium-coach-upgrade-backdrop {
  background: rgba(15, 23, 42, 0.72);
}

body.night-mode .premium-coach-upgrade-eyebrow {
  color: #93c5fd;
}

body.night-mode .premium-coach-upgrade-card {
  background: linear-gradient(165deg, #1e3a8a 0%, #1d4ed8 45%, #2563eb 100%);
  border-color: rgba(147, 197, 253, 0.35);
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

body.night-mode .premium-coach-upgrade-card h2 {
  color: #f0f9ff;
}

body.night-mode .premium-coach-upgrade-lead {
  color: rgba(219, 234, 254, 0.88);
}

body.night-mode .premium-coach-upgrade-dismiss {
  color: rgba(191, 219, 254, 0.65);
}

body.premium-coach-upgrade-open {
  overflow: hidden;
}

/* ── Launch failure toast ── */
.premium-coach-notice {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(12px);
  z-index: 10060;
  max-width: min(340px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(15, 40, 32, 0.92);
  color: #ecfdf5;
  font-size: 0.85rem;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.premium-coach-notice.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
