/* ==========================================================================
   Chez Roch - Bar Tabac — Scratch & Witness
   Mobile-first, CSS Custom Properties
   ========================================================================== */

:root {
    /* Couleurs principales */
    --sw-rock-dark: #c0392b;
    --sw-rock-light: #e74c3c;
    --sw-jackpot-dark: #1a5276;
    --sw-jackpot-light: #2980b9;
    --sw-graal-dark: #b8860b;
    --sw-graal-light: #ffd700;
    --sw-wood: #5c3d2e;
    --sw-wood-light: #8b6914;
    --sw-silver: #c0c0c0;
    --sw-silver-light: #e8e8e8;
    --sw-gold: #e2b04a;
    --sw-bg: #1a1a2e;
    --sw-bg-light: #16213e;
    --sw-text: #ffffff;
    --sw-text-muted: #a0a0a0;
    --sw-error: #e74c3c;
    --sw-success: #27ae60;

    /* Typographie */
    --sw-font-display: 'Bangers', cursive;
    --sw-font-ticket: 'Russo One', sans-serif;
    --sw-font-body: 'DM Sans', sans-serif;
    --sw-font-legal: 'Lora', serif;
    --sw-font-title: 'Playfair Display', serif;

    /* Espacements */
    --sw-spacing-xs: 4px;
    --sw-spacing-sm: 8px;
    --sw-spacing-md: 16px;
    --sw-spacing-lg: 24px;
    --sw-spacing-xl: 32px;
    --sw-spacing-xxl: 48px;

    /* Ombres */
    --sw-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    --sw-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);

    /* Arrondis */
    --sw-radius: 12px;
    --sw-radius-lg: 20px;
    --sw-radius-sm: 8px;
}

