/* ──────────────────────────────────────
   Alanews Shorts — Fullscreen Reader
   ────────────────────────────────────── */

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

.ans-reader-body {
    background: #000;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    height: 100vh;
    height: 100dvh;
}

#ans-reader {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 99999;
}

/* ─── Viewport ─── */
.ans-reader__viewport {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

/* ─── Slide ─── */
.ans-reader__slide {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
}

.ans-reader__slide--active {
    display: flex;
}

/* ─── Video ─── */
.ans-reader__video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    cursor: pointer;
}

/* On mobile, fill the screen */
@media (max-width: 768px) {
    .ans-reader__video {
        object-fit: cover;
    }
}

/* On desktop, constrain to 9:16 centered */
@media (min-width: 769px) {
    .ans-reader__video {
        width: auto;
        height: 100%;
        max-width: 100%;
        aspect-ratio: 9 / 16;
        margin: 0 auto;
        display: block;
        border-radius: 12px;
    }

    .ans-reader__slide {
        justify-content: center;
    }
}

/* ─── Close button ─── */
.ans-reader__close {
    position: absolute;
    top: env(safe-area-inset-top, 12px);
    left: 16px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.2s;
    margin-top: 12px;
}

.ans-reader__close:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* ─── Progress bar ─── */
.ans-reader__progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    z-index: 100;
}

.ans-reader__progress-fill {
    height: 100%;
    background: #fff;
    border-radius: 0 2px 2px 0;
    transition: width 0.15s linear;
    width: 0;
}

/* ─── Counter ─── */
.ans-reader__counter {
    position: absolute;
    top: env(safe-area-inset-top, 12px);
    right: 16px;
    z-index: 100;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin-top: 24px;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 10px;
    border-radius: 12px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ─── Nav arrows (desktop only) ─── */
.ans-reader__nav {
    position: absolute;
    z-index: 100;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.2s, transform 0.2s, opacity 0.2s;
}

.ans-reader__nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.ans-reader__nav:disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

@media (min-width: 769px) {
    .ans-reader__nav {
        display: flex;
    }

    .ans-reader__nav--prev {
        right: 32px;
        top: 50%;
        transform: translateY(calc(-50% - 32px));
    }

    .ans-reader__nav--prev:hover {
        transform: translateY(calc(-50% - 32px)) scale(1.1);
    }

    .ans-reader__nav--next {
        right: 32px;
        top: 50%;
        transform: translateY(calc(-50% + 32px));
    }

    .ans-reader__nav--next:hover {
        transform: translateY(calc(-50% + 32px)) scale(1.1);
    }
}

/* ─── Overlay info ─── */
.ans-reader__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    pointer-events: none;
    padding: 80px 20px 32px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.8) 0%,
        rgba(0, 0, 0, 0.4) 50%,
        transparent 100%
    );
}

@media (min-width: 769px) {
    .ans-reader__overlay {
        left: 50%;
        right: auto;
        width: min(calc(100vh * 9 / 16), 100%);
        transform: translateX(-50%);
        border-radius: 0 0 12px 12px;
    }
}

.ans-reader__overlay-content {
    max-width: 500px;
}

.ans-reader__title {
    color: #fff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 10px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

@media (min-width: 769px) {
    .ans-reader__title {
        font-size: 22px;
    }
}

.ans-reader__meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ans-reader__badge {
    background: #e53e3e;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 4px;
    letter-spacing: 0.04em;
}

.ans-reader__source {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 500;
}

/* ─── Action buttons (right sidebar) ─── */
.ans-reader__actions {
    position: absolute;
    right: 16px;
    bottom: 140px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

@media (min-width: 769px) {
    .ans-reader__actions {
        right: calc(50% - min(calc(100vh * 9 / 32), 50%) - 60px);
        bottom: 160px;
    }
}

.ans-reader__action-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.2s, transform 0.15s;
}

.ans-reader__action-btn:hover {
    background: rgba(0, 0, 0, 0.75);
    transform: scale(1.1);
}

.ans-reader__action-btn:active {
    transform: scale(0.95);
}

/* ─── Share menu ─── */
.ans-reader__share-menu {
    position: absolute;
    right: 16px;
    bottom: 240px;
    z-index: 110;
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 6px;
    min-width: 180px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: ans-share-in 0.2s ease-out;
}

@media (min-width: 769px) {
    .ans-reader__share-menu {
        right: calc(50% - min(calc(100vh * 9 / 32), 50%) - 80px);
    }
}

@keyframes ans-share-in {
    from { opacity: 0; transform: translateY(8px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ans-reader__share-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s;
    text-align: left;
}

.ans-reader__share-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.ans-reader__share-option svg {
    flex-shrink: 0;
}

/* ─── Toast ─── */
.ans-reader__toast {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    z-index: 200;
    background: rgba(255, 255, 255, 0.95);
    color: #111;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.ans-reader__toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ─── Edge hint ─── */
.ans-reader__edge-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    z-index: 200;
    background: rgba(0, 0, 0, 0.7);
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 24px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    white-space: nowrap;
}

.ans-reader__edge-hint--visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
