/* ═══════════════════════════════════════════
   dice.css — Lanceur de dés
   ═══════════════════════════════════════════ */

#app { max-width: 480px; margin: 0 auto; padding: 0 0 40px; }
header {
    padding: 20px 20px 14px;
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid var(--border);
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    position: sticky; top: 0; z-index: 100;
}
.header-title { font-family: 'Playfair Display', serif; font-size: 1.15rem; font-weight: 700; color: var(--text); }
.header-title span { color: var(--accent); }
.header-sub { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }

.section { padding: 16px; }
.section-title { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); margin-bottom: 12px; }

/* ── Dice types grid ── */
.dice-types { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 20px; }
.dice-type-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 12px 4px; border-radius: 14px;
    border: 1.5px solid var(--border); background: var(--glass-subtle);
    color: var(--muted); cursor: pointer; transition: all 0.15s;
    font-family: 'DM Sans', sans-serif;
}
.dice-type-btn:active { transform: scale(0.95); }
.dice-type-btn .dt-shape { font-size: 1.3rem; }
.dice-type-btn .dt-name { font-size: 0.72rem; font-weight: 700; }
.dice-type-btn .dt-count {
    font-size: 0.65rem; font-weight: 600;
    background: var(--glass); border-radius: 8px;
    padding: 1px 7px; min-width: 20px; text-align: center;
}
.dice-type-btn.has-dice { border-color: var(--accent); background: rgba(245,197,66,0.08); color: var(--accent); }
.dice-type-btn.has-dice .dt-count { background: var(--accent); color: var(--on-accent); }

/* ── Selected dice row ── */
.selected-dice { display: flex; flex-wrap: wrap; gap: 8px; min-height: 40px; margin-bottom: 16px; justify-content: center; }
.sel-die {
    display: flex; align-items: center; gap: 6px;
    background: var(--card); border: 1px solid var(--border);
    border-radius: 10px; padding: 6px 10px;
    font-size: 0.82rem; font-weight: 600; color: var(--text);
}
.sel-die-remove {
    width: 18px; height: 18px; border-radius: 50%;
    border: none; background: rgba(255,85,85,0.15); color: var(--red);
    font-size: 0.7rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.1s;
}
.sel-die-remove:active { transform: scale(0.85); }

/* ── Roll button ── */
.roll-btn {
    display: block; width: 100%; padding: 16px;
    border-radius: 16px; border: none;
    background: var(--accent); color: var(--on-accent);
    font-family: 'DM Sans', sans-serif; font-size: 1.05rem; font-weight: 700;
    cursor: pointer; transition: all 0.15s;
    margin-bottom: 8px;
}
.roll-btn:active { transform: scale(0.97); }
.roll-btn:disabled { opacity: 0.35; pointer-events: none; }
.clear-btn {
    display: block; width: 100%; padding: 11px;
    border-radius: 12px; border: 1px solid var(--border);
    background: transparent; color: var(--muted);
    font-family: 'DM Sans', sans-serif; font-size: 0.82rem; font-weight: 500;
    cursor: pointer; transition: all 0.15s;
}
.clear-btn:active { transform: scale(0.97); }

/* ── Results ── */
.results-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: 16px; padding: 20px; margin: 20px 16px 0;
    text-align: center; display: none;
}
.results-card.show { display: block; animation: fadeUp 0.3s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.result-total {
    font-family: 'Playfair Display', serif; font-size: 3rem; font-weight: 900;
    color: var(--accent); margin-bottom: 6px;
}
.result-label { font-size: 0.78rem; color: var(--muted); margin-bottom: 16px; }
.result-detail { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.result-die {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: var(--glass); border: 1px solid var(--border);
    border-radius: 12px; padding: 8px 12px; min-width: 52px;
}
.rd-val { font-family: 'Playfair Display', serif; font-size: 1.4rem; font-weight: 900; color: var(--text); }
.rd-val.crit-max { color: var(--accent); }
.rd-val.crit-min { color: var(--red); }
.rd-type { font-size: 0.62rem; color: var(--muted); font-weight: 600; text-transform: uppercase; }

/* ── History ── */
.history-section { margin-top: 20px; }
.history-item {
    background: var(--glass-subtle); border: 1px solid var(--border);
    border-radius: 12px; padding: 10px 14px; margin-bottom: 8px;
    display: flex; flex-direction: column; gap: 4px;
}
.hi-top {
    display: flex; align-items: center; justify-content: space-between;
}
.hi-dice { font-size: 0.72rem; color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hi-total { font-family: 'Playfair Display', serif; font-size: 1.1rem; font-weight: 900; color: var(--accent); flex-shrink: 0; margin-left: 8px; }
.hi-detail {
    font-size: 0.7rem; color: var(--muted); line-height: 1.5;
    word-break: break-all;
}
.hi-val-max { color: var(--accent); font-weight: 700; }
.hi-val-min { color: var(--red); font-weight: 700; }