/* Templates and You tab pages (2026-10-26). Owner: Enhance becomes "You"
   (everything the old hamburger drawer held), Montage becomes "Templates".
   Same CapCut rules as cutflux-capcut.css: surfaces by tone not outlines,
   16px cards, pill chips, 12px buttons, one primary per screen, 16px gutters.
   Built on the cutflux-tokens.css colours so light and dark both work. */

.tp-page *, .tp-page *::before, .tp-page *::after { box-sizing: border-box; }
.tp-page [hidden] { display: none !important; }
.tp-page {
  --tp-canvas: var(--cf-bg);
  --tp-l1: #141418;
  --tp-l2: #1E1E24;
  --tp-l3: #2A2A32;
  --tp-ink: #FFFFFF;
  --tp-ink2: rgba(255, 255, 255, .68);
  --tp-ink3: rgba(255, 255, 255, .48);
  --tp-line: rgba(255, 255, 255, .07);
  --tp-shadow: none;
  --tp-danger: #F87171;
  margin: 0; min-height: 100dvh; background: var(--tp-canvas); color: var(--tp-ink);
  font-family: var(--cf-font, 'Inter', -apple-system, 'Segoe UI', sans-serif);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
}
html[data-theme="light"] .tp-page {
  --tp-l1: #FFFFFF; --tp-l2: #F1F3F7; --tp-l3: #E6E9F0;
  --tp-ink: #0C0E16; --tp-ink2: rgba(12, 14, 22, .68); --tp-ink3: rgba(12, 14, 22, .55);
  --tp-line: rgba(12, 14, 22, .07);
  --tp-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 20px rgba(16, 24, 40, .06);
  --tp-danger: #DC2626;
}
.tp-wrap { max-width: 560px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-left, 0px)) 0 max(16px, env(safe-area-inset-right, 0px)); }

/* header: large title left, round icon buttons right (CapCut "Me" / "Templates") */
.tp-head {
  position: sticky; top: 0; z-index: 40; background: var(--tp-canvas);
  padding-top: calc(env(safe-area-inset-top, 0px) + 10px); padding-bottom: 8px;
}
.tp-head-row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.tp-title { flex: 1; margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.035em; line-height: 1.1; color: var(--tp-ink); }
.tp-icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--tp-l1); color: var(--tp-ink); box-shadow: var(--tp-shadow);
  transition: transform .12s ease, background .15s ease;
}
.tp-icon-btn:active { transform: scale(.92); background: var(--tp-l3); }
.tp-icon-btn svg { width: 20px; height: 20px; }
.tp-badge {
  position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--cf-accent, #3B82F6); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--tp-canvas);
}

