:root {
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --text-color: #f8fafc;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --success-hover: #059669;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.container {
    width: 98%;
    max-width: none;
    padding: 0.75rem 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
    box-sizing: border-box;
}

header {
    text-align: center;
    margin-bottom: 0.75rem;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    gap: 1.5rem;
}

.header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.auth-form {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.auth-link {
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border-radius: 0.4rem;
    border: 1px solid rgba(255,255,255,0.15);
    transition: all 0.2s;
}

.auth-link:hover {
    color: #38bdf8;
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
}

.auth-btn {
    padding: 0.35rem 0.75rem;
    border-radius: 0.4rem;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.auth-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: #38bdf8;
}

.auth-status {
    font-size: 0.8rem;
    color: #10b981;
    font-weight: 600;
    white-space: nowrap;
}

header h1 {
    font-weight: 800;
    font-size: 2rem;
    background: -webkit-linear-gradient(0deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.15rem;
    line-height: 1.2;
}

header p {
    color: #94a3b8;
    font-size: 0.95rem;
}

/* Language Dropdown */
.lang-dropdown {
    position: relative;
}

.lang-select {
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.05);
    color: #e2e8f0;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.05em;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1em;
    font-family: inherit;
}

.lang-select:hover {
    background-color: rgba(56, 189, 248, 0.1);
    border-color: #38bdf8;
}

.lang-select:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

.lang-select option {
    background: #1e293b;
    color: #e2e8f0;
}

main {
    display: flex;
    gap: 1.5rem;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    flex: 1;
    min-height: 0;
    box-sizing: border-box;
}

.controls-panel {
    flex: 0 0 350px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto; /* Internal scrollbar */
    padding-right: 0.75rem;
}

.controls-panel::-webkit-scrollbar {
    width: 6px;
}
.controls-panel::-webkit-scrollbar-track {
    background: transparent;
}
.controls-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
.controls-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #cbd5e1;
}

.input-group input[type="text"],
.input-group select {
    width: 100%;
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.2);
    color: white;
    font-size: 1.2rem;
    transition: border-color 0.3s;
}

.input-group select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.5em;
}

.input-group input[type="text"]:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--accent);
}

.input-group input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    padding: 0;
    margin: 0.5rem 0;
    border: none;
}

.input-group input[type="range"]:focus {
    outline: none;
}

.card-section {
    border: 1px solid rgba(56, 189, 248, 0.2);
    padding: 16px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.4);
    margin-bottom: 16px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    color: #f8fafc;
}

.card-header-flex label {
    margin-bottom: 0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    margin: 0;
}

.toggle-switch.wide {
    width: 80px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider-pill {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,0.4);
    transition: .3s;
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
}

.toggle-slider-pill:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    z-index: 2;
}

input:checked + .toggle-slider-pill {
    background-color: #38bdf8;
    border-color: #38bdf8;
    color: rgba(255,255,255,0.9);
}

input:checked + .toggle-slider-pill:before {
    transform: translateX(22px);
}

.toggle-switch.wide input:checked + .toggle-slider-pill:before {
    transform: translateX(52px);
}

.toggle-slider-pill::after {
    content: attr(data-label-off);
    position: absolute;
    right: 8px;
    z-index: 1;
}

input:checked + .toggle-slider-pill::after {
    content: attr(data-label-on);
    left: 8px;
    right: auto;
}

.input-group input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.input-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: -8px;
    cursor: pointer;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
    transition: transform 0.1s;
}

.input-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.radio-group {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 400;
    color: white;
    user-select: none;
}

.radio-group input[type="checkbox"] {
    appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    background: rgba(0,0,0,0.2);
    cursor: pointer;
    position: relative;
    padding: 0;
    margin: 0;
    transition: all 0.2s;
}

.radio-group input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.radio-group input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.dimensions-info {
    font-family: 'Consolas', 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.4) !important;
    padding: 1rem !important;
    border-radius: 0.75rem !important;
    font-size: 0.9rem !important;
    line-height: 1.6;
    color: #e2e8f0 !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn {
    padding: 1rem;
    border: none;
    border-radius: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    color: white;
}

.btn:active {
    transform: scale(0.98);
}

.btn.primary {
    background-color: var(--accent);
}

.btn.primary:hover {
    background-color: var(--accent-hover);
}

.btn.success {
    background-color: var(--success);
}

