/* Global Styles */
:root {
    --primary-color: #6C63FF;
    --secondary-color: #4CAF50;
    --danger-color: #FF4757;
    --warning-color: #FFA502;
    --bg-color: #F8F9FA;
    --text-color: #2C3E50;
    --text-light: #7F8C8D;
    --border-color: #E1E8ED;
    --white: #FFFFFF;
    --blue: #3498DB;
    --green: #2ECC71;
    --red: #E74C3C;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Remove blue highlight on tap (Android) */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Touch optimization for all interactive elements */
button, a, input, select, textarea {
    touch-action: manipulation; /* Prevent zoom on double-tap */
}

/* Minimum touch target size (44x44px recommended by Apple/Google) */
button, .btn-primary, .btn-secondary, .btn-start, .btn-small, 
.lang-btn, .home-button, .control-btn {
    min-height: 44px;
    min-width: 44px;
}

/* Prevent auto-zoom on input focus (iOS) */
input, select, textarea {
    font-size: 16px; /* iOS zooms if less than 16px */
}

/* GPU acceleration for animations */
.animate-in, .winner-card, .qr-display, .mobile-container {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform, opacity;
}

/* Language Toggle */
.language-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 5px;
    background: var(--white);
    padding: 5px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.home-button {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    width: 50px;
    height: 50px;
    background: var(--white);
    border-radius: 50%;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.home-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.lang-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 15px;
    font-weight: 600;
    transition: all 0.3s;
}

.lang-btn.active {
    background: var(--primary-color);
    color: var(--white);
}

.lang-btn:hover:not(.active) {
    background: var(--bg-color);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Home Page */
.home-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hero {
    text-align: center;
    padding: 80px 20px 60px;
}

.logo {
    color: var(--primary-color);
    margin-bottom: 30px;
    display: inline-block;
    animation: fadeInDown 0.6s ease-out;
}

.title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-color);
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 40px;
    animation: fadeInUp 0.6s ease-out 0.4s both;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-start {
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    animation: fadeInUp 0.6s ease-out 0.6s both;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.4);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--white);
}

.btn-start {
    background: var(--secondary-color);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    width: 100%;
    justify-content: center;
    font-size: 1rem;
    padding: 12px 24px;
}

.btn-start:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.btn-start:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-reraffle {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: var(--white);
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-reraffle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.reraffle-info {
    text-align: center;
    font-style: italic;
}

.btn-small {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--primary-color);
    color: var(--white);
    transition: all 0.3s;
}

.btn-small:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(108, 99, 255, 0.3);
}

.btn-delete {
    background: #ef4444;
    padding: 8px 12px;
    font-size: 1.2rem;
    line-height: 1;
    min-width: auto;
}

.btn-delete:hover {
    background: #dc2626;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
}

/* Recent Raffles */
.recent-raffles {
    max-width: 800px;
    margin: 40px auto;
    padding: 30px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.recent-raffles-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.recent-raffles h2 {
    font-size: 1.8rem;
    margin: 0;
    color: var(--text-color);
}

.btn-delete-all {
    background: transparent;
    color: #ef4444;
    border: none;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-delete-all:hover {
    color: #dc2626;
    transform: scale(1.1);
}

.raffles-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.raffle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--bg-color);
    border-radius: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.raffle-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.raffle-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.raffle-info strong {
    color: var(--text-color);
    font-size: 1.1rem;
}

.raffle-info small {
    color: var(--text-light);
    font-size: 0.85rem;
    font-family: monospace;
}

.raffle-actions {
    display: flex;
    gap: 10px;
}

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    padding: 40px 20px;
}

.feature {
    background: var(--white);
    padding: 40px 30px;
    border-radius: 16px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.feature:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.feature h3 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: var(--text-color);
}

.feature p {
    color: var(--text-light);
    line-height: 1.6;
}

/* Config Page - Optimized for no scroll */
body.config-page {
    height: 100vh;
    overflow: hidden;
}