/* Reset minimal */
.sw-game *, .sw-game *::before, .sw-game *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Conteneur principal */
.sw-game {
    font-family: var(--sw-font-body);
    background: var(--sw-bg);
    color: var(--sw-text);
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Écrans — navigation
   ========================================================================== */

.sw-screen {
    display: none;
    min-height: 100vh;
    min-height: 100dvh;
    padding: var(--sw-spacing-md);
    animation: sw-fadeIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.sw-screen--active {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* ==========================================================================
   Boutons
   ========================================================================== */

.sw-btn {
    font-family: var(--sw-font-body);
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: var(--sw-radius);
    padding: 14px 28px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-transform: uppercase;
    letter-spacing: 1px;
    -webkit-tap-highlight-color: transparent;
}

.sw-btn:active {
    transform: scale(0.96);
}

.sw-btn--primary {
    background: linear-gradient(135deg, var(--sw-jackpot-dark), var(--sw-jackpot-light));
    color: white;
    box-shadow: 0 4px 12px rgba(41, 128, 185, 0.4);
}

.sw-btn--primary:hover {
    box-shadow: 0 6px 20px rgba(41, 128, 185, 0.6);
}

.sw-btn--gold {
    background: linear-gradient(135deg, var(--sw-graal-dark), var(--sw-graal-light));
    color: #1a1a2e;
    box-shadow: 0 4px 12px rgba(226, 176, 74, 0.4);
}

.sw-btn--gold:hover {
    box-shadow: 0 6px 20px rgba(226, 176, 74, 0.6);
}

.sw-btn--large {
    font-size: 18px;
    padding: 18px 36px;
}

.sw-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   Erreur
   ========================================================================== */

.sw-error {
    color: var(--sw-error);
    font-size: 14px;
    margin-top: var(--sw-spacing-sm);
    text-align: center;
}

/* ==========================================================================
   ÉCRAN LOGIN
   ========================================================================== */

.sw-login {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.sw-login__header {
    margin-bottom: var(--sw-spacing-xl);
}

.sw-login__title {
    font-family: var(--sw-font-title);
    font-size: 42px;
    font-weight: 900;
    color: var(--sw-gold);
    text-shadow: 0 2px 8px rgba(226, 176, 74, 0.3);
    line-height: 1.1;
}

.sw-login__subtitle {
    font-family: var(--sw-font-ticket);
    font-size: 18px;
    color: var(--sw-text-muted);
    margin-top: var(--sw-spacing-xs);
    letter-spacing: 4px;
    text-transform: uppercase;
}

.sw-login__body {
    background: var(--sw-bg-light);
    border-radius: var(--sw-radius-lg);
    padding: var(--sw-spacing-xl);
    box-shadow: var(--sw-shadow);
}

.sw-login__welcome {
    font-size: 15px;
    color: var(--sw-text-muted);
    margin-bottom: var(--sw-spacing-lg);
}

.sw-form-group {
    margin-bottom: var(--sw-spacing-md);
    text-align: left;
}

.sw-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--sw-text-muted);
    margin-bottom: var(--sw-spacing-xs);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sw-form-group input {
    width: 100%;
    padding: 12px 16px;
    font-family: var(--sw-font-body);
    font-size: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--sw-radius-sm);
    background: rgba(255, 255, 255, 0.05);
    color: var(--sw-text);
    transition: border-color 0.2s;
}

.sw-form-group input:focus {
    outline: none;
    border-color: var(--sw-gold);
}

.sw-form-group input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.sw-login__form .sw-btn {
    width: 100%;
    margin-top: var(--sw-spacing-md);
}

/* ==========================================================================
   ÉCRAN COMPTOIR
   ========================================================================== */

.sw-counter {
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.sw-counter__header {
    margin-bottom: var(--sw-spacing-lg);
}

.sw-counter__title {
    font-family: var(--sw-font-title);
    font-size: 32px;
    font-weight: 900;
    color: var(--sw-gold);
}

.sw-counter__title span {
    display: block;
    font-family: var(--sw-font-ticket);
    font-size: 14px;
    color: var(--sw-text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-top: 2px;
}

.sw-score-bar {
    display: flex;
    justify-content: center;
    gap: var(--sw-spacing-md);
    margin-top: var(--sw-spacing-sm);
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--sw-radius-sm);
    font-size: 14px;
}

.sw-score-bar__balance strong {
    color: var(--sw-gold);
}

.sw-score-bar__cost {
    color: var(--sw-text-muted);
}

.sw-counter__subtitle {
    font-size: 16px;
    color: var(--sw-text-muted);
    margin-bottom: var(--sw-spacing-lg);
}

/* Grille de tickets */
.sw-tickets-display {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sw-spacing-md);
}

.sw-ticket-choice {
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    -webkit-tap-highlight-color: transparent;
}

.sw-ticket-choice:active {
    transform: scale(0.95);
}

.sw-ticket-choice--locked {
    opacity: 0.5;
    pointer-events: none;
}

.sw-ticket-choice--scratched {
    opacity: 0.6;
}

.sw-ticket-choice--scratched .sw-ticket-mini {
    filter: grayscale(0.3);
}

/* Mini ticket (comptoir) */
.sw-ticket-mini {
    border-radius: var(--sw-radius);
    padding: var(--sw-spacing-md) var(--sw-spacing-sm);
    text-align: center;
    box-shadow: var(--sw-shadow);
    position: relative;
    overflow: hidden;
    aspect-ratio: 3/4;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.sw-ticket-mini--rock {
    background: linear-gradient(160deg, var(--sw-rock-dark), var(--sw-rock-light));
}

.sw-ticket-mini--jackpot {
    background: linear-gradient(160deg, var(--sw-jackpot-dark), var(--sw-jackpot-light));
}

.sw-ticket-mini--graal {
    background: linear-gradient(160deg, var(--sw-graal-dark), var(--sw-graal-light));
}

.sw-ticket-mini__brand {
    font-family: var(--sw-font-title);
    font-size: 10px;
    opacity: 0.8;
    letter-spacing: 1px;
}

.sw-ticket-mini__name {
    font-family: var(--sw-font-display);
    font-size: 16px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.sw-ticket-mini__emoji {
    font-size: 28px;
}

.sw-ticket-mini__lock {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    background: rgba(0, 0, 0, 0.6);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--sw-radius);
}

.sw-ticket-status {
    font-size: 12px;
    margin-top: var(--sw-spacing-xs);
    min-height: 18px;
    color: var(--sw-text-muted);
}

/* ==========================================================================
   ÉCRAN TICKET DE JEU
   ========================================================================== */

.sw-ticket-game {
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
}

.sw-ticket {
    width: 100%;
    border-radius: var(--sw-radius-lg);
    overflow: hidden;
    box-shadow: var(--sw-shadow-lg);
    background: #f5f5f5;
    color: #1a1a1a;
    position: relative;
}

.sw-ticket--rock { background: linear-gradient(180deg, var(--sw-rock-light) 0%, #f5f5f5 30%); }
.sw-ticket--jackpot { background: linear-gradient(180deg, var(--sw-jackpot-light) 0%, #f5f5f5 30%); }
.sw-ticket--graal { background: linear-gradient(180deg, var(--sw-graal-light) 0%, #f5f5f5 30%); }

.sw-ticket__brand {
    text-align: center;
    font-family: var(--sw-font-title);
    font-size: 12px;
    padding: 8px 0 2px;
    letter-spacing: 2px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.sw-ticket__brand--gold {
    color: #1a1a2e;
}

.sw-ticket__name {
    text-align: center;
    font-family: var(--sw-font-display);
    font-size: 36px;
    color: white;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    padding: 0 0 4px;
}

.sw-ticket__name--gold {
    color: #1a1a2e;
    text-shadow: 0 2px 6px rgba(255, 215, 0, 0.4);
}

.sw-ticket__illustration {
    text-align: center;
    font-size: 48px;
    padding: 8px 0;
}

.sw-ticket__instruction {
    text-align: center;
    font-family: var(--sw-font-ticket);
    font-size: 11px;
    color: #666;
    padding: 8px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Grille de grattage */
.sw-scratch-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 0 16px 12px;
}

.sw-scratch-cell {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--sw-radius-sm);
    overflow: hidden;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.sw-scratch-cell__symbol {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: var(--sw-radius-sm);
}

.sw-scratch-cell__symbol--winner {
    border-color: var(--sw-gold);
    background: linear-gradient(135deg, #fff9e6, #fff3cc);
    box-shadow: 0 0 12px rgba(226, 176, 74, 0.4);
    animation: sw-winPulse 0.6s ease-in-out infinite alternate;
}

@keyframes sw-winPulse {
    from { box-shadow: 0 0 8px rgba(226, 176, 74, 0.3); }
    to { box-shadow: 0 0 20px rgba(226, 176, 74, 0.6); }
}

.sw-scratch-cell canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--sw-radius-sm);
    touch-action: none;
}

/* Section gain */
.sw-ticket__gain-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 0 16px 12px;
    background: #e8e8e8;
    border-radius: var(--sw-radius-sm);
    border: 2px dashed #ccc;
}

.sw-ticket__gain-section--gold {
    background: linear-gradient(135deg, #fff9e6, #fff3cc);
    border-color: var(--sw-graal-dark);
}

.sw-ticket__gain-label {
    font-family: var(--sw-font-display);
    font-size: 20px;
    color: #666;
}

.sw-ticket__gain-value {
    font-family: var(--sw-font-display);
    font-size: 28px;
    color: var(--sw-graal-dark);
}

.sw-ticket__footer {
    text-align: center;
    font-size: 9px;
    color: #999;
    padding: 8px;
    border-top: 1px solid #e0e0e0;
}

/* Overlay résultat */
.sw-result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: sw-fadeIn 0.3s ease;
}

.sw-result-overlay__content {
    text-align: center;
    padding: var(--sw-spacing-xl);
    max-width: 340px;
}

.sw-result-overlay__icon {
    font-size: 64px;
    margin-bottom: var(--sw-spacing-md);
}

.sw-result-overlay__message {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: var(--sw-spacing-sm);
    color: white;
}

.sw-result-overlay__amount {
    font-family: var(--sw-font-display);
    font-size: 36px;
    color: var(--sw-gold);
    margin-bottom: var(--sw-spacing-lg);
}

/* ==========================================================================
   ÉCRAN TEASING
   ========================================================================== */

.sw-teasing {
    text-align: center;
    max-width: 400px;
}

.sw-teasing__icon {
    font-size: 64px;
    margin-bottom: var(--sw-spacing-md);
    animation: sw-float 2s ease-in-out infinite;
}

@keyframes sw-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.sw-teasing__title {
    font-family: var(--sw-font-title);
    font-size: 28px;
    color: var(--sw-gold);
    margin-bottom: var(--sw-spacing-md);
    line-height: 1.3;
}

.sw-teasing__text {
    font-size: 16px;
    color: var(--sw-text-muted);
    margin-bottom: var(--sw-spacing-xl);
    line-height: 1.6;
}

/* ==========================================================================
   ÉCRAN RÉVÉLATION
   ========================================================================== */

.sw-revelation {
    text-align: center;
    max-width: 440px;
    position: relative;
}

.sw-revelation__confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.sw-revelation__content {
    position: relative;
    z-index: 20;
}

.sw-revelation__title {
    font-family: var(--sw-font-title);
    font-size: 24px;
    color: var(--sw-gold);
    margin-bottom: var(--sw-spacing-lg);
    line-height: 1.4;
}

.sw-revelation__message {
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: var(--sw-spacing-xl);
}

/* ==========================================================================
   ÉCRAN CONDITIONS
   ========================================================================== */

.sw-conditions {
    width: 100%;
    max-width: 500px;
    height: 100%;
    display: flex;
    flex-direction: column;
    max-height: 100vh;
    max-height: 100dvh;
}

.sw-conditions__title {
    font-family: var(--sw-font-legal);
    font-size: 22px;
    text-align: center;
    color: var(--sw-gold);
    padding: var(--sw-spacing-md) 0;
    flex-shrink: 0;
}

.sw-conditions__scroll {
    flex: 1;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--sw-radius);
    padding: var(--sw-spacing-lg);
    margin-bottom: var(--sw-spacing-md);
    -webkit-overflow-scrolling: touch;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sw-conditions__text {
    font-family: var(--sw-font-legal);
    font-size: 14px;
    line-height: 1.8;
    color: var(--sw-text-muted);
}

.sw-conditions__text h3 {
    font-family: var(--sw-font-legal);
    font-weight: 700;
    color: var(--sw-text);
    margin: var(--sw-spacing-lg) 0 var(--sw-spacing-sm);
    font-size: 15px;
}

.sw-conditions__text p {
    margin-bottom: var(--sw-spacing-md);
}

.sw-conditions__footer {
    flex-shrink: 0;
    text-align: center;
    padding: var(--sw-spacing-md) 0;
}

.sw-conditions__hint {
    font-size: 13px;
    color: var(--sw-text-muted);
    margin-bottom: var(--sw-spacing-sm);
    transition: opacity 0.3s;
}

/* ==========================================================================
   ÉCRAN FINAL
   ========================================================================== */

.sw-final {
    text-align: center;
    max-width: 400px;
}

.sw-final__icon {
    font-size: 80px;
    margin-bottom: var(--sw-spacing-md);
}

.sw-final__title {
    font-family: var(--sw-font-title);
    font-size: 28px;
    color: var(--sw-gold);
    margin-bottom: var(--sw-spacing-md);
}

.sw-final__message {
    font-size: 16px;
    color: var(--sw-text-muted);
    line-height: 1.6;
    margin-bottom: var(--sw-spacing-xl);
}

/* ==========================================================================
   TOGGLE SON
   ========================================================================== */

.sw-sound-toggle {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s;
}

.sw-sound-toggle:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 380px) {
    .sw-ticket-mini__name { font-size: 13px; }
    .sw-ticket-mini__emoji { font-size: 22px; }
    .sw-ticket__name { font-size: 28px; }
    .sw-scratch-cell__symbol { font-size: 26px; }
    .sw-login__title { font-size: 34px; }
    .sw-tickets-display { gap: 6px; }
}

@media (min-width: 768px) {
    .sw-login__title { font-size: 56px; }
    .sw-counter__title { font-size: 40px; }
    .sw-ticket-mini__name { font-size: 20px; }
    .sw-ticket-mini__emoji { font-size: 36px; }
    .sw-ticket { max-width: 400px; }
    .sw-teasing__title { font-size: 36px; }
    .sw-revelation__title { font-size: 30px; }
}
