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

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

:root {
    --bg: #f7f7f5;
    --surface: #ffffff;
    --text: #171717;
    --text-muted: #6f6f6f;
    --text-soft: #999999;
    --border: #e8e8e6;
    --accent: #1a1a1a;
    --accent-hover: #333333;
    --accent-fg: #ffffff;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --radius-lg: 20px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --header-h: 3.5rem;
    --header-bg: rgba(255, 255, 255, 0.85);
    --canvas-bg: #fafafa;
    --page-tint: #fafafa;
    --grid-line: #e8e8e8;
    --grid-line-faint: rgba(232, 232, 232, 0.5);
    --hover: #fafafa;
    --hover-strong: #f3f3f3;
    --overlay: rgba(20, 20, 20, 0.4);
    --danger-bg: #fef2f2;
    --ad-slot-bg: #f4f4f2;
    --hint-bg: rgba(255, 255, 255, 0.92);
    --input-bg: #ffffff;
    --axis: rgba(0, 0, 0, 0.15);
    --pixel-stroke: rgba(0, 0, 0, 0.08);
    --focus-stroke: rgba(26, 26, 26, 0.55);
    --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #111111;
    --surface: #1a1a1a;
    --text: #f2f2f0;
    --text-muted: #a3a3a3;
    --text-soft: #7a7a7a;
    --border: #2c2c2c;
    --accent: #f2f2f0;
    --accent-hover: #ffffff;
    --accent-fg: #111111;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.5);
    --header-bg: rgba(17, 17, 17, 0.9);
    --canvas-bg: #141414;
    --page-tint: #141414;
    --grid-line: #2a2a2a;
    --grid-line-faint: rgba(42, 42, 42, 0.65);
    --hover: #242424;
    --hover-strong: #2c2c2c;
    --overlay: rgba(0, 0, 0, 0.55);
    --danger-bg: #3a1818;
    --ad-slot-bg: #1f1f1f;
    --hint-bg: rgba(26, 26, 26, 0.94);
    --input-bg: #1a1a1a;
    --axis: rgba(255, 255, 255, 0.18);
    --pixel-stroke: rgba(255, 255, 255, 0.14);
    --focus-stroke: rgba(242, 242, 240, 0.55);
    --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23aaa' d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
    color-scheme: dark;
}

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100%;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

img {
    max-width: 100%;
    display: block;
}

/* ── Header ─────────────────────────────────────────────────────────── */

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: var(--header-h);
    padding: 0 1.25rem;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 20;
}

.site-logo {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    white-space: nowrap;
}

.site-header__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ── Language Switcher ──────────────────────────────────────────────── */

.lang-switcher {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.lang-switcher__label {
    display: none;
}

.lang-switcher select {
    appearance: none;
    padding: 0.4rem 1.75rem 0.4rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface) var(--select-chevron) no-repeat right 0.5rem center;
    color: var(--text);
    font-size: 0.8rem;
    cursor: pointer;
    transition: border-color 0.15s;
}

.lang-switcher select:hover,
.lang-switcher select:focus {
    border-color: var(--text-soft);
    outline: none;
}

/* ── Theme Toggle ───────────────────────────────────────────────────── */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-width: 2.35rem;
    height: 2.35rem;
    padding: 0 0.65rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--hover);
}

.theme-toggle__icon {
    display: none;
    width: 1rem;
    height: 1rem;
    background: currentColor;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
}

.theme-toggle__icon--sun {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41'/%3E%3C/svg%3E");
}

.theme-toggle__icon--moon {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 14.5A8.5 8.5 0 1 1 9.5 3a7 7 0 0 0 11.5 11.5z'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 14.5A8.5 8.5 0 1 1 9.5 3a7 7 0 0 0 11.5 11.5z'/%3E%3C/svg%3E");
}

[data-theme="light"] .theme-toggle__icon--moon,
:root:not([data-theme]) .theme-toggle__icon--moon {
    display: block;
}

[data-theme="dark"] .theme-toggle__icon--sun {
    display: block;
}

.theme-toggle__label {
    display: none;
    font-size: 0.82rem;
    font-weight: 500;
}

