/* ===================================================================
   Classic Games — feuille de style commune (thème sombre simple)
   =================================================================== */
:root {
    --bg: #12141c;
    --bg-2: #1b1e2a;
    --panel: #222636;
    --panel-2: #2a2f43;
    --border: #343a52;
    --text: #e7e9f3;
    --muted: #9aa0bd;
    --primary: #5b8cff;
    --primary-d: #3f6fe0;
    --accent: #ffc35b;
    --danger: #ff5b6e;
    --ok: #4fd68a;

    /* raretés */
    --r-commun: #b6bccd;
    --r-rare: #5b8cff;
    --r-epique: #b06bff;
    --r-legendaire: #ffb443;
    --r-mythique: #ff5bd0;
    --r-unique: #4fe6d0;
}

* { box-sizing: border-box; }
/* Masquage générique (utilisé par les bandeaux, overlays, messages…) */
.hidden { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
    background: radial-gradient(1200px 600px at 50% -200px, #1c2033, var(--bg));
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5em; }
.muted { color: var(--muted); font-size: .9rem; }

/* --- Topbar --- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: .8rem 1.4rem; background: var(--bg-2);
    border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); }
.topnav { display: flex; gap: .6rem; align-items: center; }
.pill {
    background: var(--panel); border: 1px solid var(--border);
    padding: .35rem .7rem; border-radius: 999px; font-size: .85rem;
}

/* --- Boutons --- */
.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    border: 1px solid var(--border); background: var(--panel);
    color: var(--text); padding: .5rem .9rem; border-radius: 8px;
    cursor: pointer; font-size: .9rem; font-family: inherit;
    transition: .15s; text-decoration: none;
}
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #0b1020; font-weight: 600; }
.btn-primary:hover { background: var(--primary-d); }
.btn-ghost { background: transparent; }
.btn-lg { padding: .7rem 1.4rem; font-size: 1rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* --- Layout --- */
.container { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.footer { text-align: center; color: var(--muted); padding: 1rem; font-size: .82rem; border-top: 1px solid var(--border); }

/* --- Accueil --- */
.hero { text-align: center; padding: 2rem 0 1rem; }
.hero h1 { font-size: 2rem; }
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.2rem; margin-top: 1.5rem; }
.game-card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 14px; padding: 1.4rem; display: flex; flex-direction: column; gap: .6rem;
}
.game-card .btn { align-self: flex-start; }
.game-card--soon { opacity: .6; }
.game-emoji { font-size: 2.4rem; }
.game-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: auto; }
.game-actions .btn { margin-top: 0; }