.btn.success:hover {
    background-color: var(--success-hover);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.instructions {
    background: rgba(0,0,0,0.2);
    padding: 1.5rem;
    border-radius: 1rem;
    font-size: 0.9rem;
    color: #cbd5e1;
}

.instructions h3 {
    margin-bottom: 0.5rem;
    color: #f8fafc;
}

.instructions ul {
    list-style-position: inside;
}

.instructions li {
    margin-bottom: 0.25rem;
}

.preview-panel {
    flex: 1; /* Take all remaining space for 3D model */
    position: relative;
    background: rgba(0,0,0,0.3);
    border-radius: 1.5rem;
    overflow: hidden;
    height: 100%; /* Fit exactly to main's height */
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    border: 1px solid rgba(255,255,255,0.05);
}

#viewer3d {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.preview-header {
    padding: 1.5rem;
    background: transparent;
    z-index: 10;
    display: flex;
    justify-content: center;
}

.viewer-container {
    flex: 1;
    position: relative;
    width: 100%;
    min-height: 0;
}

.viewer-hint {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.1);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    pointer-events: none;
    backdrop-filter: blur(4px);
    color: #cbd5e1;
}

/* 2D Fonts Preview Panel */
.fonts-preview-panel {
    flex: 0 0 320px;
    background: rgba(0,0,0,0.2);
    border-radius: 1.5rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.05);
}

.fonts-preview-panel::-webkit-scrollbar {
    width: 6px;
}
.fonts-preview-panel::-webkit-scrollbar-track {
    background: transparent;
}
.fonts-preview-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
.fonts-preview-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.fonts-preview-panel h3 {
    text-align: center;
    color: #f8fafc;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

#fonts-preview-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.font-preview-item {
    background: rgba(0,0,0,0.3);
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    overflow: hidden;
}

.font-preview-item:hover {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.font-preview-item.selected-font {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
}

.font-preview-name {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    font-family: 'Inter', sans-serif;
}

.font-preview-text {
    font-size: 2rem;
    color: #fff;
    white-space: nowrap;
    line-height: 1.2;
}

.status {
    padding: 1rem;
    border-radius: 0.75rem;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid var(--accent);
    text-align: center;
}

.hidden {
    display: none;
}

/* Nickname section for mobile */
.nickname-section {
    display: none;
}
.controls-panel > .nickname-section {
    display: block;
    flex-shrink: 0;
}

/* === HAMBURGER MENU BUTTON === */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    margin-right: 8px;
    z-index: 9999;
    flex-shrink: 0;
    position: relative;
}
.hamburger-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: #e2e8f0;
    margin: 5px 0;
    transition: transform 0.3s, opacity 0.2s;
    border-radius: 2px;
}
.hamburger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}
.hamburger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* === MOBILE DRAWER === */
.drawer-content {
    display: contents;
}
.drawer-close-btn {
    display: none;
}
.drawer-backdrop {
    display: none;
}

