/*
 * tools-styles.css
 * ADFORGE AI — 爆款模板資料庫頁面樣式
 * 獨立於 styles.css，不影響首頁
 */

/* ═══════════════════════════════════════════
   0. Design Tokens
═══════════════════════════════════════════ */
:root {
  /* Brand palette */
  --c-bg:           #0b0d17;
  --c-surface:      #111420;
  --c-surface-2:    #161928;
  --c-surface-3:    #1c2133;
  --c-line:         rgba(255,255,255,0.08);
  --c-line-strong:  rgba(255,255,255,0.13);

  /* Accent */
  --c-accent:       #5b8af0;
  --c-accent-2:     #7aa3ff;
  --c-accent-glow:  rgba(91,138,240,0.18);
  --c-accent-soft:  rgba(91,138,240,0.10);

  /* Category colours */
  --c-image:        #f59e0b;
  --c-image-soft:   rgba(245,158,11,0.12);
  --c-prompt:       #10b981;
  --c-prompt-soft:  rgba(16,185,129,0.12);
  --c-video:        #8b5cf6;
  --c-video-soft:   rgba(139,92,246,0.12);

  /* Text */
  --c-ink:          #f1f5ff;
  --c-muted:        #8b93ad;
  --c-muted-2:      #5a6177;

  /* Shadows */
  --shadow-card:    0 1px 3px rgba(0,0,0,0.5), 0 8px 24px rgba(0,0,0,0.35);
  --shadow-hover:   0 4px 12px rgba(0,0,0,0.6), 0 20px 48px rgba(0,0,0,0.4);
  --shadow-glow:    0 0 0 1px var(--c-accent), 0 8px 32px var(--c-accent-glow);

  /* Radii */
  --r-sm:   6px;
  --r-md:   12px;
  --r-lg:   18px;
  --r-xl:   24px;
  --r-pill: 999px;

  /* Transitions */
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --dur: 200ms;
}

/* ═══════════════════════════════════════════
   1. Reset & Base
═══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.tools-page {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: "Inter", "Noto Sans TC", system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* subtle grid texture */
  background-image:
    linear-gradient(rgba(91,138,240,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91,138,240,0.025) 1px, transparent 1px);
  background-size: 64px 64px;
}

img { display: block; max-width: 100%; }
a   { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }

/* ═══════════════════════════════════════════
   2. Layout Utilities
═══════════════════════════════════════════ */
.container {
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
}
.narrow { width: min(860px, calc(100% - 48px)); margin: 0 auto; }

/* ═══════════════════════════════════════════
   3. Header
═══════════════════════════════════════════ */
.t-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11,13,23,0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--c-line);
}

.t-header-inner {
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* Brand */
.t-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.t-brand-mark {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--c-accent), #3b5bd9);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 900; color: white;
  flex-shrink: 0;
}
.t-brand-text strong {
  display: block;
  font-size: 16px; font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--c-ink);
  line-height: 1.1;
}
.t-brand-text small {
  display: block;
  font-size: 11px; font-weight: 600;
  color: var(--c-accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Nav */
.t-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-line);
  border-radius: var(--r-pill);
  padding: 4px;
}
.t-nav a {
  padding: 8px 18px;
  border-radius: var(--r-pill);
  font-size: 13px; font-weight: 700;
  color: var(--c-muted);
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
}
.t-nav a:hover,
.t-nav a.active {
  color: var(--c-ink);
  background: var(--c-surface-3);
}
.t-nav a.active {
  color: var(--c-accent-2);
}

/* Header actions */
.t-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.t-btn {
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  font-size: 13px; font-weight: 700;
  border: 1px solid var(--c-line-strong);
  color: var(--c-muted);
  background: var(--c-surface-2);
  transition: all var(--dur) var(--ease);
}
.t-btn:hover {
  color: var(--c-ink);
  border-color: var(--c-accent);
}
.t-btn-primary {
  color: var(--c-bg);
  background: var(--c-accent);
  border-color: var(--c-accent);
}
.t-btn-primary:hover {
  background: var(--c-accent-2);
  border-color: var(--c-accent-2);
  color: #fff;
}

