/* ===================================================================
   News Match Cut · Headline Generator for After Effects
   Modern dark editor UI · 16 publication templates
   =================================================================== */

:root {
  /* Light, modern editor palette — warm off-white surfaces, neutral greys, warm accents */
  --bg: #f6f7f9;
  --bg-grad-1: #fbfbfd;
  --bg-grad-2: #eef0f4;
  --surface: #ffffff;
  --surface-2: #f3f4f7;
  --surface-3: #e9ebf0;
  --border: #e5e7ec;
  --border-strong: #d6d9e0;
  --text: #0f1419;
  --text-2: #4a5160;
  --muted: #8b90a0;
  --accent: #ff8a3d;
  --accent-2: #ff6a35;
  --accent-yellow: #ffb547;
  --accent-grad: linear-gradient(135deg, #ffd400 0%, #ffb547 50%, #ff7a45 100%);
  --shadow: 0 1px 2px rgba(15, 20, 25, 0.04), 0 8px 24px rgba(15, 20, 25, 0.06);
  --shadow-lg: 0 1px 2px rgba(15, 20, 25, 0.05), 0 18px 48px rgba(15, 20, 25, 0.10);
  --ring: 0 0 0 1px rgba(255, 138, 61, 0.55), 0 0 0 4px rgba(255, 138, 61, 0.16);
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --font-ui: 'General Sans', 'Satoshi', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 760px at 8% -8%, rgba(255, 181, 71, 0.18), transparent 60%),
    radial-gradient(1000px 640px at 96% 4%, rgba(255, 122, 69, 0.10), transparent 65%),
    radial-gradient(1400px 900px at 50% 120%, rgba(98, 120, 255, 0.08), transparent 60%),
    linear-gradient(180deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; }

/* ----- Top bar ----- */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid rgba(15, 20, 25, 0.06);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 4px 18px rgba(15, 20, 25, 0.04);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-family: 'Cabinet Grotesk', 'Satoshi', 'Inter', system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: -0.035em;
  font-size: 18px;
  line-height: 1;
  transition: transform 200ms cubic-bezier(.2,.7,.3,1);
}
.brand:hover { transform: translateY(-1px); }
.brand-logo {
  flex-shrink: 0;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 4px 14px rgba(255, 122, 69, 0.35)) drop-shadow(0 1px 2px rgba(0,0,0,0.4));
  transition: transform 400ms cubic-bezier(.2,.7,.3,1);
}
.brand:hover .brand-logo { transform: rotate(-4deg) scale(1.04); }
.brand-logo svg { width: 32px; height: 32px; display: block; }
.brand-name {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
}
.brand-mark {
  background: linear-gradient(180deg, #14161a 0%, #3b4250 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-tld {
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}
.topbar-center {
  text-align: center;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}
.topbar-actions {
  justify-self: end;
  display: flex;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text);
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: background .18s ease, border-color .18s ease, transform .12s ease, box-shadow .18s ease;
}
.btn:hover { background: var(--surface-2); border-color: #c0c4cd; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(15, 20, 25, 0.08); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--accent-grad);
  color: #1b1100;
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(255, 122, 69, 0.30);
}
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 10px 26px rgba(255, 122, 69, 0.40); }

/* ----- Layout ----- */
.layout {
  display: grid;
  grid-template-columns: 256px 1fr 340px;
  gap: 24px;
  padding: 24px 28px 40px;
  align-items: start;
  max-width: 1760px;
  margin: 0 auto;
}
@media (max-width: 1180px) {
  .layout { grid-template-columns: 220px 1fr; }
  .rail-right { grid-column: 1 / -1; position: static; }
}
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; padding: 14px; }
  .rail-left, .rail-right { position: static; }
}

.rail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 88px;
  box-shadow: var(--shadow);
}
.rail-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rail-title {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
}

