* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-image: url('bg.jpg');
    background-size: cover;
    background-position: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

.header {
    background: #722E17;
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
}

.header h1 {
    font-size: 28px;
    margin-bottom: 10px;
    padding-right: 50px;
}

.header p {
    opacity: 0.9;
    font-size: 14px;
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 22px;
        padding-right: 45px;
    }

    .settings-btn {
        right: 15px;
        padding: 6px;
    }

    .settings-btn svg {
        width: 20px;
        height: 20px;
    }
}

.settingsPanel {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 20px;
    display: none;
    border: 2px solid #722E17;
}

.settingsPanel.show {
    display: block;
}

.settings-btn {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.settings-btn svg {
    display: block;
}

.content {
    padding: 30px;
}

.alert {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: none;
}

.alert.show {
    display: block;
}

.alert-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
}

.alert-success {
    background: #efe;
    border: 1px solid #cfc;
    color: #3c3;
}

/* Registration Form Styles */
.registration-form {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 20px;
    display: none;
    border: 2px solid #722E17;
}

.registration-form.show {
    display: block;
}

h2 {
    color: #722E17;
    font-size: 22px;
    margin-bottom: 10px;
}

.registration-form p {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #722E17;
}

.button {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.button-primary {
    background: #722E17;
    color: white;
}

.button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(114, 46, 23, 0.3);
}

.button-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

#next-scan {
    display: none;
    margin-top: 15px;
}

#next-scan.show {
    display: block;
}

.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: #1a1a1a;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
    display: none;
}

.video-container.show {
    display: block;
}

#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
}

.placeholder svg {
    width: 80px;
    height: 80px;
    opacity: 0.5;
    margin-bottom: 20px;
}

.scanning-frame {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.scanning-frame.active {
    display: flex;
}

.frame {
    width: 250px;
    height: 250px;
    border: 4px solid #722E17;
    border-radius: 15px;
    position: relative;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);
}

.frame-corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 4px solid white;
}

.frame-corner.tl { top: -4px; left: -4px; border-right: none; border-bottom: none; border-radius: 15px 0 0 0; }
.frame-corner.tr { top: -4px; right: -4px; border-left: none; border-bottom: none; border-radius: 0 15px 0 0; }
.frame-corner.bl { bottom: -4px; left: -4px; border-right: none; border-top: none; border-radius: 0 0 0 15px; }
.frame-corner.br { bottom: -4px; right: -4px; border-left: none; border-top: none; border-radius: 0 0 15px 0; }

.result-box {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: none;
}

.result-box.show {
    display: block;
}

.result-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.result-data {
    font-family: monospace;
    font-size: 14px;
    word-break: break-all;
    background: white;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.button-danger {
    background: #dc3545;
    color: white;
}

.button-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(220, 53, 69, 0.3);
}

canvas {
    display: none;
}

.result-box {
    display: none;
    margin: 20px auto;
    border-radius: 8px;
    padding: 20px;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease-out;
    text-align: center;
}

.result-box.show {
    display: block;
}

#result-ok {
    background-color: #d1fae5;
    border: 2px solid #10b981;
    color: #065f46;
}

#result-warning {
    background-color: #fef3c7;
    border: 2px solid #f59e0b;
    color: #92400e;
}

#result-failed {
    background-color: #fee2e2;
    border: 2px solid #ef4444;
    color: #991b1b;
}

.result-label {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

.result-data {
    font-size: 16px;
    line-height: 1.6;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-data {
    font-size: 16px;
    line-height: 1.6;
}

.result-section {
    margin-bottom: 20px;
}

.result-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ddd;
}

.result-data-item {
    margin-bottom: 12px;
    padding: 10px;
    background: white;
    border-radius: 6px;
}

.result-data-item:last-child {
    margin-bottom: 0;
}

.item-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
    font-weight: 600;
}

.item-value {
    font-size: 16px;
    color: #333;
    word-break: break-word;
}

.item-value a {
    color: #722E17;
    text-decoration: none;
}

.item-value a:hover {
    text-decoration: underline;
}