:root {
    --primary: #8B5CF6;
    --primary-hover: #7C3AED;
    --primary-dim: rgba(139, 92, 246, 0.15);
    --bg: #0F172A;
    --bg-elevated: #1E293B;
    --bg-card: rgba(30, 41, 59, 0.8);
    --surface: rgba(255, 255, 255, 0.05);
    --border: rgba(139, 92, 246, 0.2);
    --border-strong: rgba(139, 92, 246, 0.4);
    --text: #F8FAFC;
    --text-dim: #CBD5E1;
    --text-muted: #64748B;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --font: 'Inter', -apple-system, sans-serif;
    --transition: 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.glass {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

/* Header Control Bar */
.topbar {
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    z-index: 10;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo {
    font-size: 1.5rem;
}

.brand h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.url-bar {
    display: flex;
    flex: 1;
    max-width: 600px;
    gap: 8px;
}

.input-wrapper {
    display: flex;
    flex: 1;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: all var(--transition);
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-dim);
}

.http-label {
    background: var(--surface);
    color: var(--text-dim);
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    border-right: 1px solid var(--border);
}

.url-bar input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 14px;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.9rem;
    outline: none;
}

.controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.zoom-control {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-dim);
    font-weight: 500;
    background: var(--bg-elevated);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.zoom-control input[type="range"] {
    accent-color: var(--primary);
    width: 100px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-dim);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover,
.btn-secondary.active {
    background: var(--primary-dim);
    border-color: var(--primary);
    color: white;
}

.icon-btn {
    padding: 8px 12px;
    font-size: 1.1rem;
    border-radius: 8px;
}

/* Workspace & Empty State */
.workspace {
    flex: 1;
    overflow: auto;
    background: radial-gradient(circle at center, #1E293B 0%, #0F172A 100%);
    padding: 30px;
    position: relative;
}

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    max-width: 400px;
}

.illustration {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.8;
}

.empty-state h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text);
}

.empty-state p {
    color: var(--text-dim);
    margin-bottom: 24px;
    line-height: 1.5;
}

.history-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.chip {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
}

.chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-dim);
}

/* Frames Grid */
.frames-container {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    justify-content: center;
    transform-origin: top center;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    width: max-content;
    margin: 0 auto;
    padding-bottom: 100px;
}

/* Device Frame Wrapper */
.device-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: all var(--transition);
}

.device-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-dim);
    padding: 0 4px;
}

.device-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
}

.device-dims {
    font-family: monospace;
    font-size: 0.8rem;
    opacity: 0.7;
}

.device-frame {
    background: black;
    padding: 12px 6px 24px 6px;
    border-radius: 24px;
    border: 4px solid #334155;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), inset 0 2px 5px rgba(255, 255, 255, 0.1);
    position: relative;
    transition: width 0.3s ease, height 0.3s ease;
}

.device-frame::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #475569;
    border-radius: 4px;
}

.device-frame::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: #475569;
    border-radius: 4px;
}

iframe {
    background: white;
    border: none;
    border-radius: 8px;
    width: 100%;
    height: 100%;
    display: block;
}

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

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

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

@media(max-width: 900px) {
    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .url-bar {
        max-width: none;
    }

    .controls {
        justify-content: space-between;
        flex-wrap: wrap;
    }
}