@font-face {
    font-family: 'HarmonyOS Sans SC';
    src: url('../fonts/HarmonyOS_SansSC_Medium.ttf') format('truetype');
}

:root {
    --primary-bg: #1e1e2f;
    --secondary-bg: #27293d;
    --sidebar-bg: #2a2d42;
    --accent-color: #3a3d5b;
    --highlight-color: #ff6768;
    --text-color: #dcdce4;
    --text-secondary-color: #a0a0b8;
    --font-family: 'HarmonyOS Sans SC', sans-serif;
    --border-radius: 8px;
}

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

body, html {
    width: 100%;
    height: 100%;
    font-family: var(--font-family);
    font-size: 16px; 
    background-color: transparent;
    color: var(--text-color);
    overflow: hidden;
}

.container {
    display: flex;
    height: 100%;
    background-color: var(--primary-bg);
    border-radius: var(--border-radius);
}

.sidebar {
    width: 240px;
    background-color: var(--sidebar-bg);
    padding: 0;
    display: flex;
    flex-direction: column;
    -webkit-app-region: drag;
    transition: width 0.2s ease-in-out;
    overflow: hidden;
}

.sidebar-scaler {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    transform-origin: top;
    transition: transform 0.15s ease-out;
    padding: 2vh 16px 5px;
    width: 100%;
    box-sizing: border-box;
}

.logo {
    font-family: var(--font-family);
    text-align: center;
    color: var(--highlight-color);
    margin-bottom: clamp(15px, 4vh, 40px); 
    margin-top: clamp(5px, 2vh, 15px);
    font-weight: 600;
    font-size: clamp(18px, 3vh, 24px); 
    letter-spacing: 1px;
    -webkit-app-region: no-drag;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
}

.logo-icon {
    color: var(--highlight-color);
    transition: color 0.3s ease;
}

.control-group {
    margin-bottom: clamp(15px, 2.5vh, 25px); 
    position: relative;
    flex-shrink: 0;
}

.control-group label {
    display: block;
    margin-bottom: clamp(6px, 1.2vh, 10px);
    font-size: clamp(13px, 1.8vh, 15px);
    font-weight: 400;
    color: var(--text-secondary-color);
}

.controls-wrapper, .drama-controls, .usage-tips, .drama-usage-tips {
    -webkit-app-region: no-drag;
    flex-shrink: 0;
}

.no-drag {
    -webkit-app-region: no-drag;
}

/* --- Custom Select Styling --- */
select {
    width: 100%;
    padding: clamp(8px, 1.5vh, 10px);
    background-color: var(--secondary-bg);
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-color);
    font-family: var(--font-family);
    -webkit-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23a0a0b8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 10px;
    cursor: pointer;
}

select:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--highlight-color);
}

.action-button {
    width: 100%;
    padding: clamp(10px, 1.8vh, 12px);
    background: var(--highlight-color);
    border: none;
    color: #fff;
    font-weight: 600;
    font-size: clamp(13px, 1.8vh, 15px);
    font-family: var(--font-family);
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.button-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 1;
    vertical-align: middle;
}

.button-text {
    flex: 0;
    text-align: center;
    white-space: nowrap;
    writing-mode: horizontal-tb;
}

.action-button:hover {
    background: #e55354;
    box-shadow: 0 0 15px rgba(255, 103, 104, 0.4);
}

.usage-tips {
    margin-top: clamp(15px, 2.5vh, 25px);
    padding: clamp(10px, 2vh, 15px);
    background-color: var(--accent-color);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.usage-tips h4 {
   color: var(--highlight-color);
   font-size: clamp(14px, 2vh, 16px);
   margin-bottom: clamp(10px, 1.8vh, 15px);
   text-align: center;
}

.usage-tips ul {
   list-style: none;
   padding-left: 0;
}

.usage-tips li {
   font-size: clamp(12px, 1.6vh, 14px);
   color: var(--text-secondary-color);
   margin-bottom: clamp(8px, 1.5vh, 12px);
   line-height: 1.6;
   position: relative;
   padding-left: 15px;
}

.usage-tips li::before {
    content: '•';
    position: absolute;
    left: 0;
    top: 0;
    color: var(--highlight-color);
    font-size: clamp(12px, 1.6vh, 14px);
}

.usage-tips li strong {
   color: var(--text-color);
   font-weight: 600;
}

.footer {
    text-align: center;
    margin-top: auto;
    padding-top: clamp(10px, 2vh, 20px);
    -webkit-app-region: no-drag;
    flex-shrink: 0;
}

.footer a {
    font-size: clamp(12px, 1.6vh, 14px);
    color: var(--text-secondary-color);
    text-decoration: none;
    font-weight: 400;
    transition: color 0.2s ease-in-out;
}

.footer a:hover {
    color: var(--highlight-color);
    text-decoration: underline;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.top-bar {
    height: clamp(50px, 7vh, 65px);
    display: flex;
    align-items: center;
    padding: 0 15px;
    background-color: var(--secondary-bg);
    flex-shrink: 0;
    -webkit-app-region: drag;
}

.browser-controls {
    display: flex;
    align-items: center;
    -webkit-app-region: no-drag;
}

#url-input {
    flex-grow: 1;
    padding: 8px 12px;
    background: var(--primary-bg);
    border: none;
    color: var(--text-color);
    border-radius: var(--border-radius);
    margin: 0 10px;
    font-family: var(--font-family);
    -webkit-app-region: no-drag;
    transition: all 0.2s ease;
}

#go-button {
    padding: 8px 20px;
    background: var(--accent-color);
    border: none;
    color: var(--text-color);
    cursor: pointer;
    border-radius: var(--border-radius);
    -webkit-app-region: no-drag;
    transition: all 0.2s ease;
}