/* --- Auth --- */
.auth-box { max-width: 380px; margin: 2rem auto; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 1.6rem; }
.auth-box form { display: flex; flex-direction: column; gap: 1rem; }
.auth-box label { display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; }
.auth-box input {
    background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
    padding: .6rem .7rem; border-radius: 8px; font-size: 1rem; font-family: inherit;
}
.alert { background: rgba(255,91,110,.12); border: 1px solid var(--danger); color: #ffc4cc; padding: .6rem .8rem; border-radius: 8px; }

/* --- Leaderboard --- */
.board-head { display: flex; justify-content: space-between; align-items: center; }
.board-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.board-table th, .board-table td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--border); }
.board-table thead th { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.board-table tr.me { background: rgba(91,140,255,.12); }

/* ===================================================================
   Démineur — interface de jeu
   =================================================================== */
.ms-app { position: relative; }
.ms-hud {
    display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 12px; padding: .6rem .9rem; margin-bottom: 1rem;
}
.hud-stat { display: flex; flex-direction: column; min-width: 60px; padding: 0 .5rem; border-right: 1px solid var(--border); }
.hud-stat:last-of-type { border-right: none; }
.hud-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.hud-stat span:last-child { font-size: 1.15rem; font-weight: 700; }
.hud-spacer { flex: 1; }

.ms-main { display: grid; grid-template-columns: 1fr 260px; gap: 1rem; align-items: start; }
.ms-canvas-wrap { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: .5rem; }
#msCanvas { width: 100%; height: auto; display: block; border-radius: 8px; background: #0d0f18; cursor: crosshair; }
.ms-hint { font-size: .76rem; color: var(--muted); text-align: center; margin-top: .5rem; }

.ms-inventory { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; }
.inv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.inv-item { border: 1px solid var(--border); border-left-width: 4px; border-radius: 8px; padding: .5rem .6rem; background: var(--bg-2); }
.inv-item .inv-name { font-weight: 600; font-size: .9rem; }
.inv-item .inv-meta { font-size: .74rem; color: var(--muted); }
.inv-item.consumed { opacity: .45; }
.inv-item button.use { margin-top: .35rem; font-size: .74rem; padding: .25rem .5rem; }
/* Description au survol */
.inv-item { position: relative; }
.inv-desc {
    max-height: 0; overflow: hidden; opacity: 0;
    font-size: .78rem; color: var(--muted); line-height: 1.35;
    transition: max-height .18s ease, opacity .18s ease, margin-top .18s ease;
    margin-top: 0;
}
.inv-item:hover .inv-desc { max-height: 140px; opacity: 1; margin-top: .4rem; }

/* raretés (bordure gauche + texte) */
.r-commun { border-left-color: var(--r-commun); }
.r-rare { border-left-color: var(--r-rare); }
.r-epique { border-left-color: var(--r-epique); }
.r-legendaire { border-left-color: var(--r-legendaire); }
.r-mythique { border-left-color: var(--r-mythique); }
.r-unique { border-left-color: var(--r-unique); }
.rarity-tag { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.rarity-tag.r-commun { color: var(--r-commun); }
.rarity-tag.r-rare { color: var(--r-rare); }
.rarity-tag.r-epique { color: var(--r-epique); }
.rarity-tag.r-legendaire { color: var(--r-legendaire); }
.rarity-tag.r-mythique { color: var(--r-mythique); }
.rarity-tag.r-unique { color: var(--r-unique); }

/* --- Overlays / panneaux modaux --- */
.ms-overlay {
    position: fixed; inset: 0; background: rgba(6,8,14,.72);
    display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem;
}
.ms-overlay.hidden { display: none; }
.ms-panel {
    background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
    padding: 1.8rem; max-width: 640px; width: 100%; text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.ms-panel h2 { font-size: 1.5rem; }
.shop-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: .7rem 1rem; margin: 1rem 0; }

.item-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin: 1.2rem 0; }
.item-card {
    background: var(--bg-2); border: 1px solid var(--border); border-left-width: 4px;
    border-radius: 10px; padding: 1rem .8rem; cursor: pointer; text-align: left;
    display: flex; flex-direction: column; gap: .4rem; transition: .15s;
}
.item-card:hover { transform: translateY(-3px); border-color: var(--primary); }
.item-card .ic-name { font-weight: 700; }
.item-card .ic-desc { font-size: .8rem; color: var(--muted); }
.item-actions { display: flex; gap: .6rem; justify-content: center; }

@media (max-width: 820px) {
    .ms-main { grid-template-columns: 1fr; }
    .item-choices { grid-template-columns: 1fr; }
}

/* --- Boutique --- */
.shop-head-right { display: flex; gap: .8rem; align-items: center; }
.shop-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1.2rem; margin-top: 1.5rem;
}
.shop-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
    padding: 1.4rem 1.2rem; text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: .55rem;
    transition: .15s;
}
.shop-card:not(.shop-card--soon):hover { border-color: var(--primary); transform: translateY(-3px); }
.shop-card .btn { margin-top: auto; }
.shop-card--soon { opacity: .5; }
.shop-icon { font-size: 2.6rem; line-height: 1; }
.shop-owned { font-size: .9rem; color: var(--muted); }
.shop-owned strong { color: var(--accent); }
.shop-msg { margin-top: 1rem; padding: .6rem .9rem; border-radius: 8px; border: 1px solid var(--border); }
.shop-msg.ok { border-color: var(--ok); background: rgba(79,214,138,.1); }
.shop-msg.bad { border-color: var(--danger); background: rgba(255,91,110,.1); }
.shop-msg.hidden { display: none; }

