
:root{
  --mtm-bg: #ffffff;
  --mtm-ink: #111827;
  --mtm-muted: #6b7280;
  --mtm-line: rgba(17,24,39,.08);
  --mtm-shadow: 0 10px 30px rgba(17,24,39,.08);
  --mtm-radius: 18px;

  --mtm-primary: #ff6a3d;
  --mtm-primary-2: #ff8a3d;
  --mtm-green: #16a34a;
  --mtm-red: #ef4444;
  --mtm-blue: #2563eb;
  --mtm-chip: rgba(17,24,39,.05);

  --mtm-max: 520px;
}

.mtm-app{
  width: 100%;
  display:flex;
  justify-content:center;
  padding: 18px 12px 88px;
  background: radial-gradient(1200px 600px at 20% 0%, rgba(255, 106, 61, .12), transparent 60%),
              radial-gradient(1200px 600px at 80% 10%, rgba(34, 197, 94, .10), transparent 55%),
              #fff;
  color: var(--mtm-ink);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

.mtm-shell{
  width: min(100%, var(--mtm-max));
  position: relative;
}

.mtm-topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--mtm-line);
  border-radius: 16px;
  box-shadow: var(--mtm-shadow);
}

.mtm-brand{
  display:flex;
  align-items:center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.mtm-logo{ font-size: 20px; }
.mtm-title{ font-size: 16px; }

.mtm-context{
  display:flex; gap: 8px; align-items:center;
}
.mtm-chip{
  font-size: 12px;
  padding: 6px 10px;
  background: var(--mtm-chip);
  border: 1px solid var(--mtm-line);
  border-radius: 999px;
  color: #111827;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mtm-main{ margin-top: 12px; }

.mtm-card{
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(10px);
  border: 1px solid var(--mtm-line);
  border-radius: var(--mtm-radius);
  box-shadow: var(--mtm-shadow);
  padding: 16px;
}

.mtm-hero h2{
  margin: 2px 0 6px;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.mtm-hero p{
  margin: 0 0 14px;
  color: var(--mtm-muted);
  font-size: 13.5px;
}

.mtm-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mtm-mood, .mtm-type{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 14px 14px;
  border-radius: 16px;
  border: 1px solid var(--mtm-line);
  background: rgba(255,255,255,.85);
  box-shadow: 0 8px 18px rgba(17,24,39,.06);
  cursor:pointer;
  transition: transform .08s ease, box-shadow .08s ease, border-color .12s ease;
  text-align:left;
}
.mtm-mood:hover, .mtm-type:hover{ transform: translateY(-1px); box-shadow: 0 14px 28px rgba(17,24,39,.08); }
.mtm-mood:active, .mtm-type:active{ transform: translateY(0px) scale(.99); }
.mtm-mood-emoji, .mtm-type-emoji{ font-size: 22px; }
.mtm-mood-text, .mtm-type-text{ font-weight: 700; font-size: 14px; }

.mtm-form{ display:flex; flex-direction:column; gap: 10px; }
.mtm-label{ font-size: 12px; color: var(--mtm-muted); margin-top: 4px; }
.mtm-input{
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--mtm-line);
  background: rgba(255,255,255,.9);
  outline: none;
}
.mtm-input:focus{ border-color: rgba(255,106,61,.45); box-shadow: 0 0 0 4px rgba(255,106,61,.12); }

.mtm-row{ display:flex; flex-wrap:wrap; gap: 8px; }
.mtm-pill{
  border-radius: 999px;
  border: 1px solid var(--mtm-line);
  background: rgba(255,255,255,.9);
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
}
.mtm-pill.active{
  border-color: rgba(255,106,61,.45);
  box-shadow: 0 0 0 4px rgba(255,106,61,.12);
  background: rgba(255,106,61,.10);
}

.mtm-cta{
  display:flex;
  gap: 10px;
  justify-content:center;
  margin-top: 14px;
}
.mtm-cta.split{
  justify-content:space-between;
  gap: 10px;
}

.mtm-btn{
  border: 1px solid var(--mtm-line);
  background: rgba(255,255,255,.9);
  color: var(--mtm-ink);
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 800;
  cursor:pointer;
  transition: transform .08s ease, box-shadow .08s ease, background .12s ease;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  text-decoration:none;
  user-select:none;
}
.mtm-btn:hover{ transform: translateY(-1px); box-shadow: 0 14px 26px rgba(17,24,39,.10); }
.mtm-btn:active{ transform: translateY(0px) scale(.99); }
.mtm-btn:disabled{ opacity:.65; cursor:not-allowed; transform:none; box-shadow:none; filter:none; }

.mtm-btn.primary{
  border: none;
  color: white;
  background: linear-gradient(135deg, var(--mtm-primary), var(--mtm-primary-2));
}
.mtm-btn.ghost{
  background: rgba(255,255,255,.75);
}
.mtm-btn.cook{
  flex: 1;
  background: rgba(17,24,39,.04);
}
.mtm-btn.order{
  flex: 1;
  border: none;
  color: white;
  background: linear-gradient(135deg, var(--mtm-green), #22c55e);
}
.mtm-btn.eat{
  border:none;
  color:white;
  background: linear-gradient(135deg, #fb7185, #ef4444);
  flex:1;
}
.mtm-btn.pass{
  background: rgba(17,24,39,.06);
  flex:1;
}

.mtm-loading{
  display:flex;
  align-items:center;
  gap: 14px;
  padding: 12px;
}
.mtm-spinner{
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(17,24,39,.10);
  border-top-color: rgba(255,106,61,.95);
  animation: mtmspin 1s linear infinite;
}
@keyframes mtmspin { to { transform: rotate(360deg); } }

.mtm-meal .mtm-badges{ display:flex; flex-wrap:wrap; gap: 8px; margin-bottom: 10px; }
.mtm-badge{
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--mtm-line);
  background: rgba(255,255,255,.85);
  font-weight: 800;
}
.mtm-badge.subtle{ color: var(--mtm-muted); font-weight: 700; }

.mtm-meal-img{
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--mtm-line);
  box-shadow: 0 18px 38px rgba(17,24,39,.12);
  margin: 6px 0 12px;
  object-fit: cover;
  aspect-ratio: 1 / 1;
}
.mtm-meal-img.ph{
  display:flex; align-items:center; justify-content:center;
  background: rgba(17,24,39,.04);
  color: var(--mtm-muted);
  height: 320px;
}

.mtm-meal-title{ margin: 0 0 6px; font-size: 22px; letter-spacing:-0.02em; }
.mtm-meal-desc{ margin: 0 0 6px; color: var(--mtm-muted); }
.mtm-meal-why{ margin: 0 0 10px; font-weight: 700; }

.mtm-note{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,106,61,.08);
  border: 1px solid rgba(255,106,61,.18);
  color: #7c2d12;
  font-size: 12.5px;
}

.mtm-error h2{ margin: 4px 0 8px; }
.mtm-error p{ margin: 0 0 10px; color: var(--mtm-muted); }

.mtm-muted{ color: var(--mtm-muted); }

.mtm-bottomnav{
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--mtm-line);
  display:flex;
  justify-content:center;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  z-index: 9999;
}
.mtm-bottomnav .mtm-navbtn{
  width: min(140px, 20%);
  max-width: 140px;
  border: 1px solid transparent;
  background: transparent;
  padding: 8px 10px;
  border-radius: 14px;
  cursor:pointer;
  display:flex;
  flex-direction:column;
  gap: 3px;
  align-items:center;
  color: var(--mtm-muted);
  font-weight: 800;
}
.mtm-bottomnav .mtm-navbtn .mtm-ico{ font-size: 18px; }
.mtm-bottomnav .mtm-navbtn .mtm-lbl{ font-size: 11px; }
.mtm-bottomnav .mtm-navbtn.active{
  color: var(--mtm-ink);
  background: rgba(255,106,61,.12);
  border-color: rgba(255,106,61,.22);
}