/* Template list (left rail) */
.tpl-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 -8px;
}
.tpl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
  transition: background .15s ease, color .15s ease, transform .15s ease;
  width: 100%;
}
.tpl-item:hover { background: var(--surface-2); color: var(--text); transform: translateX(2px); }
.tpl-item.is-active {
  background: linear-gradient(135deg, rgba(255, 212, 0, 0.22) 0%, rgba(255, 122, 69, 0.14) 100%);
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 138, 61, 0.40);
}
.tpl-item.is-active .tpl-dot { box-shadow: 0 0 0 2px #fff inset, 0 0 0 1px rgba(15, 20, 25, 0.15); }
.tpl-dot {
  width: 12px; height: 12px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Inputs */
.input {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 13px;
  font-family: inherit;
  font-size: 13.5px;
  resize: vertical;
  width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.input::placeholder { color: var(--muted); }
textarea.input { min-height: 78px; line-height: 1.45; }
.input:focus {
  outline: none;
  border-color: rgba(255, 138, 61, 0.65);
  background: #ffffff;
  box-shadow: var(--ring);
}

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.seg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.seg-btn {
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  color: var(--text-2);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.seg-btn:hover { color: var(--text); background: rgba(15, 20, 25, 0.04); }
.seg-btn.is-active {
  background: #ffffff;
  color: #0f1419;
  box-shadow: 0 1px 2px rgba(15, 20, 25, 0.04), 0 2px 8px rgba(15, 20, 25, 0.08);
}

.colors {
  display: flex;
  align-items: center;
  gap: 10px;
}
.colors input[type="color"] {
  width: 38px;
  height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  padding: 2px;
}
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.sw {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid rgba(15, 20, 25, 0.12);
  cursor: pointer;
  padding: 0;
  transition: transform .15s ease, box-shadow .15s ease;
}
.sw:hover { transform: scale(1.12); box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(255, 138, 61, 0.45); }

/* ----- Photo bg controls ----- */
.photo-controls {
  display: flex;
  gap: 8px;
}
.photo-upload-btn { flex: 1; justify-content: center; }
.photo-upload-btn svg { color: var(--accent); }
.photo-remove-btn {
  background: rgba(229, 56, 98, 0.08);
  border-color: rgba(229, 56, 98, 0.22);
  color: #c82455;
}
.photo-remove-btn:hover {
  background: rgba(229, 56, 98, 0.14);
  border-color: rgba(229, 56, 98, 0.45);
  color: #a51d47;
}
.slider-row { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11.5px;
  color: var(--text-2);
  font-weight: 500;
}
.slider-val {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 600;
}
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--surface-3);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent-grad);
  border-radius: 50%;
  border: 2px solid #ffffff;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(15, 20, 25, 0.12), 0 2px 8px rgba(255, 122, 69, 0.35);
  transition: transform .15s ease;
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #ffb547;
  border-radius: 50%;
  border: 2px solid #ffffff;
  cursor: grab;
}

.rail-hint {
  font-size: 12px;
  color: var(--text-2);
  background: linear-gradient(135deg, rgba(255, 181, 71, 0.14) 0%, rgba(255, 122, 69, 0.06) 100%);
  border: 1px solid rgba(255, 138, 61, 0.22);
  border-radius: 12px;
  padding: 13px 14px;
  line-height: 1.55;
}
.rail-hint strong { color: var(--text); display: block; margin-bottom: 4px; font-size: 12px; letter-spacing: 0.02em; }
.rail-hint p { margin: 0; }

/* ----- Stage ----- */
.stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px;
  position: sticky;
  top: 88px;
  box-shadow: var(--shadow-lg);
}
.stage-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(80% 60% at 50% 0%, rgba(255, 181, 71, 0.10) 0%, transparent 60%),
    linear-gradient(180deg, #f3f4f7 0%, #e9ebf0 100%);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), inset 0 -40px 80px rgba(15, 20, 25, 0.04);
  transition: background .25s ease;
}
/* Show a checkerboard so transparent canvas remains visible against the dark UI */
.stage-frame.is-transparent {
  background:
    linear-gradient(45deg, #c8ccd6 25%, transparent 25%),
    linear-gradient(-45deg, #c8ccd6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #c8ccd6 75%),
    linear-gradient(-45deg, transparent 75%, #c8ccd6 75%),
    #e9ebef;
  background-size: 28px 28px;
  background-position: 0 0, 0 14px, 14px -14px, -14px 0px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), inset 0 -40px 80px rgba(0,0,0,0.08);
}
.stage-inner {
  position: absolute; inset: 0;
}
.stage-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.stage-meta .dot { opacity: .5; }

/* The canvas is the actual export node, rendered at native px and scaled to fit */
.canvas {
  position: absolute;
  inset: 0;
  width: 1920px;
  height: 1080px;
  transform-origin: top left;
  background: #ffffff;
  color: #14161a;
  overflow: hidden;
}
/* Render quality: pin font smoothing + geometric precision to keep 4K supersampled output crisp */
.canvas, .canvas * {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}
.canvas.exporting { contain: paint; }

/* Square 1:1 — render 1080x1080, content adapts via flex */
.canvas[data-size="1080"] { width: 1080px; height: 1080px; }
/* Vertical 9:16 — render 1080x1920 */
.canvas[data-size="1080v"] { width: 1080px; height: 1920px; }
/* 4K UHD — same DOM size 1920x1080, exported at pixelRatio 2 */
.canvas[data-size="3840"] { width: 1920px; height: 1080px; }

/* ---- Photo background overlay (sits behind .tpl content, above .canvas bg) ---- */
.canvas .photo-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #0a0a0a;
  opacity: var(--photo-opacity, 1);
}
.canvas .photo-bg[data-fit="contain"] { background-size: contain; }
.canvas .photo-dim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: rgba(0, 0, 0, var(--photo-dim, 0));
}
/* When a photo is set, the .tpl content needs a stacking context above the overlay */
.canvas.has-photo .tpl { position: relative; z-index: 2; }
/* Also lift child elements that already have z-index */
.canvas.has-photo .topbar-news,
.canvas.has-photo .body,
.canvas.has-photo .masthead,
.canvas.has-photo .wapo-mast,
.canvas.has-photo .grid-bg { z-index: 2; }
/* When photo is in use, hide brand-template fill backgrounds so the photo shows through */
.canvas.has-photo { background: #0a0a0a !important; }
.canvas.has-photo .tpl { background: transparent !important; }
.canvas.has-photo .grid-bg { display: none !important; }
/* Force readable typography over photo (white text + soft shadow) */
.canvas.has-photo .headline,
.canvas.has-photo .author,
.canvas.has-photo .byline,
.canvas.has-photo .nyt-name,
.canvas.has-photo .wapo-name,
.canvas.has-photo .ft-name,
.canvas.has-photo .wsj-name,
.canvas.has-photo .nyt-meta-row,
.canvas.has-photo .nyt-tag,
.canvas.has-photo .wapo-tag,
.canvas.has-photo .economist-name,
.canvas.has-photo .lemonde-name,
.canvas.has-photo .spiegel-name,
.canvas.has-photo .aljazeera-name,
.canvas.has-photo .time-name,
.canvas.has-photo .vox-logo,
.canvas.has-photo .sky-name {
  color: #ffffff !important;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.5);
}
.canvas.has-photo .nyt-meta-row,
.canvas.has-photo .nyt-tag,
.canvas.has-photo .wapo-tag {
  border-color: rgba(255, 255, 255, 0.35) !important;
}
.canvas.has-photo .nyt-tag .nyt-divider,
.canvas.has-photo hr,
.canvas.has-photo .masthead,
.canvas.has-photo .wapo-mast { border-color: rgba(255, 255, 255, 0.25) !important; }

/* ----- Footer ----- */
.footer {
  text-align: center;
  padding: 22px;
  color: var(--muted);
  font-size: 11.5px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  letter-spacing: 0.01em;
}
.footer a { color: var(--text-2); text-decoration: none; transition: color .15s ease; }
.footer a:hover { color: var(--accent); }

/* ============================================
   Word highlighting (universal)
   ============================================ */

.word {
  cursor: pointer;
  position: relative;
  transition: background-color .12s ease, color .12s ease;
}
.word:hover {
  background: rgba(255, 212, 0, 0.18);
}
.canvas .word.is-highlight[data-style="marker"] {
  background-color: var(--hl, #ffd400);
  box-shadow:
    0.06em 0 0 var(--hl, #ffd400),
    -0.06em 0 0 var(--hl, #ffd400);
}
.canvas .word.is-highlight[data-style="underline"] {
  background-image:
    linear-gradient(0deg, var(--hl, #ffd400) 0, var(--hl, #ffd400) 0.18em, transparent 0.18em);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  padding-bottom: 0.05em;
}
.canvas .word.is-highlight[data-style="boxed"] {
  background-color: var(--hl, #ffd400);
  padding: 0.04em 0.18em;
  border-radius: 4px;
}
.canvas .word.is-highlight[data-style="invert"] {
  background-color: var(--hl, #111);
  color: var(--hl-fg, #fff);
  padding: 0.04em 0.18em;
}

/* Solid highlight — fills consecutive highlighted words AND the spaces
   between them. Inner words inherit, the wrapping run paints the bg. */
.canvas .hl-run[data-style="solid"] {
  background-color: var(--hl, #ffd400);
  box-shadow:
    0.08em 0 0 var(--hl, #ffd400),
    -0.08em 0 0 var(--hl, #ffd400);
  padding: 0;
  border-radius: 2px;
  -webkit-box-decoration-break: clone;
          box-decoration-break: clone;
}
.canvas .hl-run[data-style="solid"] .word.is-highlight,
.canvas .hl-run[data-style="solid"] .hl-space {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0;
}
/* Standalone solid highlight (single word, no run) */
.canvas .word.is-highlight[data-style="solid"]:not(.hl-run .word) {
  background-color: var(--hl, #ffd400);
  box-shadow:
    0.08em 0 0 var(--hl, #ffd400),
    -0.08em 0 0 var(--hl, #ffd400);
}

/* ============================================
   Generic helpers
   ============================================ */

.tpl {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.headline {
  outline: none;
  word-wrap: break-word;
  margin: 0;
}
.byline {
  outline: none;
  margin: 0;
}

/* ============================================
   1) BBC NEWS — red banner, three-block logo
   ============================================ */

/* BBC Reith is custom — based on Helvetica. Use system Helvetica Neue/Arial for authentic match */
.tpl-bbc {
  background: #ffffff;
  --bbc-sans: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.tpl-bbc .topbar-news {
  background: #bb1919;
  padding: 26px 80px;
  display: flex;
  align-items: center;
  gap: 30px;
}
.tpl-bbc .bbc-logo {
  display: flex;
  gap: 4px;
}
.tpl-bbc .bbc-block {
  background: #fff;
  color: #111;
  font-family: var(--bbc-sans);
  font-weight: 800;
  font-size: 56px;
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.02em;
}
.tpl-bbc .news-word {
  font-family: var(--bbc-sans);
  font-weight: 500;
  font-size: 56px;
  color: #fff;
  letter-spacing: -0.01em;
}
.tpl-bbc .live-pill {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-family: var(--bbc-sans);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.04em;
}
.tpl-bbc .live-dot {
  width: 16px; height: 16px; min-width: 16px; min-height: 16px;
  background: #fff;
  border-radius: 50%;
  flex-shrink: 0;
}
.tpl-bbc .body {
  flex: 1;
  padding: 100px 80px 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tpl-bbc .headline {
  font-family: var(--bbc-sans);
  font-weight: 700;
  font-size: 108px;
  line-height: 1.05;
  color: #111;
  letter-spacing: -0.018em;
}
.tpl-bbc .author {
  font-family: var(--bbc-sans);
  font-size: 28px;
  color: #14161a;
}
.tpl-bbc .byline {
  color: #6b6b6b;
  font-family: var(--bbc-sans);
  font-size: 24px;
  font-weight: 500;
}

/* ============================================
   2.5) REUTERS — orange topbar, mirrors BBC layout
   for a clean match-cut transition between the two
   ============================================ */
.tpl-reuters {
  background: #ffffff;
  --rt-sans: 'Inter', 'Helvetica Neue', Arial, sans-serif;
}
.tpl-reuters .topbar-news {
  background: #FA6400;
  padding: 26px 80px;
  display: flex;
  align-items: center;
  gap: 30px;
}
.tpl-reuters .reuters-logo {
  display: flex;
  align-items: center;
  gap: 18px;
}
.tpl-reuters .reuters-mark { display: block; flex-shrink: 0; }
.tpl-reuters .reuters-name {
  font-family: var(--rt-sans);
  font-weight: 800;
  font-size: 56px;
  letter-spacing: 0.04em;
  color: #ffffff;
  line-height: 1;
}
.tpl-reuters .live-pill {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-family: var(--rt-sans);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.04em;
}
.tpl-reuters .live-dot {
  width: 16px; height: 16px; min-width: 16px; min-height: 16px;
  background: #fff;
  border-radius: 50%;
  flex-shrink: 0;
}
.tpl-reuters .body {
  flex: 1;
  padding: 100px 80px 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tpl-reuters .headline {
  font-family: var(--rt-sans);
  font-weight: 700;
  font-size: 108px;
  line-height: 1.05;
  color: #111;
  letter-spacing: -0.018em;
}
.tpl-reuters .author {
  font-family: var(--rt-sans);
  font-size: 28px;
  color: #14161a;
}
.tpl-reuters .byline {
  color: #6b6b6b;
  font-family: var(--rt-sans);
  font-size: 24px;
  font-weight: 500;
}

/* ============================================
   3) THE NEW YORK TIMES — Old English masthead
   ============================================ */

/* NYT uses Cheltenham (custom). Closest free match: Source Serif 4 (humanist transitional) at heaviest weight + Old Standard for body italics */
.tpl-nyt {
  background: #fdfdf7;
  padding: 70px 110px 80px;
  --nyt-serif: 'Source Serif 4', 'Georgia', 'Times New Roman', serif;
  --nyt-italic: 'Old Standard TT', 'Georgia', serif;
}
.tpl-nyt .masthead {
  text-align: center;
  border-top: 4px double #14161a;
  border-bottom: 1px solid #14161a;
  padding: 16px 0 22px;
  margin-bottom: 76px;
}
.tpl-nyt .nyt-name {
  font-family: 'UnifrakturCook', 'Old Standard TT', 'Times New Roman', serif;
  font-weight: 700;
  font-size: 96px;
  letter-spacing: 0.004em;
  color: #14161a;
  line-height: 1;
  font-variant-ligatures: none;
}
.tpl-nyt .nyt-meta-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--nyt-italic);
  color: #555;
  font-size: 16px;
  letter-spacing: 0.04em;
  font-style: italic;
  margin-bottom: 10px;
}
.tpl-nyt .nyt-tag {
  margin-top: 8px;
  font-family: var(--nyt-italic);
  font-style: italic;
  color: #555;
  font-size: 22px;
  letter-spacing: 0.04em;
}
.tpl-nyt .body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tpl-nyt .headline {
  font-family: var(--nyt-serif);
  font-weight: 900;
  font-size: 92px;
  line-height: 1.08;
  color: #14161a;
  letter-spacing: -0.018em;
  text-align: center;
  font-feature-settings: 'lnum';
}
.tpl-nyt .body .kicker {
  align-self: center;
  margin-bottom: 0;
}
.tpl-nyt .body { gap: 26px; }
.tpl-nyt .byline-block { align-items: center; }
.tpl-nyt .author {
  font-family: var(--nyt-italic);
  font-style: italic;
  font-size: 28px;
  font-weight: 700;
  color: #14161a;
}
.tpl-nyt .byline {
  font-family: var(--nyt-italic);
  font-style: italic;
  color: #6a6a6a;
  font-size: 22px;
}

/* ============================================
   4) THE GUARDIAN — blue boxed wordmark
   ============================================ */

/* Guardian uses Guardian Egyptian (custom slab). Zilla Slab is the closest free match (85% similarity) */
.tpl-guardian {
  background: #ffffff;
  padding: 80px 110px;
  --gd-slab: 'Zilla Slab', 'Bitter', 'Source Serif 4', serif;
}
.tpl-guardian .gd-logo {
  background: #052962;
  color: #ffffff;
  font-family: var(--gd-slab);
  font-weight: 900;
  font-size: 60px;
  letter-spacing: -0.015em;
  padding: 20px 28px 22px;
  line-height: 1;
}
.tpl-guardian .gd-logo em {
  font-style: italic;
  font-weight: 900;
  color: #fff;
}
.tpl-guardian .body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tpl-guardian .headline {
  font-family: var(--gd-slab);
  font-weight: 800;
  font-size: 108px;
  line-height: 1.08;
  color: #14161a;
  letter-spacing: -0.015em;
}
.tpl-guardian .author {
  font-family: var(--gd-slab);
  font-size: 28px;
  color: #14161a;
  font-weight: 700;
}
.tpl-guardian .byline {
  color: #707070;
  font-family: var(--gd-slab);
  font-size: 24px;
  font-weight: 400;
  font-style: italic;
}

/* ============================================
   5) FINANCIAL TIMES — salmon paper, condensed
   ============================================ */

/* FT uses Financier Display (custom) — Playfair Display is closest free (high-contrast transitional) */
.tpl-ft {
  background: #fff1e0;
  padding: 70px 110px;
  --ft-serif: 'Playfair Display', 'Source Serif 4', 'Times New Roman', serif;
}
.tpl-ft .ft-mast {
  display: flex;
  align-items: baseline;
  gap: 22px;
  border-bottom: 2px solid #14161a;
  padding-bottom: 18px;
  margin-bottom: 70px;
}
.tpl-ft .ft-circle {
  background: #990F3D;
  color: #fff1e0;
  font-family: var(--ft-serif);
  font-weight: 900;
  width: 80px; height: 80px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 46px;
  flex-shrink: 0;
  letter-spacing: -0.06em;
  align-self: center;
  font-style: italic;
}
.tpl-ft .ft-name {
  font-family: var(--ft-serif);
  font-weight: 900;
  font-size: 56px;
  color: #14161a;
  letter-spacing: -0.005em;
  line-height: 1;
  white-space: nowrap;
}
.tpl-ft .ft-tag {
  margin-left: auto;
  font-family: var(--ft-serif);
  font-style: italic;
  font-size: 22px;
  color: #5a4030;
  letter-spacing: 0.02em;
  font-weight: 400;
}
.tpl-ft .body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tpl-ft .headline {
  font-family: var(--ft-serif);
  font-weight: 900;
  font-size: 112px;
  line-height: 1.05;
  color: #14161a;
  letter-spacing: -0.015em;
}
.tpl-ft .author {
  font-family: var(--ft-serif);
  font-size: 28px;
  color: #14161a;
  font-weight: 700;
}
.tpl-ft .byline {
  color: #5a4030;
  font-family: var(--ft-serif);
  font-size: 24px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.01em;
}

/* ============================================
   6) WASHINGTON POST — blackletter masthead
   ============================================ */

/* WaPo uses Postoni for headlines (Bodoni-based) — Playfair Display is the closest free alternative */
.tpl-wapo {
  background: #ffffff;
  padding: 70px 110px;
  --wapo-serif: 'Playfair Display', 'PT Serif', 'Source Serif 4', serif;
}
.tpl-wapo .wapo-mast {
  text-align: center;
  border-bottom: 1px solid #14161a;
  padding-bottom: 22px;
  margin-bottom: 70px;
}
.tpl-wapo .wapo-name {
  font-family: 'UnifrakturCook', 'Old Standard TT', serif;
  font-weight: 700;
  font-size: 96px;
  color: #14161a;
  line-height: 1;
}
.tpl-wapo .wapo-tag {
  margin-top: 14px;
  font-family: var(--wapo-serif);
  font-style: italic;
  font-size: 22px;
  color: #6a6a6a;
  letter-spacing: 0.04em;
}
.tpl-wapo .body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tpl-wapo .headline {
  font-family: var(--wapo-serif);
  font-weight: 900;
  font-size: 104px;
  line-height: 1.08;
  color: #14161a;
  letter-spacing: -0.015em;
  text-align: center;
}
.tpl-wapo .body .kicker {
  align-self: center;
  margin-bottom: 0;
}
.tpl-wapo .body { gap: 26px; }
.tpl-wapo .byline-block { align-items: center; }
.tpl-wapo .author {
  font-family: var(--wapo-serif);
  font-size: 28px;
  font-weight: 700;
  color: #14161a;
}
.tpl-wapo .byline {
  font-family: var(--wapo-serif);
  font-style: italic;
  color: #6a6a6a;
  font-size: 22px;
  font-weight: 400;
}

/* ============================================
   7) CNN — red boxed wordmark
   ============================================ */

/* CNN uses CNN Sans (Helvetica Neue-based). Use Helvetica system + Barlow Condensed for condensed headlines */
.tpl-cnn {
  background: #ffffff;
  padding: 0;
  --cnn-sans: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --cnn-cond: 'Barlow Condensed', 'Helvetica Neue', Arial, sans-serif;
}
.tpl-cnn .topbar-news {
  background: #cc0000;
  padding: 20px 90px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.tpl-cnn .cnn-mark {
  font-family: var(--cnn-sans);
  font-weight: 900;
  font-size: 64px;
  color: #ffffff;
  letter-spacing: -0.02em;
  font-style: italic;
}
.tpl-cnn .cnn-tag {
  color: #fff;
  font-family: var(--cnn-sans);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-left: 16px;
  border-left: 2px solid rgba(255,255,255,0.5);
  padding-left: 18px;
}
.tpl-cnn .live-pill {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: #cc0000;
  font-family: var(--cnn-sans);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.1em;
  padding: 8px 16px;
}
.tpl-cnn .live-pill .pulse {
  width: 12px; height: 12px;
  background: #cc0000;
  border-radius: 50%;
  flex-shrink: 0;
}
.tpl-cnn .cnn-strap {
  background: #14161a;
  color: #ffffff;
  font-family: var(--cnn-sans);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 14px 90px;
}
.tpl-cnn .body {
  flex: 1;
  padding: 70px 90px 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 30px;
}
.tpl-cnn .headline {
  font-family: var(--cnn-cond);
  font-weight: 800;
  font-size: 108px;
  line-height: 1.0;
  color: #14161a;
  letter-spacing: -0.015em;
  text-transform: uppercase;
}
.tpl-cnn .author {
  font-family: var(--cnn-sans);
  font-size: 26px;
  color: #14161a;
  font-weight: 700;
}
.tpl-cnn .byline {
  color: #6b6b6b;
  font-family: var(--cnn-sans);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ============================================
   8) WALL STREET JOURNAL — serif
   ============================================ */

/* WSJ uses Escrow (Scotch Roman). Libre Bodoni is the closest free Scotch-adjacent (high-contrast didone-transitional) for nameplate; Source Serif 4 for body */
.tpl-wsj {
  background: #fbfaf6;
  padding: 70px 110px;
  --wsj-serif: 'Libre Bodoni', 'Source Serif 4', 'Times New Roman', serif;
  --wsj-body: 'Source Serif 4', 'Georgia', 'Times New Roman', serif;
  --wsj-italic: 'Old Standard TT', 'Georgia', serif;
  --wsj-sans: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.tpl-wsj .wsj-mast {
  text-align: center;
  border-top: 6px double #14161a;
  border-bottom: 1px solid #14161a;
  padding: 14px 0 18px;
  margin-bottom: 60px;
}
.tpl-wsj .wsj-row1 {
  font-family: var(--wsj-italic);
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  color: #14161a;
  letter-spacing: 0.02em;
}
.tpl-wsj .wsj-name {
  font-family: var(--wsj-serif);
  font-weight: 800;
  font-size: 96px;
  color: #14161a;
  letter-spacing: -0.005em;
  line-height: 1;
  margin: 8px 0 10px;
}
.tpl-wsj .wsj-row3 {
  font-family: var(--wsj-sans);
  font-size: 17px;
  color: #555;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
}
.tpl-wsj .body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tpl-wsj .headline {
  font-family: var(--wsj-body);
  font-weight: 900;
  font-size: 104px;
  line-height: 1.05;
  color: #14161a;
  letter-spacing: -0.018em;
  text-align: center;
}
.tpl-wsj .byline-block { align-items: center; }
.tpl-wsj .author {
  font-family: var(--wsj-italic);
  font-size: 26px;
  color: #14161a;
  font-weight: 700;
  font-style: italic;
}
.tpl-wsj .byline {
  font-family: var(--wsj-sans);
  font-size: 18px;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 600;
}

/* ============================================
   9) BLOOMBERG — black bar, ticker feel
   ============================================ */

/* Bloomberg uses Neue Haas Grotesk (essentially Helvetica Neue). System Helvetica is the most authentic match */
.tpl-bloomberg {
  background: #ffffff;
  --bb-sans: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --bb-serif: 'Source Serif 4', 'Libre Bodoni', 'Times New Roman', serif;
}
.tpl-bloomberg .topbar-news {
  background: #14161a;
  padding: 22px 80px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.tpl-bloomberg .bb-name {
  font-family: var(--bb-serif);
  font-weight: 900;
  font-size: 40px;
  color: #ffffff;
  letter-spacing: -0.01em;
  font-style: italic;
}
.tpl-bloomberg .bb-tag {
  color: #ffffff;
  font-family: var(--bb-sans);
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  border-left: 1px solid rgba(255,255,255,0.4);
  padding-left: 22px;
}
.tpl-bloomberg .ticker {
  margin-left: auto;
  display: flex;
  gap: 22px;
  color: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, 'Courier New', monospace;
  font-size: 22px;
  font-weight: 600;
}
.tpl-bloomberg .ticker .up { color: #5af09b; }
.tpl-bloomberg .ticker .down { color: #ff6b6b; }
.tpl-bloomberg .body {
  flex: 1;
  padding: 100px 80px 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tpl-bloomberg .headline {
  font-family: var(--bb-sans);
  font-weight: 900;
  font-size: 108px;
  line-height: 1.04;
  color: #14161a;
  letter-spacing: -0.025em;
}
.tpl-bloomberg .author {
  font-family: var(--bb-sans);
  font-size: 28px;
  color: #14161a;
  font-weight: 700;
}
.tpl-bloomberg .byline {
  color: #6b6b6b;
  font-family: var(--bb-sans);
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ============================================
   10) VOX — yellow accent, chunky sans
   ============================================ */

.tpl-vox {
  background: #ffffff;
  padding: 100px 130px;
}
.tpl-vox .vox-logo {
  font-family: 'Cabinet Grotesk', 'Helvetica Neue', sans-serif;
  font-weight: 900;
  font-size: 64px;
  color: #14161a;
  letter-spacing: -0.06em;
  line-height: 1;
  margin-bottom: 60px;
  display: inline-flex;
  align-items: center;
  gap: 0;
  align-self: flex-start;
  background: #ffd400;
  padding: 18px 28px 20px;
  border-radius: 6px;
}
.tpl-vox .vox-logo .dot {
  color: #14161a;
}
.tpl-vox .body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tpl-vox .headline {
  font-family: 'Cabinet Grotesk', 'Satoshi', sans-serif;
  font-weight: 900;
  font-size: 130px;
  line-height: 0.98;
  color: #14161a;
  letter-spacing: -0.022em;
}
.tpl-vox .author {
  font-family: 'Cabinet Grotesk', sans-serif;
  font-size: 28px;
  color: #14161a;
  font-weight: 700;
}
.tpl-vox .byline {
  color: #777b85;
  font-family: 'General Sans', sans-serif;
  font-size: 22px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

/* ============================================
   Author + kicker (universal helpers)
   ============================================ */
.byline-block {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.author {
  outline: none;
  font-weight: 700;
  font-size: 28px;
  color: #14161a;
}
.kicker {
  display: inline-flex;
  align-self: flex-start;
  margin-bottom: 26px;
  padding: 6px 14px;
  font-family: 'General Sans', 'Inter', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ffffff;
  background: var(--accent-color, #14161a);
}

/* Per-publication kicker color via accent var */
.tpl-bbc { --accent-color: #bb1919; }
.tpl-reuters { --accent-color: #FA6400; }
.tpl-guardian { --accent-color: #052962; }
.tpl-ft { --accent-color: #14161a; }
.tpl-cnn { --accent-color: #cc0000; }
.tpl-bloomberg { --accent-color: #14161a; }
.tpl-sky { --accent-color: #0072c9; }
.tpl-aljazeera { --accent-color: #fa9000; }
.tpl-spiegel { --accent-color: #e30613; }

/* ============================================
   11) SKY NEWS — blue banner, white logo pill
   ============================================ */
.tpl-sky {
  background: #ffffff;
  --sky-sans: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  --sky-cond: 'Roboto Condensed', 'Helvetica Neue', Arial, sans-serif;
}
.tpl-sky .topbar-news {
  background: #0072c9;
  padding: 22px 80px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.tpl-sky .sky-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tpl-sky .sky-pill {
  background: #ffffff;
  color: #0072c9;
  font-family: var(--sky-sans);
  font-weight: 900;
  font-size: 36px;
  padding: 6px 16px 8px;
  border-radius: 6px;
  letter-spacing: -0.02em;
  font-style: italic;
}
.tpl-sky .sky-news {
  font-family: var(--sky-sans);
  font-weight: 900;
  font-size: 32px;
  color: #ffffff;
  letter-spacing: 0.12em;
}
.tpl-sky .sky-tag {
  background: #ffd400;
  color: #0a2540;
  font-family: var(--sky-sans);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.16em;
  padding: 8px 16px;
  text-transform: uppercase;
}
.tpl-sky .live-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-family: var(--sky-sans);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.1em;
}
.tpl-sky .live-pill .live-dot {
  width: 14px; height: 14px;
  background: #ff3b3b;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.25);
}
.tpl-sky .sky-strap {
  background: #0a2540;
  color: #fff;
  font-family: var(--sky-sans);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.16em;
  padding: 12px 80px;
}
.tpl-sky .body {
  flex: 1;
  padding: 90px 80px 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tpl-sky .headline {
  font-family: var(--sky-cond);
  font-weight: 900;
  font-size: 116px;
  line-height: 1.02;
  color: #0a2540;
  letter-spacing: -0.02em;
}
.tpl-sky .author {
  color: #0a2540;
  font-family: var(--sky-sans);
  font-size: 26px;
}
.tpl-sky .byline {
  color: #6b7480;
  font-family: var(--sky-sans);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ============================================
   12) TIME — red border, condensed serif
   ============================================ */
.tpl-time {
  background: #f5efe6;
  padding: 60px 70px;
  --time-serif: 'Playfair Display', 'Source Serif 4', serif;
  --time-sans: 'General Sans', 'Inter', sans-serif;
}
.tpl-time .time-frame {
  flex: 1;
  border: 16px solid #e10000;
  background: #f5efe6;
  padding: 50px 70px 60px;
  display: flex;
  flex-direction: column;
}
.tpl-time .time-mast {
  border-bottom: 1px solid #14161a;
  padding-bottom: 18px;
  margin-bottom: 50px;
}
.tpl-time .time-name {
  font-family: var(--time-serif);
  font-weight: 900;
  font-size: 132px;
  letter-spacing: -0.025em;
  color: #e10000;
  line-height: 1;
  font-style: italic;
}
.tpl-time .body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tpl-time .headline {
  font-family: var(--time-serif);
  font-weight: 900;
  font-size: 124px;
  line-height: 1.04;
  color: #14161a;
  letter-spacing: -0.02em;
}
.tpl-time .author {
  color: #14161a;
  font-family: var(--time-sans);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tpl-time .byline {
  color: #6b6b6b;
  font-family: var(--time-sans);
  font-size: 22px;
  font-style: italic;
}

/* ============================================
   13) THE ECONOMIST — red mast, white serif
   ============================================ */
.tpl-economist {
  background: #ffffff;
  padding: 0;
  --econ-serif: 'EB Garamond', 'Source Serif 4', serif;
}
.tpl-economist .econ-frame {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.tpl-economist .econ-mast {
  background: #e3120b;
  padding: 24px 80px 28px;
}
.tpl-economist .econ-name {
  font-family: var(--econ-serif);
  font-weight: 700;
  font-size: 64px;
  color: #ffffff;
  letter-spacing: -0.005em;
  font-style: italic;
}
.tpl-economist .body {
  flex: 1;
  padding: 100px 100px 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tpl-economist .headline {
  font-family: var(--econ-serif);
  font-weight: 700;
  font-size: 116px;
  line-height: 1.05;
  color: #14161a;
  letter-spacing: -0.012em;
}
.tpl-economist .author {
  color: #14161a;
  font-family: var(--econ-serif);
  font-size: 28px;
  font-style: italic;
  font-weight: 500;
}
.tpl-economist .byline {
  color: #6b6b6b;
  font-family: var(--econ-serif);
  font-size: 24px;
  font-style: italic;
}

/* ============================================
   14) AL JAZEERA — orange flame, white wordmark
   ============================================ */
.tpl-aljazeera {
  background: #ffffff;
  --aj-sans: 'General Sans', 'Helvetica Neue', Arial, sans-serif;
}
.tpl-aljazeera .topbar-news {
  background: #ffffff;
  border-bottom: 4px solid #fa9000;
  padding: 22px 80px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.tpl-aljazeera .aj-flame {
  width: 72px; height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tpl-aljazeera .aj-flame svg { width: 100%; height: 100%; }
.tpl-aljazeera .aj-name {
  font-family: var(--aj-sans);
  font-weight: 700;
  font-size: 42px;
  color: #14161a;
  letter-spacing: -0.025em;
}
.tpl-aljazeera .aj-tag {
  font-family: var(--aj-sans);
  font-weight: 700;
  font-size: 22px;
  color: #fa9000;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding-left: 14px;
  border-left: 1px solid #d8d8d2;
}
.tpl-aljazeera .live-pill {
  margin-left: auto;
  background: #c7222a;
  color: #fff;
  font-family: var(--aj-sans);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.12em;
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.tpl-aljazeera .live-pill .live-dot {
  width: 12px; height: 12px;
  background: #fff;
  border-radius: 50%;
}
.tpl-aljazeera .body {
  flex: 1;
  padding: 80px 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tpl-aljazeera .headline {
  font-family: var(--aj-sans);
  font-weight: 700;
  font-size: 110px;
  line-height: 1.04;
  color: #14161a;
  letter-spacing: -0.02em;
}
.tpl-aljazeera .author {
  color: #14161a;
  font-family: var(--aj-sans);
  font-size: 26px;
}
.tpl-aljazeera .byline {
  color: #6b6b6b;
  font-family: var(--aj-sans);
  font-size: 22px;
  font-weight: 600;
}

/* ============================================
   15) DER SPIEGEL — red mast, condensed sans
   ============================================ */
.tpl-spiegel {
  background: #ffffff;
  padding: 0;
  --sp-sans: 'Roboto Condensed', 'Helvetica Neue', Arial, sans-serif;
  --sp-display: 'Anton', 'Oswald', 'Helvetica Neue', sans-serif;
}
.tpl-spiegel .sp-mast {
  background: #e30613;
  padding: 28px 80px;
}
.tpl-spiegel .sp-name {
  font-family: var(--sp-display);
  font-weight: 700;
  font-size: 78px;
  color: #ffffff;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1;
}
.tpl-spiegel .body {
  flex: 1;
  padding: 90px 80px 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tpl-spiegel .headline {
  font-family: var(--sp-display);
  font-weight: 700;
  font-size: 122px;
  line-height: 1.08;
  color: #14161a;
  letter-spacing: -0.005em;
  text-transform: uppercase;
}
.tpl-spiegel .author {
  color: #14161a;
  font-family: var(--sp-sans);
  font-size: 26px;
  font-weight: 700;
}
.tpl-spiegel .byline {
  color: #6b6b6b;
  font-family: var(--sp-sans);
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ============================================
   16) LE MONDE — italic mast, classic French
   ============================================ */
.tpl-lemonde {
  background: #faf7f1;
  padding: 70px 110px;
  --lm-serif: 'Playfair Display', 'EB Garamond', serif;
  --lm-body: 'EB Garamond', 'Source Serif 4', serif;
}
.tpl-lemonde .lm-mast {
  display: flex;
  align-items: baseline;
  gap: 24px;
}
.tpl-lemonde .lm-meta-left,
.tpl-lemonde .lm-meta-right {
  font-family: var(--lm-body);
  font-style: italic;
  font-size: 20px;
  color: #6a6a6a;
  flex: 1;
}
.tpl-lemonde .lm-meta-right { text-align: right; }
.tpl-lemonde .lm-name {
  font-family: var(--lm-serif);
  font-weight: 700;
  font-style: italic;
  font-size: 88px;
  color: #14161a;
  letter-spacing: -0.005em;
  line-height: 1;
}
.tpl-lemonde .lm-rule {
  height: 3px;
  background: #14161a;
  margin: 14px 0 22px;
  position: relative;
}
.tpl-lemonde .lm-rule::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: -7px;
  height: 1px;
  background: #14161a;
}
.tpl-lemonde .lm-section {
  font-family: var(--lm-body);
  font-style: italic;
  font-size: 22px;
  color: #b1191c;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 36px;
  text-transform: none;
}
.tpl-lemonde .lm-stand {
  font-family: var(--lm-body);
  font-size: 28px;
  line-height: 1.35;
  color: #2a2a2a;
  font-style: italic;
  margin: 26px 0 30px;
  max-width: 1300px;
}
.tpl-lemonde .body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tpl-lemonde .headline {
  font-family: var(--lm-serif);
  font-weight: 700;
  font-size: 102px;
  line-height: 1.08;
  color: #14161a;
  letter-spacing: -0.012em;
}
.tpl-lemonde .author {
  color: #14161a;
  font-family: var(--lm-body);
  font-size: 28px;
  font-style: italic;
  font-weight: 500;
}
.tpl-lemonde .byline {
  color: #6a6a6a;
  font-family: var(--lm-body);
  font-size: 24px;
  font-style: italic;
}

/* Guardian extra mast styles */
.tpl-guardian .gd-mast {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 50px;
}
.tpl-guardian .gd-tag {
  font-family: var(--gd-slab);
  font-style: italic;
  font-size: 24px;
  color: #707070;
  font-weight: 400;
}

/* ============================================
   Background modes
   ============================================ */

/* CLEAN MODE — hide all decorative chrome (live pills, tickers, taglines, side metadata)
   so only the headline + masthead + author remain. */
.canvas[data-bg="clean"] .grid-bg,
.canvas[data-bg="clean"] .live-pill,
.canvas[data-bg="clean"] .ticker,
.canvas[data-bg="clean"] .nyt-meta-row,
.canvas[data-bg="clean"] .nyt-tag,
.canvas[data-bg="clean"] .gd-tag,
.canvas[data-bg="clean"] .ft-tag,
.canvas[data-bg="clean"] .wapo-tag,
.canvas[data-bg="clean"] .cnn-tag,
.canvas[data-bg="clean"] .cnn-strap,
.canvas[data-bg="clean"] .wsj-row1,
.canvas[data-bg="clean"] .wsj-row3,
.canvas[data-bg="clean"] .bb-tag,
.canvas[data-bg="clean"] .sky-tag,
.canvas[data-bg="clean"] .sky-strap,
.canvas[data-bg="clean"] .aj-tag,
.canvas[data-bg="clean"] .economist-strap,
.canvas[data-bg="clean"] .spiegel-strap,
.canvas[data-bg="clean"] .lemonde-strap,
.canvas[data-bg="clean"] .lm-section,
.canvas[data-bg="clean"] .lm-stand,
.canvas[data-bg="clean"] .time-strap { display: none !important; }

/* Tighten masthead horizontal rules in Clean mode (some templates have decorative dividers tied to taglines) */
.canvas[data-bg="clean"] .tpl-nyt .masthead { padding-bottom: 16px; }
.canvas[data-bg="clean"] .tpl-wapo .wapo-mast { padding-bottom: 16px; }

.canvas[data-bg="dark"] {
  background: #0e0f12;
  color: #fff;
}
.canvas[data-bg="dark"] .grid-bg { display: none; }
.canvas[data-bg="dark"] .tpl-bbc,
.canvas[data-bg="dark"] .tpl-reuters,
.canvas[data-bg="dark"] .tpl-nyt,
.canvas[data-bg="dark"] .tpl-guardian,
.canvas[data-bg="dark"] .tpl-ft,
.canvas[data-bg="dark"] .tpl-wapo,
.canvas[data-bg="dark"] .tpl-cnn,
.canvas[data-bg="dark"] .tpl-wsj,
.canvas[data-bg="dark"] .tpl-bloomberg,
.canvas[data-bg="dark"] .tpl-vox,
.canvas[data-bg="dark"] .tpl-sky,
.canvas[data-bg="dark"] .tpl-time,
.canvas[data-bg="dark"] .tpl-time .time-frame,
.canvas[data-bg="dark"] .tpl-economist,
.canvas[data-bg="dark"] .tpl-aljazeera,
.canvas[data-bg="dark"] .tpl-spiegel,
.canvas[data-bg="dark"] .tpl-lemonde { background: #0e0f12; }

.canvas[data-bg="dark"] .headline,
.canvas[data-bg="dark"] .vox-logo,
.canvas[data-bg="dark"] .nyt-name,
.canvas[data-bg="dark"] .wapo-name,
.canvas[data-bg="dark"] .wsj-name,
.canvas[data-bg="dark"] .wsj-row1,
.canvas[data-bg="dark"] .author,
.canvas[data-bg="dark"] .aj-name,
.canvas[data-bg="dark"] .lm-name,
.canvas[data-bg="dark"] .time-name { color: #fff; }
.canvas[data-bg="dark"] .byline,
.canvas[data-bg="dark"] .nyt-meta,
.canvas[data-bg="dark"] .wapo-tag,
.canvas[data-bg="dark"] .wsj-row3,
.canvas[data-bg="dark"] .lm-stand,
.canvas[data-bg="dark"] .ft-tag { color: #aaa; }
.canvas[data-bg="dark"] .lm-section { color: #ff5b5b; }
.canvas[data-bg="dark"] .tpl-nyt .masthead,
.canvas[data-bg="dark"] .tpl-wapo .wapo-mast,
.canvas[data-bg="dark"] .tpl-wsj .wsj-mast {
  border-color: #fff;
}
.canvas[data-bg="dark"] .tpl-ft .ft-circle { background: #fff; color: #0e0f12; }
.canvas[data-bg="dark"] .tpl-guardian .gd-logo { background: #0c4ba0; }
.canvas[data-bg="dark"] .tpl-vox .vox-logo .dot { color: #ffd400; }

.canvas[data-bg="transparent"] {
  background: transparent !important;
}
.canvas[data-bg="transparent"] .grid-bg { display: none; }
.canvas[data-bg="transparent"] .tpl-bbc,
.canvas[data-bg="transparent"] .tpl-reuters,
.canvas[data-bg="transparent"] .tpl-nyt,
.canvas[data-bg="transparent"] .tpl-guardian,
.canvas[data-bg="transparent"] .tpl-ft,
.canvas[data-bg="transparent"] .tpl-wapo,
.canvas[data-bg="transparent"] .tpl-cnn,
.canvas[data-bg="transparent"] .tpl-wsj,
.canvas[data-bg="transparent"] .tpl-bloomberg,
.canvas[data-bg="transparent"] .tpl-vox,
.canvas[data-bg="transparent"] .tpl-sky,
.canvas[data-bg="transparent"] .tpl-time,
.canvas[data-bg="transparent"] .tpl-time .time-frame,
.canvas[data-bg="transparent"] .tpl-economist,
.canvas[data-bg="transparent"] .tpl-aljazeera,
.canvas[data-bg="transparent"] .tpl-spiegel,
.canvas[data-bg="transparent"] .tpl-lemonde { background: transparent !important; }
/* keep brand-color banners (otherwise the logo disappears) */
.canvas[data-bg="transparent"] .tpl-bbc .topbar-news,
.canvas[data-bg="transparent"] .tpl-cnn .topbar-news,
.canvas[data-bg="transparent"] .tpl-bloomberg .topbar-news { /* unchanged */ }

/* ============================================
   Support button + Donate modal
   ============================================ */
.btn-support {
  background: rgba(255, 59, 107, 0.08);
  border-color: rgba(255, 59, 107, 0.28);
  color: #d1234c;
}
.btn-support:hover {
  background: rgba(255, 59, 107, 0.14);
  border-color: rgba(255, 59, 107, 0.5);
  color: #a81a3c;
}
.btn-support svg { color: #ff3b6b; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: modalFade .18s ease-out;
}
.modal[hidden] { display: none; }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 20, 25, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-card {
  position: relative;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 32px 24px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 20px 60px rgba(15, 20, 25, 0.18), 0 2px 6px rgba(15, 20, 25, 0.06);
  text-align: center;
  animation: modalPop .22s cubic-bezier(.2,.7,.3,1.2);
}
@keyframes modalPop { from { transform: translateY(8px) scale(.97); } to { transform: translateY(0) scale(1); } }

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, color .12s;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }

.modal-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.modal-title {
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
  color: var(--text);
}
.modal-sub {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.55;
  margin: 0 0 22px;
}
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.btn-lg {
  justify-content: center;
  padding: 12px 18px;
  font-size: 13.5px;
  border-radius: 10px;
}
.modal-foot {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

@media (max-width: 600px) {
  .modal-card { padding: 26px 22px 20px; max-width: 100%; }
  .modal-title { font-size: 19px; }
}

/* ============================================
   YouTube button + footer link
   ============================================ */
.btn-yt {
  background: rgba(255, 0, 0, 0.06);
  border-color: rgba(255, 0, 0, 0.22);
  color: #c40000;
  text-decoration: none;
}
.btn-yt:hover {
  background: rgba(255, 0, 0, 0.12);
  border-color: rgba(255, 0, 0, 0.45);
  color: #9a0000;
}
.btn-yt svg { flex-shrink: 0; }

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
}
.footer-sep { opacity: 0.4; }
.footer-link {
  color: var(--text-2);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px dashed var(--border-strong);
  padding-bottom: 1px;
  transition: color .15s ease, border-color .15s ease;
}
.footer-link:hover { border-bottom-color: var(--accent); color: var(--accent); }

/* =============================================================
   SOCIAL MEDIA TEMPLATES
   ============================================================= */

/* ---------- X / Twitter ---------- */
.tpl-twitter {
  background: #000;
  color: #e7e9ea;
  padding: 80px 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}
.tw-card {
  width: 100%;
  max-width: 1180px;
  background: #000;
  border: 1px solid #2f3336;
  border-radius: 18px;
  padding: 40px 48px;
}
.tw-head {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.tw-avatar svg { display: block; border-radius: 50%; width: 72px; height: 72px; }
.tw-meta { display: flex; flex-direction: column; gap: 2px; }
.tw-name-row { display: flex; align-items: center; gap: 6px; }
.tw-name {
  font-weight: 700;
  font-size: 30px;
  color: #e7e9ea;
  letter-spacing: -0.01em;
}
.tw-verified { display: inline-block; }
.tw-handle {
  font-size: 24px;
  color: #71767b;
  font-weight: 400;
}
.tw-text {
  font-size: 56px;
  line-height: 1.18;
  font-weight: 400;
  color: #e7e9ea;
  letter-spacing: -0.012em;
  margin: 8px 0 32px 0;
  word-break: break-word;
}
.tw-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 720px;
  color: #71767b;
}
.tw-action {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 22px;
  font-weight: 400;
}
.tw-action svg { flex-shrink: 0; }

/* Twitter on Square / Vertical */
.canvas[data-size="1080"] .tpl-twitter,
.canvas[data-size="1080v"] .tpl-twitter { padding: 60px 60px; }
.canvas[data-size="1080v"] .tw-card { padding: 36px 36px; }
.canvas[data-size="1080v"] .tw-text { font-size: 48px; }

/* ---------- Instagram ---------- */
.tpl-instagram {
  background: #fafafa;
  color: #262626;
  padding: 60px 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}
.ig-card {
  width: 100%;
  max-width: 720px;
  background: #fff;
  border: 1px solid #dbdbdb;
  border-radius: 14px;
  overflow: hidden;
}
.ig-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid #efefef;
}
.ig-avatar-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ig-avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: #262626;
}
.ig-name-block { flex: 1; line-height: 1.15; }
.ig-name-row { display: flex; align-items: center; gap: 5px; }
.ig-name { font-weight: 600; font-size: 16px; color: #262626; }
.ig-verified { width: 14px; height: 14px; }
.ig-loc { font-size: 12px; color: #262626; opacity: 0.85; margin-top: 1px; }
.ig-dots { font-size: 22px; line-height: 1; color: #262626; cursor: default; padding: 0 6px; }
.ig-photo {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #efefef;
  overflow: hidden;
}
.ig-photo-fallback {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 30% 30%, rgba(240,148,51,0.18), transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(220,39,67,0.18), transparent 50%),
    linear-gradient(135deg, #f5f5f5, #e5e5e5);
}
.ig-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px 8px 18px;
}
.ig-actions-left { display: flex; gap: 16px; align-items: center; }
.ig-actions svg { display: block; }
.ig-likes {
  font-weight: 600;
  font-size: 16px;
  color: #262626;
  padding: 0 18px 6px 18px;
}
.ig-caption {
  padding: 0 18px 18px 18px;
  font-size: 16px;
  line-height: 1.4;
  color: #262626;
}
.ig-cap-name { font-weight: 600; margin-right: 6px; }

/* IG vertical/square layout */
.canvas[data-size="1080"] .tpl-instagram { padding: 30px 60px; }
.canvas[data-size="1080v"] .tpl-instagram { padding: 60px 30px; }
.canvas[data-size="1080v"] .ig-card { max-width: 100%; }

/* ---------- Telegram ---------- */
.tpl-telegram {
  background: #17212b;
  color: #fff;
  padding: 0;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}
.tg-channel-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 36px;
  background: #232e3c;
  border-bottom: 1px solid #0e1621;
}
.tg-back {
  font-size: 36px;
  line-height: 1;
  color: #6ab2f2;
  font-weight: 300;
}
.tg-channel-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #229ED9, #1976d2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tg-channel-avatar-inner {
  font-weight: 700;
  font-size: 24px;
  color: #fff;
}
.tg-channel-info { line-height: 1.2; }
.tg-channel-name { font-weight: 600; font-size: 22px; color: #fff; }
.tg-channel-sub { font-size: 16px; color: #6c7883; margin-top: 2px; }
.tg-msg-area {
  flex: 1;
  padding: 60px 120px;
  display: flex;
  align-items: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(106, 178, 242, 0.06), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(34, 158, 217, 0.05), transparent 50%),
    #0e1621;
}
.tg-msg {
  background: #182533;
  border-radius: 18px 18px 18px 6px;
  padding: 24px 32px;
  max-width: 1100px;
  width: 100%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.tg-msg-header {
  font-weight: 600;
  font-size: 22px;
  color: #6ab2f2;
  margin-bottom: 10px;
}
.tg-msg-text {
  font-size: 44px;
  line-height: 1.3;
  color: #fff;
  font-weight: 400;
  word-break: break-word;
  margin-bottom: 14px;
}
.tg-msg-meta {
  font-size: 18px;
  color: #6c7883;
  text-align: right;
  font-weight: 400;
}

/* TG vertical/square */
.canvas[data-size="1080"] .tg-msg-area,
.canvas[data-size="1080v"] .tg-msg-area { padding: 40px 40px; }
.canvas[data-size="1080v"] .tg-msg-text { font-size: 38px; }

/* ---------- Reddit ---------- */
.tpl-reddit {
  background: #dae0e6;
  color: #1c1c1c;
  padding: 80px 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'IBM Plex Sans', -apple-system, 'Segoe UI', sans-serif;
}
.rd-card {
  width: 100%;
  max-width: 1280px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  display: flex;
  overflow: hidden;
}
.rd-vote {
  background: #f8f9fa;
  width: 80px;
  padding: 18px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: #878a8c;
  flex-shrink: 0;
}
.rd-score {
  font-weight: 700;
  font-size: 18px;
  color: #1a1a1b;
}
.rd-main {
  flex: 1;
  padding: 22px 28px;
}
.rd-meta {
  font-size: 18px;
  color: #787c7e;
  margin-bottom: 14px;
  line-height: 1.4;
}
.rd-sub { color: #1a1a1b; font-weight: 700; }
.rd-user { color: #0079d3; font-weight: 500; }
.rd-title {
  font-size: 44px;
  line-height: 1.22;
  font-weight: 500;
  color: #222;
  margin-bottom: 22px;
  word-break: break-word;
}
.rd-actions {
  display: flex;
  gap: 28px;
  font-size: 18px;
  font-weight: 700;
  color: #878a8c;
}
.rd-action {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rd-action svg { flex-shrink: 0; }

/* Reddit vertical/square */
.canvas[data-size="1080"] .tpl-reddit,
.canvas[data-size="1080v"] .tpl-reddit { padding: 60px 40px; }
.canvas[data-size="1080v"] .rd-title { font-size: 40px; }


/* ---------- Avatar uploaded image (covers initial circle) ---------- */
.avatar-img {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  border-radius: 50%;
  display: block;
}
.tw-avatar .avatar-img { width: 72px; height: 72px; }
.ig-avatar-inner .avatar-img { width: 100%; height: 100%; }
.tg-channel-avatar .avatar-img { width: 56px; height: 56px; }

/* ---------- Instagram post photo (uploaded) ---------- */
.ig-photo-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

/* ---------- Rail note (small caption under upload buttons) ---------- */
.rail-note {
  font-size: 11px;
  color: var(--text-2, #8b8e94);
  line-height: 1.4;
  margin-top: 8px;
  margin-bottom: 0;
}

/* =============================================================
   NEW SOCIAL TEMPLATES (TikTok, iMessage, Discord, Push, Apple News, Google, Wikipedia, YouTube)
   ============================================================= */

/* ---------- TikTok ---------- */
.tpl-tiktok {
  position: relative;
  background: #000;
  color: #fff;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}
.tk-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 25% 35%, rgba(254, 44, 85, 0.22), transparent 55%),
    radial-gradient(ellipse at 75% 70%, rgba(37, 244, 238, 0.20), transparent 60%),
    radial-gradient(ellipse at 50% 50%, rgba(0,0,0,0.4), transparent 70%),
    linear-gradient(135deg, #1a0a2e 0%, #16213e 40%, #0a0f1e 100%);
}
.tk-topbar {
  position: absolute;
  top: 36px;
  left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 36px;
  z-index: 3;
  color: #fff;
  font-weight: 600;
  font-size: 22px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.tk-tab { color: rgba(255,255,255,0.55); }
.tk-tab-active {
  color: #fff;
  position: relative;
}
.tk-tab-active::after {
  content: '';
  position: absolute;
  left: 20%; right: 20%; bottom: -8px;
  height: 3px;
  background: #fff;
  border-radius: 2px;
}
.tk-search { position: absolute; right: 36px; top: 0; }
.tk-disc {
  margin-top: 12px;
}
.tk-disc-inner {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fe2c55, #25f4ee);
  border: 2px solid rgba(255,255,255,0.6);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  animation: tk-spin 6s linear infinite;
}
.tk-disc-inner .avatar-img { width: 64px; height: 64px; }
@keyframes tk-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.tk-follow {
  display: inline-block;
  border: 2px solid #fff;
  padding: 4px 14px;
  border-radius: 6px;
  font-size: 22px;
  font-weight: 600;
  margin-left: 12px;
  vertical-align: middle;
}
.tk-music-marquee { font-style: normal; }
.tk-side {
  position: absolute;
  right: 60px;
  bottom: 220px;
  display: flex;
  flex-direction: column;
  gap: 36px;
  align-items: center;
  z-index: 2;
}
.tk-side-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.tk-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: #fe2c55;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 38px; color: #fff;
  border: 3px solid #fff;
  overflow: hidden;
}
.tk-avatar .avatar-img { width: 80px; height: 80px; }
.tk-plus {
  width: 28px; height: 28px;
  background: #fe2c55;
  border-radius: 50%;
  margin-top: -16px;
  font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.tk-count {
  font-size: 22px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.tk-bottom {
  position: absolute;
  left: 60px;
  right: 200px;
  bottom: 100px;
  z-index: 2;
}
.tk-username {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 16px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}
.tk-caption {
  font-size: 32px;
  line-height: 1.35;
  font-weight: 500;
  margin-bottom: 20px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
  word-break: break-word;
}
.tk-music {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 500;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}
.canvas[data-size="1080"] .tk-side,
.canvas[data-size="1080"] .tk-bottom { left: 40px; right: 40px; }
.canvas[data-size="1080"] .tk-side { right: 40px; left: auto; bottom: 200px; }
.canvas[data-size="1080v"] .tk-side { right: 40px; bottom: 240px; }
.canvas[data-size="1080v"] .tk-bottom { left: 40px; right: 160px; bottom: 80px; }
.canvas[data-size="1080v"] .tk-caption { font-size: 36px; }

/* ---------- iMessage ---------- */
.tpl-imessage {
  background: #fff;
  color: #000;
  padding: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, 'SF Pro Text', 'Helvetica Neue', sans-serif;
}
.im-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 50px 14px 50px;
  font-size: 26px;
  font-weight: 600;
}
.im-time { font-family: -apple-system, 'SF Pro Display', sans-serif; }
.im-island {
  width: 220px;
  height: 44px;
  background: #000;
  border-radius: 24px;
}
.im-status-icons { display: flex; gap: 8px; align-items: center; }
.im-header {
  display: flex;
  align-items: center;
  padding: 16px 30px 14px 30px;
  border-bottom: 0.5px solid #c6c6c8;
  background: rgba(248,248,250,0.95);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  position: relative;
}
.im-header-left { display: flex; align-items: center; gap: 8px; min-width: 90px; }
.im-header-right { display: flex; align-items: center; min-width: 50px; justify-content: flex-end; }
.im-back { margin-right: 8px; }
.im-badge {
  background: #ff3b30;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 12px;
  min-width: 24px;
  text-align: center;
}
.im-contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  margin-right: 50px;
}
.im-contact-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffb347 0%, #ff7e5f 100%);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 34px; color: #fff;
  margin-bottom: 8px;
  overflow: hidden;
}
.im-contact-avatar .avatar-img { width: 80px; height: 80px; }
.im-contact-name {
  font-size: 22px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.im-chevron { display: inline-block; }
.im-meta {
  text-align: center;
  font-size: 18px;
  color: #8e8e93;
  padding: 30px 40px 10px 40px;
  font-weight: 500;
}
.im-bubble-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 30px 50px;
  gap: 14px;
}
.im-typing {
  background: #e9e9eb;
  padding: 18px 22px;
  border-radius: 24px;
  border-bottom-left-radius: 6px;
  display: flex;
  gap: 8px;
}
.im-typing span {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #8e8e93;
  display: inline-block;
  opacity: 0.4;
  animation: im-typing 1.2s infinite;
}
.im-typing span:nth-child(2) { animation-delay: 0.15s; }
.im-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes im-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}
.im-input {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 30px 24px;
  border-top: 0.5px solid #c6c6c8;
}
.im-input-plus {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #e9e9eb;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  color: #8e8e93;
  font-weight: 300;
}
.im-input-field {
  flex: 1;
  border: 1px solid #d1d1d6;
  border-radius: 22px;
  padding: 10px 22px;
  font-size: 22px;
  color: #8e8e93;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.im-mic { color: #8e8e93; font-size: 14px; }
.im-bubble {
  background: #e9e9eb;
  color: #000;
  font-size: 52px;
  line-height: 1.3;
  padding: 36px 48px;
  border-radius: 42px;
  border-bottom-left-radius: 10px;
  max-width: 82%;
  word-break: break-word;
}
.canvas[data-size="1080v"] .im-bubble { font-size: 40px; }
.canvas[data-size="1080"] .im-bubble { font-size: 38px; max-width: 82%; }

/* ---------- Discord ---------- */
.tpl-discord {
  background: #313338;
  color: #dbdee1;
  padding: 0;
  display: grid;
  grid-template-columns: 90px 280px 1fr;
  width: 100%;
  height: 100%;
  font-family: 'gg sans', -apple-system, 'Helvetica Neue', sans-serif;
  overflow: hidden;
}
.dc-servers {
  background: #1e1f22;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0;
  gap: 10px;
}
.dc-server-home {
  width: 56px; height: 56px;
  border-radius: 18px;
  background: #5865f2;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.dc-server-divider {
  width: 36px; height: 2px;
  background: #2b2d31;
  margin: 4px 0;
  border-radius: 1px;
}
.dc-server-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #313338;
  color: #fff;
  font-weight: 700; font-size: 24px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.dc-server-icon.dc-active { border-radius: 18px; }
.dc-server-icon.dc-active::before {
  content: '';
  position: absolute;
  left: -16px; top: 50%; transform: translateY(-50%);
  width: 6px; height: 40px;
  background: #fff;
  border-radius: 0 4px 4px 0;
}
.dc-server-add {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #313338;
  color: #23a55a;
  font-size: 32px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 300;
}
.dc-channels {
  background: #2b2d31;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.dc-srv-name {
  padding: 22px 20px;
  font-weight: 600;
  font-size: 18px;
  color: #f2f3f5;
  border-bottom: 1px solid #1e1f22;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 0 rgba(0,0,0,0.2);
}
.dc-chev { color: #b5bac1; }
.dc-cat {
  padding: 18px 14px 6px 14px;
  font-size: 14px;
  font-weight: 700;
  color: #80848e;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dc-channel-row {
  padding: 8px 14px;
  margin: 2px 8px;
  border-radius: 6px;
  font-size: 18px;
  color: #80848e;
  cursor: pointer;
}
.dc-active-row { background: #404249; color: #fff; font-weight: 500; }
.dc-main {
  display: flex;
  flex-direction: column;
  padding: 0;
  min-width: 0;
}
.dc-input-row { padding: 20px 30px; margin-top: auto; }
.dc-input {
  background: #383a40;
  border-radius: 8px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 18px;
  color: #b5bac1;
}
.dc-input-plus {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #b5bac1;
  color: #383a40;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  font-weight: 600;
  flex-shrink: 0;
}
.dc-input-text { flex: 1; }
.dc-input-icons { font-size: 16px; }
.dc-reaction-add {
  background: #2b2d31;
  border: 1px solid #3f4147;
  padding: 8px 12px;
  border-radius: 10px;
  color: #80848e;
  font-size: 18px;
}
.dc-channel-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 30px;
  border-bottom: 1px solid #1e1f22;
  background: #313338;
  margin: 0;
  font-size: 20px;
  flex-wrap: wrap;
  box-shadow: 0 1px 0 rgba(0,0,0,0.2);
}
.dc-hash { font-size: 30px; color: #80848e; font-weight: 500; }
.dc-channel { font-weight: 600; color: #f2f3f5; font-size: 26px; }
.dc-divider { width: 1px; height: 22px; background: #3f4147; }
.dc-topic { color: #80848e; font-size: 20px; }
.dc-msg {
  display: flex;
  gap: 18px;
  padding: 20px 30px;
  margin-top: 0;
  flex: 1;
}
.dc-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: #5865f2;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 36px; color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.dc-avatar .avatar-img { width: 80px; height: 80px; }
.dc-body { flex: 1; min-width: 0; }
.dc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.dc-name { font-weight: 600; font-size: 28px; color: #f2f3f5; }
.dc-tag {
  background: #5865f2;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}
.dc-time { color: #949ba4; font-size: 16px; }
.dc-text {
  font-size: 36px;
  line-height: 1.45;
  color: #dbdee1;
  font-weight: 400;
  margin-bottom: 20px;
  word-break: break-word;
}
.dc-reactions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.dc-reaction {
  background: #2b2d31;
  border: 1px solid #3f4147;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 18px;
  color: #dbdee1;
  display: flex;
  gap: 8px;
  align-items: center;
}
.dc-reaction span { color: #5865f2; font-weight: 600; font-size: 18px; }
.canvas[data-size="1080"] .tpl-discord,
.canvas[data-size="1080v"] .tpl-discord { padding: 0; grid-template-columns: 70px 220px 1fr; }
.canvas[data-size="1080v"] .dc-text { font-size: 28px; }
.canvas[data-size="1080v"] .tpl-discord { grid-template-columns: 60px 200px 1fr; }

/* ---------- iOS Push notification ---------- */
.tpl-push {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(120, 80, 200, 0.25), transparent 55%),
    radial-gradient(ellipse at 70% 80%, rgba(40, 100, 180, 0.22), transparent 55%),
    linear-gradient(180deg, #0a0a14 0%, #1c1c2e 50%, #0a0a14 100%);
  color: #fff;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 40px 30px 40px;
  position: relative;
  font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
}
.ps-statusbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 12px;
  font-size: 22px;
  font-weight: 600;
  color: #fff;
}
.ps-sb-icons { display: flex; gap: 8px; align-items: center; }
.ps-lockicon {
  margin-top: 30px;
  margin-bottom: 24px;
  opacity: 0.7;
}
.ps-time {
  font-size: 180px;
  font-weight: 200;
  letter-spacing: -0.02em;
  line-height: 1;
  color: #fff;
  margin-bottom: 4px;
  text-shadow: 0 4px 30px rgba(0,0,0,0.4);
  font-family: -apple-system, 'SF Pro Display', sans-serif;
}
.ps-date {
  font-size: 28px;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  margin-bottom: 50px;
}
.ps-notif-list {
  width: 100%;
  max-width: 920px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ps-notif-header {
  font-size: 18px;
  font-weight: 600;
  color: rgba(255,255,255,0.65);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-left: 4px;
  margin-bottom: 4px;
}
.ps-notification {
  background: rgba(60, 60, 70, 0.5);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 0.5px solid rgba(255,255,255,0.08);
  border-radius: 22px;
  padding: 20px 22px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}
.ps-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 60px;
}
.ps-flash, .ps-cam {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  display: flex; align-items: center; justify-content: center;
}
.ps-home-indicator {
  width: 200px; height: 6px;
  background: rgba(255,255,255,0.6);
  border-radius: 3px;
}
.ps-icon {
  width: 64px; height: 64px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ff3b30, #ff6b6b);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 30px; color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.ps-icon .avatar-img { width: 64px; height: 64px; border-radius: 14px; }
.ps-body { flex: 1; min-width: 0; }
.ps-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.ps-app {
  font-size: 26px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
}
.ps-when {
  font-size: 18px;
  color: rgba(255,255,255,0.7);
}
.ps-text {
  font-size: 36px;
  line-height: 1.3;
  color: rgba(255,255,255,0.95);
  font-weight: 400;
  word-break: break-word;
}
.canvas[data-size="1080"] .ps-time,
.canvas[data-size="1080v"] .ps-time { font-size: 140px; }
.canvas[data-size="1080v"] .ps-text { font-size: 26px; }
.canvas[data-size="1080v"] .tpl-push { padding: 0 30px 30px; }

/* ---------- Apple News ---------- */
.tpl-applenews {
  background: #fff;
  color: #1a1a1a;
  padding: 0;
  display: flex;
  flex-direction: column;
  font-family: 'New York', 'Times New Roman', serif;
}
.an-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px 14px;
  font-size: 22px;
  font-weight: 600;
  font-family: -apple-system, 'Helvetica Neue', sans-serif;
  color: #1a1a1a;
}
.an-sb-icons { display: flex; gap: 8px; align-items: center; }
.an-card { padding: 0 40px; }
.an-tabbar {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  padding: 14px 16px 22px;
  border-top: 0.5px solid #d1d1d6;
  margin-top: auto;
  font-family: -apple-system, 'Helvetica Neue', sans-serif;
}
.an-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: #8a8a8e;
}
.an-tab-active { color: #fc3158; }
.an-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 6px;
}
.an-icons { display: flex; gap: 16px; align-items: center; }
.an-thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.15) 100%);
  pointer-events: none;
}
.an-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e5e5e7;
  padding: 0 40px 16px;
  margin: 0 0 24px 0;
}
.an-section {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fc3158;
  font-family: -apple-system, 'Helvetica Neue', sans-serif;
}
.an-newslogo {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 26px;
  font-weight: 700;
  color: #1a1a1a;
  font-family: -apple-system, 'Helvetica Neue', sans-serif;
}
.an-card {
  display: flex;
  flex-direction: column;
  gap: 28px;
  flex: 1;
}
.an-thumb {
  width: 100%;
  height: 540px;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #fc3158, #ff6b6b 50%, #ffb347);
}
.an-thumb-inner {
  position: absolute; inset: 0;
}
.an-thumb-inner .ig-photo-img {
  position: absolute; inset: 0;
}
.an-thumb-inner .ig-photo-fallback {
  background: linear-gradient(135deg, #1d3557 0%, #457b9d 50%, #a8dadc 100%);
  position: absolute; inset: 0;
}
.an-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.an-pub {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fc3158;
  text-transform: uppercase;
  font-family: -apple-system, 'Helvetica Neue', sans-serif;
}
.an-headline {
  font-size: 64px;
  line-height: 1.05;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.02em;
  word-break: break-word;
}
.an-meta {
  font-size: 22px;
  color: #6e6e73;
  font-family: -apple-system, 'Helvetica Neue', sans-serif;
}
.canvas[data-size="1080"] .tpl-applenews,
.canvas[data-size="1080v"] .tpl-applenews { padding: 0; }
.canvas[data-size="1080"] .an-card { padding: 0 30px; }
.canvas[data-size="1080"] .an-header { padding: 0 30px 14px; }
.canvas[data-size="1080v"] .an-card { padding: 0 30px; }
.canvas[data-size="1080v"] .an-header { padding: 0 30px 14px; }
.canvas[data-size="1080"] .an-thumb { height: 380px; }
.canvas[data-size="1080v"] .an-thumb { height: 600px; }
.canvas[data-size="1080v"] .an-headline { font-size: 56px; }

/* ---------- Google Search ---------- */
.tpl-google {
  background: #fff;
  color: #202124;
  padding: 60px 100px;
  display: flex;
  flex-direction: column;
  font-family: arial, sans-serif;
}
.gg-header {
  display: flex;
  align-items: center;
  gap: 50px;
  padding-bottom: 30px;
  border-bottom: 1px solid #ebebeb;
}
.gg-logo {
  font-family: 'Product Sans', arial, sans-serif;
  font-size: 56px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.gg-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 18px;
  border: 1px solid #dfe1e5;
  border-radius: 30px;
  padding: 18px 24px;
  font-size: 26px;
  color: #202124;
  box-shadow: 0 1px 6px rgba(32,33,36,0.08);
}
.gg-query {
  flex: 1;
  word-break: break-word;
}
.gg-tabs {
  display: flex;
  gap: 36px;
  padding: 24px 0 16px 80px;
  border-bottom: 1px solid #ebebeb;
  font-size: 20px;
  color: #5f6368;
}
.gg-tab.is-active {
  color: #1a73e8;
  border-bottom: 3px solid #1a73e8;
  padding-bottom: 14px;
  margin-bottom: -16px;
  font-weight: 500;
}
.gg-stats {
  font-size: 18px;
  color: #70757a;
  margin: 26px 0 26px 80px;
}
.gg-results {
  margin-left: 80px;
  display: flex;
  flex-direction: column;
  gap: 36px;
  max-width: 1280px;
}
.gg-result { display: flex; flex-direction: column; gap: 6px; }
.gg-site {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}
.gg-favicon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  font-family: arial, sans-serif;
  flex-shrink: 0;
  border: 1px solid #ebebeb;
}
.gg-site-meta { display: flex; flex-direction: column; line-height: 1.2; }
.gg-site-name {
  font-size: 18px;
  color: #202124;
  font-weight: 500;
}
.gg-url {
  font-size: 16px;
  color: #4d5156;
  margin: 0;
}
.gg-title {
  font-size: 38px;
  color: #1a0dab;
  font-weight: 400;
  line-height: 1.3;
  margin: 4px 0 6px;
  word-break: break-word;
  cursor: text;
}
.gg-title-edit { color: #1a0dab; }
.gg-snippet {
  font-size: 22px;
  color: #4d5156;
  line-height: 1.5;
  max-width: 1100px;
}
.canvas[data-size="1080"] .tpl-google,
.canvas[data-size="1080v"] .tpl-google { padding: 50px 50px; }
.canvas[data-size="1080"] .gg-header { gap: 30px; }
.canvas[data-size="1080"] .gg-results,
.canvas[data-size="1080v"] .gg-results { margin-left: 0; gap: 24px; }
.canvas[data-size="1080"] .gg-stats,
.canvas[data-size="1080v"] .gg-stats { margin-left: 0; }
.canvas[data-size="1080v"] .gg-title { font-size: 30px; }
.canvas[data-size="1080v"] .gg-snippet { font-size: 18px; }

/* Google rail list */
.gres-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.gres-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-2, #f7f7f8);
  border: 1px solid var(--border, #e5e5e7);
  border-radius: 8px;
  font-size: 13px;
}
.gres-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent, #111);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.gres-name { flex: 1; color: var(--text, #111); font-weight: 500; }
.gres-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted, #888);
  background: rgba(0,0,0,0.04);
  padding: 2px 8px;
  border-radius: 4px;
}
.gres-del {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted, #888);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}
.gres-del:hover { background: rgba(220, 53, 69, 0.12); color: #dc3545; }

/* ---------- Wikipedia ---------- */
.tpl-wikipedia {
  background: #fff;
  color: #202122;
  padding: 50px 80px;
  display: flex;
  flex-direction: column;
  font-family: 'Linux Libertine', Georgia, 'Times New Roman', serif;
}
.wk-header {
  border-bottom: 1px solid #a2a9b1;
  padding-bottom: 20px;
  margin-bottom: 16px;
}
.wk-logo {
  display: flex;
  gap: 16px;
  align-items: center;
}
.wk-globe {
  display: block;
  width: 96px;
  height: 96px;
  flex-shrink: 0;
}
.wk-A { font-size: 0.78em; vertical-align: 1px; }
.wk-name-1 {
  font-size: 30px;
  font-weight: 400;
  letter-spacing: 0.16em;
  color: #202122;
  font-family: 'Linux Libertine', Georgia, serif;
  line-height: 1;
  margin-bottom: 4px;
}
.wk-name-2 {
  font-size: 16px;
  color: #54595d;
  letter-spacing: 0.05em;
  font-family: -apple-system, 'Helvetica Neue', sans-serif;
  font-style: italic;
}
.wk-tabs {
  font-size: 16px;
  color: #0645ad;
  padding: 8px 0 16px 0;
  border-bottom: 1px solid #c8ccd1;
  margin-bottom: 24px;
  font-family: -apple-system, 'Helvetica Neue', sans-serif;
}
.wk-body {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 40px;
  flex: 1;
}
.wk-main { min-width: 0; }
.wk-title {
  font-size: 72px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.005em;
  border-bottom: 1px solid #a2a9b1;
  padding-bottom: 14px;
  margin: 0 0 16px 0;
  color: #202122;
  word-break: break-word;
}
.wk-sub {
  font-size: 16px;
  color: #54595d;
  font-style: italic;
  margin-bottom: 24px;
  font-family: -apple-system, 'Helvetica Neue', sans-serif;
}
.wk-para {
  font-size: 26px;
  line-height: 1.55;
  color: #202122;
  margin-bottom: 20px;
  word-break: break-word;
}
.wk-para b { font-weight: 700; }
.wk-infobox {
  background: #f8f9fa;
  border: 1px solid #a2a9b1;
  padding: 16px;
  font-family: -apple-system, 'Helvetica Neue', sans-serif;
  font-size: 14px;
}
.wk-infobox-title {
  font-weight: 700;
  font-size: 18px;
  text-align: center;
  margin-bottom: 12px;
  word-break: break-word;
}
.wk-infobox-img {
  width: 100%;
  height: 240px;
  background: #e0e0e0;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}
.wk-infobox-img .ig-photo-img,
.wk-infobox-img .ig-photo-fallback {
  position: absolute; inset: 0;
}
.wk-infobox-img .ig-photo-fallback {
  background: linear-gradient(135deg, #4a5568, #718096);
}
.wk-infobox-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.wk-infobox-table td {
  padding: 6px 8px;
  vertical-align: top;
  border-top: 1px solid #d8d8d8;
}
.wk-infobox-table td:first-child {
  font-weight: 700;
  width: 40%;
  background: #eaecf0;
}
.canvas[data-size="1080"] .wk-body,
.canvas[data-size="1080v"] .wk-body { grid-template-columns: 1fr; gap: 24px; }
.canvas[data-size="1080v"] .wk-infobox-img { height: 320px; }
.canvas[data-size="1080v"] .wk-title { font-size: 48px; }

/* ---------- YouTube (light / desktop) ---------- */
.tpl-youtube {
  background: #ffffff;
  color: #0f0f0f;
  padding: 0;
  display: flex;
  flex-direction: column;
  font-family: 'Roboto', -apple-system, 'Helvetica Neue', Arial, sans-serif;
}
.yt-topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 20px 40px;
  gap: 40px;
  background: #ffffff;
}
.yt-logo-row { display: flex; align-items: center; gap: 18px; }
.yt-burger { width: 32px !important; height: 32px !important; }
.yt-logo svg { width: 148px !important; height: 34px !important; }
.yt-logo svg { display: block; }
.yt-burger { color: #0f0f0f; }

.yt-search-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}
.yt-search {
  flex: 1;
  background: #ffffff;
  border: 1px solid #d3d3d3;
  border-right: 0;
  border-radius: 28px 0 0 28px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  font-size: 20px;
  color: #606060;
  height: 52px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.03);
}
.yt-search-text { color: #606060; }
.yt-search-btn {
  height: 52px;
  width: 78px;
  background: #f8f8f8;
  border: 1px solid #d3d3d3;
  border-radius: 0 28px 28px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.yt-search-btn svg { width: 26px !important; height: 26px !important; }
.yt-mic {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #f2f2f2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.yt-mic svg { width: 26px !important; height: 26px !important; }

.yt-actions {
  display: flex;
  align-items: center;
  gap: 22px;
  justify-self: end;
}
.yt-actions > svg { width: 26px !important; height: 26px !important; color: #0f0f0f; }
.yt-user { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, #ff5252, #cc0000); display:flex; align-items:center; justify-content:center; color:#fff; font-weight:700; font-size:18px; }
.yt-user .avatar-img { width: 44px; height: 44px; }

.yt-thumb {
  width: calc(100% - 80px);
  margin: 16px 40px 0;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d1b3a 50%, #1a1a1a 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 620px;
}
.yt-thumb-inner {
  position: absolute; inset: 0;
}
.yt-thumb-inner .ig-photo-img {
  position: absolute; inset: 0;
}
.yt-thumb-inner .ig-photo-fallback {
  background:
    radial-gradient(ellipse at 30% 30%, rgba(255, 0, 0, 0.3), transparent 60%),
    linear-gradient(135deg, #2c1810 0%, #1a0e08 100%);
  position: absolute; inset: 0;
}
.yt-thumb-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 40%, rgba(0,0,0,0.35) 100%);
  pointer-events: none;
  z-index: 1;
}
.yt-duration {
  position: absolute;
  bottom: 18px;
  right: 18px;
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 22px;
  font-weight: 600;
  z-index: 2;
  letter-spacing: 0.01em;
}
.yt-play { position: relative; z-index: 2; filter: drop-shadow(0 4px 18px rgba(0,0,0,0.35)); }
.yt-play svg { width: 140px !important; height: 98px !important; }

.yt-info {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding: 22px 40px 6px;
}
.yt-channel-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff5252, #cc0000);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 28px; color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.yt-channel-avatar .avatar-img { width: 64px; height: 64px; }
.yt-text { flex: 1; min-width: 0; }
.yt-title {
  font-size: 36px;
  font-weight: 600;
  line-height: 1.28;
  color: #0f0f0f;
  margin-bottom: 10px;
  word-break: break-word;
  letter-spacing: -0.015em;
}
.yt-channel {
  font-size: 20px;
  color: #606060;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.yt-channel > span:first-child { color: #0f0f0f; font-weight: 500; }
.yt-verified { display: inline-block; vertical-align: middle; flex-shrink: 0; width: 18px !important; height: 18px !important; }
.yt-dot { color: #606060; }
.yt-meta { font-size: 20px; color: #606060; }
.yt-more {
  align-self: flex-start;
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.yt-more svg { width: 26px !important; height: 26px !important; }

.yt-actions-bar {
  display: flex;
  gap: 10px;
  padding: 14px 40px 30px 122px; /* align under title (avatar+gap) */
  flex-wrap: wrap;
  align-items: center;
}
.yt-like-pill {
  display: flex;
  align-items: center;
  background: #f2f2f2;
  border-radius: 999px;
  overflow: hidden;
}
.yt-like-pill .yt-act { background: transparent; border-radius: 0; padding: 10px 22px; }
.yt-like-pill .yt-act.yt-like { border-right: 1px solid #d9d9d9; padding-right: 26px; }
.yt-like-pill .yt-act.yt-dislike { padding-left: 20px; padding-right: 20px; }
.yt-act {
  background: #f2f2f2;
  border-radius: 999px;
  padding: 10px 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 500;
  color: #0f0f0f;
  white-space: nowrap;
}
.yt-act svg { width: 26px !important; height: 26px !important; }
.yt-act.yt-subscribe {
  background: #0f0f0f;
  color: #fff;
  padding: 11px 26px;
  font-weight: 600;
  margin-left: auto;
}

.canvas[data-size="1080"] .tpl-youtube,
.canvas[data-size="1080v"] .tpl-youtube { padding: 0; }
.canvas[data-size="1080"] .yt-info { padding: 14px 20px 4px; }
.canvas[data-size="1080v"] .yt-info { padding: 14px 20px 4px; }
.canvas[data-size="1080v"] .yt-title { font-size: 22px; }
.canvas[data-size="1080"] .yt-thumb,
.canvas[data-size="1080v"] .yt-thumb { width: calc(100% - 40px); margin: 12px 20px 0; }
.canvas[data-size="1080"] .yt-actions-bar,
.canvas[data-size="1080v"] .yt-actions-bar { padding: 12px 20px 18px 78px; }