.config-page .container {
    max-width: 1400px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 10px 20px;
}

.config-header {
    text-align: center;
    padding: 65px 20px 5px;
    flex-shrink: 0;
}

.config-header h1 {
    font-size: 1.6rem;
    margin-bottom: 3px;
}

.raffle-id {
    color: var(--text-color);
    font-family: monospace;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 3px;
    margin-bottom: 8px;
}

.raffle-id span {
    color: var(--primary-color);
    font-weight: 700;
}
.config-panel {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 15px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.config-form, .stats-panel {
    background: var(--white);
    padding: 15px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.config-form {
    overflow-y: auto;
}

.stats-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.85rem;
}

.input-field {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    align-items: center;
}

.form-actions button {
    flex: 1;
    padding: 10px 20px;
    font-size: 0.9rem;
}

.auto-save-indicator {
    display: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}

.auto-save-indicator.typing {
    background: #FFF3CD;
    color: #856404;
}

.auto-save-indicator.saving {
    background: #D1ECF1;
    color: #0C5460;
}

.auto-save-indicator.saved {
    background: #D4EDDA;
    color: #155724;
}

.auto-save-indicator.error {
    background: #F8D7DA;
    color: #721C24;
}

.stats-panel {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Add consistent spacing */
}

.stats-panel h3 {
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 3px;
    flex-shrink: 0;
}

.participant-count {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    margin: 5px 0;
    flex-shrink: 0;
}

/* Participant count inline style */
.stats-panel h3.inline-count {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 10px;
}

.stats-panel h3.inline-count .count-number {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.action-buttons {
    margin-top: 8px;
    padding-top: 0;
    flex-shrink: 0;
}

.countdown-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid var(--border-color);
    text-align: center;
    flex-shrink: 0;
}

.countdown-section h3 {
    font-size: 1.2rem;
    margin-bottom: 12px;
    animation: pulse 1s infinite;
}

.countdown-timer {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--primary-color);
    animation: scaleUp 1s infinite;
}