/* ═══════════════════════════════════════════
   4. Hero Section
═══════════════════════════════════════════ */
.t-hero {
  padding: 80px 0 72px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* radial glow backdrop */
.t-hero::before {
  content: "";
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(91,138,240,0.14) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.t-hero > * { position: relative; z-index: 1; }

.t-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(91,138,240,0.3);
  background: rgba(91,138,240,0.08);
  font-size: 13px; font-weight: 800;
  color: var(--c-accent-2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 28px;
}
.t-hero-eyebrow span { opacity: 0.6; }

.t-hero h1 {
  margin: 0 auto 24px;
  max-width: 820px;
  font-size: clamp(36px, 6vw, 72px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.t-hero h1 em {
  font-style: normal;
  color: var(--c-accent-2);
  position: relative;
  display: inline-block;
}
/* animated underline */
.t-hero h1 em::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0; right: 0;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--c-accent), var(--c-accent-2));
  transform-origin: left;
  animation: underline-grow 0.8s var(--ease) 0.4s both;
}
@keyframes underline-grow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.t-hero-desc {
  max-width: 560px;
  margin: 0 auto 40px;
  font-size: 18px;
  color: var(--c-muted);
  line-height: 1.8;
  font-weight: 500;
}

/* Search bar */
.t-search-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(600px, 100%);
  margin: 0 auto 56px;
  padding: 8px 8px 8px 20px;
  border-radius: var(--r-pill);
  border: 1px solid var(--c-line-strong);
  background: var(--c-surface-2);
  box-shadow: 0 0 0 0 transparent;
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.t-search-wrap:focus-within {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-glow);
}
.t-search-wrap svg {
  flex-shrink: 0;
  opacity: 0.4;
}
.t-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font: inherit;
  font-size: 15px;
  color: var(--c-ink);
}
.t-search-input::placeholder { color: var(--c-muted-2); }
.t-search-btn {
  height: 42px;
  padding: 0 22px;
  border-radius: var(--r-pill);
  background: var(--c-accent);
  color: white;
  font-size: 14px; font-weight: 800;
  transition: background var(--dur) var(--ease);
  flex-shrink: 0;
}
.t-search-btn:hover { background: var(--c-accent-2); }

/* Stats bar */
.t-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
}
.t-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 36px;
  border-right: 1px solid var(--c-line);
}
.t-stat:last-child { border-right: none; }
.t-stat strong {
  font-size: 28px; font-weight: 900;
  color: var(--c-ink);
  line-height: 1;
}
.t-stat span {
  margin-top: 6px;
  font-size: 13px;
  color: var(--c-muted);
  font-weight: 600;
}

/* ═══════════════════════════════════════════
   5. Filter Bar
═══════════════════════════════════════════ */
.t-filter-bar {
  position: sticky;
  top: 72px;
  z-index: 90;
  background: rgba(11,13,23,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--c-line);
  padding: 14px 0;
}

.t-filter-inner {
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Category tabs */
.t-cat-tabs {
  display: flex;
  gap: 6px;
}
.t-cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--c-line-strong);
  background: var(--c-surface-2);
  color: var(--c-muted);
  font-size: 13px; font-weight: 700;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
}
.t-cat-btn .cat-icon { font-size: 14px; }
.t-cat-btn:hover {
  color: var(--c-ink);
  border-color: var(--c-line-strong);
}
.t-cat-btn.active-all    { color: var(--c-accent-2); border-color: var(--c-accent); background: var(--c-accent-soft); }
.t-cat-btn.active-image  { color: var(--c-image);   border-color: var(--c-image);   background: var(--c-image-soft); }
.t-cat-btn.active-prompt { color: var(--c-prompt);  border-color: var(--c-prompt);  background: var(--c-prompt-soft); }
.t-cat-btn.active-video  { color: var(--c-video);   border-color: var(--c-video);   background: var(--c-video-soft); }