.mtm-gamecard{
  display:grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  align-items:stretch;
}
.mtm-gamecard img{
  width: 120px; height: 120px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid var(--mtm-line);
}
.mtm-gamebody h3{ margin: 0 0 6px; font-size: 16px; }
.mtm-gamebody p{ margin: 0 0 10px; }

.mtm-ep img{
  width:100%;
  border-radius:16px;
  aspect-ratio: 4 / 3;
  object-fit:cover;
  border: 1px solid var(--mtm-line);
  box-shadow: 0 18px 38px rgba(17,24,39,.12);
}
.mtm-ep-title{
  margin-top: 10px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.mtm-ep-actions{
  display:flex; gap: 10px; margin-top: 10px;
}

.mtm-tt{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}
.mtm-tt-card{
  border: 1px solid var(--mtm-line);
  background: rgba(255,255,255,.9);
  border-radius: 16px;
  overflow:hidden;
  cursor:pointer;
  box-shadow: 0 10px 22px rgba(17,24,39,.08);
  text-align:left;
  padding: 0;
}
.mtm-tt-card img{
  width:100%;
  height: 150px;
  object-fit: cover;
  display:block;
}
.mtm-tt-title{
  padding: 10px 10px 12px;
  font-weight: 900;
  font-size: 13px;
}

.mtm-saved-list{
  display:flex;
  flex-direction:column;
  gap: 10px;
  margin-top: 10px;
}
.mtm-saved{
  display:grid;
  grid-template-columns: 86px 1fr;
  gap: 10px;
  align-items:stretch;
  padding: 10px;
  border: 1px solid var(--mtm-line);
  border-radius: 16px;
  background: rgba(255,255,255,.9);
}
.mtm-saved img{
  width: 86px; height: 86px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--mtm-line);
}
.mtm-saved.ph{
  width: 86px; height: 86px;
  border-radius: 14px;
  background: rgba(17,24,39,.05);
}
.mtm-saved-title{ font-weight: 900; margin-bottom: 4px; }

