/* ══ Makan AI — Poke / iMessage-style chat ══ */

.mai-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px) + 12px);
  bottom: calc(var(--nav-stack-h, 94px) + 12px);
  z-index: 195;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: #007aff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 122, 255, 0.35), 0 2px 6px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
}

.mai-fab:active {
  transform: scale(0.9);
}

.mai-fab.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

.home-hdr-ai-btn {
  width: 34px;
  height: 34px;
  border: none;
  background: rgba(0, 122, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #007aff;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  margin-left: 2px;
}

.home-hdr-ai-btn:active {
  opacity: 0.55;
}

/* Full-screen chat shell */
.mai-chat {
  position: fixed;
  inset: 0;
  z-index: 920;
  display: flex;
  flex-direction: column;
  background: #f2f2f7;
  animation: maiSlideUp 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
  max-width: 520px;
  margin: 0 auto;
  left: 0;
  right: 0;
}

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

/* iOS nav bar */
.mai-nav {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(env(safe-area-inset-top, 0px), 8px) 12px 10px;
  background: rgba(242, 242, 247, 0.92);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.12);
}

.mai-nav-back {
  width: 44px;
  height: 44px;
  border: none;
  background: none;
  color: #007aff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  margin-left: -8px;
}

.mai-nav-back:active {
  opacity: 0.45;
}

.mai-nav-contact {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mai-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ff9a56 0%, #c4682a 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--fb);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(196, 104, 42, 0.25);
}

.mai-nav-text {
  min-width: 0;
}

.mai-nav-name {
  font-size: 16px;
  font-weight: 600;
  color: #000;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.mai-nav-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: rgba(60, 60, 67, 0.6);
  margin-top: 1px;
}

.mai-nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34c759;
  flex-shrink: 0;
}