@media (max-width: 1600px) {
    body {
        height: 100vh;
        overflow: hidden;
        align-items: stretch;
    }

    .container {
        width: 100%;
        max-width: none;
        padding: 0;
        height: 100vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .app-header {
        flex-wrap: nowrap;
        gap: 0.5rem;
        justify-content: space-between;
        padding: 0.5rem 0.75rem;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .header-left {
        flex-direction: row;
        align-items: center;
        text-align: left;
        width: auto;
        gap: 0.25rem;
    }

    .header-right {
        width: auto;
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 0.5rem;
    }

    header h1 {
        font-size: 1.1rem;
        margin-bottom: 0;
    }

    .lang-select {
        padding: 0.3rem 1.5rem 0.3rem 0.5rem;
        font-size: 0.75rem;
    }

    main {
        flex: 1;
        flex-direction: column;
        height: 100%;
        min-height: 0;
        padding: 0;
        gap: 0;
        border-radius: 0;
        border: none;
        position: relative;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .hamburger-btn {
        display: block;
    }

    .viewer-hint {
        display: none;
    }

    .nickname-section {
        display: block;
        flex-shrink: 0;
        padding: 0.75rem;
        background: rgba(30, 41, 59, 0.8);
        backdrop-filter: blur(12px);
        border-bottom: 1px solid rgba(56, 189, 248, 0.2);
    }
    .nickname-section .input-group {
        margin-bottom: 0.5rem;
    }
    .nickname-section .input-group label {
        margin-bottom: 0.25rem;
        font-size: 0.85rem;
    }
    .nickname-section .input-group input[type="text"] {
        padding: 0.6rem;
        font-size: 1rem;
    }
    .nickname-section .actions {
        margin-bottom: 0;
    }
    .nickname-section .btn {
        padding: 0.6rem;
        font-size: 0.95rem;
    }

    .preview-panel {
        flex: 1;
        width: 100%;
        min-height: 280px;
        border-radius: 0;
        border: none;
    }

    .controls-panel {
        flex-basis: 100%;
        max-width: 100%;
    }

    .fonts-preview-panel {
        flex: none;
        width: 100%;
        max-height: 45vh;
        padding: 0.75rem;
        padding-bottom: 0;
        border-radius: 0;
        gap: 0.5rem;
        margin: 0;
        border-top: 1px solid rgba(56, 189, 248, 0.2);
        background: rgba(30, 41, 59, 0.9);
        position: sticky;
        bottom: 0;
        z-index: 10;
    }
    #fonts-preview-container {
        padding-bottom: 5rem;
    }
    .fonts-preview-panel h3 {
        font-size: 0.95rem;
        margin-bottom: 0.25rem;
        position: sticky;
        top: 0;
        z-index: 1;
        background: rgba(30, 41, 59, 0.9);
        padding: 0.5rem 0;
    }

    .drawer-content {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: calc(-55% - 20px);
        width: 55%;
        max-width: 400px;
        height: 100vh;
        z-index: 9999;
        background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
        border-left: 2px solid rgba(56, 189, 248, 0.6);
        box-shadow: -15px 0 60px rgba(0,0,0,1);
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 1rem;
        padding-top: calc(env(safe-area-inset-top, 0px) + 0.75rem);
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 2rem);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        gap: 0;
        color: #f8fafc;
    }
    .drawer-content .input-group label {
        color: #e2e8f0 !important;
    }
    .drawer-content .card-section {
        background: rgba(15, 23, 42, 0.8);
        border: 1px solid rgba(56, 189, 248, 0.3);
    }
    .drawer-content.open {
        right: 0;
    }
    .drawer-content .controls-panel {
        flex: none;
        width: 100%;
        max-height: none;
        overflow-y: visible;
        padding-right: 0;
        gap: 0.75rem;
    }
    .drawer-content .controls-panel .card-section:last-child {
        margin-bottom: 0;
    }

    .drawer-close-btn { display: none; }

    .drawer-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.15);
        z-index: 9998;
    }
    .drawer-backdrop.show {
        display: block;
    }

    .card-section {
        padding: 12px;
        margin-bottom: 12px;
    }

    .input-group input[type="text"],
    .input-group select {
        padding: 0.75rem;
        font-size: 1rem;
    }
    .input-group label {
        font-size: 0.9rem;
    }

.nickname-section .btn {
    font-size: 0.9rem;
}

.btn {
        padding: 0.75rem;
        font-size: 1rem;
    }

    #fonts-preview-container { gap: 0.5rem; }
    .font-preview-item { padding: 0.6rem; }
    .font-preview-text { font-size: 1.4rem; }
    .font-preview-name { font-size: 0.65rem; margin-bottom: 0.25rem; }

    .radio-group {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .toggle-switch { width: 42px; height: 24px; }
    .toggle-slider-pill { font-size: 0.6rem; padding: 0 6px; }
    .toggle-slider-pill:before { height: 16px; width: 16px; left: 3px; bottom: 3px; }
    input:checked + .toggle-slider-pill:before { transform: translateX(18px); }
    .toggle-switch.wide { width: 64px; }
    .toggle-switch.wide input:checked + .toggle-slider-pill:before { transform: translateX(40px); }

    .custom-select-trigger { padding: 0.6rem 0.75rem; font-size: 0.95rem; }
    .custom-select-options { max-height: 200px; }
    .custom-select-option { padding: 0.5rem 0.8rem; font-size: 0.9rem; }

    .global-loader {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
        top: 0.75rem;
        left: 50%;
    }
}

@media (max-width: 768px) {
    .drawer-content {
        width: 85%;
        max-width: 360px;
        right: calc(-85% - 20px);
    }
    .fonts-preview-panel {
        max-height: 45vh;
        padding-bottom: 0;
    }
    #fonts-preview-container {
        padding-bottom: 5rem;
    }
}

