/* CSS Variables */
:root {
    --primary-color: #818cf8;
    --primary-hover: #6366f1;
    --primary-light: rgba(129, 140, 248, 0.15);
    --secondary-color: #94a3b8;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --success: #34d399;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
    --glow: 0 0 20px rgba(129, 140, 248, 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* App Layout */
.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--surface);
    padding: 0.75rem 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.logo-icon {
    height: 2rem;
    width: auto;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Main Layout */
.main {
    flex: 1;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Controls Sidebar */
.controls {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.control-section {
    background: var(--surface);
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.control-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.control-group {
    margin-bottom: 1rem;
}

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

.control-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.control-group input,
.control-group select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.control-group input:focus,
.control-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.control-group input::placeholder {
    color: var(--text-secondary);
}

/* Game Selector Dropdown */
.game-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.game-select:hover {
    background-color: var(--surface-hover);
    border-color: var(--primary-color);
}

.game-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--glow);
}

.game-select option {
    background: var(--surface);
    color: var(--text-primary);
    padding: 0.5rem;
}

/* Size Presets */
.size-presets {
    display: flex;
    gap: 0.5rem;
}

.size-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.size-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary-color);
}

.size-btn.active {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: var(--glow);
}

.size-btn .size-icon {
    font-size: 1.25rem;
}

.size-btn .size-name {
    font-weight: 500;
}

/* Collapsible Section */
.collapsible {
    padding: 0;
    overflow: hidden;
}

.collapse-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 1rem 1.25rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.collapse-toggle:hover {
    color: var(--text-primary);
}

.toggle-icon {
    font-size: 0.625rem;
    transition: transform 0.2s ease;
}

.collapse-toggle.open .toggle-icon {
    transform: rotate(180deg);
}

.collapse-content {
    display: none;
    padding: 0 1.25rem 1.25rem;
}

.collapse-content.open {
    display: block;
}

/* Preview Area */
.preview-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 1rem;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    min-height: 300px;
    height: calc(100vh - 180px);
    overflow: hidden;
}

/* URL Display */
.url-display {
    display: none;
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.25rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 32px;
}

.url-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.url-display code {
    font-size: 0.75rem;
    color: var(--text-secondary);
    word-break: break-all;
    font-family: 'Monaco', 'Courier New', monospace;
    line-height: 1.3;
}

.preview-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Device Frame */
.device-frame {
    position: relative;
    background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
    border-radius: 40px;
    padding: 12px;
    box-shadow: var(--shadow-xl), inset 0 0 0 2px #3a3a3a, 0 0 40px rgba(129, 140, 248, 0.1);
    display: none;
}

.device-frame.visible {
    display: block;
}

.device-notch {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 24px;
    background: #1a1a1a;
    border-radius: 0 0 16px 16px;
    z-index: 10;
}

.device-bar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: #444;
    border-radius: 2px;
}

.iframe-container {
    position: relative;
    background: #000;
    border-radius: 28px;
    overflow: hidden;
    transition: width 0.3s ease, height 0.3s ease;
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    display: block;
}

/* Footer */
.footer {
    padding: 1rem 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    background: var(--surface);
    border-top: 1px solid var(--border-color);
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 900px) {
    .main {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }
    
    .controls {
        order: 2;
    }
    
    .preview-area {
        order: 1;
        min-height: 500px;
    }
    
    .size-presets {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1rem;
    }
    
    .device-frame {
        border-radius: 24px;
        padding: 8px;
    }
    
    .device-notch {
        width: 60px;
        height: 16px;
        top: 8px;
    }
    
    .iframe-container {
        border-radius: 16px;
    }
}