/* --- Stats --- */
.stats-search { display: flex; gap: .6rem; margin: 1.2rem 0; flex-wrap: wrap; }
.stats-search input {
    flex: 1; min-width: 220px;
    background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
    padding: .6rem .8rem; border-radius: 8px; font-size: 1rem; font-family: inherit;
}
.stats-player { margin-top: 1rem; }
.stats-since { font-size: .85rem; font-weight: 400; }
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 1rem; margin-top: 1.2rem;
}
.stat-tile {
    background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
    padding: 1.3rem 1rem; text-align: center;
    display: flex; flex-direction: column; gap: .3rem; align-items: center;
}
.stat-icon { font-size: 1.7rem; }
.stat-value { font-size: 1.7rem; font-weight: 800; color: var(--accent); }
.stat-label { font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* --- Case à cocher (login) --- */
.checkbox-line { flex-direction: row !important; align-items: center; gap: .5rem !important; cursor: pointer; }
.checkbox-line input { width: auto; accent-color: var(--primary); }

/* ===================================================================
   Roue du Destin
   =================================================================== */
.wheel-app { position: relative; max-width: 900px; margin: 0 auto; }
.wheel-nav { display: flex; gap: .5rem; justify-content: flex-end; margin-bottom: .8rem; flex-wrap: wrap; }
.wheel-hud {
    display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; justify-content: center;
    background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
    padding: .6rem .9rem; margin-bottom: .8rem;
}
.special-banner {
    background: linear-gradient(90deg, rgba(176,107,255,.18), rgba(255,195,91,.18));
    border: 1px solid var(--accent); border-radius: 10px;
    padding: .6rem .9rem; margin-bottom: .8rem; text-align: center; font-size: .92rem;
    animation: toastIn .25s ease-out;
}
.special-banner.hidden { display: none; }
.quota-track { height: 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 1rem; }
.quota-bar { height: 100%; width: 0; background: var(--primary); transition: width .3s ease; }
.quota-bar.reached { background: var(--ok); }

.wheel-main { display: grid; grid-template-columns: 1fr 260px; gap: 1rem; align-items: start; }
.wheel-canvas-wrap { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
#wheelCanvas { width: 100%; max-width: 440px; height: auto; }
.wheel-actions { display: flex; gap: .8rem; }
.wheel-actions .btn:disabled { opacity: .4; }

.wheel-side { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; }
.wheel-log { display: flex; flex-direction: column; gap: .25rem; max-height: 380px; overflow-y: auto; font-size: .82rem; }
.wlog-line { padding: .25rem .4rem; border-radius: 6px; background: var(--bg-2); }
.wlog-line.ok { color: var(--ok); }
.wlog-line.bad { color: var(--danger); }
.wlog-line.warn { color: var(--accent); }
.wlog-line.muted { color: var(--muted); font-weight: 700; background: transparent; }

.wheel-rules { text-align: left; font-size: .9rem; color: var(--muted); margin: 1rem 0; line-height: 1.5; }
.seg-badge { display: inline-block; padding: .05rem .4rem; border-radius: 6px; color: #0b1020; font-weight: 800; font-size: .8rem; }
.wheel-hint { text-align: center; font-size: .82rem; margin: -.4rem 0 1rem; }
.artefact-list { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.art-chip { font-size: .8rem; padding: .3rem .5rem; border-radius: 7px; background: var(--bg-2); border-left: 3px solid var(--border); cursor: help; }
.art-chip.r-commun { border-left-color: var(--r-commun); }
.art-chip.r-rare { border-left-color: var(--r-rare); }
.art-chip.r-epique { border-left-color: var(--r-epique); }
.art-chip.r-legendaire { border-left-color: var(--r-legendaire); }
.art-chip.r-mythique { border-left-color: var(--r-mythique); }

@media (max-width: 780px) {
    .wheel-main { grid-template-columns: 1fr; }
}

/* --- Toasts --- */
.ms-toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 60; }
.ms-toast {
    background: var(--panel-2); border: 1px solid var(--border); border-left: 4px solid var(--accent);
    padding: .6rem .9rem; border-radius: 8px; font-size: .88rem; max-width: 320px;
    animation: toastIn .2s ease-out;
}
.ms-toast.ok { border-left-color: var(--ok); }
.ms-toast.bad { border-left-color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