.t-filter-divider {
  width: 1px; height: 28px;
  background: var(--c-line);
  flex-shrink: 0;
}

/* Tag pills */
.t-tag-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
}
.t-tag-scroll::-webkit-scrollbar { display: none; }
.t-tag-pill {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--c-line);
  background: transparent;
  color: var(--c-muted);
  font-size: 12px; font-weight: 700;
  white-space: nowrap;
  transition: all var(--dur) var(--ease);
}
.t-tag-pill:hover { color: var(--c-ink); border-color: var(--c-line-strong); }
.t-tag-pill.active {
  color: var(--c-accent-2);
  border-color: var(--c-accent);
  background: var(--c-accent-soft);
}

/* Result count */
.t-result-count {
  margin-left: auto;
  font-size: 13px;
  color: var(--c-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.t-result-count strong { color: var(--c-accent-2); }

/* ═══════════════════════════════════════════
   6. Main Grid Layout
═══════════════════════════════════════════ */
.t-main {
  padding: 48px 0 80px;
}

.t-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: start;
}

/* ═══════════════════════════════════════════
   7. Sidebar Rail
═══════════════════════════════════════════ */
.t-sidebar {
  position: sticky;
  top: calc(72px + 68px + 20px);
}
.t-sidebar-section {
  margin-bottom: 32px;
}
.t-sidebar-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-muted-2);
  margin: 0 0 10px;
  padding: 0 4px;
}
.t-sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.t-sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  font-size: 13px; font-weight: 700;
  color: var(--c-muted);
  transition: all var(--dur) var(--ease);
}
.t-sidebar-link .s-icon {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  background: var(--c-surface-2);
  flex-shrink: 0;
}
.t-sidebar-link:hover {
  background: var(--c-surface-2);
  color: var(--c-ink);
}
.t-sidebar-link.active {
  background: var(--c-surface-3);
  color: var(--c-ink);
}
.t-sidebar-link.active .s-icon { background: var(--c-accent-soft); }
.t-sidebar-link .s-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--c-muted-2);
  background: var(--c-surface-3);
  padding: 2px 7px;
  border-radius: var(--r-pill);
}

/* Platform list */
.t-platform-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.t-platform-chip {
  padding: 5px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--c-line);
  font-size: 11px; font-weight: 700;
  color: var(--c-muted);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.t-platform-chip:hover { color: var(--c-ink); border-color: var(--c-line-strong); }
.t-platform-chip.active {
  color: var(--c-accent-2);
  border-color: var(--c-accent);
  background: var(--c-accent-soft);
}

/* ═══════════════════════════════════════════
   8. Template Cards Grid
═══════════════════════════════════════════ */
.t-grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.t-grid-title {
  font-size: 15px; font-weight: 800;
  color: var(--c-muted);
}
.t-sort-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 7px 30px 7px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--c-line);
  background: var(--c-surface-2);
  color: var(--c-muted);
  font: inherit;
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  background-image: 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='%238b93ad'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.t-sort-select:focus { outline: none; border-color: var(--c-accent); }