.mtm-ol{
  margin: 6px 0 12px;
  padding-left: 18px;
}
.mtm-ol li{ margin-bottom: 6px; color: #111827; }

.mtm-toast{
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%) translateY(10px);
  opacity: 0;
  background: rgba(17,24,39,.92);
  color: white;
  padding: 10px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  z-index: 10000;
  transition: opacity .18s ease, transform .18s ease;
}
.mtm-toast.show{
  opacity: 1;
  transform: translateX(-50%) translateY(0px);
}

/* Desktop enhancements */
@media (min-width: 900px){
  .mtm-app{ padding-bottom: 28px; }
  .mtm-bottomnav{
    left: auto; right: auto;
    width: min(720px, 92vw);
    border: 1px solid var(--mtm-line);
    border-radius: 18px;
    bottom: 16px;
    margin: 0 auto;
    box-shadow: var(--mtm-shadow);
  }
}


/* Search bar (optional) */
.mtm-searchbar{
  display:flex;
  align-items:center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(10px);
  border: 1px solid var(--mtm-line);
  border-radius: 16px;
  box-shadow: var(--mtm-shadow);
}
.mtm-search{
  flex: 1;
  border: 1px solid var(--mtm-line);
  background: rgba(255,255,255,.9);
  border-radius: 999px;
  padding: 10px 12px;
  outline: none;
}
.mtm-search:focus{ border-color: rgba(255,106,61,.45); box-shadow: 0 0 0 4px rgba(255,106,61,.12); }
.mtm-searchbtn{
  border: none;
  border-radius: 999px;
  padding: 10px 12px;
  font-weight: 900;
  cursor:pointer;
  background: rgba(17,24,39,.06);
}

/* Full-screen app feel */
.mtm-app{ min-height: 100vh; }
.mtm-shell{ min-height: calc(100vh - 88px); display:flex; flex-direction:column; }
.mtm-main{ flex: 1; display:flex; flex-direction:column; }
.mtm-card{ flex: 1; }


