@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700;800;900&family=Inter:wght@400;500;600&display=swap');

:root {
  --gtm-gold:    #c9942a;
  --gtm-gold2:   #e8b84b;
  --gtm-dark:    #ffffff;
  --gtm-dark2:   #f7f7f9;
  --gtm-dark3:   #f0f0f4;
  --gtm-text:    #1a1a2e;
  --gtm-text2:   #444460;
  --gtm-muted:   #8888aa;
  --gtm-border:  #dddde8;
  --gtm-soft:    #ebebf3;
  --gtm-radius:  10px;
  --gtm-ease:    .18s ease;
  --gtm-serif:   'Montserrat', system-ui, sans-serif;
  --gtm-sans:    'Inter', system-ui, sans-serif;
}

.gtm-app *, .gtm-app *::before, .gtm-app *::after { box-sizing:border-box; margin:0; padding:0; }

/* Ensure the plugin wrapper itself never inherits asymmetric theme margins */
.gtm-app { position:relative; left:0 !important; right:0 !important; }
.gtm-app {
  font-family:var(--gtm-sans); color:var(--gtm-text);
  background:var(--gtm-dark) !important;
  width:100%; max-width:1200px; margin:0 auto !important;
  border-radius:var(--gtm-radius);
  padding:0 1rem 2rem;
  box-sizing:border-box;
  overflow-x:hidden; /* prevent content bleeding past viewport */
}

/* ── SETUP NOTICE ─────────────────────────────────────────── */
.gtm-notice { display:flex; align-items:flex-start; gap:1rem; padding:1.5rem; border:1.5px dashed var(--gtm-border); border-radius:var(--gtm-radius); }
.gtm-notice span { font-size:2rem; }
.gtm-notice strong { display:block; font-family:var(--gtm-serif); font-weight:800; font-size:1.05rem; color:var(--gtm-gold); margin-bottom:.3rem; }
.gtm-notice p { font-size:.88rem; color:var(--gtm-muted); }
.gtm-notice a { color:var(--gtm-gold); }

