:root {
    --bg-color: #000;
    --text-color: #fff;
    --accent-color: #ff0055;
    --overlay-gradient: linear-gradient(to top, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.6) 40%, rgba(0, 0, 0, 0) 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport for mobile */
    width: 100vw;
}

/* Vertical Scroll Snap Container */
.scroll-container {
    height: 100%;
    width: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.scroll-container::-webkit-scrollbar {
    display: none;
}

/* Individual Video Page - Flex Column Layout */
.video-page {
    height: 100vh;
    height: 100dvh;
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: #000;
    overflow: hidden;

    /* Strict Padding to avoid overlapping Header and Bottom Nav */
    padding-top: 60px;
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
    box-sizing: border-box;
}

/* Video Wrapper */
.video-wrapper {
    flex: 1;
    /* Grow and shrink to fill available space */
    width: 100%;
    min-height: 0;
    /* Critical for Flexbox shrinking */
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
    overflow: hidden;
}

/* Product Info Block (Static Flow) */
.video-info-block {
    flex: 0 0 auto;
    /* Don't shrink below content size */
    width: 100%;
    padding: 12px 16px;
    background: #111;
    z-index: 20;
    border-top: 1px solid #333;
    position: relative;
}

.product-info {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.jacket-link {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid #fff;
    display: block;
    background: #333;
}

.jacket-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.text-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.product-title-link {
    text-decoration: none;
    color: #fff;
    display: block;
    cursor: pointer;
}

.product-title {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
}

.product-meta {
    display: block;
    font-size: 11px;
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.actress-name {
    color: #ccc;
    font-weight: bold;
}

/* --- Native Video Player & Controls --- */
.video-container {
    width: 100%;
    height: 100%;
    background: #000;
    position: relative;
    /* Relative for indicators */
    display: flex;
    justify-content: center;
    align-items: center;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Black bars if aspect ratio differs */
}

/* Indicators (Inside Video Container) */
.mute-indicator {
    position: absolute;
    top: 10px;
    /* Relative to video container layout */
    left: 10px;
    z-index: 40;
    background: rgba(0, 0, 0, 0.6);
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

.play-state-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 40;
    color: rgba(255, 255, 255, 0.8);
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.play-state-center svg {
    width: 48px;
    height: 48px;
}

/* Loading / Error */
.loading-overlay,
.error-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: none;
}

.loading-overlay.hidden {
    display: none;
}

.error-placeholder {
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 20px;
    border-radius: 8px;
    white-space: nowrap;
    color: #ccc;
    font-size: 14px;
}

/* Controls Layer (Over Video Wrapper) */
.video-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 30;
    display: flex;
    /* Adjust layout inside controls if needed */
    flex-direction: column;
    justify-content: flex-end;
    /* Align elements to bottom */
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.video-controls.control-hidden {
    opacity: 0;
}

/* Enable interactions on controls */
.side-buttons button,
.seekbar-wrapper input {
    pointer-events: auto;
}

/* Right Side Buttons */
.side-buttons {
    position: absolute;
    right: 12px;
    bottom: 50px;
    /* Above seekbar */
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    z-index: 35;
}

.control-btn {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.control-btn:active {
    transform: scale(0.9);
    background: rgba(0, 0, 0, 0.6);
}

.control-btn svg {
    width: 20px;
    height: 20px;
}

/* Seekbar */
.seekbar-wrapper {
    width: 100%;
    padding: 0 10px 10px 10px;
    z-index: 40;
}

.seek-bar {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    transition: height 0.2s;
}

.seek-bar:active {
    height: 6px;
}

.seek-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-color);
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: transform 0.1s;
}

.seek-bar:active::-webkit-slider-thumb {
    transform: scale(1.3);
}


/* Header */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
    z-index: 50;
    pointer-events: none;
    padding: 0 20px;
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}

.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.brand-name {
    font-size: 16px;
    font-weight: 800;
    background: linear-gradient(45deg, #ff00cc, #3333ff);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#header-title {
    font-size: 14px;
    font-weight: 600;
    color: #ccc;
    max-width: 40%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: #000;
    /* Solid background so scrolling text hides behind it */
    border-top: 1px solid #333;
    display: flex;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 11px;
    gap: 6px;
}

.nav-item.active {
    color: #fff;
}

.nav-item svg {
    width: 26px;
    height: 26px;
}

/* Search Overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 80px;
    opacity: 1;
    transition: opacity 0.3s;
    pointer-events: auto;
    overflow-y: auto;
}

.search-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.search-container {
    width: 85%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.search-box {
    width: 100%;
    display: flex;
    gap: 8px;
}

.search-box input {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: none;
    background: #222;
    color: #fff;
    font-size: 16px;
}

.search-box button {
    padding: 12px 20px;
    border-radius: 8px;
    border: none;
    background: var(--accent-color);
    color: #fff;
    font-weight: bold;
    cursor: pointer;
}

.search-suggestions {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 40px;
}

.suggestion-group h3 {
    font-size: 14px;
    color: #888;
    margin-bottom: 10px;
    font-weight: 600;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-chip {
    padding: 8px 16px;
    background: #333;
    border-radius: 20px;
    font-size: 13px;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.suggestion-chip:active {
    background: #444;
}

.close-btn {
    position: absolute;
    top: 30px;
    right: 30px;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
}

/* Loading Spinner */
.loading-spinner {
    padding: 20px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.loading-spinner.hidden {
    display: none;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Utilities */
.hidden {
    display: none !important;
}

.opacity-0 {
    opacity: 0;
}