/* =========================================================
 * TDS-LECTEUR – Styles
 * ======================================================= */

.tds-lecteur-root,
.tds-lecteur-root * {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

/* =========================================================
 * ICON RESET — Force SVG icons to always be visible,
 * even when the WordPress theme applies aggressive CSS.
 * ======================================================= */
.tds-lecteur-root svg {
    fill: none !important;
    stroke: currentColor !important;
    display: inline-block !important;
    vertical-align: middle !important;
    max-width: none !important;
    max-height: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    opacity: 1 !important;
    filter: none !important;
    background: transparent !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none;
}
.tds-lecteur-root .tds-iconbtn,
.tds-lecteur-root .tds-iconbtn * {
    color: #fff !important;
}
.tds-lecteur-root .tds-iconbtn.active,
.tds-lecteur-root .tds-iconbtn.active * {
    color: #fff !important;
}
.tds-lecteur-root .tds-themes .tds-iconbtn.active,
.tds-lecteur-root .tds-themes .tds-iconbtn.active * {
    color: #0a2a2a !important;
}
.tds-lecteur-root .tds-toolbar .tds-iconbtn,
.tds-lecteur-root .tds-toolbar .tds-iconbtn * {
    color: #1a1f1f !important;
}
.tds-theme-dark .tds-toolbar .tds-iconbtn,
.tds-theme-dark .tds-toolbar .tds-iconbtn * {
    color: #e8e6df !important;
}
.tds-lecteur-root .tds-form-icon svg,
.tds-lecteur-root .tds-form-icon * {
    color: #fff !important;
}
.tds-lecteur-root .tds-drop-icon,
.tds-lecteur-root .tds-drop-icon * {
    color: #fff !important;
}

/* Prevent theme from replacing button content */
.tds-lecteur-root button::before,
.tds-lecteur-root button::after {
    content: none !important;
}

.tds-lecteur-root {
    --tds-navy:      #0a2a2a;
    --tds-navy-2:    #0f3a3a;
    --tds-emerald:   #10b981;
    --tds-emerald-2: #059669;
    --tds-paper:     #f7f2e8;
    --tds-cream:     #fafaf5;
    --tds-ink:       #1a1f1f;

    position: relative;
    width: 100%;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 14px;
    background: var(--tds-cream);
    color: var(--tds-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.tds-lecteur-root.tds-theme-sepia { background: #efe4cf; color: #3a2a1a; }
.tds-lecteur-root.tds-theme-dark  { background: #1a2020; color: #e8e6df; }

/* ================ Loading ================ */
.tds-loading {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 14px;
    background: var(--tds-navy);
    color: rgba(255,255,255,.85);
    font-size: 14px;
    z-index: 9;
}
.tds-loading-spinner {
    width: 28px; height: 28px;
    border: 3px solid rgba(255,255,255,.15);
    border-top-color: var(--tds-emerald);
    border-radius: 50%;
    animation: tds-spin 0.9s linear infinite;
}
@keyframes tds-spin { to { transform: rotate(360deg); } }

/* ================ Landing / Home ================ */
.tds-home {
    min-height: 500px;
    background: linear-gradient(135deg, var(--tds-navy) 0%, var(--tds-navy-2) 100%);
    color: #fff;
    padding: clamp(28px, 5vw, 60px) clamp(20px, 4vw, 60px);
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    position: relative;
    overflow: hidden;
}
@media (min-width: 900px) {
    .tds-home { grid-template-columns: 1.2fr 1fr; align-items: center; }
}

.tds-home::before,
.tds-home::after {
    content: "";
    position: absolute;
    width: 420px; height: 420px;
    border-radius: 50%;
    background: rgba(16,185,129,0.10);
    filter: blur(80px);
    pointer-events: none;
}
.tds-home::before { top: -120px; left: -120px; }
.tds-home::after  { bottom: -120px; right: -120px; }

.tds-home-content { position: relative; z-index: 1; }
.tds-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px; border-radius: 999px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    font-size: 11px; letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.85);
    margin-bottom: 20px;
}
.tds-badge-dot { width: 6px; height: 6px; background: var(--tds-emerald); border-radius: 50%; }

.tds-home h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
    font-size: clamp(28px, 4vw, 48px);
    line-height: 1.05;
    margin: 0 0 18px 0;
    letter-spacing: -0.02em;
}
.tds-home h1 em { color: var(--tds-emerald); font-style: normal; }
.tds-home p.lead {
    color: rgba(255,255,255,0.72);
    font-size: clamp(14px, 1.3vw, 16px);
    line-height: 1.6;
    margin: 0 0 22px 0;
    max-width: 520px;
}
.tds-features {
    display: flex; flex-wrap: wrap; gap: 8px;
    font-size: 12px;
}
.tds-feature {
    padding: 6px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 999px;
}

.tds-home-form {
    position: relative; z-index: 1;
    background: #fff;
    color: var(--tds-ink);
    border-radius: 16px;
    padding: clamp(20px, 3vw, 28px);
    box-shadow: 0 16px 50px rgba(0,0,0,.25);
}
.tds-tabs {
    display: inline-flex; gap: 4px;
    background: rgba(10, 42, 42, 0.06);
    padding: 4px; border-radius: 999px;
    margin-bottom: 18px;
    font-size: 13px;
}
.tds-tab {
    padding: 7px 16px; border: 0; background: transparent;
    cursor: pointer; border-radius: 999px;
    color: rgba(10,42,42,0.65); font-weight: 500;
    transition: all 0.2s ease;
}
.tds-tab.active { background: #fff; color: var(--tds-navy); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

.tds-form-title {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 14px;
}
.tds-form-icon {
    width: 36px; height: 36px;
    background: var(--tds-emerald); color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.tds-form-title h3 { margin: 0; font-size: 17px; color: var(--tds-ink); font-weight: 600; }
.tds-form-title p  { margin: 2px 0 0 0; font-size: 12px; color: #777; }

.tds-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e1e4e3;
    border-radius: 10px;
    font-size: 14px;
    background: #fff;
    color: var(--tds-ink);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
}
.tds-input:focus {
    border-color: var(--tds-emerald);
    box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}

.tds-btn {
    margin-top: 12px;
    width: 100%;
    padding: 13px 18px;
    border: 0;
    background: var(--tds-emerald);
    color: #fff; font-weight: 600; font-size: 14px;
    border-radius: 10px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    transition: background 0.15s, transform 0.15s;
}
.tds-btn:hover:not(:disabled) { background: var(--tds-emerald-2); }
.tds-btn:active:not(:disabled) { transform: translateY(1px); }
.tds-btn:disabled { opacity: 0.55; cursor: wait; }

.tds-drop {
    position: relative;
    border: 2px dashed #cfd8d4;
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.tds-drop.active, .tds-drop:hover {
    border-color: var(--tds-emerald);
    background: rgba(16,185,129,0.05);
}
.tds-drop-icon {
    width: 56px; height: 56px; margin: 0 auto 12px;
    background: var(--tds-emerald);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    box-shadow: 0 8px 20px rgba(16,185,129,0.25);
}
.tds-drop h4 {
    font-family: Georgia, serif;
    font-size: 20px; margin: 6px 0; color: var(--tds-ink);
    font-weight: 600;
}
.tds-drop p { margin: 4px 0 0 0; font-size: 12px; color: #888; }
.tds-drop input[type=file] { display: none; }

.tds-hint {
    margin-top: 10px; font-size: 11px; color: #999; text-align: center;
}

/* ================ Reader view ================ */
.tds-reader {
    display: flex;
    flex-direction: column;
    min-height: 500px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.tds-topbar {
    background: var(--tds-navy);
    color: #fff;
    padding: 10px 16px;
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-wrap: wrap;
}
.tds-topbar-title {
    flex: 1; min-width: 0;
    font-size: 13px;
    color: rgba(255,255,255,0.75);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tds-topbar-title strong {
    display: block;
    font-family: Georgia, serif; font-size: 15px;
    color: #fff; margin-bottom: 1px;
}

.tds-iconbtn {
    width: 34px; height: 34px;
    border: 0; background: rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.tds-iconbtn:hover { background: rgba(255,255,255,0.2); }
.tds-iconbtn.active { background: var(--tds-emerald); }
.tds-iconbtn:disabled { opacity: 0.35; cursor: not-allowed; }

.tds-themes {
    display: inline-flex;
    background: rgba(255,255,255,0.1);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}
.tds-themes .tds-iconbtn {
    width: 28px; height: 28px;
    background: transparent;
}
.tds-themes .tds-iconbtn.active {
    background: #fff; color: var(--tds-navy);
}

.tds-toolbar {
    background: rgba(255,255,255,0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--tds-ink);
}
.tds-theme-dark .tds-toolbar {
    background: rgba(26,32,32,0.8);
    color: #e8e6df;
    border-bottom-color: rgba(255,255,255,0.08);
}
.tds-toolbar-group { display: inline-flex; align-items: center; gap: 6px; }

.tds-page-input {
    width: 48px; text-align: center;
    border: 0; border-bottom: 1px solid #cbd5d3;
    background: transparent;
    color: inherit; font: inherit;
    outline: none; padding: 2px 4px;
}
.tds-page-input:focus { border-bottom-color: var(--tds-emerald); }

.tds-toolbar .tds-iconbtn { background: transparent; color: inherit; width: 32px; height: 32px; }
.tds-toolbar .tds-iconbtn:hover { background: rgba(0,0,0,0.06); }
.tds-theme-dark .tds-toolbar .tds-iconbtn:hover { background: rgba(255,255,255,0.08); }

.tds-progress {
    width: clamp(80px, 18vw, 200px);
    height: 6px;
    background: rgba(0,0,0,0.08);
    border-radius: 999px;
    overflow: hidden;
}
.tds-theme-dark .tds-progress { background: rgba(255,255,255,0.12); }
.tds-progress-fill {
    height: 100%;
    background: var(--tds-emerald);
    transition: width 0.25s ease;
    width: 0%;
}

/* ================ Stage (book page) ================ */
.tds-stage {
    flex: 1;
    min-height: 400px;
    position: relative;
    display: flex;
    align-items: flex-start; justify-content: center;
    padding: 0;
    overflow: hidden;
}

/* Scroll mode – stage becomes a vertical scroll container */
.tds-stage-scroll {
    overflow-y: auto !important;
    overflow-x: hidden;
    align-items: stretch;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
.tds-stage-scroll::-webkit-scrollbar { width: 10px; }
.tds-stage-scroll::-webkit-scrollbar-track { background: transparent; }
.tds-stage-scroll::-webkit-scrollbar-thumb {
    background: rgba(10, 42, 42, 0.2);
    border-radius: 999px;
}
.tds-stage-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(10, 42, 42, 0.35);
}
.tds-theme-dark .tds-stage-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); }

/* PDF continuous scroll column */
.tds-pdf-scroll {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0 60px 0;
    gap: 18px;
}
/* PDF paper slot — ALWAYS white regardless of theme.
   flex-shrink:0 + display:block guarantee the inline height from JS
   is honored on mobile Chrome and avoids collapse-to-0 bugs. */
.tds-pdf-slot {
    background: #ffffff !important;
    border-radius: 6px;
    box-shadow:
        0 14px 36px -14px rgba(0,0,0,0.3),
        0 0 1px rgba(0,0,0,0.08);
    position: relative;
    max-width: 100%;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    flex-basis: auto !important;
    transition: none;
}
.tds-pdf-slot:not(.rendered)::after {
    content: "";
    position: absolute; inset: 0;
    background:
        linear-gradient(110deg, rgba(255,255,255,0.02) 0%, rgba(0,0,0,0.05) 50%, rgba(255,255,255,0.02) 100%),
        repeating-linear-gradient(to bottom, transparent 0, transparent 20px, rgba(0,0,0,0.035) 20px, rgba(0,0,0,0.035) 21px);
    animation: tds-shimmer 1.4s linear infinite;
    background-size: 200% 100%, 100% 100%;
}
@keyframes tds-shimmer {
    0%   { background-position: 100% 0, 0 0; }
    100% { background-position: -100% 0, 0 0; }
}
.tds-pdf-slot canvas,
.tds-pdf-slot .tds-pdf-canvas {
    display: block !important;
    max-width: 100% !important;
    height: auto !important;
    background: #ffffff !important;
    opacity: 1 !important;
    filter: none !important;
    mix-blend-mode: normal !important;
}

/* EPUB stage (epub.js handles its own scroll inside .epub-container) */
.tds-stage-epub {
    overflow: hidden !important;
    align-items: stretch;
    padding: 0;
}
.tds-stage-epub .tds-epub-scroll-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    padding: 14px 10px;
    box-sizing: border-box;
}
.tds-stage-epub .tds-epub-frame-scroll {
    width: min(820px, 100%);
    height: 100%;
    background: var(--tds-paper);
    border-radius: 6px;
    box-shadow: 0 14px 36px -14px rgba(0,0,0,0.25);
    overflow: hidden;
    position: relative;
}
.tds-theme-sepia .tds-stage-epub .tds-epub-frame-scroll { background: #efe4cf; }
.tds-theme-dark  .tds-stage-epub .tds-epub-frame-scroll { background: #1a2020; }

/* epub.js scroll container styling */
.tds-stage-epub .epub-container {
    scroll-behavior: smooth;
}
.tds-stage-epub .epub-container::-webkit-scrollbar { width: 10px; }
.tds-stage-epub .epub-container::-webkit-scrollbar-track { background: transparent; }
.tds-stage-epub .epub-container::-webkit-scrollbar-thumb {
    background: rgba(10, 42, 42, 0.2);
    border-radius: 999px;
}
.tds-stage-epub .epub-container::-webkit-scrollbar-thumb:hover {
    background: rgba(10, 42, 42, 0.35);
}
.tds-theme-dark .tds-stage-epub .epub-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); }

/* Legacy EPUB scroll wrapper (kept for fallback) */
.tds-epub-scroll-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 18px 0 60px 0;
    min-height: 100%;
}
.tds-epub-frame-scroll {
    width: min(820px, 96%);
    min-height: 500px;
    background: var(--tds-paper);
    border-radius: 6px;
    box-shadow: 0 14px 36px -14px rgba(0,0,0,0.25);
    overflow: visible;
    position: relative;
}
/* Let epub.js manage multiple iframes inside the container */
.tds-epub-frame-scroll > div,
.tds-epub-frame-scroll iframe {
    width: 100% !important;
    display: block;
}
.tds-theme-sepia .tds-epub-frame-scroll { background: #efe4cf; }
.tds-theme-dark  .tds-epub-frame-scroll { background: #1a2020; }

/* Old paginated (kept for safety, unused in v3.2) */
.tds-page-wrap {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    max-width: 100%; max-height: 100%;
    transform-style: preserve-3d;
    transition: transform 650ms cubic-bezier(0.645, 0.045, 0.355, 1),
                opacity 650ms ease;
}

.tds-page-wrap.flip-next { animation: tds-flip-next 650ms cubic-bezier(0.645, 0.045, 0.355, 1) both; transform-origin: left center; }
.tds-page-wrap.flip-prev { animation: tds-flip-prev 650ms cubic-bezier(0.645, 0.045, 0.355, 1) both; transform-origin: right center; }
@keyframes tds-flip-next {
    0%   { transform: rotateY(0deg);   opacity: 1; }
    45%  { transform: rotateY(-70deg); opacity: 0.5; }
    55%  { transform: rotateY(-90deg); opacity: 0; }
    56%  { transform: rotateY(90deg);  opacity: 0; }
    100% { transform: rotateY(0deg);   opacity: 1; }
}
@keyframes tds-flip-prev {
    0%   { transform: rotateY(0deg);   opacity: 1; }
    45%  { transform: rotateY(70deg);  opacity: 0.5; }
    55%  { transform: rotateY(90deg);  opacity: 0; }
    56%  { transform: rotateY(-90deg); opacity: 0; }
    100% { transform: rotateY(0deg);   opacity: 1; }
}

.tds-canvas-shell {
    background: var(--tds-paper);
    padding: 10px;
    border-radius: 6px;
    box-shadow:
        0 14px 36px -12px rgba(0,0,0,0.35),
        0 0 1px rgba(0,0,0,0.1);
    position: relative;
    max-width: 100%;
}
.tds-theme-sepia .tds-canvas-shell { background: #efe4cf; }
.tds-theme-dark  .tds-canvas-shell { background: #1a2020; }
.tds-canvas-shell canvas {
    display: block;
    max-width: 100% !important;
    height: auto !important;
    border-radius: 3px;
}
.tds-canvas-shell::before {
    content: ""; position: absolute; inset: 10px; left: 10px; width: 10px;
    background: linear-gradient(90deg, rgba(0,0,0,0.2), transparent);
    pointer-events: none;
}

.tds-epub-frame {
    width: min(820px, 96%);
    height: min(80vh, 1000px);
    background: var(--tds-paper);
    border-radius: 6px;
    box-shadow: 0 14px 36px -12px rgba(0,0,0,0.35);
    overflow: hidden;
}
.tds-theme-sepia .tds-epub-frame { background: #efe4cf; }
.tds-theme-dark  .tds-epub-frame { background: #1a2020; }

.tds-nav-arrow {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px;
    border: 0; border-radius: 50%;
    background: rgba(255,255,255,0.85);
    color: var(--tds-navy);
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
    cursor: pointer; z-index: 5;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, transform 0.15s;
}
.tds-nav-arrow:hover:not(:disabled) { background: #fff; transform: translateY(-50%) scale(1.06); }
.tds-nav-arrow:disabled { opacity: 0.3; cursor: not-allowed; }
.tds-nav-arrow.prev { left: 10px; }
.tds-nav-arrow.next { right: 10px; }
@media (max-width: 600px) {
    .tds-nav-arrow { width: 38px; height: 38px; }
}

/* Copy link button (appears when URL-sourced) */
.tds-copy-btn {
    position: relative;
}
.tds-copy-btn.copied {
    background: var(--tds-emerald) !important;
    color: #fff !important;
}

/* Mini hint in top bar indicating a shareable link */
.tds-share-hint {
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    margin-right: 4px;
    white-space: nowrap;
}
@media (max-width: 700px) {
    .tds-share-hint { display: none; }
}

/* ================ Footer watermark ================ */
.tds-footer {
    text-align: center;
    padding: 10px 14px;
    border-top: 1px solid rgba(0,0,0,0.06);
    font-family: Georgia, serif;
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(0,0,0,0.45);
    background: inherit;
}
.tds-theme-dark .tds-footer { border-top-color: rgba(255,255,255,0.08); color: rgba(255,255,255,0.5); }

/* ================ Stage loader overlay ================ */
.tds-stage-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(250, 250, 245, 0.95);
    z-index: 8;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.tds-theme-sepia .tds-stage-loader { background: rgba(239, 228, 207, 0.95); }
.tds-theme-dark  .tds-stage-loader { background: rgba(26, 32, 32, 0.95); color: #e8e6df; }

.tds-loader-text {
    font-size: 14px;
    color: var(--tds-navy);
    font-weight: 500;
}
.tds-theme-dark .tds-loader-text { color: #e8e6df; }

.tds-loader-pct {
    font-size: 12px;
    color: var(--tds-emerald);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ================ Error / toast ================ */
.tds-toast {
    position: absolute;
    top: 14px; right: 14px;
    background: var(--tds-navy);
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: tds-toast-in 0.25s ease;
}
.tds-toast.error { background: #b91c1c; }
.tds-toast.success { background: var(--tds-emerald); }
@keyframes tds-toast-in {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ================ Responsive tweaks ================ */
@media (max-width: 600px) {
    .tds-home h1 { font-size: 26px; }
    .tds-home p.lead { font-size: 13px; }
    .tds-topbar { padding: 8px 10px; }
    .tds-topbar-title strong { font-size: 13px; }
    .tds-topbar-title { font-size: 11px; }
    .tds-toolbar { padding: 7px 10px; font-size: 12px; }
    .tds-page-input { width: 40px; }
    .tds-stage { padding: 12px 6px; }
}

/* =========================================================
 * ADVERTISEMENT POPUP (Google AdSense 300x250)
 * Shown every 60 seconds during reading. Closable with X.
 * ======================================================= */
.tds-ad-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    opacity: 0;
    transition: opacity 220ms ease;
    pointer-events: auto;
}
.tds-ad-overlay.show { opacity: 1; }

.tds-ad-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    width: min(420px, 100%);
    max-width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: tds-ad-pop 260ms cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@keyframes tds-ad-pop {
    from { transform: scale(0.85); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.tds-ad-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px 6px 12px;
    background: #f8f8f8;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: rgba(0, 0, 0, 0.38);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.tds-ad-label {
    font-weight: 500;
}
.tds-ad-close {
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.42) !important;
    font-size: 14px;
    line-height: 1;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, color 0.15s, transform 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.tds-ad-close:hover {
    background: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.58) !important;
    transform: scale(1.04);
}
.tds-ad-close:active {
    transform: scale(0.94);
}

.tds-ad-slot {
    width: 300px;
    height: 250px;
    max-width: 100%;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}
.tds-ad-slot ins.adsbygoogle {
    position: relative;
    z-index: 1;
}
.tds-ad-legacy-host {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
    background: transparent;
}
.tds-ad-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
}
.tds-ad-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    text-align: center;
    font-size: 12px;
    line-height: 1.5;
    color: #5f6b7a;
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(250,250,250,0.92));
}
@media (max-width: 340px) {
    .tds-ad-box { width: 100%; }
    .tds-ad-slot {
        width: 100%;
        height: auto;
        aspect-ratio: 300 / 250;
    }
}