/* Message thread */
.mai-thread {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mai-day-label {
  align-self: center;
  font-size: 11px;
  font-weight: 600;
  color: rgba(60, 60, 67, 0.55);
  padding: 4px 10px;
  margin: 8px 0 4px;
  letter-spacing: 0.02em;
}

.mai-row {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  margin-bottom: 2px;
}

.mai-row--user {
  align-self: flex-end;
  align-items: flex-end;
}

.mai-row--assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.mai-bubble {
  padding: 9px 14px;
  font-size: 16px;
  line-height: 1.38;
  letter-spacing: -0.01em;
  word-break: break-word;
  position: relative;
}

.mai-row--user .mai-bubble {
  background: #007aff;
  color: #fff;
  border-radius: 18px 18px 4px 18px;
}

.mai-row--assistant .mai-bubble {
  background: #e9e9eb;
  color: #000;
  border-radius: 18px 18px 18px 4px;
}

.mai-bubble--solo {
  border-radius: 18px !important;
}

/* Link preview cards (Poke / Business Chat style) */
.mai-previews {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(100%, 280px);
  margin-top: 6px;
}

.mai-preview {
  display: flex;
  align-items: stretch;
  width: 100%;
  border: none;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  text-align: left;
  cursor: pointer;
  font-family: var(--fb);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.mai-preview:active {
  opacity: 0.88;
  transform: scale(0.985);
}

.mai-preview-thumb {
  width: 56px;
  flex-shrink: 0;
  background: linear-gradient(160deg, #fff5ee 0%, #f0e6dc 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c4682a;
}

.mai-preview-body {
  flex: 1;
  min-width: 0;
  padding: 10px 10px 10px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.mai-preview-domain {
  font-size: 10px;
  font-weight: 600;
  color: rgba(60, 60, 67, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mai-preview-title {
  font-size: 14px;
  font-weight: 600;
  color: #000;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mai-preview-sub {
  font-size: 12px;
  color: rgba(60, 60, 67, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mai-preview-chevron {
  display: flex;
  align-items: center;
  padding-right: 10px;
  color: rgba(60, 60, 67, 0.3);
  flex-shrink: 0;
}

/* Quick reply chips (iMessage Business Chat) */
.mai-replies {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(100%, 280px);
  margin-top: 8px;
}

.mai-reply {
  width: 100%;
  padding: 11px 16px;
  border-radius: 20px;
  border: none;
  background: #fff;
  color: #007aff;
  font-size: 15px;
  font-weight: 500;
  font-family: var(--fb);
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  letter-spacing: -0.01em;
}

.mai-reply:active {
  background: #f2f2f7;
}

/* Draft card */
.mai-draft {
  width: min(100%, 280px);
  margin-top: 6px;
  padding: 14px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.mai-draft-label {
  font-size: 11px;
  font-weight: 700;
  color: #c4682a;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.mai-draft-body {
  font-size: 14px;
  color: #1c1c1e;
  line-height: 1.45;
}

.mai-draft-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.mai-draft-btn {
  width: 100%;
  padding: 11px;
  border-radius: 20px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--fb);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mai-draft-btn--primary {
  background: #007aff;
  color: #fff;
}

.mai-draft-btn--ghost {
  background: #f2f2f7;
  color: #007aff;
}

.mai-draft-btn:active {
  opacity: 0.75;
}

/* Typing indicator bubble */
.mai-typing-row {
  align-self: flex-start;
}

.mai-typing-bubble {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #e9e9eb;
  border-radius: 18px 18px 18px 4px;
}

.mai-typing-bubble span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(60, 60, 67, 0.35);
  animation: maiDot 1.1s ease-in-out infinite;
}

.mai-typing-bubble span:nth-child(2) { animation-delay: 0.15s; }
.mai-typing-bubble span:nth-child(3) { animation-delay: 0.3s; }

@keyframes maiDot {
  0%, 70%, 100% { opacity: 0.35; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-3px); }
}

/* Empty / starter state */
.mai-starter {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 28px 12px;
  text-align: center;
}

.mai-starter-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ff9a56 0%, #c4682a 100%);
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(196, 104, 42, 0.28);
}

.mai-starter-title {
  font-size: 20px;
  font-weight: 700;
  color: #000;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.mai-starter-sub {
  font-size: 14px;
  color: rgba(60, 60, 67, 0.6);
  line-height: 1.5;
  max-width: 280px;
  margin-bottom: 20px;
}

.mai-starter-chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 300px;
}

/* iOS composer bar */
.mai-composer-wrap {
  flex-shrink: 0;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(242, 242, 247, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 0.5px solid rgba(60, 60, 67, 0.12);
}

.mai-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.mai-composer-field {
  flex: 1;
  display: flex;
  align-items: flex-end;
  min-height: 36px;
  padding: 7px 14px;
  background: #fff;
  border: 0.5px solid rgba(60, 60, 67, 0.15);
  border-radius: 20px;
}

.mai-inp {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--fb);
  font-size: 16px;
  line-height: 1.35;
  color: #000;
  resize: none;
  outline: none;
  max-height: 100px;
  min-height: 22px;
  padding: 0;
}

.mai-inp::placeholder {
  color: rgba(60, 60, 67, 0.35);
}

.mai-send {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  margin-bottom: 1px;
  border: none;
  border-radius: 50%;
  background: #007aff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, transform 0.15s;
}

.mai-send:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.mai-send:not(:disabled):active {
  transform: scale(0.9);
}

.mai-usage {
  font-size: 10px;
  color: rgba(60, 60, 67, 0.4);
  text-align: center;
  padding: 4px 0 0;
}

/* Rich interactive widgets */
.mai-row--rich {
  max-width: 96%;
}

.mai-widgets {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(100%, 336px);
  margin-top: 6px;
}

.mai-discovery-card,
.mai-memory-card,
.mai-goal-card,
.mai-progress-card,
.mai-leader-card {
  width: 100%;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  border: 0.5px solid rgba(60, 60, 67, 0.1);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.mai-discovery-body,
.mai-memory-body,
.mai-goal-card,
.mai-progress-card,
.mai-leader-card {
  padding: 14px;
}

.mai-map-hero,
.mai-photo-hero {
  position: relative;
  height: 214px;
  overflow: hidden;
  background: #182233;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mai-map-hero:active,
.mai-photo-hero:active {
  opacity: 0.88;
}

.mai-mini-map {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #172131;
}

.mai-mini-map .leaflet-tile-pane {
  filter: saturate(1.08) contrast(0.98) brightness(0.76);
}

.mai-mini-map .leaflet-control-container {
  display: none;
}

.mai-map-marker {
  border: none;
  background: transparent;
}

.mai-map-marker span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: #fff;
  color: #111113;
  border: 2px solid #111113;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
  font-size: 12px;
  font-weight: 850;
}

.mai-photo-hero .mai-discovery-photo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #f2f2f7;
}

.mai-map-fade,
.mai-photo-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 58%;
  z-index: 2;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.68));
  pointer-events: none;
}

.mai-map-place-pill {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.mai-map-place-title {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 780;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mai-map-place-rating {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 800;
}

.mai-discovery-eyebrow,
.mai-memory-eyebrow,
.mai-goal-eyebrow {
  font-size: 11px;
  font-weight: 750;
  color: rgba(60, 60, 67, 0.48);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 5px;
}

.mai-discovery-title,
.mai-memory-title,
.mai-goal-title,
.mai-progress-title,
.mai-leader-title {
  font-size: 18px;
  font-weight: 780;
  color: #111113;
  line-height: 1.18;
  letter-spacing: -0.03em;
}

.mai-discovery-stars {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: #ff9f0a;
}

.mai-discovery-stars span:last-child {
  color: rgba(60, 60, 67, 0.56);
  font-size: 12px;
  font-weight: 700;
}

.mai-discovery-copy,
.mai-memory-copy,
.mai-goal-copy,
.mai-progress-copy {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.42;
  color: rgba(28, 28, 30, 0.72);
}

.mai-discovery-meta,
.mai-memory-meta {
  margin-top: 6px;
  font-size: 12px;
  color: rgba(60, 60, 67, 0.52);
}

.mai-memory-card {
  display: flex;
  gap: 12px;
  padding: 14px;
}

.mai-memory-body {
  flex: 1;
  min-width: 0;
  padding: 0;
}

.mai-memory-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: linear-gradient(160deg, #fff5ee, #ffe2cb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.mai-goal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.mai-goal-score {
  padding: 7px 10px;
  border-radius: 999px;
  background: #f2f2f7;
  color: #007aff;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}

.mai-goal-track,
.mai-progress-track {
  height: 9px;
  border-radius: 999px;
  background: #f2f2f7;
  overflow: hidden;
  margin-top: 12px;
}

.mai-goal-fill,
.mai-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #007aff, #5ac8fa);
  animation: maiActionGrow 0.42s ease-out both;
}

.mai-progress-fill {
  background: linear-gradient(90deg, #ff9a56, #c4682a);
}

@keyframes maiActionGrow {
  from { width: 0 !important; }
}

.mai-progress-stats {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.mai-progress-stats span {
  flex: 1;
  min-width: 0;
  padding: 8px;
  border-radius: 12px;
  background: #f2f2f7;
  color: rgba(60, 60, 67, 0.58);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mai-progress-stats strong {
  display: block;
  color: #111113;
  font-size: 16px;
  line-height: 1.1;
  margin-bottom: 2px;
  text-transform: none;
  letter-spacing: -0.02em;
}

.mai-leader-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.mai-leader-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 9px;
  border-radius: 12px;
  background: #f2f2f7;
}

.mai-leader-rank {
  color: #007aff;
  font-size: 12px;
  font-weight: 850;
  width: 28px;
  flex-shrink: 0;
}

.mai-leader-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #111113;
  font-size: 14px;
  font-weight: 700;
}

.mai-leader-value {
  color: rgba(60, 60, 67, 0.55);
  font-size: 12px;
  font-weight: 650;
}

.mai-action-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
}

.mai-action-btn {
  width: 100%;
  min-height: 44px;
  border: none;
  border-radius: 999px;
  padding: 10px 14px;
  background: #f2f2f7;
  color: #007aff;
  font-family: var(--fb);
  font-size: 15px;
  font-weight: 720;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mai-action-btn--primary {
  background: #007aff;
  color: #fff;
}

.mai-action-btn:active {
  opacity: 0.76;
  transform: scale(0.985);
}

.mai-journey-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.82);
  border: 0.5px solid rgba(60, 60, 67, 0.1);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.mai-journey-kicker {
  font-size: 11px;
  font-weight: 700;
  color: rgba(60, 60, 67, 0.48);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}

.mai-journey-observation {
  font-size: 20px;
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: #111113;
}

.mai-journey-story {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.48;
  color: rgba(28, 28, 30, 0.72);
}

.mai-journey-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 0.5px solid rgba(60, 60, 67, 0.12);
}

.mai-journey-section-title {
  font-size: 12px;
  font-weight: 700;
  color: #1c1c1e;
  letter-spacing: -0.01em;
  margin-bottom: 9px;
}

.mai-highlight-list,
.mai-craving-list,
.mai-personality-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mai-highlight {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.mai-highlight-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: #f2f2f7;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 17px;
}

.mai-highlight-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mai-highlight-label,
.mai-highlight-meta {
  font-size: 11px;
  color: rgba(60, 60, 67, 0.52);
}

.mai-highlight-value {
  font-size: 14px;
  font-weight: 650;
  color: #111113;
  line-height: 1.25;
}

.mai-craving {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  color: #111113;
}

.mai-craving strong {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mai-craving em {
  font-style: normal;
  font-size: 11px;
  color: rgba(60, 60, 67, 0.48);
}

.mai-personality-list {
  flex-direction: row;
  flex-wrap: wrap;
}

.mai-personality-pill {
  padding: 7px 10px;
  border-radius: 999px;
  background: #f2f2f7;
  color: #1c1c1e;
  font-size: 12px;
  font-weight: 650;
}

.mai-suggestion {
  margin-top: 14px;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(160deg, #fff5ee 0%, #ffe8d6 100%);
  color: #5c3d1e;
}

.mai-suggestion-title {
  font-size: 13px;
  font-weight: 750;
  margin-bottom: 3px;
}

.mai-suggestion-body {
  font-size: 13px;
  line-height: 1.4;
  opacity: 0.78;
}

.mai-suggestion-btn {
  min-height: 44px;
  width: 100%;
  margin-top: 10px;
  border: none;
  border-radius: 999px;
  background: #007aff;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--fb);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mai-suggestion-btn:active {
  opacity: 0.78;
}

.mai-widget {
  background: #fff;
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
}

.mai-widget-title {
  font-size: 12px;
  font-weight: 700;
  color: rgba(60, 60, 67, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.mai-stat-row {
  display: flex;
  gap: 8px;
}

.mai-stat {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  background: #f2f2f7;
  border-radius: 12px;
  min-width: 0;
}

.mai-stat-val {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: #000;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.mai-stat-lbl {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: rgba(60, 60, 67, 0.55);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mai-stars {
  display: inline-flex;
  gap: 1px;
  margin: 2px 0;
}

.mai-star {
  color: rgba(60, 60, 67, 0.2);
  display: flex;
}

.mai-star--on {
  color: #ff9f0a;
}

.mai-bar-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mai-bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  color: #1c1c1e;
  margin-bottom: 4px;
  gap: 8px;
}

.mai-bar-head span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mai-bar-num {
  color: rgba(60, 60, 67, 0.45);
  font-weight: 600;
  flex-shrink: 0;
}

.mai-bar-track {
  height: 8px;
  background: #f2f2f7;
  border-radius: 4px;
  overflow: hidden;
}

.mai-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff9a56, #c4682a);
  border-radius: 4px;
  animation: maiBarGrow 0.5s ease-out both;
}

@keyframes maiBarGrow {
  from { width: 0 !important; }
}

.mai-rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mai-rank-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #f2f2f7;
  border-radius: 10px;
}

.mai-rank-n {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #007aff;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mai-rank-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #000;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mai-rank-meta {
  font-size: 11px;
  color: rgba(60, 60, 67, 0.5);
  flex-shrink: 0;
}

.mai-rating-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  height: 72px;
  padding-top: 4px;
}

.mai-rating-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.mai-rating-col-bar {
  width: 100%;
  min-height: 8px;
  background: linear-gradient(180deg, #ff9a56, #c4682a);
  border-radius: 4px 4px 2px 2px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 3px;
  animation: maiColGrow 0.45s ease-out both;
}

.mai-rating-col-bar span {
  font-size: 9px;
  font-weight: 700;
  color: #fff;
}

.mai-rating-col-lbl {
  font-size: 9px;
  color: rgba(60, 60, 67, 0.45);
  font-weight: 600;
}

@keyframes maiColGrow {
  from { height: 8px !important; }
}

.mai-carousel {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 6px;
  margin: 0 -4px;
}

.mai-carousel::-webkit-scrollbar {
  display: none;
}

.mai-tile {
  flex: 0 0 148px;
  scroll-snap-align: start;
  border: none;
  border-radius: 14px;
  padding: 14px 12px;
  text-align: left;
  font-family: var(--fb);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 130px;
}

.mai-tile--dish {
  background: linear-gradient(160deg, #fff5ee 0%, #ffe8d6 100%);
  color: #5c3d1e;
}

.mai-tile--place {
  background: linear-gradient(160deg, #eef4ff 0%, #dce8ff 100%);
  color: #1e3a5c;
}

.mai-tile:active {
  transform: scale(0.97);
}

.mai-tile-icon {
  color: inherit;
  opacity: 0.7;
  margin-bottom: 4px;
}

.mai-tile-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mai-tile-sub {
  font-size: 11px;
  opacity: 0.65;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mai-shortcut-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mai-shortcut {
  border: none;
  border-radius: 12px;
  background: #f2f2f7;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  cursor: pointer;
  font-family: var(--fb);
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.mai-shortcut:active {
  background: #e5e5ea;
}

.mai-shortcut-ico {
  color: #007aff;
}

.mai-shortcut-lbl {
  font-size: 12px;
  font-weight: 600;
  color: #000;
  line-height: 1.3;
}

@media (prefers-reduced-motion: reduce) {
  .mai-chat { animation: none; }
  .mai-typing-bubble span { animation: none; opacity: 0.6; }
  .mai-bar-fill, .mai-rating-col-bar, .mai-goal-fill, .mai-progress-fill { animation: none; }
}

[data-theme="dark"] .mai-chat {
  background: #000;
}

[data-theme="dark"] .mai-nav {
  background: rgba(28, 28, 30, 0.94);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .mai-nav-name {
  color: #fff;
}

[data-theme="dark"] .mai-row--assistant .mai-bubble,
[data-theme="dark"] .mai-typing-bubble {
  background: #3a3a3c;
  color: #fff;
}

[data-theme="dark"] .mai-preview,
[data-theme="dark"] .mai-draft,
[data-theme="dark"] .mai-reply,
[data-theme="dark"] .mai-widget {
  background: #2c2c2e;
}

[data-theme="dark"] .mai-journey-card {
  background: rgba(44, 44, 46, 0.86);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .mai-discovery-card,
[data-theme="dark"] .mai-memory-card,
[data-theme="dark"] .mai-goal-card,
[data-theme="dark"] .mai-progress-card,
[data-theme="dark"] .mai-leader-card {
  background: rgba(44, 44, 46, 0.9);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .mai-journey-observation,
[data-theme="dark"] .mai-journey-section-title,
[data-theme="dark"] .mai-highlight-value,
[data-theme="dark"] .mai-craving,
[data-theme="dark"] .mai-personality-pill,
[data-theme="dark"] .mai-discovery-title,
[data-theme="dark"] .mai-memory-title,
[data-theme="dark"] .mai-goal-title,
[data-theme="dark"] .mai-progress-title,
[data-theme="dark"] .mai-leader-title,
[data-theme="dark"] .mai-leader-name,
[data-theme="dark"] .mai-progress-stats strong {
  color: #fff;
}

[data-theme="dark"] .mai-journey-story,
[data-theme="dark"] .mai-discovery-copy,
[data-theme="dark"] .mai-memory-copy,
[data-theme="dark"] .mai-goal-copy,
[data-theme="dark"] .mai-progress-copy {
  color: rgba(235, 235, 245, 0.7);
}

[data-theme="dark"] .mai-highlight-icon,
[data-theme="dark"] .mai-personality-pill,
[data-theme="dark"] .mai-goal-score,
[data-theme="dark"] .mai-goal-track,
[data-theme="dark"] .mai-progress-track,
[data-theme="dark"] .mai-progress-stats span,
[data-theme="dark"] .mai-leader-row,
[data-theme="dark"] .mai-action-btn {
  background: #3a3a3c;
}

[data-theme="dark"] .mai-preview-title,
[data-theme="dark"] .mai-draft-body,
[data-theme="dark"] .mai-starter-title {
  color: #fff;
}

[data-theme="dark"] .mai-composer-field {
  background: #1c1c1e;
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .mai-inp {
  color: #fff;
}

[data-theme="dark"] .mai-composer-wrap {
  background: rgba(28, 28, 30, 0.96);
  border-top-color: rgba(255, 255, 255, 0.08);
}
