:root { color-scheme: dark; }

/* KageAnime Lite - iOS 9.3.5 / iPad 2 Optimized CSS */
* {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
}

body {
    background-color: #0d0e15;
    color: #e6e8f0;
    font-family: -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.4;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

/* Header */
#legacy-header {
    background: #151622;
    border-bottom: 2px solid #ff2a5f;
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 8px 16px;
    -webkit-box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.header-inner {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    max-width: 1100px;
    margin: 0 auto;
}

.logo-box {
    cursor: pointer;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
}

.logo-badge {
    background: #ff2a5f;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    padding: 3px 6px;
    border-radius: 4px;
    margin-right: 8px;
    text-transform: uppercase;
}

.logo-title {
    font-size: 20px;
    color: #fff;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.logo-title strong {
    color: #ff2a5f;
    font-weight: 700;
}

/* Search Box */
.search-box {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    max-width: 420px;
    margin: 0 16px;
}

#search-input {
    width: 100%;
    background: #202234;
    border: 1px solid #313552;
    color: #fff;
    padding: 7px 12px;
    font-size: 14px;
    border-radius: 6px 0 0 6px;
    outline: none;
}

#search-input:focus {
    border-color: #ff2a5f;
    background: #272a40;
}

.btn-search {
    background: #ff2a5f;
    border: none;
    color: #fff;
    padding: 0 14px;
    font-weight: bold;
    font-size: 13px;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
}

.btn-search:active {
    background: #e01d4f;
}

/* Header Action Buttons */
.header-actions {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
}

.btn-nav {
    background: #24273d;
    border: 1px solid #373c5c;
    color: #e1e4f5;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    margin-left: 6px;
    cursor: pointer;
}

.btn-nav:active {
    background: #ff2a5f;
    color: #fff;
    border-color: #ff2a5f;
}

/* Navigation Tabs */
#legacy-tabs {
    background: #11121c;
    border-bottom: 1px solid #202336;
    padding: 6px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
}

.tabs-scroll {
    max-width: 1100px;
    margin: 0 auto;
}

.tab-item {
    display: inline-block;
    background: transparent;
    border: 1px solid transparent;
    color: #9ea3bf;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 20px;
    margin-right: 6px;
    cursor: pointer;
}

.tab-item.active {
    background: #ff2a5f;
    color: #fff;
}

.tab-item:active {
    background: #2b2f48;
}

.btn-source-pill {
    display: inline-block;
    background: #181a28;
    border: 1px solid #2b2f48;
    color: #a4a9c8;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    margin: 2px 4px;
    cursor: pointer;
}

.btn-source-pill.active {
    background: #00e5ff;
    color: #000;
    border-color: #00e5ff;
    font-weight: bold;
}

.btn-source-pill:active {
    background: #00b4d8;
}

/* Main Container */
#legacy-main {
    max-width: 1100px;
    margin: 14px auto 30px;
    padding: 0 14px;
    min-height: 500px;
}

/* Views Visibility */
.active-view {
    display: block;
}

.hidden-view {
    display: none;
}

.section-head {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    margin-bottom: 14px;
    border-left: 4px solid #ff2a5f;
    padding-left: 10px;
}

.section-head h2 {
    font-size: 18px;
    color: #fff;
    font-weight: 700;
}

.count-badge {
    color: #8c92b3;
    font-size: 13px;
}

.btn-back {
    background: #24273d;
    border: 1px solid #373c5c;
    color: #fff;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
}

/* Anime Card Grid (Responsive for iPad 2 1024x768) */
.grid-container {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    margin: -6px;
}

.anime-card {
    width: 20%;
    padding: 6px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    cursor: pointer;
}

@media (max-width: 820px) {
    .anime-card {
        width: 25%;
    }
}

@media (max-width: 600px) {
    .anime-card {
        width: 33.333%;
    }
}

.card-inner {
    background: #171826;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #23263b;
    position: relative;
    -webkit-transition: -webkit-transform 0.15s ease;
    transition: transform 0.15s ease;
}

.anime-card:active .card-inner {
    -webkit-transform: scale(0.96);
    transform: scale(0.96);
    border-color: #ff2a5f;
}

.card-thumb-wrap {
    position: relative;
    width: 100%;
    padding-top: 142%; /* 1:1.42 anime poster aspect ratio */
    background: #10111a;
    overflow: hidden;
}

.card-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card-score {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0,0,0,0.85);
    color: #ffc107;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255,193,7,0.4);
}

.card-source {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: rgba(255,42,95,0.88);
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 3px;
    text-transform: uppercase;
}

.card-info {
    padding: 8px 6px 6px;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* Status / Alerts */
#status-bar {
    background: #25283f;
    color: #ffc107;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    border: 1px solid #3e4468;
}

#status-bar.hidden {
    display: none;
}

/* Player View */
.player-nav-top {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    margin-bottom: 12px;
}

.btn-back-main {
    background: #202338;
    border: 1px solid #333857;
    color: #fff;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
}

.btn-back-main:active {
    background: #ff2a5f;
}

.player-header-title {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    margin: 0 12px;
}

.player-header-title h2 {
    font-size: 18px;
    color: #fff;
    font-weight: 700;
}