.countdown-timer-large {
    font-size: 8rem;
    font-weight: 700;
    color: white;
    animation: scaleUp 1s infinite;
    margin: 20px 0;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.countdown-timer-mobile {
    font-size: 6rem;
    font-weight: 700;
    color: white;
    animation: scaleUp 1s infinite;
    margin: 30px 0;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes scaleUp {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.winners-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.winners-section h3 {
    text-align: center;
    margin-bottom: 8px;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.winners-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
    min-height: 0;
}

/* Custom scrollbar for winners list */
.winners-list::-webkit-scrollbar {
    width: 8px;
}

.winners-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.winners-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.winners-list::-webkit-scrollbar-thumb:hover {
    background: #5848d9;
}

/* Winners Table */
.winners-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.5s ease-out;
}

.winners-table thead {
    background: var(--primary-color);
    color: white;
}

.winners-table th {
    padding: 6px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.winners-table tbody tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s ease;
}

.winners-table tbody tr:last-child {
    border-bottom: none;
}

.winners-table tbody tr:hover {
    background-color: rgba(103, 58, 183, 0.05);
}

.winners-table td {
    padding: 5px 8px;
    font-size: 0.75rem;
}

.round-cell {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.85rem;
    width: 50px;
    text-align: center;
    white-space: nowrap;
}

.icon-cell {
    font-size: 1rem;
    width: 35px;
    text-align: center;
}

.id-cell {
    font-family: monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: #333;
    word-break: break-all;
    line-height: 1.3;
}

/* Legacy styles for backwards compatibility (can be removed later) */
.winner-item {
    background: var(--bg-color);
    padding: 15px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    animation: slideIn 0.5s ease-out;
}

.winner-icon {
    font-size: 1.5rem;
}

.winner-id {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 600;
}

.winner-round-separator {
    margin: 25px 0 15px 0;
    padding: 10px 0;
    border-top: 2px solid var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    text-align: center;
}

.round-label {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Display Page */
.display-page {
    background: linear-gradient(135deg, var(--primary-color) 0%, #4834DF 100%);
    color: var(--white);
    min-height: 100vh;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.display-page::-webkit-scrollbar {
    display: none;
}

.display-page {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.display-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

.control-btn {
    width: 50px;
    height: 50px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: var(--white);
    font-size: 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.control-btn:active {
    transform: scale(0.95);
}

.display-container {
    width: 100%;
    max-width: 1400px;
    padding: 40px;
    transition: transform 0.3s ease;
}

.display-header {
    text-align: center;
    margin-bottom: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
}

.display-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

.prize-subtitle {
    margin-top: 12px;
    margin-bottom: 0;
    font-size: 1.3rem;
    opacity: 0.95;
    font-weight: 500;
    text-align: center;
    color: white;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.language-toggle-display {
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px;
    border-radius: 20px;
}

.lang-btn-small {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--white);
    cursor: pointer;
    border-radius: 15px;
    font-weight: 600;
    transition: all 0.3s;
}

.lang-btn-small.active {
    background: var(--white);
    color: var(--primary-color);
}

.qr-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
}

.qr-code-container {
    background: var(--white);
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-code-container img, .qr-code-container canvas {
    display: block;
    width: 320px;
    height: 320px;
    max-width: 90vw;
    max-height: 50vh;
    object-fit: contain;
}

.participant-counter {
    text-align: center;
}

.counter-label {
    font-size: 1.3rem;
    margin-bottom: 15px;
    opacity: 0.9;
}

.counter-value {
    font-size: 5rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.2);
    padding: 30px 50px;
    border-radius: 20px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.display-start-btn {
    margin-top: 30px;
    padding: 16px 40px;
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.4);
}

.display-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(34, 197, 94, 0.5);
}

.display-start-btn:active {
    transform: translateY(0);
}

.display-start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.reraffle-note {
    margin-top: 12px;
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    font-style: italic;
}

.raffle-animation {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}

.animation-content h2 {
    font-size: 3rem;
    margin-bottom: 40px;
    animation: pulse 2s infinite;
}

.spinner-container {
    margin: 40px 0;
}

.spinner {
    width: 120px;
    height: 120px;
    border: 8px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.animation-subtitle {
    font-size: 2rem;
    margin-top: 30px;
    animation: fadeInOut 2s infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.winners-display {
    margin-top: 60px;
}

.winners-title {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 40px;
}

.winners-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.winner-card {
    background: rgba(255, 255, 255, 0.15);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.winner-number {
    font-size: 1.2rem;
    opacity: 0.8;
    margin-bottom: 15px;
}

.winner-device-id {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: monospace;
    margin-bottom: 20px;
}

.winner-icon {
    font-size: 3rem;
}

.display-footer {
    text-align: center;
    margin-top: 60px;
    opacity: 0.8;
}

/* Join Page (Mobile) */
.join-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.5s ease;
}

.join-page.registered {
    background: linear-gradient(135deg, var(--blue) 0%, #2980B9 100%);
}

.join-page.winner {
    background: linear-gradient(135deg, var(--green) 0%, #27AE60 100%);
}

.join-page.loser {
    background: linear-gradient(135deg, var(--red) 0%, #C0392B 100%);
}

.mobile-container {
    width: 100%;
    max-width: 400px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100vh;
}

.mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.logo-small {
    color: var(--white);
}

.language-toggle-mobile {
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px;
    border-radius: 15px;
}

.mobile-content {
    background: var(--white);
    border-radius: 20px;
    padding: 25px 15px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    width: auto;
    max-width: 90%;
    margin: 0 auto;
    min-height: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.mobile-footer {
    text-align: center;
    padding: 10px 0;
    margin-top: 15px;
    flex-shrink: 0;
}

.mobile-footer p {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

.loading-state, .registered-state, .countdown-state, .winner-state, .loser-state, .error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.status-icon, .trophy-icon, .sad-icon, .error-icon {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background: var(--bg-color);
    border-radius: 50%;
}

.status-icon {
    color: var(--blue);
}

.mobile-content h2 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin: 0;
}

.device-id-display {
    width: 100%;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 10px;
    margin: 10px 0;
}

.device-label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 3px;
}

.device-id {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
}

.device-id.large {
    font-size: 1.4rem;
}

.waiting-message, .countdown-message, .try-again, .congratulations {
    color: var(--text-light);
    font-size: 1rem;
    margin: 0;
}

.prize-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin: 5px 0;
}

/* Winner state - No animation */
.winner-state {
    position: relative;
}

/* Winner/Loser states - Make card transparent and text white */
.winner-state h2,
.loser-state h2 {
    color: var(--white) !important;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.8);
    font-weight: 800;
    font-size: 2rem !important;
    margin: 15px 0 !important;
    letter-spacing: 1px;
}

.winner-state p,
.loser-state p {
    color: var(--white) !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    font-weight: 600;
}

.winner-state .device-id,
.loser-state .device-id {
    color: var(--white) !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
    font-weight: 700;
    font-size: 1.6rem !important;
}

/* Make mobile-content card transparent with glassmorphism for winner/loser states */
body.join-page.winner .mobile-content,
body.join-page.loser .mobile-content {
    background: rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4) !important;
}

/* Error state styling */
.join-page.error {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

body.join-page.error .mobile-content {
    background: rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4) !important;
}

.error-state h2,
.error-state p {
    color: white !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.error-icon {
    color: #fbbf24 !important;
    background: rgba(0, 0, 0, 0.3) !important;
}

.winner-state .device-id-display,
.loser-state .device-id-display {
    background: rgba(0, 0, 0, 0.3) !important;
    border-radius: 12px;
    padding: 20px 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.winner-state .prize-title {
    color: var(--white) !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    font-weight: 700;
    font-size: 1.3rem;
}

.winner-state .trophy-icon,
.loser-state .sad-icon {
    font-size: 4rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.winner-state .congratulations,
.loser-state .try-again {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Removed winner animations for cleaner look */

/* Footer */
footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-light);
    margin-top: auto;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-in {
    animation: fadeInUp 0.6s ease-out both;
}

/* Responsive Design */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .config-panel {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .qr-display {
        flex-direction: column;
        gap: 30px;
    }

    .qr-code-container img {
        width: 300px;
        height: 300px;
    }

    .counter-value {
        font-size: 5rem;
        padding: 30px 40px;
    }

    .display-header h1 {
        font-size: 2rem;
    }

    .winners-title {
        font-size: 2rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .language-toggle {
        top: 10px;
        right: 10px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .hero {
        padding: 60px 15px 40px;
    }

    .btn-primary, .btn-secondary {
        padding: 14px 24px;
        font-size: 1rem;
    }

    .qr-code-container {
        padding: 20px;
    }

    .qr-code-container img, .qr-code-container canvas {
        width: 250px;
        height: 250px;
        max-width: 85vw;
        max-height: 40vh;
    }
}

/* Landscape orientation optimizations */
@media (orientation: landscape) and (max-height: 600px) {
    .qr-code-container {
        padding: 20px;
    }
    
    .qr-code-container img, .qr-code-container canvas {
        max-height: 60vh;
        width: auto;
        height: auto;
    }
    
    .display-header h1 {
        font-size: 2rem;
    }
    
    .prize-subtitle {
        font-size: 1.2rem;
    }
}

/* Portrait tablets */
@media (min-width: 600px) and (max-width: 900px) and (orientation: portrait) {
    .qr-code-container img, .qr-code-container canvas {
        width: 350px;
        height: 350px;
        max-width: 80vw;
    }
}

/* Large displays - keep QR readable */
@media (min-width: 1600px) {
    .qr-code-container img, .qr-code-container canvas {
        width: 500px;
        height: 500px;
    }
}