/* ── TOP BAR ──────────────────────────────────────────────── */
.gtm-topbar {
  display:flex; align-items:center; justify-content:space-between;
  padding:1.5rem 0 1.25rem;
  border-bottom:1px solid var(--gtm-border);
  margin-bottom:1.25rem;
}
.gtm-topbar-brand { display:flex; align-items:center; gap:.85rem; }
.gtm-logo-wrap { flex-shrink:0; }
.gtm-logo-icon { width:42px; height:42px; filter:drop-shadow(0 0 8px rgba(232,184,75,.4)); }
.gtm-brand-name { display:block; font-family:var(--gtm-serif); font-size:1.6rem; font-weight:900; color:var(--gtm-gold); line-height:1.1; letter-spacing:-.02em; }
.gtm-brand-sub  { display:block; font-size:.68rem; text-transform:uppercase; letter-spacing:.12em; color:var(--gtm-muted); margin-top:.2rem; }
.gtm-yt-link {
  display:inline-flex; align-items:center; gap:.45rem;
  padding:.42rem .9rem; border-radius:20px;
  border:1.5px solid var(--gtm-border); background:var(--gtm-soft);
  font-family:var(--gtm-sans); font-size:.8rem; font-weight:600; color:var(--gtm-text2);
  text-decoration:none; transition:var(--gtm-ease);
}
.gtm-yt-link:hover { border-color:#ff4444; color:#ff4444; }
.gtm-yt-icon { width:18px; height:18px; flex-shrink:0; }

/* ── FILTER BAR ───────────────────────────────────────────── */
.gtm-filterbar {
  display:flex; align-items:flex-start; gap:1rem; flex-wrap:wrap;
  padding:1rem 0; border-bottom:1px solid var(--gtm-border);
  margin-bottom:1rem;
}
.gtm-filterbar-left  { flex:1; display:flex; flex-direction:column; gap:.75rem; }
.gtm-filterbar-right { display:flex; align-items:center; gap:.5rem; flex-shrink:0; padding-top:.2rem; }

.gtm-filter-group { display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; }
.gtm-filter-group-label {
  font-size:.68rem; font-weight:700; letter-spacing:.1em; text-transform:uppercase;
  color:var(--gtm-muted); white-space:nowrap; min-width:48px;
}
.gtm-pills { display:flex; gap:.35rem; flex-wrap:wrap; }
.gtm-pill {
  padding:.3rem .75rem; border-radius:20px;
  border:1.5px solid var(--gtm-border); background:var(--gtm-soft);
  font-family:var(--gtm-sans); font-size:.78rem; font-weight:500; color:var(--gtm-text2);
  cursor:pointer; transition:var(--gtm-ease); white-space:nowrap;
}
.gtm-pill:hover { border-color:var(--gtm-gold); color:var(--gtm-gold); }
.gtm-pill.active {
  background:var(--gtm-gold); border-color:var(--gtm-gold); color:var(--gtm-dark); font-weight:700;
}
.gtm-sort {
  padding:.4rem 1.6rem .4rem .7rem;
  border:1.5px solid var(--gtm-border); border-radius:20px;
  font-family:var(--gtm-sans); font-size:.8rem; color:var(--gtm-text2);
  background:var(--gtm-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238888aa'/%3E%3C/svg%3E") no-repeat right .6rem center;
  -webkit-appearance:none; appearance:none; outline:none; cursor:pointer;
}
.gtm-sort:focus { border-color:var(--gtm-gold); }
.gtm-layout-toggle { display:flex; border:1.5px solid var(--gtm-border); border-radius:6px; overflow:hidden; }
.gtm-layout-btn {
  width:32px; height:32px; border:none; background:var(--gtm-soft);
  font-size:1rem; cursor:pointer; color:var(--gtm-muted); transition:var(--gtm-ease);
  display:flex; align-items:center; justify-content:center;
}
.gtm-layout-btn:hover { background:var(--gtm-dark3); }
.gtm-layout-btn.active { background:var(--gtm-gold); color:var(--gtm-dark); }

/* ── SEARCH BAR ───────────────────────────────────────────── */
.gtm-searchbar { display:flex; align-items:center; gap:1rem; margin-bottom:1.25rem; }
.gtm-search-wrap { position:relative; flex:1; max-width:420px; }
.gtm-search-icon { position:absolute; left:.65rem; top:50%; transform:translateY(-50%); font-size:.78rem; pointer-events:none; }
.gtm-search {
  width:100%; padding:.48rem .7rem .48rem 2rem;
  border:1.5px solid var(--gtm-border); border-radius:20px;
  font-family:var(--gtm-sans); font-size:.88rem; color:var(--gtm-text);
  background:var(--gtm-soft); outline:none; transition:border-color var(--gtm-ease);
}
.gtm-search::placeholder { color:var(--gtm-muted); }
.gtm-search:focus { border-color:var(--gtm-gold); }
.gtm-search-clear {
  position:absolute; right:.6rem; top:50%; transform:translateY(-50%);
  background:none; border:none; color:var(--gtm-muted); cursor:pointer; font-size:.8rem; padding:.1rem .3rem;
}
.gtm-search-clear:hover { color:var(--gtm-text); }
.gtm-count { font-size:.8rem; color:var(--gtm-muted); white-space:nowrap; }

/* ── VIDEO GRID ───────────────────────────────────────────── */
.gtm-grid {
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(230px,1fr));
  gap:1rem; min-height:200px;
  width:100%;
}
.gtm-grid.is-list { grid-template-columns:1fr; gap:.5rem; }

/* Video card */
.gtm-card {
  background:var(--gtm-dark2); border:1px solid var(--gtm-border); border-radius:var(--gtm-radius);
  overflow:hidden; cursor:pointer; transition:transform var(--gtm-ease), box-shadow var(--gtm-ease), border-color var(--gtm-ease);
}
.gtm-card:hover { transform:translateY(-4px); box-shadow:0 8px 30px rgba(0,0,0,.10); border-color:rgba(232,184,75,.3); }
.gtm-card:active { transform:scale(.98); }

/* Thumbnail */
.gtm-thumb-wrap { position:relative; aspect-ratio:16/9; overflow:hidden; background:#e0e0e8; }
.gtm-thumb { width:100%; height:100%; object-fit:cover; display:block; transition:transform var(--gtm-ease); }
.gtm-card:hover .gtm-thumb { transform:scale(1.04); }
.gtm-play-btn {
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  opacity:0; transition:opacity var(--gtm-ease); background:rgba(0,0,0,.4);
}
.gtm-card:hover .gtm-play-btn { opacity:1; }
.gtm-play-circle {
  width:52px; height:52px; border-radius:50%;
  background:var(--gtm-gold);
  display:flex; align-items:center; justify-content:center; font-size:1.1rem;
  box-shadow:0 0 20px rgba(232,184,75,.5);
}
.gtm-duration {
  position:absolute; bottom:.4rem; right:.4rem;
  background:rgba(0,0,0,.82); color:#fff; font-size:.65rem; font-weight:600;
  padding:.12rem .42rem; border-radius:3px;
}
.gtm-views-tag {
  position:absolute; bottom:.4rem; left:.4rem;
  background:rgba(0,0,0,.7); color:rgba(255,255,255,.85); font-size:.65rem;
  padding:.12rem .42rem; border-radius:3px;
}

/* Card body */
.gtm-card-body { padding:.85rem .9rem .7rem; }
.gtm-card-title {
  font-family:var(--gtm-serif); font-size:.9rem; font-weight:700; color:var(--gtm-text);
  line-height:1.35; margin-bottom:.5rem; letter-spacing:-.01em;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.gtm-card-tags { display:flex; gap:.35rem; flex-wrap:wrap; margin-bottom:.4rem; }
.gtm-card-tag {
  font-size:.65rem; font-weight:600; padding:.1rem .42rem; border-radius:10px;
  letter-spacing:.04em; text-transform:uppercase; white-space:nowrap;
}
.gtm-card-tag.art { background:rgba(232,184,75,.15); color:var(--gtm-gold); border:1px solid rgba(232,184,75,.25); }
.gtm-card-tag.gen { background:rgba(58,127,212,.08); color:#3a7fd4; border:1px solid rgba(58,127,212,.2); }
.gtm-card-meta { font-size:.72rem; color:var(--gtm-muted); }

/* List mode */
.gtm-grid.is-list .gtm-card { display:flex; flex-direction:row; }
.gtm-grid.is-list .gtm-thumb-wrap { width:200px; flex-shrink:0; aspect-ratio:16/9; height:auto; min-height:112px; }
.gtm-grid.is-list .gtm-card-body { flex:1; display:flex; flex-direction:column; justify-content:center; padding:1rem 1.1rem; }
.gtm-grid.is-list .gtm-card-title { -webkit-line-clamp:1; font-size:1rem; }

/* ── LOADING / EMPTY ──────────────────────────────────────── */

.gtm-loading { display:flex; align-items:center; gap:.65rem; padding:4rem; justify-content:center; font-size:.9rem; color:var(--gtm-muted); grid-column:1/-1; }
.gtm-spinner { width:22px; height:22px; border:2px solid var(--gtm-border); border-top-color:var(--gtm-gold); border-radius:50%; animation:gtmSpin .65s linear infinite; flex-shrink:0; }
@keyframes gtmSpin { to { transform:rotate(360deg); } }
.gtm-empty { text-align:center; padding:4rem 1rem; color:var(--gtm-muted); grid-column:1/-1; }
.gtm-empty-icon { font-size:2.5rem; display:block; margin-bottom:.6rem; }

/* ── PAGINATION ───────────────────────────────────────────── */
.gtm-pagination { display:flex; justify-content:center; gap:.35rem; margin-top:1.75rem; flex-wrap:wrap; }
.gtm-pg { width:36px; height:36px; border-radius:50%; border:1px solid var(--gtm-border); background:var(--gtm-soft); font-family:var(--gtm-sans); font-size:.82rem; color:var(--gtm-text2); cursor:pointer; display:flex; align-items:center; justify-content:center; transition:var(--gtm-ease); padding:0; }
.gtm-pg:hover { border-color:var(--gtm-gold); color:var(--gtm-gold); }
.gtm-pg.on { background:var(--gtm-gold); border-color:var(--gtm-gold); color:var(--gtm-dark); font-weight:700; }
.gtm-pg-dot { width:36px; height:36px; display:flex; align-items:center; justify-content:center; color:var(--gtm-muted); font-size:.9rem; }

/* ── MODAL ────────────────────────────────────────────────── */
.gtm-modal { position:fixed; inset:0; z-index:99999; display:flex; align-items:center; justify-content:center; }
.gtm-modal-bg { position:absolute; inset:0; background:rgba(0,0,0,.92); backdrop-filter:blur(8px); }
.gtm-modal-box {
  position:relative; z-index:1; background:var(--gtm-dark2); border-radius:14px;
  border:1px solid var(--gtm-border);
  width:96%; max-width:900px; max-height:94dvh; overflow:hidden;
  box-shadow:0 30px 80px rgba(0,0,0,.25), 0 0 0 1px rgba(0,0,0,.08);
  animation:gtmMIn .22s cubic-bezier(.34,1.56,.64,1) both;
  display:flex; flex-direction:column;
}
@keyframes gtmMIn { from{opacity:0;transform:scale(.9)} to{opacity:1;transform:scale(1)} }
.gtm-modal-close {
  position:absolute; top:.75rem; right:.75rem; z-index:2;
  width:32px; height:32px; border-radius:50%; border:none;
  background:rgba(0,0,0,.08); color:var(--gtm-text2); font-size:.95rem;
  display:flex; align-items:center; justify-content:center; cursor:pointer; transition:var(--gtm-ease);
}
.gtm-modal-close:hover { background:rgba(232,184,75,.2); color:var(--gtm-gold); }
.gtm-modal-player { position:relative; aspect-ratio:16/9; background:#111; }
.gtm-modal-player iframe { position:absolute; inset:0; width:100%; height:100%; border:none; display:block; }
.gtm-modal-info { padding:.9rem 1.2rem; background:var(--gtm-dark3); border-top:1px solid var(--gtm-border); }
.gtm-modal-title { font-family:var(--gtm-serif); font-size:1.05rem; font-weight:800; color:var(--gtm-text); margin-bottom:.35rem; line-height:1.3; }
.gtm-modal-meta { display:flex; gap:.85rem; flex-wrap:wrap; font-size:.75rem; color:var(--gtm-muted); align-items:center; }
.gtm-modal-yt { color:var(--gtm-gold); text-decoration:none; font-weight:600; font-size:.78rem; }
.gtm-modal-yt:hover { text-decoration:underline; }
.gtm-modal-tag { font-size:.68rem; padding:.1rem .45rem; border-radius:10px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; }
.gtm-modal-art { background:rgba(232,184,75,.15); color:var(--gtm-gold); }
.gtm-modal-gen { background:rgba(58,127,212,.08); color:#3a7fd4; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media(max-width:860px){
  .gtm-grid { grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); }
  .gtm-filterbar { flex-direction:column; }
  .gtm-filterbar-right { align-self:stretch; justify-content:space-between; }
}
@media(max-width:560px){
  /* Strip all side padding — override any theme margin/padding on the wrapper */
  .gtm-app { padding:0 .5rem 2rem; margin-left:0 !important; margin-right:0 !important; width:100% !important; }

  /* Top bar: centered on mobile */
  .gtm-topbar { flex-direction:column; align-items:center; gap:.75rem; text-align:center; }
  .gtm-topbar-brand { justify-content:center; width:100%; }

  /* Filter bar: fully centered pills */
  .gtm-filterbar { align-items:center; }
  .gtm-filterbar-left { align-items:center; width:100%; }
  .gtm-filter-group { justify-content:center; width:100%; }
  .gtm-filter-group-label { min-width:auto; }
  .gtm-pills { justify-content:center; width:100%; }
  .gtm-filterbar-right { align-self:center; justify-content:center; gap:.75rem; width:100%; }

  /* Search: full width, centered */
  .gtm-searchbar { flex-direction:column; align-items:stretch; gap:.6rem; }
  .gtm-search-wrap { max-width:none; width:100%; }
  .gtm-count { text-align:center; }

  /* Grid: two perfectly equal columns, no leftover space; force full width */
  .gtm-grid { grid-template-columns:1fr 1fr; gap:.5rem; width:100%; }

  /* List mode thumb on mobile — keep aspect ratio */
  .gtm-grid.is-list { grid-template-columns:1fr; }
  .gtm-grid.is-list .gtm-thumb-wrap { width:120px; aspect-ratio:16/9; min-height:unset; }

  /* Modal: slide up from bottom */
  .gtm-modal { align-items:flex-end; }
  .gtm-modal-box { border-radius:12px 12px 0 0; max-height:96dvh; width:100%; }
  @keyframes gtmMIn { from{opacity:0;transform:translateY(100%)} to{opacity:1;transform:translateY(0)} }
}
@media(max-width:380px){
  .gtm-grid { grid-template-columns:1fr; }
}