/* ── Buttons ────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem 1.35rem;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    transition: background 0.18s, border-color 0.18s, transform 0.12s, opacity 0.15s;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    color: var(--accent-fg);
    background: var(--accent);
    border: 1px solid var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-secondary {
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--hover);
    border-color: var(--text-soft);
}

.btn-ghost {
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--hover);
    color: var(--text);
}

.btn-sm {
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem;
    border-radius: 8px;
}

/* ── Toast ──────────────────────────────────────────────────────────── */

.toast {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    z-index: 200;
    max-width: min(90vw, 380px);
    padding: 0.75rem 1.1rem;
    background: var(--accent);
    color: var(--accent-fg);
    border-radius: 10px;
    font-size: 0.88rem;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease;
    pointer-events: none;
}

.toast.is-visible {
    transform: translateX(-50%) translateY(0);
}

[dir="rtl"] .site-header {
    flex-direction: row-reverse;
}

@media (min-width: 640px) {
    .lang-switcher__label {
        display: inline;
    }
}

/* ── Ads (AdSense) – hohe Viewability, kein Overlay, kein CLS ───────── */

.ad-slot {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    background: var(--ad-slot-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    min-height: 90px;
    contain: layout style size;
}

.ad-slot--banner,
.ad-slot--leaderboard {
    min-height: 90px;
    aspect-ratio: 728 / 90;
    max-height: 120px;
}

.ad-slot--rail {
    width: 160px;
    min-height: 600px;
    max-width: 160px;
    aspect-ratio: 160 / 600;
    border-radius: 8px;
}

.ad-slot--rectangle {
    min-height: 250px;
    max-width: 300px;
}

.ad-slot__fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-soft);
    text-align: center;
    pointer-events: none;
    letter-spacing: 0.02em;
}

.ad-slot--loaded .ad-slot__fallback {
    display: none;
}

.ad-slot--error {
    background: var(--bg);
}

.ad-slot .adsbygoogle {
    display: block;
    width: 100%;
    min-height: inherit;
}

.ad-wrap {
    width: 100%;
    max-width: 728px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 1.25rem 1rem;
}

.ad-wrap--intro {
    padding: 1.5rem 0 0;
}

.ad-wrap--footer {
    padding: 0.75rem 1rem 1.25rem;
}

.ad-wrap--story {
    padding: 2rem 0 0;
}

.ad-label {
    display: block;
    text-align: center;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-soft);
    margin-bottom: 0.35rem;
}

@media (max-width: 480px) {
    .ad-slot--banner,
    .ad-slot--leaderboard {
        aspect-ratio: auto;
        min-height: 100px;
        max-height: none;
        border-radius: 8px;
    }
}

/* ── Viral Celebrate (Traffic) ──────────────────────────────────────── */

body.traffic-celebrate-open {
    overflow: hidden;
}

.traffic-celebrate {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: var(--overlay);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.traffic-celebrate.is-visible {
    opacity: 1;
}

.traffic-celebrate__panel {
    position: relative;
    width: min(100%, 440px);
    background: var(--surface);
    border-radius: 20px;
    padding: 2rem 1.5rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    transform: translateY(16px) scale(0.97);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
}

.traffic-celebrate.is-visible .traffic-celebrate__panel {
    transform: translateY(0) scale(1);
}

.traffic-celebrate__burst {
    position: absolute;
    top: -40%;
    left: 50%;
    width: 280px;
    height: 280px;
    margin-left: -140px;
    background: radial-gradient(circle, rgba(255, 87, 51, 0.12) 0%, transparent 70%);
    animation: trafficPulse 2.4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes trafficPulse {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.15); opacity: 1; }
}

.traffic-celebrate__eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-soft);
    margin-bottom: 0.75rem;
}

.traffic-celebrate h2 {
    position: relative;
    font-size: clamp(1.2rem, 3.5vw, 1.45rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.3;
    margin-bottom: 0.65rem;
}

.traffic-celebrate__hint {
    position: relative;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.traffic-celebrate__link {
    position: relative;
    font-size: 0.78rem;
    margin-bottom: 1.25rem;
}

.traffic-celebrate__link a {
    color: var(--text-soft);
    word-break: break-all;
}

.traffic-celebrate__share {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
    margin-bottom: 1.35rem;
}

.traffic-celebrate__share .share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.traffic-celebrate__share .share-btn:hover {
    background: var(--hover);
    color: var(--text);
}

.traffic-celebrate__actions {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}
