:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f0f0f0;
    --text-primary: #000000;
    --text-secondary: #333333;
    --border: #000000;
    --shadow: rgba(0, 0, 0, 0.2);
    --btn-primary-bg: #000000;
    --btn-primary-text: #ffffff;
    --btn-secondary-bg: #ffffff;
    --btn-secondary-text: #000000;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #000000;
        --bg-secondary: #1a1a1a;
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
        --border: #ffffff;
        --shadow: rgba(255, 255, 255, 0.2);
        --btn-primary-bg: #ffffff;
        --btn-primary-text: #000000;
        --btn-secondary-bg: #000000;
        --btn-secondary-text: #ffffff;
    }
}

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

body {
    font-family: 'Courier New', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    min-height: 100vh;
    position: relative;
}

.screen {
    display: none;
    min-height: 100vh;
    animation: slideIn 0.3s ease-out;
}

.screen.active {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px 0;
    text-align: center;
}

.header-main {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px 0;
}

.header-captures {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px 0;
    position: relative;
}

.avatar-icon {
    width: 32px;
    height: 32px;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.avatar-icon:hover {
    transform: scale(1.1);
}

.avatar-icon canvas {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.app-title, .title {
    font-size: 32px;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.header-main .app-title {
    margin: 0;
    line-height: 1;
}

.header-captures h2 {
    font-size: 32px;
    font-weight: bold;
    letter-spacing: 2px;
    margin: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.subtitle {
    font-size: 14px;
    letter-spacing: 1px;
    margin: 0;
    opacity: 0.8;
    text-align: center;
}

.btn-icon {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 20px;
}

.btn-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

.btn-icon:active {
    transform: scale(0.95);
}

.spacer {
    width: 40px;
}

/* Form Styles */
.profile-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 10px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
    opacity: 0.8;
}

.input-group input[type="text"],
.input-group input[type="email"] {
    padding: 12px;
    border: 3px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 16px;
    outline: none;
    transition: all 0.2s;
}

.input-group input:focus {
    box-shadow: 0 0 0 3px var(--shadow);
}

.input-group input:invalid {
    border-color: #ff0000;
}

.avatar-preview {
    border: 3px solid var(--border);
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    overflow: hidden;
}

.avatar-preview canvas {
    width: 192px;
    height: 192px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Buttons */
.btn {
    padding: 15px 30px;
    border: 3px solid var(--border);
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
}

.btn:active {
    transform: scale(0.98);
}

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

.btn-primary:hover {
    transform: scale(1.02);
}

.btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
}

.btn-secondary:hover {
    transform: scale(1.02);
}

.btn-scan {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 306px; /* Match QR and stats card width */
    margin: 0 auto;
    box-sizing: border-box;
}

.scan-icon {
    font-size: 30px;
    line-height: 0.8;
}

.btn-close {
    position: absolute;
    top: 40px;
    right: 20px;
    background: white;
    color: black;
    width: 40px;
    height: 40px;
    border-radius: 0;
    font-size: 24px;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

/* Stats Card */
.stats-card {
    border: 3px solid var(--border);
    padding: 20px;
    margin: 0 auto 30px;
    text-align: center;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.2s;
    width: 306px; /* Match QR container total width */
    box-sizing: border-box;
}

.stats-card:hover {
    transform: scale(1.02);
}

.stats-card:active {
    transform: scale(0.98);
}

.capture-count {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.count-number {
    font-size: 48px;
    font-weight: bold;
}

.count-label {
    font-size: 14px;
    letter-spacing: 2px;
    opacity: 0.8;
}

/* QR Section */
.qr-section {
    margin-bottom: 0;
    text-align: center;
}

.qr-container {
    border: 3px solid var(--border);
    padding: 0;
    background: white;
    display: inline-block;
    margin-bottom: 5px;
    width: 300px; /* Canvas width */
    height: 300px;
    box-sizing: content-box; /* Border adds to total width = 306px */
    cursor: pointer;
    transition: all 0.2s;
}

.qr-container:hover {
    transform: scale(1.02);
}

.qr-container:active {
    transform: scale(0.98);
}

.qr-container canvas {
    display: block;
}

.qr-label {
    font-size: 12px;
    letter-spacing: 1px;
    opacity: 0.8;
    text-align: center;
    margin-bottom: 30px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Scanner Screen */
.scanner-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: black;
    z-index: 9999;
}

#scannerVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.scanner-frame {
    width: 250px;
    height: 250px;
    border: 4px solid white;
    box-shadow: 0 0 0 10000px rgba(0, 0, 0, 0.6);
    position: relative;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        border-color: white;
    }
    50% {
        border-color: #00ff00;
    }
}

.scanner-hint {
    color: white;
    margin-top: 20px;
    font-size: 16px;
    letter-spacing: 2px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Captures List */
.captures-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.capture-item {
    border: 3px solid var(--border);
    padding: 15px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.capture-item:hover {
    transform: scale(1.01);
}

.capture-item:active {
    transform: scale(0.98);
}

.capture-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.capture-actions {
    display: flex;
    gap: 10px;
}

.capture-edit,
.capture-delete {
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    opacity: 0.7;
}

.capture-edit:hover {
    opacity: 1;
    transform: scale(1.1);
}

.capture-delete {
    font-size: 14px;
}

.capture-delete:hover {
    opacity: 1;
    color: #ff0000;
    transform: scale(1.1);
}

.capture-photo {
    width: 100px;
    height: 100px;
    border: 3px solid var(--border);
    object-fit: cover;
    background: var(--bg-primary);
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.capture-info {
    flex: 1;
}

.capture-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.capture-team {
    font-size: 12px;
    opacity: 0.8;
}

.capture-email {
    font-size: 11px;
    opacity: 0.7;
    font-style: italic;
    color: var(--text-primary);
    text-decoration: underline;
    display: block;
    transition: opacity 0.2s;
}

.capture-email:hover {
    opacity: 1;
}

.capture-time {
    font-size: 10px;
    opacity: 0.6;
}

.capture-note {
    font-size: 12px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    opacity: 0.9;
    font-style: italic;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    opacity: 0.5;
}

.empty-state .hint {
    font-size: 12px;
    margin-top: 10px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border: 3px solid var(--border);
    padding: 30px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.modal-content h2 {
    margin-bottom: 20px;
    font-size: 24px;
    letter-spacing: 2px;
}

.captured-builder {
    margin: 20px 0;
    padding: 20px;
    border: 2px solid var(--border);
    background: var(--bg-secondary);
}

.captured-builder img {
    width: 100px;
    height: 100px;
    border: 2px solid var(--border);
    object-fit: cover;
    margin-bottom: 15px;
}

.captured-builder .name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
}

.captured-builder .team {
    font-size: 14px;
    opacity: 0.8;
}

/* Confetti Animation */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    z-index: 9999;
    animation: confetti-fall linear;
}

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }
    
    .app-title, .title {
        font-size: 24px;
    }
    
    .count-number {
        font-size: 36px;
    }
}