.player-header-title span {
    font-size: 12px;
    color: #8c92b3;
    display: block;
}

.btn-fav {
    background: #272038;
    border: 1px solid #5a3c75;
    color: #ffc107;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
}

.btn-fav.active {
    background: #ffc107;
    color: #000;
}

/* Video Player Box */
.video-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    border: 1px solid #23263b;
}

#legacy-video {
    width: 100%;
    max-height: 480px;
    display: block;
    background: #000;
}

.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #11121c;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    text-align: center;
}

.video-placeholder.hidden {
    display: none;
}

.placeholder-msg {
    color: #8c92b3;
}

.icon-play {
    display: inline-block;
    width: 54px;
    height: 54px;
    line-height: 54px;
    background: #ff2a5f;
    color: #fff;
    font-size: 24px;
    border-radius: 50%;
    margin-bottom: 10px;
}

/* Quick Episode Navigation Bar */
.quick-ep-bar {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    background: #171826;
    border: 1px solid #23263b;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 14px;
}

.btn-ep-nav {
    background: #202338;
    border: 1px solid #333857;
    color: #fff;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
}

.btn-ep-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-ep-nav:not(:disabled):active {
    background: #ff2a5f;
}

.current-ep-badge {
    font-size: 14px;
    font-weight: 700;
    color: #ff2a5f;
}

/* Controls Panel */
.controls-panel {
    background: #151622;
    border-radius: 8px;
    border: 1px solid #202336;
    padding: 14px;
}

.panel-section {
    margin-bottom: 16px;
}

.panel-section-head {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
}

.panel-label {
    display: block;
    font-size: 14px;
    font-weight: bold;
    color: #e1e4f5;
    margin-bottom: 8px;
}

.ep-count-text {
    font-size: 12px;
    color: #8c92b3;
}

/* Voiceover buttons scroll */
.buttons-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    padding-bottom: 4px;
}

.btn-pill {
    display: inline-block;
    background: #202338;
    border: 1px solid #313655;
    color: #cdd1ea;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    margin-right: 6px;
    cursor: pointer;
}

.btn-pill.active {
    background: #ff2a5f;
    border-color: #ff2a5f;
    color: #fff;
}

.btn-pill:active {
    background: #3b4168;
}

/* Episode Grid Buttons */
.episodes-container {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    max-height: 220px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin: -3px;
    padding: 2px;
}

.btn-episode {
    width: 48px;
    height: 38px;
    line-height: 36px;
    text-align: center;
    background: #202338;
    border: 1px solid #313655;
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    border-radius: 6px;
    margin: 3px;
    cursor: pointer;
}

.btn-episode.active {
    background: #ff2a5f;
    border-color: #ff2a5f;
    color: #fff;
}

.btn-episode:active {
    background: #ff4777;
}

/* Anime Information Section */
.anime-info-section {
    border-top: 1px solid #23263b;
    padding-top: 14px;
    margin-bottom: 0;
}

.anime-info-body {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
}

.player-poster {
    width: 100px;
    height: 142px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #2e324d;
    margin-right: 14px;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}

.anime-info-text {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
}

.meta-row {
    margin-bottom: 8px;
}

.meta-badge {
    display: inline-block;
    background: #202338;
    color: #c4c8e6;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    margin-right: 6px;
}

.score-badge {
    background: rgba(255,193,7,0.18);
    color: #ffc107;
    border: 1px solid rgba(255,193,7,0.3);
}

.meta-genres {
    color: #8c92b3;
    font-size: 13px;
}

.anime-synopsis {
    color: #b0b5d0;
    font-size: 13px;
    line-height: 1.5;
    max-height: 90px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Footer */
#legacy-footer {
    text-align: center;
    padding: 20px 14px;
    color: #696f8c;
    font-size: 13px;
    border-top: 1px solid #1a1c2a;
    background: #0b0c12;
}

#legacy-footer strong {
    color: #ff2a5f;
}

.footer-sub {
    font-size: 11px;
    color: #525875;
    margin-top: 4px;
}

/* Player Quality & Iframe Enhancements */
.legacy-iframe {
    width: 100%;
    height: 440px;
    border: 0;
    display: block;
    background: #000;
}

.legacy-iframe.hidden {
    display: none;
}

.quality-bar {
    background: #171826;
    border: 1px solid #23263b;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
}

.quality-bar.hidden {
    display: none;
}

.quality-label {
    font-size: 13px;
    font-weight: 700;
    color: #00e5ff;
    margin-right: 10px;
    white-space: nowrap;
}

.quality-pills-list {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.btn-quality-pill {
    display: inline-block;
    background: #202338;
    border: 1px solid #333857;
    color: #c4c8e6;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 12px;
    margin-right: 6px;
    cursor: pointer;
}

.btn-quality-pill.active {
    background: #ff2a5f;
    color: #fff;
    border-color: #ff2a5f;
}

.btn-quality-pill:active {
    background: #ff547d;
}

.btn-manual-play {
    display: inline-block;
    margin-top: 10px;
    background: #ff2a5f;
    color: #fff;
    border: none;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255,42,95,0.4);
}

.btn-manual-play.hidden {
    display: none;
}

