:root {
    --primary: #2ecc71;
    --primary-dark: #27ae60;
    --bg: #f0f2f5;
    --admin-bg: #e2e8f0;
    --text: #1a202c;
    --text-muted: #718096;
    --white: #ffffff;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    --error: #e74c3c;
    --accent: #3498db;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

h1 {
    font-size: 28px;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-container {
    width: 100%;
    max-width: 480px;
    padding: 20px;
    box-sizing: border-box;
}

.admin-container {
    max-width: 900px;
}

header {
    text-align: center;
    padding: 20px 0;
}

.card {
    background: var(--white);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    transition: transform 0.2s;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

input {
    width: 100%;
    padding: 15px;
    margin-bottom: 12px;
    border: 2px solid #edf2f7;
    border-radius: 12px;
    box-sizing: border-box;
    font-size: 16px;
    transition: all 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(46, 204, 113, 0.1);
}

button {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.btn-main { background-color: var(--primary); color: white; }
.btn-main:active { transform: scale(0.96); background-color: var(--primary-dark); }
.btn-secondary { background: #edf2f7; color: #4a5568; }
.btn-danger { background: #fee2e2; color: #dc2626; }

.round-btn {
    border-radius: 12px;
}

.round-btn:active { transform: scale(0.9); }

.badge {
    background: #ebf8ff;
    color: #2b6cb0;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
}

#toast {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 9999;
    padding: 16px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

#html5-qrcode-anchor-scan-type-change { display: none !important; }
.flash { display: none; }

#reader {
    width: 100% !important;
    height: 350px !important;
    border: none !important;
    background-color: #000;
}

#reader video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.scanner-ui-controls {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 10px;
    right: 10px;
    gap: 10px;
    z-index: 10;
}

.scanner-action-layer {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
    pointer-events: none;
}

.btn-scan-trigger {
    pointer-events: auto;
    width: auto !important;
    padding: 12px 30px !important;
    background: var(--primary) !important;
    color: white !important;
    border-radius: 30px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    font-size: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    animation: pulse 2s infinite;
}

.btn-scan-trigger:active {
    transform: scale(0.95);
    background: var(--primary-dark) !important;
}

.btn-scan-trigger:disabled,
.btn-scan-trigger.btn-disabled {
    background: #a0aec0 !important;
    border-color: #cbd5e0 !important;
    cursor: not-allowed;
    animation: none;
    transform: scale(1) !important;
    opacity: 0.8;
}

.progress-container {
    width: 100%;
    height: 10px;
    background: #edf2f7;
    border-radius: 10px;
    margin: 15px 0 25px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.5s ease-out;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats-header h3 { margin: 0; }

.item-card {
    display: flex;
    align-items: center;
    background: #f8fafc;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 12px;
    border-left: 5px solid var(--primary);
    animation: slideIn 0.3s ease-out;
}

.item-icon {
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.item-details { flex-grow: 1; }
.item-details strong { display: block; font-size: 16px; color: var(--text); }
.item-details small { color: #a0aec0; font-size: 12px; }

.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
    margin-top: 20px;
}

.admin-table th {
    text-align: left;
    padding: 0 15px;
    color: var(--text-muted);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.admin-table td {
    background: var(--white);
    padding: 18px 15px;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
}

.admin-table td:first-child {
    border-left: 1px solid #f1f5f9;
    border-radius: 15px 0 0 15px;
}

.admin-table td:last-child {
    border-right: 1px solid #f1f5f9;
    border-radius: 0 15px 15px 0;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: var(--bg);
    border-radius: 50%;
    font-weight: bold;
    font-size: 14px;
}

#qr-shaded-region > div {
    background-color: #ffffff !important;
}
.hidden { display: none !important; }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3); }
    50% { transform: scale(1.05); box-shadow: 0 4px 20px rgba(46, 204, 113, 0.5); }
    100% { transform: scale(1); box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.fa-spin {
    animation: spin 1s linear infinite;
}