.t-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* ─── Card ─── */
.t-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
  cursor: pointer;
}
.t-card:hover {
  border-color: var(--c-line-strong);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.t-card:focus-within {
  box-shadow: var(--shadow-glow);
  border-color: var(--c-accent);
}

/* Card Preview */
.t-card-preview {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.t-card-preview-inner {
  font-size: 48px;
  opacity: 0.5;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.t-card:hover .t-card-preview-inner {
  transform: scale(1.1);
  opacity: 0.7;
}
.t-card-preview-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.05) 50%, transparent 60%);
  background-size: 200% 100%;
  animation: shimmer 3s ease-in-out infinite;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Card badges */
.t-card-badge {
  position: absolute;
  top: 12px; left: 12px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 10px; font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.badge-hot  { background: rgba(239,68,68,0.9);  color: white; }
.badge-new  { background: rgba(16,185,129,0.9); color: white; }
.badge-pro  { background: rgba(139,92,246,0.9); color: white; }

/* Category dot */
.t-card-cat-dot {
  position: absolute;
  top: 12px; right: 12px;
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
  backdrop-filter: blur(8px);
}
.dot-image  { background: var(--c-image-soft);  color: var(--c-image);  border: 1px solid rgba(245,158,11,0.25); }
.dot-prompt { background: var(--c-prompt-soft); color: var(--c-prompt); border: 1px solid rgba(16,185,129,0.25); }
.dot-video  { background: var(--c-video-soft);  color: var(--c-video);  border: 1px solid rgba(139,92,246,0.25); }

/* Card Body */
.t-card-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.t-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.t-card-cat-label {
  font-size: 11px; font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.cat-image  { color: var(--c-image); }
.cat-prompt { color: var(--c-prompt); }
.cat-video  { color: var(--c-video); }
.t-card-ratio {
  margin-left: auto;
  font-size: 11px; font-weight: 700;
  color: var(--c-muted-2);
  background: var(--c-surface-3);
  padding: 2px 8px;
  border-radius: var(--r-pill);
}
.t-card-title {
  margin: 0 0 6px;
  font-size: 16px; font-weight: 800;
  line-height: 1.3;
  color: var(--c-ink);
}
.t-card-subtitle {
  margin: 0 0 10px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--c-muted-2);
  text-transform: uppercase;
}
.t-card-desc {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--c-muted);
  line-height: 1.7;
  flex: 1;
}

/* Tags */
.t-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 16px;
}
.t-card-tag {
  padding: 3px 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--c-line);
  font-size: 11px; font-weight: 700;
  color: var(--c-muted);
}

/* Card footer */
.t-card-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--c-line);
}
.t-card-uses {
  font-size: 12px;
  color: var(--c-muted-2);
  font-weight: 600;
}
.t-card-uses span { color: var(--c-muted); }
.t-card-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}
.t-action-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--c-line-strong);
  font-size: 12px; font-weight: 800;
  color: var(--c-muted);
  background: var(--c-surface-2);
  transition: all var(--dur) var(--ease);
}
.t-action-btn:hover {
  color: var(--c-ink);
  border-color: var(--c-accent);
}
.t-action-btn.primary {
  color: white;
  background: var(--c-accent);
  border-color: var(--c-accent);
}
.t-action-btn.primary:hover {
  background: var(--c-accent-2);
  border-color: var(--c-accent-2);
}

/* Level badge */
.t-card-level {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px; font-weight: 700;
  color: var(--c-muted-2);
}
.level-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--c-muted-2);
}
.t-card-level.基礎 .level-dot  { background: var(--c-prompt); }
.t-card-level.進階 .level-dot  { background: var(--c-image); }
.t-card-level.品牌級 .level-dot { background: var(--c-video); }

/* No results */
.t-no-results {
  grid-column: 1/-1;
  padding: 80px 0;
  text-align: center;
  color: var(--c-muted);
}
.t-no-results p { font-size: 18px; font-weight: 700; }
.t-no-results small { font-size: 14px; opacity: 0.6; }

/* ═══════════════════════════════════════════
   9. Modal Overlay
═══════════════════════════════════════════ */
.t-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}
.t-modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.t-modal {
  background: var(--c-surface);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-xl);
  width: min(720px, 100%);
  max-height: 85vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--c-line-strong) transparent;
  display: flex;
  flex-direction: column;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s var(--ease);
  box-shadow: 0 32px 80px rgba(0,0,0,0.6);
}
.t-modal-overlay.open .t-modal {
  transform: translateY(0) scale(1);
}

.t-modal-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--c-line);
  position: sticky;
  top: 0;
  background: var(--c-surface);
  z-index: 1;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.t-modal-preview-icon {
  width: 52px; height: 52px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.t-modal-header-text { flex: 1; min-width: 0; }
.t-modal-category {
  font-size: 11px; font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.t-modal-title {
  margin: 0 0 4px;
  font-size: 20px; font-weight: 900;
  color: var(--c-ink);
}
.t-modal-subtitle {
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-muted-2);
}
.t-modal-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--c-line);
  background: var(--c-surface-2);
  color: var(--c-muted);
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--dur) var(--ease);
}
.t-modal-close:hover {
  color: var(--c-ink);
  border-color: var(--c-line-strong);
}