#go-button:hover {
    background: var(--highlight-color);
    color: #fff;
}

.nav-button {
   display: flex;
   align-items: center;
   justify-content: center;
   width: 36px;
   height: 36px;
   background: transparent;
   border: none;
   color: var(--text-secondary-color);
   cursor: pointer;
   border-radius: var(--border-radius);
   transition: all 0.2s ease;
}

.nav-button svg {
   width: 20px;
   height: 20px;
}

.nav-button:hover {
    background: var(--accent-color);
    color: var(--text-color);
}

.nav-button:disabled {
    color: #5a5a72;
    cursor: not-allowed;
    background: transparent;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--primary-bg);
}

::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--highlight-color);
}

.window-controls {
    display: flex;
    align-items: center;
    -webkit-app-region: no-drag;
    margin-left: 15px;
}

.window-control-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius);
    background: transparent;
    border: none;
    color: var(--text-secondary-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.window-control-button svg {
    width: 16px;
    height: 16px;
}

.window-control-button:hover {
    background: var(--accent-color);
    color: var(--text-color);
}

.window-control-button#close-button:hover {
    background: var(--highlight-color);
    color: #fff;
}


/* --- Youku Custom Page Styles (Theme-Aligned) --- */
#youku-custom-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
    box-sizing: border-box;
    text-align: center;
    background: var(--primary-bg);
    color: var(--text-color);
    overflow: hidden;
}

#youku-custom-page .icon-container {
    margin-bottom: 25px;
    color: var(--highlight-color);
    filter: drop-shadow(0 0 15px var(--highlight-color));
}

#youku-custom-page h2 {
    font-size: 2.8em;
    font-weight: 300;
    letter-spacing: 1px;
    color: var(--text-color);
    margin-bottom: 10px;
}

#youku-custom-page p {
    font-size: 1.1em;
    color: var(--text-secondary-color);
    margin-bottom: 40px;
    max-width: 550px;
    line-height: 1.6;
}

#youku-custom-page input[type="text"] {
    width: 100%;
    max-width: 600px;
    padding: 18px 25px;
    font-size: 1.2em;
    border: 1px solid var(--accent-color);
    border-radius: 50px;
    background-color: var(--secondary-bg);
    color: var(--text-color);
    margin-bottom: 40px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}

#youku-custom-page input[type="text"]::placeholder {
    color: var(--text-secondary-color);
    opacity: 0.6;
}

#youku-custom-page input[type="text"]:focus {
    outline: none;
    border-color: var(--highlight-color);
    box-shadow: 0 0 20px rgba(255, 103, 104, 0.4), inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

#youku-custom-page .usage-tips {
    width: 100%;
    max-width: 600px;
    text-align: left;
    background-color: var(--secondary-bg);
    padding: 25px 30px;
    border-radius: var(--border-radius);
    border: 1px solid var(--accent-color);
}

#youku-custom-page .usage-tips h4 {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--accent-color);
}

#youku-custom-page .usage-tips ul {
    list-style-type: none;
    padding-left: 0;
}

#youku-custom-page .usage-tips li {
    font-size: 1em;
    color: var(--text-secondary-color);
    margin-bottom: 12px;
    line-height: 1.7;
    padding-left: 20px;
    position: relative;
}

#youku-custom-page .usage-tips li::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 2px;
    color: var(--highlight-color);
    font-weight: bold;
}

/* --- Loading Overlay --- */
#loading-overlay {
    position: fixed;
    top: 56px;
    left: 240px;
    right: 0;
    bottom: 0;
    background-color: rgba(30, 30, 47, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.2s ease-in-out;
}

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

.spinner {
    border: 4px solid var(--accent-color);
    border-top: 4px solid var(--highlight-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* --- View Transition Customization --- */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

#update-toast-container {
    position: relative;
}

/* --- SMART LAYOUT FOR SMALL WINDOWS --- */
@media (max-height: 780px) {
    .logo {
        margin-bottom: 20px;
        margin-top: 10px;
    }
    .control-group {
        margin-bottom: 15px;
    }
    .usage-tips {
        margin-top: 15px;
        padding: 12px;
    }
    .footer {
        padding-top: 10px;
    }
}
