body {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    overscroll-behavior-y: none;
}

.pt-safe { padding-top: env(safe-area-inset-top, 0px); }
.pb-safe { padding-bottom: env(safe-area-inset-bottom, 0px); }

.glass-header {
    background: rgba(242, 242, 247, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.dark .glass-header { background: rgba(28, 28, 30, 0.75); }

.glass-card {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}
.dark .glass-card {
    background: rgba(44, 44, 46, 0.6);
    border: 1px solid rgba(80, 80, 80, 0.3);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.nav-btn.active { color: #007AFF; }
.dark .nav-btn.active { color: #0A84FF; }

@media (pointer: fine) {
    .custom-scrollbar::-webkit-scrollbar { width: 6px; }
    .custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
    .reading-highlight {
    color: var(--ios-primary);
    text-shadow: 0 0 15px rgba(0, 122, 255, 0.2);
    transform: scale(1.02);
    font-weight: 600;
}
.poem-line-inline {
    transform-origin: left;
}
.toast-msg {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    padding: 1rem 1.7rem;
    border-radius: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    font-weight: 700;
    pointer-events: auto;
    color: #1a1a1a;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: toast-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.dark .toast-msg {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f1f1f1;
}
.toast-msg.toast-out {
    animation: toast-out 0.4s ease forwards;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateY(-30px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-50px) scale(0.85); }
}
    .custom-scrollbar::-webkit-scrollbar-thumb {
        background-color: rgba(156, 163, 175, 0.5);
        border-radius: 20px;
    }
    .custom-scrollbar::-webkit-scrollbar-thumb:hover {
        background: #bbb;
    }
    .dark .custom-scrollbar::-webkit-scrollbar-thumb { background-color: rgba(75, 85, 99, 0.5); }
}

.selectable { user-select: text; -webkit-user-select: text; }

.fade-enter { opacity: 0; transform: translateY(10px); }
.fade-enter-active {
    opacity: 1; transform: translateY(0);
    transition: opacity 300ms ease-out, transform 300ms ease-out;
}
.fade-exit { opacity: 1; }
.fade-exit-active { opacity: 0; transition: opacity 200ms ease-in; }

button:active:not(:disabled) { opacity: 0.6; }

.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.bg-gradient-dynamic { background: linear-gradient(135deg, rgba(0, 122, 255, 0.05) 0%, rgba(200, 200, 250, 0.1) 100%); }
.dark .bg-gradient-dynamic { background: linear-gradient(135deg, rgba(10, 132, 255, 0.05) 0%, rgba(50, 50, 80, 0.2) 100%); }

#main-header.hidden-up { transform: translateY(-100%); }
nav.hidden-down { transform: translateY(100%); }

.poem-content { white-space: pre-wrap; transition: all 0.3s ease; }

.poem-text-sm .poem-content { font-size: 0.875rem; line-height: 1.6; }
.poem-text-base .poem-content { font-size: 1rem; line-height: 1.7; }
.poem-text-lg .poem-content { font-size: 1.125rem; line-height: 1.8; }
.poem-text-xl .poem-content { font-size: 1.25rem; line-height: 1.9; }
.poem-text-2xl .poem-content { font-size: 1.5rem; line-height: 2; }

/* Font Families */
.poem-font-serif .poem-content { font-family: 'EB Garamond', serif; }
.poem-font-modern .poem-content { font-family: 'Lora', serif; }
.poem-font-playfair .poem-content { font-family: 'Playfair Display', serif; }
.poem-font-script .poem-content { font-family: 'Dancing Script', cursive; }
.poem-font-sans .poem-content { font-family: ui-sans-serif, system-ui, -apple-system, sans-serif; }

/* TIMELINE COMPONENT */
.timeline-container { position: relative; padding: 20px 0; }
.timeline-line {
    position: absolute; left: 28px; top: 0; bottom: 0; width: 3px;
    background: linear-gradient(to bottom, #007AFF, #5856D6, #FF2D55, #FF9500);
    border-radius: 4px; opacity: 0.3;
}
.timeline-item { position: relative; padding-left: 60px; margin-bottom: 40px; }
.timeline-dot {
    position: absolute; left: 20px; top: 8px; width: 20px; height: 20px;
    border-radius: 50%; background: #fff; border: 4px solid #007AFF; z-index: 10;
}
.timeline-dot.active { box-shadow: 0 0 15px #007AFF; transform: scale(1.2); }
.timeline-year { font-size: 0.7rem; font-weight: 900; color: #8e8e93; margin-bottom: 4px; letter-spacing: 0.05em; }

@keyframes timeline-pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.3; }
    100% { transform: scale(1); opacity: 1; }
}
.timeline-dot-pulse {
    position: absolute; left: 16px; top: 4px; width: 28px; height: 28px;
    background: #007AFF1a; border-radius: 50%;
    animation: timeline-pulse 2s infinite ease-in-out;
}

/* Paper Themes - Now targeting only the poem card */
.poem-card-box { transition: all 0.5s ease; }

.theme-paper .poem-card-box {
    background-color: #f9f7f2 !important;
    color: #2c2c2e !important;
    background-image: url('https://www.transparenttextures.com/patterns/rice-paper-2.png');
    border: 1px solid #dcd7c9 !important;
}
.theme-sepia .poem-card-box { 
    background-color: #f4ecd8 !important; 
    color: #5b4636 !important; 
    background-image: url('https://www.transparenttextures.com/patterns/handmade-paper.png');
    border: 1px solid #d3c4a9 !important;
}
.theme-antique .poem-card-box { 
    background-color: #e8dfc7 !important; 
    color: #3e2723 !important; 
    background-image: url('https://www.transparenttextures.com/patterns/parchment.png');
    border: 1px solid #c5b396 !important;
}
.theme-royal .poem-card-box { 
    background: linear-gradient(135deg, #1a237e 0%, #0d47a1 100%) !important; 
    color: #e3f2fd !important; 
    border: 1px solid rgba(255,255,255,0.2) !important;
}
.theme-royal .poem-card-box .fa-quote-left { color: rgba(255,255,255,0.2) !important; }

/* HORIZONTAL SCROLL NO BAR */
.hide-scroll-bar::-webkit-scrollbar { display: none; }

/* Glossary Highlighting */
.glossary-word {
    border-bottom: 2px solid rgba(0, 122, 255, 0.5);
    background-color: rgba(0, 122, 255, 0.05);
    cursor: help;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 2px 4px;
    margin: 0 -2px;
    border-radius: 6px;
    font-weight: 500;
}
.glossary-word:hover {
    background-color: rgba(0, 122, 255, 0.15);
    border-bottom-color: #007AFF;
    transform: translateY(-1px);
}

.hidden { display: none !important; }

/* Zen Mode Unified & Aurora Background */
.zen-active {
    /* Kaydırma serbest bırakıldı, sayfayı siyaha boya */
    overflow-y: auto !important;
    background: #000 !important;
    color: #fff !important;
}

/* Tüm menüleri (Mobil ve Masaüstü navigasyonları) gizle */
.zen-active nav,
.zen-active header,
.zen-active #main-header,
.zen-active .poem-extras-hide,
.zen-active .poem-note-hide,
.zen-active footer {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(-20px);
    transition: all 0.5s ease;
}

/* Şiir kartının şeffaflığını kardır ki arka planla bütünleşsin */
.zen-active .glass-card,
.zen-active .poem-card-box {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #fff !important;
}

.zen-active .poem-content {
    font-size: 110% !important;
    line-height: 2.2 !important;
    opacity: 0.9;
    text-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

#zen-overlay {
    position: fixed;
    inset: 0;
    /* Zen modu daima huzurlu bir karanlık konsepttedir */
    background: radial-gradient(circle at 20% 30%, #007AFF15 0%, transparent 40%),
                radial-gradient(circle at 80% 70%, #5856D615 0%, transparent 40%),
                radial-gradient(circle at 50% 50%, #050508 0%, #000000 100%);
    transition: opacity 1s ease;
    z-index: 1; /* Kartların arkasında kalmalı */
    opacity: 0;
    pointer-events: none;
}

.dark #zen-overlay {
    background: radial-gradient(circle at 20% 30%, #007AFF20 0%, transparent 40%),
                radial-gradient(circle at 80% 70%, #5856D620 0%, transparent 40%),
                radial-gradient(circle at 50% 50%, #0a0a0b 0%, #000000 100%);
}

#zen-overlay.active {
    opacity: 1;
    animation: aurora 15s infinite alternate ease-in-out;
}

/* DESKTOP SCROLL ARROWS */
.scroll-arrow-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #007AFF;
    z-index: 99;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.9;
}
.scroll-arrow-btn:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}
.scroll-arrow-btn:active {
    transform: translateY(-50%) scale(0.95);
}
.scroll-arrow-left { left: 4px; }
.scroll-arrow-right { right: 4px; }

.dark .scroll-arrow-btn {
    background: #1c1c1e;
    border-color: rgba(255,255,255,0.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    color: #0A84FF;
}

/* Sadece geniş ekranlarda görünecek ve gerektiğinde .hide classıyla gizlenecek */
@media (max-width: 768px) {
    .scroll-arrow-btn { display: none !important; }
}
.scroll-arrow-btn.hidden-arrow {
    display: none !important;
}
#exit-zen-btn {
    position: fixed !important;
    top: 30px !important;
    right: 30px !important;
    width: 50px !important;
    height: 50px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    background: #000 !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,0.3) !important;
    z-index: 9999999 !important;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s ease;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    cursor: pointer;
}

.dark #exit-zen-btn {
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid rgba(0,0,0,0.1) !important;
}

.zen-active #exit-zen-btn {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: scale(1);
}

#exit-zen-btn:hover {
    transform: scale(1.1);
    background: var(--ios-primary) !important;
    color: white !important;
}

.zen-active .poem-card-box {
    position: relative !important;
    z-index: 50 !important;
    box-shadow: 0 40px 100px rgba(0,0,0,0.1);
    transform: scale(1.05);
    background: rgba(255,255,255,0.85) !important;
    backdrop-filter: blur(20px);
}

@keyframes aurora {
    0% { filter: hue-rotate(0deg) saturate(1); }
    100% { filter: hue-rotate(45deg) saturate(1.5); }
}

.zen-active .poem-card-box {
    box-shadow: 0 40px 100px rgba(0,0,0,0.1);
    transform: scale(1.05);
    background: rgba(255,255,255,0.8) !important;
    backdrop-filter: blur(20px);
}

.dark .zen-active .poem-card-box {
    background: rgba(20,20,25,0.7) !important;
    box-shadow: 0 40px 100px rgba(0,0,0,0.5);
}

.zen-active .poem-line-inline {
    opacity: 0.3;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.zen-active .poem-line-inline:hover,
.zen-active .poem-line-inline.focus {
    opacity: 1;
    transform: scale(1.02);
    color: var(--ios-primary);
}

/* Copy Animation Toast & Tooltip */
.copy-badge {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #000;
    color: #fff;
    padding: 12px 24px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}
.copy-badge.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Glossary Meaning Modal */
#glossary-overlay {
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
}

.meaning-reveal {
    animation: meaningScale 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes meaningScale {
    from { opacity: 0; transform: scale(0.8) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}
.hide-scroll-bar { -ms-overflow-style: none; scrollbar-width: none; }

/* PREMIUM SHARE CARD STYLES */
#share-card-container {
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.6);
    user-select: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

#share-poem-content {
    text-shadow: 0 2px 10px rgba(0,0,0,0.1);
    word-break: break-word; /* Ensure no overflow */
}

/* Stanza Selection UI */
.stanza-btn {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stanza-btn:active {
    transform: scale(0.95);
}

/* Story Scale Animations */
@keyframes card-reveal {
    from { opacity: 0; transform: scale(0.8) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

#share-card-container:not(.scale-90) {
    animation: card-reveal 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

#stanza-list::-webkit-scrollbar {
    display: none;
}
#stanza-list {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Enhanced Share Features */
#share-overlay {
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

button {
    touch-action: manipulation;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

#share-card-container {
    transform-origin: center;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    will-change: transform, opacity;
}

#share-card-container.shadow-\[0_45px_100px_rgba\(0\,0\,0\,0\.6\)\] {
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.5) !important;
}

#share-card-bg .backdrop-blur-lg {
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
}

#share-grain-layer.active {
    opacity: 0.15 !important;
    mix-blend-mode: overlay;
    pointer-events: none;
}
