/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --green-50: #e8f5e9;
    --green-100: #c8e6c9;
    --green-300: #81c784;
    --green-500: #4CAF50;
    --green-700: #388E3C;
    --green-900: #1B5E20;
    --white: #ffffff;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-500: #9e9e9e;
    --gray-700: #616161;
    --gray-900: #212121;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 10px;
    --radius-sm: 6px;
    --max-width: 1200px;
    --nav-height: 56px;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--gray-100) url('bg.jpg') repeat;
    color: var(--gray-900);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--green-700); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Navigation ===== */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--green-700);
    box-shadow: var(--shadow-sm);
    height: var(--nav-height);
}

.nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--white);
}

.nav-links {
    display: flex;
    gap: 4px;
    list-style: none;
}

.nav-links a {
    display: block;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: rgba(255,255,255,0.85);
    transition: background 0.2s, color 0.2s;
}

.nav-links a:hover {
    background: rgba(255,255,255,0.15);
    color: var(--white);
    text-decoration: none;
}

/* ===== Main Content ===== */
.main {
    flex: 1;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 24px 16px 32px;
    width: 100%;
}

/* ===== Hero ===== */
.hero {
    text-align: center;
    padding: 0;
}

.hero h3 {
    font-size: 1.35rem;
    font-weight: 600;
    color: #777;
    margin-bottom: 8px;
}

/* ===== Parse Box ===== */
.parse-box {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 28px 24px;
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.parse-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.parse-form .input-wrap {
    flex: 1;
    min-width: 0;
}

.parse-form input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.25s;
    background: var(--gray-50);
}

.parse-form input[type="text"]:focus {
    border-color: var(--green-500);
    background: var(--white);
}

.parse-form input[type="text"]::placeholder {
    color: var(--gray-500);
}

.parse-form button {
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--green-500);
    color: var(--white);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
    flex-shrink: 0;
}

.parse-form button:hover { background: var(--green-700); }
.parse-form button:active { transform: scale(0.97); }
.parse-form button:disabled {
    background: var(--gray-300);
    color: var(--gray-500);
    cursor: not-allowed;
    transform: none;
}

/* ===== Status Messages ===== */
.status {
    margin-top: 14px;
    font-size: 0.875rem;
    min-height: 1.4em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--green-500);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.status.error { color: #d32f2f; }
.status.success { color: var(--green-700); }
.status.info { color: var(--gray-700); }

/* ===== Info Bar ===== */
.info-bar {
    display: none;
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-top: 12px;
    font-size: 0.875rem;
    color: var(--gray-700);
    box-shadow: var(--shadow-sm);
    border-left: 3px solid var(--green-500);
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.info-bar.visible { display: flex; }
.info-bar .label { color: var(--gray-500); font-size: 0.8rem; }
.info-bar .name { font-weight: 600; color: var(--gray-900); word-break: break-all; flex: 1; min-width: 0; }

.info-bar .skip-group {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.info-bar .skip-btn {
    padding: 3px 10px;
    border: 1px solid var(--green-500);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--green-500);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    line-height: 1.4;
}

.info-bar .skip-btn:hover {
    background: var(--green-500);
    color: var(--white);
}

.info-bar .skip-btn.active {
    background: var(--green-500);
    color: var(--white);
}

.info-bar .skip-btn.skip-clear {
    border-color: var(--gray-500);
    color: var(--gray-500);
}

.info-bar .skip-btn.skip-clear:hover {
    background: var(--gray-500);
    color: var(--white);
}

/* ===== Player ===== */
.player-wrap {
    position: relative;
    margin-top: 20px;
    background: #000;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.player-wrap.hidden { display: none; }

#player-container {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}



/* ===== Episode Panel ===== */
.ajx-ep-panel {
    display: none;
    position: absolute;
    top: 0;
    right: -360px;
    width: 340px;
    height: 100%;
    background: rgba(20, 20, 20, 0.95);
    color: #eee;
    z-index: 100;
    overflow-y: auto;
    transition: right 0.3s ease;
    font-size: 0.85rem;
}

.ajx-ep-panel.ajx-ep-open {
    display: block;
    right: 0;
}

.ajx-ep-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: sticky;
    top: 0;
    background: rgba(20, 20, 20, 0.98);
    z-index: 1;
}

.ajx-ep-title {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 8px;
}

.ajx-ep-close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.ajx-ep-close:hover { color: #fff; }

.ajx-ep-info {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.ajx-ep-pic {
    flex-shrink: 0;
    width: 100px;
    height: 140px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(255,255,255,0.05);
}

.ajx-ep-pic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ajx-ep-desc {
    flex: 1;
    font-size: 0.78rem;
    color: #999;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    word-break: break-all;
}

.ajx-ep-list {
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 6px;
}

.ajx-ep-item {
    padding: 8px 6px;
    text-align: center;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.2s;
}

.ajx-ep-item:hover { background: var(--green-700); color: #fff; }
.ajx-ep-item.ajx-ep-active {
    background: var(--green-500);
    color: #fff;
    font-weight: 600;
}

/* ===== Footer ===== */
.footer {
    border-top: 1px solid var(--gray-200);
    background: var(--white);
    padding: 20px 16px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: auto;
}

.footer a { color: var(--gray-500); }
.footer a:hover { color: var(--green-500); text-decoration: none; }

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .hero h3 { font-size: 1.15rem; }
    .parse-box { padding: 16px; }
    .parse-form { flex-direction: column; }
    .parse-form button { width: 100%; }
    .nav-inner { padding: 0 12px; }
    .main { padding: 16px 12px 24px; }
}

@media (max-width: 380px) {
    .nav-brand { font-size: 1.05rem; }
    .nav-links a { padding: 6px 8px; font-size: 0.8rem; }
}