/* Selected state */
.mtm-mood, .mtm-type { position: relative; }
.mtm-check{
  position:absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  border-radius: 999px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  background: rgba(255,106,61,.14);
  border: 1px solid rgba(255,106,61,.22);
  color: #7c2d12;
  opacity: 0;
}
.mtm-mood.active, .mtm-type.active{
  border-color: rgba(255,106,61,.38);
  box-shadow: 0 0 0 4px rgba(255,106,61,.12), 0 14px 28px rgba(17,24,39,.10);
  background: rgba(255,106,61,.06);
}
.mtm-mood.active .mtm-check, .mtm-type.active .mtm-check{ opacity: 1; }

.mtm-app button{ pointer-events: auto; }

/* TikTok import + modal */
.mtm-tt-importbar{
  position: sticky;
  bottom: 64px;
  display:flex;
  justify-content:center;
  padding: 10px 14px;
  z-index: 20;
}
.mtm-tt-link{
  background: rgba(255,255,255,.75);
  border: 1px solid rgba(0,0,0,.06);
  color: #1f2937;
  font-weight: 800;
  padding: 10px 12px;
  border-radius: 14px;
  box-shadow: 0 10px 26px rgba(0,0,0,.08);
  backdrop-filter: blur(10px);
}
.mtm-tt-i{ opacity:.85; margin:0 4px; }

.mtm-modal{ display:none; position:fixed; inset:0; z-index:9999; }
.mtm-modal.open{ display:block; }
.mtm-modal-backdrop{ position:absolute; inset:0; background: rgba(0,0,0,.35); }
.mtm-modal-card{
  position: absolute;
  left:50%; top:50%;
  transform: translate(-50%,-50%);
  width: min(92vw, 420px);
  background: rgba(255,255,255,.92);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  overflow:hidden;
}
.mtm-modal-head{
  display:flex; align-items:center; justify-content:space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.mtm-modal-title{ font-weight: 900; font-size: 16px; }
.mtm-iconbtn{ border:none; background:transparent; font-size:18px; padding:6px 8px; border-radius:10px; }
.mtm-modal-body{ padding: 14px 16px 16px; }
.mtm-label{ font-size: 13px; font-weight: 800; opacity:.85; display:block; margin-bottom:6px; }
.mtm-input{
  width:100%; padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.12);
  outline: none;
  background: rgba(255,255,255,.9);
}
.mtm-btn.primary{ font-weight: 900; }

.mtm-tt-list{ display:flex; flex-direction:column; gap:10px; margin-top:10px; }
.mtm-tt-item{
  display:flex; align-items:center; gap:12px;
  padding: 10px 10px;
  border-radius: 16px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(0,0,0,.06);
}
.mtm-tt-thumb{ width: 54px; height: 54px; border-radius: 14px; object-fit: cover; background:#f3f4f6; }
.mtm-tt-meta{ flex:1; min-width:0; }
.mtm-tt-title{ font-weight: 900; font-size: 13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mtm-tt-sub{ font-size: 12px; opacity:.75; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mtm-tt-chip{
  display:inline-flex; align-items:center;
  padding: 4px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 900;
  background: rgba(255, 176, 120, .22);
  border: 1px solid rgba(255, 176, 120, .35);
  margin-top:6px;
}
.mtm-tt-strip{
  position: sticky;
  bottom: 68px;
  display:flex; align-items:center; gap:12px;
  padding: 10px 12px;
  margin-top: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.80);
  border: 1px solid rgba(0,0,0,.06);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px rgba(0,0,0,.08);
}
.mtm-tt-strip-thumb{ width:56px; height:56px; border-radius:16px; object-fit:cover; background:#f3f4f6; flex:0 0 auto; }
.mtm-tt-strip-meta{ flex:1; min-width:0; }
.mtm-tt-strip-title{ font-weight: 900; font-size: 13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mtm-tt-strip-tag{ font-size: 12px; opacity:.75; margin-top:2px; }
.mtm-watermark{
  position:absolute; left:12px; bottom:12px;
  padding: 6px 10px;
  border-radius: 14px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-weight: 900;
  font-size: 12px;
}
