* { 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); }

.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; }

.record-preview {
    display: none;
    width: 100%;
    max-width: 320px;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 12px;
    background: #000;
    margin: 0 auto;
}
.record-preview.visible { display: block; }
.record-status { font-size: 13px; color: var(--text-dim); text-align: center; min-height: 16px; }

.deck {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.deck-empty {
    color: var(--text-dim);
    text-align: center;
    padding: 40px 20px;
    font-size: 14px;
}

.swipe-card {
    width: 100%;
    max-width: 360px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    touch-action: pan-y;
    will-change: transform;
}
.swipe-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    background: #000;
}
.swipe-card .info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
}
.swipe-card .info strong { font-size: 18px; }
.swipe-card .info span { font-size: 12px; color: var(--text-dim); }

.swipe-actions {
    display: none;
    justify-content: center;
    gap: 24px;
    padding: 16px 0 8px;
}
.swipe-actions.visible { display: flex; }
.swipe-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface2);
    font-size: 26px;
    cursor: pointer;
    transition: transform 0.1s;
}
.swipe-btn:active { transform: scale(0.92); }
.swipe-btn.skip { color: var(--accent); }
.swipe-btn.like { color: var(--green); }

.breed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 4px 8px;
}
.round-badge {
    font-size: 13px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    letter-spacing: 0.3px;
}
.direction-banner {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    margin-bottom: 10px;
}
.direction-banner.receiving { border-color: var(--green); color: var(--green); }
.direction-banner.giving { border-color: var(--accent2); color: #b78bff; }
#round-steps { margin-bottom: 10px; }
.breed-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    text-align: center;
}
.breed-body h2 { font-size: 20px; }
.breed-body p { color: var(--text-dim); font-size: 14px; line-height: 1.5; max-width: 340px; }
.breed-icon { font-size: 44px; line-height: 1; }
.breed-steps {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.step-indicator {
    display: flex;
    gap: 8px;
    flex: 1;
    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; }

.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; }
}

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

.countdown-warning {
    display: none;
    border: 1px solid var(--accent);
    background: var(--surface2);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--accent);
    margin-bottom: 12px;
}
.countdown-warning.visible { display: block; }

.mode-group { display: flex; flex-direction: column; gap: 6px; }
.mode-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-dim);
    text-align: center;
}
.mode-select {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 0;
    overflow: hidden;
}
.mode-btn {
    flex: 1;
    padding: 12px 8px;
    background: var(--surface2);
    color: var(--text-dim);
    border: none;
    border-right: 1px solid var(--border);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.mode-btn:last-child { border-right: none; }
.mode-btn.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.mode-hint { font-size: 12px; color: var(--text-dim); text-align: center; min-height: 15px; }

.stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 4px 0 8px;
}
.stats-bar:empty { display: none; }
.stat-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 6px 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 0;
    min-width: 60px;
}
.stat-chip .num {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.15;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.stat-chip .label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-dim);
}
.stat-chip.tone-yellow .num { color: var(--yellow); }
.stat-chip.tone-green .num { color: var(--green); }
.stat-chip.tone-red .num { color: var(--accent); }
.stat-chip.tone-purple .num { color: var(--accent2); }
.stat-chip.tone-flagship { border-color: var(--accent); }
.stat-chip.tone-flagship .num {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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