/* section labels and grouped lists */
.tp-sec { margin: 22px 4px 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--tp-ink3); }
.tp-group { background: var(--tp-l1); border-radius: 16px; overflow: hidden; box-shadow: var(--tp-shadow); }
.tp-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px;
  background: transparent; border: 0; color: var(--tp-ink); text-decoration: none; text-align: left;
  font: 600 15px/1.3 var(--cf-font, 'Inter', sans-serif); cursor: pointer; position: relative;
  transition: background .15s ease;
}
.tp-row + .tp-row::before { content: ""; position: absolute; top: 0; left: 58px; right: 0; height: 1px; background: var(--tp-line); }
.tp-row:active { background: var(--tp-l2); }
.tp-row-ic {
  flex: none; width: 32px; height: 32px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--tp-l2); color: var(--tp-ink);
}
.tp-row-ic svg { width: 18px; height: 18px; }
.tp-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tp-row-sub { font-size: 13px; font-weight: 500; color: var(--tp-ink3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-row-end { flex: none; display: inline-flex; align-items: center; gap: 6px; color: var(--tp-ink3); font-size: 13px; font-weight: 600; }
.tp-row-end svg { width: 16px; height: 16px; }
.tp-row.is-danger { color: var(--tp-danger); }
.tp-row.is-danger .tp-row-ic { color: var(--tp-danger); }
.tp-row-theme { cursor: default; }
.tp-row-theme:active { background: transparent; }

/* buttons */
.tp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 18px;
  border-radius: 12px; border: 0; cursor: pointer; text-decoration: none;
  font: 800 15px var(--cf-font, 'Inter', sans-serif); letter-spacing: -.005em;
  transition: transform .12s ease, filter .15s ease;
}
.tp-btn:active { transform: scale(.97); }
.tp-btn-primary { background: var(--cf-accent, #3B82F6); color: #fff; }
.tp-btn-tonal { background: var(--tp-l2); color: var(--tp-ink); }
.tp-btn-block { width: 100%; }

/* ===================== You (profile.html) ===================== */
.pf-card { background: var(--tp-l1); border-radius: 16px; padding: 16px; box-shadow: var(--tp-shadow); display: flex; flex-direction: column; gap: 14px; }
.pf-who { display: flex; align-items: center; gap: 14px; }
.pf-av {
  flex: none; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(140deg, #5B9BFF, #2F6FE0); color: #fff; font-size: 24px; font-weight: 800;
}
.pf-av.is-anon { background: var(--tp-l2); color: var(--tp-ink3); }
.pf-av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.pf-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pf-name { font-size: 19px; font-weight: 800; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-mail { font-size: 13.5px; color: var(--tp-ink3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-plan {
  align-self: flex-start; margin-top: 3px; display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px;
  border-radius: 999px; background: var(--tp-l2); color: var(--tp-ink2); font-size: 12px; font-weight: 800; letter-spacing: .02em;
}
.pf-plan.is-pro { background: #3B82F6; color: #fff; }
.pf-foot { margin: 26px 0 8px; text-align: center; font-size: 12px; color: var(--tp-ink3); }
.pf-foot a { color: inherit; }

/* What's new sheet */
.tp-sheet-scrim {
  position: fixed; inset: 0; z-index: 9800; background: rgba(0, 0, 0, .5); opacity: 0; pointer-events: none;
  transition: opacity .22s ease;
}
.tp-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9801; max-height: 82dvh; display: flex; flex-direction: column;
  background: var(--tp-l1); color: var(--tp-ink); border-radius: 20px 20px 0 0;
  padding: 8px 0 calc(env(safe-area-inset-bottom, 0px) + 12px);
  transform: translateY(104%); visibility: hidden;
  transition: transform .32s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .32s;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .35);
}
.tp-sheet.is-open { transform: none; visibility: visible; transition: transform .32s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
.tp-sheet-scrim.is-open { opacity: 1; pointer-events: auto; }
.tp-sheet-grab { width: 40px; height: 5px; border-radius: 999px; background: var(--tp-l3); margin: 2px auto 10px; }
.tp-sheet-head { display: flex; align-items: center; gap: 10px; padding: 0 16px 10px; }
.tp-sheet-head h2 { flex: 1; margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.tp-sheet-body { overflow-y: auto; padding: 0 16px 8px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.upd-item { position: relative; padding: 14px 0 14px 18px; }
.upd-item + .upd-item { border-top: 1px solid var(--tp-line); }
.upd-item::before { content: ""; position: absolute; left: 0; top: 21px; width: 8px; height: 8px; border-radius: 50%; background: var(--tp-l3); }
.upd-item.is-new::before { background: var(--cf-accent, #3B82F6); box-shadow: 0 0 0 4px rgba(59, 130, 246, .18); }
.upd-date { font-size: 12px; font-weight: 700; color: var(--tp-ink3); letter-spacing: .02em; }
.upd-title { margin-top: 2px; font-size: 15.5px; font-weight: 800; letter-spacing: -.01em; }
.upd-body { margin: 4px 0 0; font-size: 14px; line-height: 1.45; color: var(--tp-ink2); }

/* ===================== Templates (templates.html) ===================== */
.tl-search {
  display: flex; align-items: center; gap: 10px; height: 44px; margin-top: 10px; padding: 0 14px;
  background: var(--tp-l1); border-radius: 999px; box-shadow: var(--tp-shadow); color: var(--tp-ink3);
}
.tl-search svg { flex: none; width: 18px; height: 18px; }
.tl-search input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--tp-ink);
  font: 500 15px var(--cf-font, 'Inter', sans-serif);
}
.tl-search input::placeholder { color: var(--tp-ink3); }
.tl-chips { display: flex; gap: 8px; margin: 12px -16px 0; padding: 0 16px 2px; overflow-x: auto; scrollbar-width: none; }
.tl-chips::-webkit-scrollbar { display: none; }
.tl-chip {
  flex: none; height: 34px; padding: 0 14px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--tp-l1); color: var(--tp-ink2); box-shadow: var(--tp-shadow);
  font: 700 13.5px var(--cf-font, 'Inter', sans-serif); transition: background .15s, color .15s;
}
.tl-chip[aria-pressed="true"] { background: var(--tp-ink); color: var(--tp-canvas); }

/* featured: the newest template, wide */
.tl-feature {
  position: relative; display: block; width: 100%; margin-top: 16px; padding: 0; border: 0; cursor: pointer; text-align: left;
  aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: var(--tp-l2); color: #fff;
  box-shadow: var(--tp-shadow); transition: transform .14s ease;
}
.tl-feature:active { transform: scale(.985); }
.tl-feature img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tl-feature::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,.78) 100%); }
.tl-feature-body { position: absolute; left: 14px; right: 14px; bottom: 12px; z-index: 2; display: flex; align-items: flex-end; gap: 10px; }
.tl-feature-txt { flex: 1; min-width: 0; }
.tl-kicker { font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.8); }
.tl-feature-name { margin-top: 2px; font-size: 22px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-use {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px;
  background: #fff; color: #0C0E16; font-size: 13.5px; font-weight: 800;
}
.tl-use svg { width: 14px; height: 14px; }

.tl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.tl-card {
  display: flex; flex-direction: column; gap: 8px; padding: 0; border: 0; background: transparent; color: var(--tp-ink);
  text-align: left; cursor: pointer; min-width: 0; transition: transform .14s ease;
}
.tl-card:active { transform: scale(.97); }
.tl-thumb {
  position: relative; aspect-ratio: 4 / 5; border-radius: 16px; overflow: hidden; background: var(--tp-l2); box-shadow: var(--tp-shadow);
}
.tl-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s ease; }
.tl-thumb img.is-in { opacity: 1; }
.tl-thumb::after { content: ""; position: absolute; inset: auto 0 0 0; height: 40%; background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.55)); }
.tl-clips {
  position: absolute; left: 8px; bottom: 8px; z-index: 2; display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
  border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 11.5px; font-weight: 700;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.tl-clips svg { width: 12px; height: 12px; }
.tl-pro {
  position: absolute; top: 8px; right: 8px; z-index: 2; height: 22px; padding: 0 8px; border-radius: 999px;
  display: inline-flex; align-items: center; background: #3B82F6; color: #fff;
  font-size: 11px; font-weight: 800; letter-spacing: .04em;
}
.tl-name { padding: 0 2px; font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-empty { grid-column: 1 / -1; padding: 40px 12px; text-align: center; color: var(--tp-ink3); font-size: 14.5px; }
.tl-skel { aspect-ratio: 4 / 5; border-radius: 16px; background: var(--tp-l1); animation: tlPulse 1.2s ease-in-out infinite; }
@keyframes tlPulse { 50% { opacity: .55; } }

.tl-how { margin-top: 22px; background: var(--tp-l1); border-radius: 16px; padding: 14px 16px; box-shadow: var(--tp-shadow); display: grid; gap: 10px; }
.tl-how h3 { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.tl-step { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--tp-ink2); }
.tl-step b { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--tp-l2); color: var(--tp-ink); font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  .tp-sheet, .tp-sheet-scrim, .tl-thumb img { transition: none; }
  .tl-skel { animation: none; }
}
