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

:root {
    --bg: #0a0a0f;
    --surface: #141420;
    --surface2: #1c1c2e;
    --border: #2a2a40;
    --text: #e0e0e8;
    --text-dim: #888898;
    --accent: #ff2d55;
    --accent2: #7b2dff;
    --green: #30d158;
    --yellow: #ffd60a;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    overflow-x: hidden;
}

.screen { display: none; min-height: 100dvh; padding: 16px; }
.screen.active { display: flex; flex-direction: column; }

header {
    text-align: center;
    padding: 12px 0;
}
header h1 {
    font-size: 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
}
header .subtitle { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.15s;
    color: #fff;
    width: 100%;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.btn-secondary { background: var(--surface2); border: 1px solid var(--border); }
.btn-green { background: var(--green); color: #000; }
.btn-small { padding: 10px 16px; font-size: 14px; width: auto; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 16px;
    outline: none;
}
input[type="text"]:focus { border-color: var(--accent); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}
.upload-zone:hover { border-color: var(--accent); }
.upload-zone img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 12px;
    margin-bottom: 12px;
}
.upload-zone .icon { font-size: 48px; margin-bottom: 8px; }
.upload-zone p { color: var(--text-dim); font-size: 14px; }

.lobby-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    flex: 1;
    align-content: start;
}
.lobby-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
}
.lobby-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.lobby-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}
.lobby-card .info {
    padding: 8px 10px;
    font-size: 13px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breed-steps {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.step-indicator {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.step-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.3s;
}
.step-dot.active { background: var(--accent); }
.step-dot.done { background: var(--green); }

.step-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    text-align: center;
}
.step-content h2 { font-size: 20px; }
.step-content p { color: var(--text-dim); font-size: 14px; line-height: 1.5; max-width: 320px; }

.qr-display {
    background: #fff;
    padding: 16px;
    border-radius: 12px;
    display: inline-block;
}
.qr-display canvas { display: block; }

#camera-view {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 1;
    border-radius: 12px;
    object-fit: cover;
    background: #000;
}

.scanner-box {
    position: relative;
    width: 100%;
    max-width: 320px;
}
.scanner-box::after {
    content: '';
    position: absolute;
    inset: 20%;
    border: 2px solid var(--accent);
    border-radius: 8px;
    pointer-events: none;
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--surface2);
    border-radius: 10px;
    font-size: 13px;
}
.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.invite-toast {
    position: fixed;
    bottom: 20px;
    left: 16px;
    right: 16px;
    background: var(--surface2);
    border: 1px solid var(--accent);
    border-radius: 14px;
    padding: 16px;
    display: none;
    z-index: 100;
    animation: slideUp 0.3s ease;
}
.invite-toast.visible { display: block; }
.invite-toast .actions { display: flex; gap: 8px; margin-top: 12px; }

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.timer {
    font-size: 13px;
    color: var(--yellow);
    font-variant-numeric: tabular-nums;
}

.gap-12 { display: flex; flex-direction: column; gap: 12px; }
.gap-16 { display: flex; flex-direction: column; gap: 16px; }
.mt-auto { margin-top: auto; }
.text-center { text-align: center; }
.flex-1 { flex: 1; }