.t-modal-body {
  padding: 24px;
  flex: 1;
}

/* Prompt display */
.t-prompt-block {
  margin-bottom: 20px;
}
.t-prompt-label {
  font-size: 12px; font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-muted-2);
  margin-bottom: 10px;
}
.t-prompt-code {
  position: relative;
  background: var(--c-surface-2);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: 16px;
}
.t-prompt-code pre {
  margin: 0;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 13px;
  line-height: 1.7;
  color: var(--c-muted);
  white-space: pre-wrap;
  word-break: break-word;
}
.t-prompt-code pre .highlight { color: var(--c-accent-2); }
.t-copy-btn {
  position: absolute;
  top: 10px; right: 10px;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--c-line-strong);
  background: var(--c-surface-3);
  color: var(--c-muted);
  font-size: 11px; font-weight: 800;
  transition: all var(--dur) var(--ease);
}
.t-copy-btn:hover { color: var(--c-accent-2); border-color: var(--c-accent); }
.t-copy-btn.copied { color: var(--c-prompt); border-color: var(--c-prompt); }

/* Script timeline (video) */
.t-script-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.t-timeline-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.t-timeline-time {
  min-width: 60px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--c-surface-3);
  font-size: 11px; font-weight: 800;
  color: var(--c-accent);
  text-align: center;
  flex-shrink: 0;
}
.t-timeline-content {}
.t-timeline-role {
  font-size: 13px; font-weight: 800;
  color: var(--c-ink);
  margin-bottom: 2px;
}
.t-timeline-desc {
  font-size: 13px;
  color: var(--c-muted);
  line-height: 1.6;
}

/* Info grid */
.t-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.t-info-item {
  background: var(--c-surface-2);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: 12px 14px;
}
.t-info-item dt {
  font-size: 11px; font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--c-muted-2);
  margin-bottom: 4px;
}
.t-info-item dd {
  margin: 0;
  font-size: 14px; font-weight: 700;
  color: var(--c-ink);
}

/* Platform tags in modal */
.t-modal-platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}
.t-modal-platform {
  padding: 4px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--c-line);
  font-size: 12px; font-weight: 700;
  color: var(--c-muted);
}

/* Modal footer */
.t-modal-footer {
  padding: 16px 24px 24px;
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--c-line);
}
.t-modal-footer .t-action-btn {
  flex: 1;
  height: 44px;
  font-size: 14px;
  justify-content: center;
  display: flex;
  align-items: center;
  border-radius: var(--r-md);
}

/* ═══════════════════════════════════════════
   10. Toast Notification
═══════════════════════════════════════════ */
.t-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 300;
  padding: 12px 24px;
  border-radius: var(--r-pill);
  background: var(--c-ink);
  color: var(--c-bg);
  font-size: 14px; font-weight: 800;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  white-space: nowrap;
}
.t-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════
   11. Footer