@media (max-width: 480px) {
    header h1 { font-size: 1rem; }

    .drawer-content {
        width: 100%;
        max-width: none;
        right: calc(-100% - 20px);
        padding: 0.75rem;
        padding-top: calc(env(safe-area-inset-top, 0px) + 0.5rem);
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 2rem);
    }

    .card-section { padding: 10px; margin-bottom: 8px; }
    .input-group input[type="text"], .input-group select { padding: 0.6rem; font-size: 0.9rem; }
    .btn { padding: 0.6rem; font-size: 0.9rem; }
    .fonts-preview-panel { padding: 0.5rem; padding-bottom: 0; }
    #fonts-preview-container { padding-bottom: 5rem; }
    .font-preview-item { padding: 0.4rem; }
    .font-preview-text { font-size: 1.1rem; }
    .custom-select-trigger { padding: 0.5rem 0.6rem; font-size: 0.85rem; }
    .custom-select-options { max-height: 160px; }
}
/* Global Loading Banner */
.global-loader {
    position: fixed;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.75rem;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 9999px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 20px rgba(56, 189, 248, 0.3);
    font-size: 0.95rem;
    font-weight: 600;
    color: #e0f2fe;
    animation: slideDownFadeIn 0.3s ease-out forwards;
    pointer-events: none;
}

.global-loader.hidden {
    display: none !important;
}

.loader-spinner {
    width: 18px;
    height: 18px;
    border: 3px solid rgba(56, 189, 248, 0.2);
    border-radius: 50%;
    border-top-color: #38bdf8;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes slideDownFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -15px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.custom-select-group-label {
    padding: 0.6rem 1.1rem 0.2rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #38bdf8;
    pointer-events: none;
    user-select: none;
    border-top: 1px solid rgba(56, 189, 248, 0.15);
    margin-top: 0.25rem;
}

.custom-select-option + .custom-select-group-label {
    border-top: none;
    margin-top: 0;
    padding-top: 0.35rem;
}

/* Font Search Input */
.font-search-input {
    width: 100%;
    padding: 0.7rem 1.1rem;
    border: none;
    border-bottom: 1px solid rgba(56, 189, 248, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 0.95rem;
    outline: none;
    position: sticky;
    top: 0;
    z-index: 2;
    backdrop-filter: blur(16px);
    box-sizing: border-box;
}

.font-search-input::placeholder {
    color: #64748b;
}

.font-search-input:focus {
    background: rgba(0, 0, 0, 0.5);
    border-bottom-color: #38bdf8;
}

/* === FOOTER === */
.site-footer {
    width: 100%;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    box-sizing: border-box;
    text-align: center;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-inner a {
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border-radius: 0.4rem;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.2s;
}

.footer-inner a:hover {
    color: #38bdf8;
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
}

@media (max-width: 640px) {
    .site-footer {
        padding: 0.75rem 1rem;
    }
    .footer-inner a {
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
    }
}

/* Hide footer below 1600px (only visible on desktop) */
@media (max-width: 1599px) {
    .site-footer {
        display: none;
    }
}

.drawer-about-link {
    display: block;
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border-radius: 0.4rem;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.2s;
    text-align: center;
}

.drawer-about-link:hover {
    color: #38bdf8;
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
}

.drawer-only {
    display: block;
}

@media (min-width: 1601px) {
    .drawer-only {
        display: none;
    }
}

/* Custom Font Select Dropdown UI */
.custom-select-container {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.2);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.custom-select-trigger:hover {
    border-color: rgba(56, 189, 248, 0.5);
    background: rgba(56, 189, 248, 0.05);
}

.custom-select-trigger.active {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.custom-select-trigger .arrow {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid white;
    transition: transform 0.3s;
    margin-left: 8px;
}

.custom-select-trigger.active .arrow {
    transform: rotate(180deg);
}

.custom-select-options {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 0.75rem;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
}

.custom-select-options.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-select-option {
    padding: 0.7rem 1.1rem;
    font-size: 1.05rem;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.custom-select-option:last-child {
    border-bottom: none;
}

.custom-select-option:hover {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    padding-left: 1.4rem;
}

.custom-select-option.selected {
    background: rgba(56, 189, 248, 0.25);
    color: #38bdf8;
    font-weight: bold;
}

/* Custom Scrollbar for Options Dropdown */
.custom-select-options::-webkit-scrollbar {
    width: 6px;
}
.custom-select-options::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 0 0.75rem 0.75rem 0;
}
.custom-select-options::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.3);
    border-radius: 3px;
}
.custom-select-options::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 189, 248, 0.6);
}
