:root {
    /* Light mode colors */
    --bg-primary: #fafafa;
    --bg-secondary: #fff;
    --bg-tertiary: #f5f5f5;
    --border-color: #e0e0e0;
    --text-primary: #1a1a1a;
    --text-secondary: #888;
    --button-bg: #000;
    --button-text: #fff;
    --button-hover: rgba(0, 0, 0, 0.8);
    --error-bg: #ffebee;
    --error-text: #d32f2f;
    --error-border: #d32f2f;
    --success-bg: #e8f5e9;
    --success-text: #388e3c;
    --success-border: #388e3c;
}

body.dark-mode {
    --bg-primary: #1a1a1a;
    --bg-secondary: #242424;
    --bg-tertiary: #2a2a2a;
    --border-color: #3a3a3a;
    --text-primary: #f0f0f0;
    --text-secondary: #b0b0b0;
    --button-bg: #fff;
    --button-text: #1a1a1a;
    --button-hover: rgba(255, 255, 255, 0.9);
    --error-bg: #5d1f1f;
    --error-text: #ff9999;
    --error-border: #d32f2f;
    --success-bg: #1f4d2f;
    --success-text: #66ff99;
    --success-border: #388e3c;
}

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

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.sidebar {
    width: 250px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.3s ease;
}

.sidebar-header-content {
    flex: 1;
}

.sidebar-header h1 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0rem;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.sidebar-header p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
    transition: color 0.3s ease;
}

.theme-toggle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 0px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--border-color);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle svg {
    width: 22px;
    height: 22px;
    position: absolute;
    color: var(--text-primary);
    transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.theme-toggle .sun-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.theme-toggle .moon-icon {
    opacity: 0;
    transform: rotate(-180deg) scale(0);
}

.theme-toggle.dark-mode .sun-icon {
    opacity: 0;
    transform: rotate(180deg) scale(0);
}

.theme-toggle.dark-mode .moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0rem 0rem;
    background: var(--bg-primary);
    transition: background-color 0.3s ease;
    overflow: hidden !important;
}

.file-loader {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border-color);
    transition: border-color 0.3s ease;
}

.file-loader-label {
    padding: 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    font-weight: 600;
    transition: color 0.3s ease;
}

.load-font-div {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    border: none;
    padding: 1rem;
    cursor: pointer;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.load-font-div:hover {
    transition: opacity 0.3s ease;
    background: var(--bg-tertiary);
}

.load-font-div:active {
    background-color: var(--border-color);
}

.script-icon {
    font-family: 'Material Symbols Outlined';
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.load-button {
    font-family: inherit;
    color: var(--text-primary);
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: opacity 0.2s, background-color 0.3s ease, color 0.3s ease;
    background: none;
}

.load-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.refresh-button {
    height: inherit;
    border: none;
    font-family: 'Material Symbols Outlined';
    font-size: 1.2rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    margin: -1px -1px 0px 0px;
    border: 1px solid var(--border-color);
}

.load-refresh-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    height: 56px;
}

.loaded-font-name-error {
    align-items: start;
    padding: 0rem;
}

.controls-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--bg-secondary);
    transition: background-color 0.3s ease;
}

.control-section {
    margin-bottom: 2rem;
}

.control-section-title {
    display: none;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

.control-item {
    margin-bottom: 1.5rem;
}

.control-item:last-child {
    margin-bottom: 0;
}

.control-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0rem;
    gap: 0.5rem;
}

.control-label {
    font-size: 0.75rem;
    font-weight: 500;
    flex: 1;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.control-value {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 50px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    transition: color 0.3s ease;
}

.play-button {
    width: 20px;
    height: auto;
    border: var(--border-color);
    background: none;
    color: var(--button-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 600;
    transition: opacity 0.2s, background-color 0.3s ease, color 0.3s ease;
    flex-shrink: 0;
    padding: 0;
    font-family: 'Material Icons';
    font-variation-settings: 'FILL' 1;
}

.play-button:hover {
    opacity: 0.7;
}

.play-button.playing {
    background: none;
}

input[type="range"] {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--button-bg);
    cursor: pointer;
    transition: all 0.2s ease, background-color 0.3s ease;
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--button-bg);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease, background-color 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.3);
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.3);
}

.preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden !important;
    padding: 0rem;
}

.preview-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0rem 2rem;
    margin-bottom: 2rem;
    flex-shrink: 0;
    overflow: visible;
}

.preview-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    font-weight: 600;
    transition: color 0.3s ease;
}

.preview-reset {
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s, color 0.3s ease;
}

.preview-reset:hover {
    color: var(--text-primary);
}

#preview {
    flex: 1;
    padding: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 64px;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
    resize: none;
    border: none;
    outline: none;
    font-family: inherit;
    font-weight: 400;
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    overflow: auto !important;
    min-height: 0;
}

#preview::placeholder {
    color: var(--border-color);
    transition: color 0.3s ease;
}

.error {
    color: var(--error-text);
    background: var(--error-bg);
    padding: 1rem;
    border-radius: 4px;
    border-left: 3px solid var(--error-border);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.success {
    z-index: 100;
    color: var(--success-text);
    background: var(--success-bg);
    padding: 0.5rem;
    border-radius: 16px;
    border-left: 0px solid var(--success-border);
    margin-top: -2.5rem;
    margin-bottom: 0.48rem;
    font-size: 0.75rem;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

@media (max-width: 1024px) {
    body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 40%;
    }

    .main-content {
        padding: 1.5rem;
    }
}

/* Scrollbar styling */
.sidebar::-webkit-scrollbar,
.controls-scroll::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track,
.controls-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.controls-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
    transition: background-color 0.3s ease;
}

.controls-scroll::-webkit-scrollbar-thumb:hover,
.controls-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Features Container */
.features-container {
    display: none;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.feature-pill {
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'DM Mono', monospace;
    white-space: nowrap;
    user-select: none;
}

.feature-pill:hover {
    background: var(--border-color);
}

.feature-pill.active {
    background: var(--button-bg);
    color: var(--button-text);
    border-color: var(--button-bg);
}

.feature-pill.active:hover {
    opacity: 0.8;
}