═══════════════════════════════════════════ */
.t-footer {
  border-top: 1px solid var(--c-line);
  padding: 40px 0;
}
.t-footer-inner {
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.t-footer-left { display: flex; align-items: center; gap: 12px; }
.t-footer-copy {
  font-size: 13px;
  color: var(--c-muted-2);
}
.t-footer-links {
  display: flex;
  gap: 20px;
}
.t-footer-links a {
  font-size: 13px; font-weight: 600;
  color: var(--c-muted-2);
  transition: color var(--dur) var(--ease);
}
.t-footer-links a:hover { color: var(--c-muted); }

/* ═══════════════════════════════════════════
   12. Responsive
═══════════════════════════════════════════ */
@media (max-width: 960px) {
  .t-layout {
    grid-template-columns: 1fr;
  }
  .t-sidebar {
    position: static;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
  }
  .t-sidebar-section {
    margin-bottom: 0;
  }
}

@media (max-width: 720px) {
  .container,
  .narrow,
  .t-header-inner,
  .t-filter-inner,
  .t-footer-inner {
    width: min(100% - 28px, 1200px);
  }

  body.tools-page {
    background-size: 40px 40px;
  }

  .t-nav { display: none; }
  .t-header-inner {
    height: 58px;
    gap: 10px;
  }

  .t-brand {
    gap: 8px;
    min-width: 0;
  }

  .t-brand-mark {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }

  .t-brand-text strong {
    font-size: 14px;
  }

  .t-brand-text small {
    display: none;
  }

  .t-header-actions {
    gap: 6px;
  }

  .t-header-actions .t-btn:first-child {
    display: none;
  }

  .t-btn {
    height: 34px;
    padding: 0 12px;
    font-size: 12px;
  }

  .t-hero {
    padding: 34px 0 30px;
  }

  .t-hero::before {
    width: 420px;
    height: 360px;
  }

  .t-hero-eyebrow {
    max-width: 100%;
    margin-bottom: 18px;
    padding: 6px 11px;
    font-size: 11px;
    line-height: 1.4;
    letter-spacing: 0.03em;
    text-transform: none;
  }

  .t-hero h1 {
    max-width: 360px;
    margin-bottom: 16px;
    font-size: clamp(25px, 7vw, 34px);
    line-height: 1.16;
  }

  .t-hero h1 em::after {
    height: 2px;
    bottom: -2px;
  }

  .t-hero-desc {
    max-width: 340px;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.7;
  }

  .t-hero-desc br {
    display: none;
  }

  .t-search-wrap {
    gap: 8px;
    margin-bottom: 26px;
    padding: 7px 7px 7px 14px;
    border-radius: var(--r-md);
  }

  .t-search-input {
    min-width: 0;
    font-size: 13px;
  }

  .t-search-btn {
    height: 34px;
    padding: 0 13px;
    font-size: 12px;
  }

  .t-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
  }

  .t-stat {
    padding: 12px 8px;
    border: 1px solid var(--c-line);
    border-radius: var(--r-md);
    background: rgba(255,255,255,0.025);
  }

  .t-stat:last-child {
    border-right: 1px solid var(--c-line);
  }

  .t-stat strong { font-size: 19px; }

  .t-stat span {
    margin-top: 4px;
    font-size: 11px;
  }

  .t-filter-bar {
    top: 58px;
    padding: 9px 0;
  }

  .t-filter-inner {
    gap: 8px;
  }

  .t-cat-tabs {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 1px;
    scrollbar-width: none;
  }

  .t-cat-tabs::-webkit-scrollbar {
    display: none;
  }

  .t-cat-btn {
    height: 32px;
    padding: 0 10px;
    font-size: 11px;
    gap: 5px;
  }

  .t-filter-divider,
  .t-result-count {
    display: none;
  }

  .t-tag-scroll {
    width: 100%;
    flex: 0 0 100%;
  }

  .t-tag-pill {
    height: 28px;
    padding: 0 10px;
    font-size: 11px;
  }

  .t-main {
    padding: 24px 0 52px;
  }

  .t-layout {
    gap: 20px;
  }

  .t-sidebar {
    gap: 10px;
  }

  .t-sidebar-section {
    width: 100%;
  }

  .t-sidebar-section:nth-child(3) {
    display: none;
  }

  .t-sidebar-title {
    margin-bottom: 8px;
    font-size: 10px;
  }

  .t-sidebar-links,
  .t-platform-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .t-sidebar-links::-webkit-scrollbar,
  .t-platform-list::-webkit-scrollbar {
    display: none;
  }

  .t-sidebar-link {
    flex: 0 0 auto;
    padding: 7px 9px;
    font-size: 12px;
  }

  .t-sidebar-link .s-icon {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }

  .t-platform-chip {
    flex: 0 0 auto;
    padding: 5px 9px;
    font-size: 10px;
  }

  .t-grid-header {
    margin-bottom: 14px;
  }

  .t-grid-title {
    font-size: 13px;
  }

  .t-sort-select {
    max-width: 140px;
    padding: 6px 28px 6px 12px;
    font-size: 11px;
  }

  .t-cards-grid { grid-template-columns: 1fr; }

  .t-card {
    border-radius: var(--r-md);
  }

  .t-card-preview {
    height: 96px;
  }

  .t-card-preview-inner {
    font-size: 34px;
  }

  .t-card-badge {
    top: 9px;
    left: 9px;
    padding: 3px 8px;
    font-size: 9px;
  }

  .t-card-cat-dot {
    top: 9px;
    right: 9px;
    width: 24px;
    height: 24px;
    font-size: 11px;
  }

  .t-card-body {
    padding: 14px 14px 15px;
  }

  .t-card-meta {
    margin-bottom: 7px;
  }

  .t-card-cat-label,
  .t-card-ratio,
  .t-card-subtitle,
  .t-card-tag,
  .t-card-level {
    font-size: 10px;
  }

  .t-card-title {
    margin-bottom: 5px;
    font-size: 15px;
    line-height: 1.32;
  }

  .t-card-subtitle {
    margin-bottom: 8px;
  }

  .t-card-desc {
    margin-bottom: 12px;
    font-size: 12px;
    line-height: 1.65;
  }

  .t-card-tags {
    gap: 4px;
    margin-bottom: 12px;
  }

  .t-card-tag {
    padding: 2px 7px;
  }

  .t-card-footer {
    gap: 8px;
    padding-top: 12px;
    align-items: flex-start;
  }

  .t-card-uses {
    font-size: 11px;
  }

  .t-card-actions {
    flex-direction: column;
    align-items: flex-end;
  }

  .t-action-btn {
    height: 28px;
    padding: 0 10px;
    font-size: 11px;
  }

  .t-modal-overlay {
    align-items: flex-end;
    padding: 10px;
  }

  .t-modal {
    width: 100%;
    max-height: 88vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }

  .t-modal-header { padding: 16px 16px 14px; }
  .t-modal-preview-icon {
    width: 42px;
    height: 42px;
    font-size: 20px;
  }
  .t-modal-title { font-size: 17px; }
  .t-modal-subtitle,
  .t-modal-category { font-size: 10px; }
  .t-modal-body { padding: 16px; }
  .t-modal-footer { padding: 12px 16px 16px; }

  .t-prompt-code {
    padding: 13px;
  }

  .t-prompt-code pre,
  .t-timeline-role,
  .t-timeline-desc {
    font-size: 12px;
  }

  .t-info-grid {
    grid-template-columns: 1fr 1fr;
  }

  .t-info-item {
    padding: 10px;
  }

  .t-info-item dd {
    font-size: 12px;
  }

  .t-modal-footer {
    display: grid;
  }

  .t-toast {
    bottom: 18px;
    max-width: calc(100% - 28px);
    padding: 10px 16px;
    font-size: 12px;
  }

  .t-footer {
    padding: 30px 0;
  }

  .t-footer-left,
  .t-footer-links {
    width: 100%;
  }

  .t-footer-links {
    gap: 14px;
    flex-wrap: wrap;
  }
}

@media (max-width: 380px) {
  .t-hero h1 {
    font-size: 24px;
  }

  .t-search-btn {
    padding: 0 10px;
  }

  .t-card-footer {
    display: grid;
  }

  .t-card-actions {
    margin-left: 0;
    align-items: stretch;
    flex-direction: row;
  }

  .t-action-btn {
    flex: 1;
  }
}

/* ═══════════════════════════════════════════
   13. Animations
═══════════════════════════════════════════ */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.t-card {
  animation: fade-in-up 0.35s var(--ease) both;
}

/* stagger via JS inline style --delay */
.t-card { animation-delay: var(--delay, 0ms); }
