/* Dice roller - quick dice, count stepper, adv/dis toggle, result panel with crit highlighting. */

.dice { color: var(--text); --dice-crit: var(--good); --dice-fumble: var(--bad); }
.dice-intro { color: var(--muted); margin: 0.25rem 0 1.25rem; }
.dice-intro code { background: var(--accent-weak); color: var(--accent-strong);
    border-radius: 5px; padding: 0.05rem 0.35rem; font-size: 0.95em; }

/* Notation row */
.dice-notation { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.dice-notation input { flex: 1 1 auto; min-width: 0; font: inherit; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.75rem; }
.dice-notation input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.dice-notation button { font: inherit; cursor: pointer; border: 1px solid var(--accent); border-radius: 8px;
    background: var(--accent); color: var(--bg); padding: 0.5rem 1.1rem; }
.dice-notation button:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.dice-notation button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Quick dice */
.dice-quick { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.8rem; }
.dice-die-btn { font: inherit; font-weight: 600; cursor: pointer; min-width: 3.2rem;
    border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface);
    color: var(--text); padding: 0.45rem 0.6rem; box-shadow: var(--shadow); }
.dice-die-btn:hover { border-color: var(--accent); color: var(--accent-strong); }

/* Options: count stepper + adv/dis */
.dice-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.2rem; margin-bottom: 1.25rem; }
.dice-count, .dice-adv { display: flex; align-items: center; gap: 0.3rem; }
.dice-count button, .dice-adv-btn { font: inherit; cursor: pointer; border: 1px solid var(--border-strong);
    border-radius: 8px; background: transparent; color: var(--text); padding: 0.35rem 0.7rem; }
.dice-count button:hover, .dice-adv-btn:hover { border-color: var(--accent); color: var(--accent-strong); }
.dice-count-n { min-width: 1.6rem; text-align: center; font-variant-numeric: tabular-nums; }
.dice-adv-btn.is-on { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.dice-adv-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.dice-adv-btn:disabled:hover { border-color: var(--border-strong); color: var(--text); }

/* Result panel */
.dice-result[aria-hidden="true"] { display: none; }
.dice-result { background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: var(--shadow); padding: 1rem 1.1rem; }
.dice-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dice-expr { color: var(--muted); font-variant-numeric: tabular-nums; word-break: break-all; }
/* Total sits on a blue d20-ish hexagon (clip-path), text in --bg so it stays legible in both themes. */
.dice-total { display: grid; place-items: center; width: 4.4rem; aspect-ratio: 1 / 1.155;
    flex: 0 0 auto; padding: 0 0.3rem; font-size: 1.85rem; font-weight: 800; line-height: 1;
    color: var(--bg); font-variant-numeric: tabular-nums;
    background: linear-gradient(150deg, var(--accent), var(--accent-strong));
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.18); }
.dice-breakdown { margin-top: 0.6rem; color: var(--muted); display: flex; flex-direction: column;
    gap: 0.35rem; font-variant-numeric: tabular-nums; }
/* One row per term: notation label · dice values · subtotal. */
.dice-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.6rem; }
.dice-line-label { color: var(--accent-strong); font-weight: 600; min-width: 3.5rem; }
.dice-line-mod { color: var(--text); }
.dice-line-dice { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem; flex: 1 1 auto; }
.dice-line-sub { color: var(--text); font-weight: 600; margin-left: auto; }
.dice-sep { color: var(--faint); }
.dice-die { color: var(--text); }
.dice-die.is-crit { color: var(--dice-crit); font-weight: 700; }
.dice-die.is-fumble { color: var(--dice-fumble); font-weight: 700; }
/* A dropped die stays muted even if its face is 20/1 (e.g. disadvantage dropping a nat 20). */
.dice-die.is-dropped { text-decoration: line-through; color: var(--faint); font-weight: 400; }

.dice-error { color: var(--dice-fumble); margin: 0.5rem 0 0; }
