:root {
    --bg-color: #0f1115;
    --surface-color: #1a1d24;
    --surface-light: #252a33;
    --text-primary: #f8f9fa;
    --text-secondary: #a0aab2;
    --accent-color: #ff007f;
    --accent-glow: rgba(255, 0, 127, 0.4);
    --adrien-color: #3388ff;
    --hannah-color: #ff33bb;
    
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;

    --nav-height: 80px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

.hidden {
    display: none !important;
}

/* Gestion PC */
.desktop-warning {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    text-align: center;
    padding: 20px;
    background: var(--bg-color);
}
.warning-content {
    background: var(--surface-color);
    padding: 40px;
    border-radius: var(--radius-lg);
    max-width: 400px;
    border-top: 4px solid var(--accent-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 40px var(--accent-glow);
}
.warning-content i {
    width: 64px;
    height: 64px;
    color: var(--accent-color);
    margin-bottom: 20px;
    filter: drop-shadow(0 0 10px var(--accent-glow));
}
.warning-content h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 15px;
    color: var(--text-primary);
}
.warning-content p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 1rem;
}

@media (min-width: 768px) {
    .app-container { display: none !important; }
    #desktop-warning { display: flex !important; }
    #install-warning { display: none !important; }
}
@media (max-width: 767px) {
    .app-container { display: flex; flex-direction: column; height: 100vh; }
    #desktop-warning { display: none !important; }
    #install-warning { display: flex !important; } /* Par défaut affiché sur mobile */
}

/* Standalone PWA iOS */
@media all and (display-mode: standalone) {
    #install-warning { display: none !important; }
    .app-container { display: flex !important; }
}

/* App Container */
.app-container {
    padding-top: env(safe-area-inset-top, 47px);
    padding-bottom: env(safe-area-inset-bottom, 34px);
}

.view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px;
}

/* Login */
#view-login {
    justify-content: center;
    align-items: center;
    text-align: center;
}
.login-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff, #a0aab2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.login-header p {
    color: var(--text-secondary);
    margin-bottom: 40px;
}
.login-cards {
    display: flex;
    gap: 20px;
}
.user-card {
    background: var(--surface-color);
    padding: 20px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    width: 140px;
}
.user-card:active {
    transform: scale(0.95);
    background: var(--surface-light);
}
.avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 15px;
    color: white;
}
.adrien-bg { background-color: var(--adrien-color); }
.hannah-bg { background-color: var(--hannah-color); }

/* Main Content Wrapper */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px 15px;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}
.avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.9rem;
    color: white;
}
.wallet {
    background: var(--surface-color);
    padding: 6px 12px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: bold;
    color: var(--text-primary);
}
.wallet i {
    width: 16px;
    height: 16px;
    color: gold;
}

/* Tabs */
.tab-view {
    display: none;
}
.tab-view.active {
    display: flex;
}

/* Counter */
#view-counter {
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    padding-top: 0;
}
.counter-title {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-bottom: 10px;
}
.counter-value {
    font-size: 8.5rem;
    font-weight: 900;
    margin-bottom: 0;
    line-height: 1;
    display: block;
    margin-left: auto;
    margin-right: auto;
    width: fit-content;
}

.big-flop-btn {
    background: var(--accent-color);
    border: none;
    border-radius: var(--radius-lg);
    width: 95%;
    height: 150px;
    margin: 0 auto;
    color: white;
    font-size: 3.5rem;
    font-weight: 800;
    box-shadow: 0 0 40px var(--accent-glow);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.1s;
    outline: none;
}
.big-flop-btn:active {
    transform: scale(0.95);
    box-shadow: 0 0 20px var(--accent-glow);
}
.undo-btn {
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    font-size: 0.9rem;
    margin-top: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.8;
}
.undo-btn i {
    width: 16px;
    height: 16px;
}
.undo-btn:active {
    opacity: 0.5;
}
.btn-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.btn-inner i {
    width: 48px;
    height: 48px;
}

/* Lists */
.section-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 20px;
}
.shop-list, .inventory-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-bottom: calc(var(--nav-height) + 20px);
}
.item-card {
    background: var(--surface-color);
    border-radius: var(--radius-md);
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}
.item-icon {
    width: 48px;
    height: 48px;
    background: var(--surface-light);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
}
.item-details {
    flex: 1;
}
.item-title {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 4px;
}
.item-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.item-action {
    display: flex;
    align-items: center;
}
.btn-buy, .btn-consume {
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-lg);
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-buy { background: var(--surface-light); }
.btn-buy.affordable { background: var(--adrien-color); }
.btn-consume { background: var(--accent-color); }
.btn-consumed {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--surface-light);
    padding: 8px 16px;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
}

/* Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--nav-height) + env(safe-area-inset-bottom, 0));
    background: rgba(26, 29, 36, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--surface-light);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.75rem;
    flex: 1;
}
.nav-item.active {
    color: var(--text-primary);
}
.nav-item i {
    width: 24px;
    height: 24px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}
.modal-content {
    background: var(--surface-color);
    padding: 30px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 350px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.modal-content input {
    background: var(--surface-light);
    border: none;
    padding: 15px;
    border-radius: var(--radius-md);
    color: white;
    outline: none;
}
.btn-primary {
    background: var(--accent-color);
    border: none;
    padding: 15px;
    border-radius: var(--radius-md);
    color: white;
    font-weight: bold;
}
.btn-secondary {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-color);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--surface-light);
    border-top: 5px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Snackbar */
.snackbar {
    visibility: hidden;
    min-width: 250px;
    background-color: var(--surface-color);
    color: #fff;
    text-align: center;
    border-radius: 20px;
    padding: 16px;
    position: fixed;
    z-index: 10000;
    left: 50%;
    top: 20px;
    transform: translateX(-50%);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s, top 0.3s;
}
.snackbar.show {
    visibility: visible;
    opacity: 1;
    top: 80px; /* Au dessus du compteur, sous le header */
}
