/* =====================================================================
 *  MAP.CSS: the GM screen (drawn by /scripts/map.js)
 *  Colors come from /css/styles.css variables. Everything is prefixed mp-.
 * ===================================================================== */

.mp-area { container-type: inline-size; }
/* The map box: label, the GM's toolbar and the legend on one row, then the board.
   Accents follow the site: amber for anything selected; teal only means "open door". */
.mp-screen { min-width: 0; }
/* Section labels match the page's (.table h2 / .strip h2) */
.mp-title { margin: 0; font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint); }
.mp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.mp-toolbar { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.mp-screen button.mp-tool {
    gap: 7px; min-height: 40px; padding: 0 13px; border: 0; border-right: 1px solid var(--line); border-radius: 0;
    font-size: 11px; transform: none !important;
}
.mp-screen button.mp-tool:last-child { border-right: 0; }
.mp-screen button.mp-tool:not(:disabled):hover { background: rgba(178, 154, 64, 0.08); color: #fff; }
.mp-screen button.mp-tool[aria-pressed="true"] { background: rgba(178, 154, 64, 0.2); color: #fff; box-shadow: inset 0 -2px 0 var(--amber); }
.mp-icon { display: inline-grid; place-items: center; }
.mp-legend { list-style: none; margin: 0 0 0 auto; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.mp-legend li { display: inline-flex; align-items: center; gap: 6px; }
.mp-screen [hidden] { display: none !important; }

/* ---------------------------------------------------------------- board */
.mp-board-wrap { position: relative; min-width: 0; }
.mp-board { display: grid; grid-template-columns: 22px minmax(0, 1fr); grid-template-rows: 20px auto; }
.mp-cols, .mp-rows { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; color: var(--faint); user-select: none; }
.mp-cols { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); align-items: center; text-align: center; }
.mp-rows { display: grid; grid-template-rows: repeat(var(--rows), minmax(0, 1fr)); align-items: center; padding-right: 6px; text-align: right; }

.mp-grid {
    position: relative; container-type: inline-size;
    aspect-ratio: var(--cols) / var(--rows);
    border: 1px solid var(--line); border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.18);
    background-image:
        linear-gradient(to right, var(--line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--line) 1px, transparent 1px);
    background-size: calc(100% / var(--cols)) calc(100% / var(--rows));
    background-position: -1px -1px;
    touch-action: none; user-select: none;
}
.mp-layer { position: absolute; inset: 0; }
.mp-status { margin: 10px 0 0; min-height: 1.2em; font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--faint); }
.mp-status.is-bad { color: var(--health); }
.mp-status.is-warn { color: #e0a030; }

/* Pieces on the board are placed by map.js in % of the grid; visuals sit inset on ::before */
.mp-screen .mp-obj, .mp-screen .mp-token {
    position: absolute; display: grid; place-items: center; box-sizing: border-box;
    min-width: 0; padding: 0; gap: 0; border: 0; border-radius: 0; background: none;
    font-family: var(--mono); font-size: calc(100cqw / var(--cols) * 0.26); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--ink); transform: none !important; transition: none;
}
.mp-screen .mp-obj:hover, .mp-screen .mp-token:hover { color: var(--ink); }
.mp-obj::before, .mp-token::before, .mp-select::before, .mp-ghost::before { content: ""; position: absolute; inset: 2px; border-radius: 4px; }
.mp-obj-text { position: relative; max-width: 100%; padding: 0 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; pointer-events: none; }

.mp-obj.is-hard::before { background: #55554e; border: 1px solid #6c6c64; }
.mp-obj.is-soft::before { background: repeating-linear-gradient(135deg, rgba(160, 160, 150, 0.55) 0 3px, rgba(0, 0, 0, 0.25) 3px 7px); border: 1px solid #6c6c64; }
.mp-obj.is-door::before { background: rgba(196, 85, 74, 0.28); border: 1px solid var(--health); }
.mp-obj.is-door.is-open::before { background: rgba(63, 174, 156, 0.22); border-color: var(--teal); }
.mp-obj.is-hazard::before { background: repeating-linear-gradient(45deg, rgba(214, 128, 40, 0.55) 0 3px, rgba(0, 0, 0, 0.3) 3px 7px); border: 1px solid #d6802a; }
.mp-obj.is-hazard .mp-obj-text { color: #f2c08a; }
.mp-obj.is-door .mp-obj-text { color: #e8b0a9; }

/* Irregular objects: one shape drawn in SVG over the box; only the shape's tiles take the pointer */
.mp-screen .mp-obj.is-shaped { pointer-events: none; }
.mp-obj.is-shaped::before { display: none; }
.mp-shape { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); overflow: visible; }
.mp-shape-fill { pointer-events: auto; }
.mp-shape-edge { fill: none; stroke-width: 1px; stroke-linecap: square; }
.mp-obj.is-hard .mp-shape-fill { fill: #55554e; }
.mp-obj.is-hard .mp-shape-edge, .mp-obj.is-soft .mp-shape-edge { stroke: #6c6c64; }
.mp-obj.is-soft .mp-hatch-a { fill: rgba(0, 0, 0, 0.25); }
.mp-obj.is-soft .mp-hatch-b { fill: rgba(160, 160, 150, 0.55); }
.mp-obj.is-hazard .mp-hatch-a { fill: rgba(0, 0, 0, 0.3); }
.mp-obj.is-hazard .mp-hatch-b { fill: rgba(214, 128, 40, 0.55); }
.mp-obj.is-hazard .mp-shape-edge { stroke: #d6802a; }
.mp-obj.is-door .mp-shape-fill { fill: rgba(196, 85, 74, 0.28); }
.mp-obj.is-door .mp-shape-edge { stroke: var(--health); }
.mp-obj.is-door.is-open .mp-shape-fill { fill: rgba(63, 174, 156, 0.22); }
.mp-obj.is-door.is-open .mp-shape-edge { stroke: var(--teal); }
.mp-obj.is-door.is-open .mp-obj-text { color: #9fe0d4; }

.mp-token::before { inset: 3px; border-radius: 50%; background: var(--tok); border: 2px solid rgba(255, 255, 255, 0.28); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45); }
.mp-token-face { position: relative; font-size: calc(100cqw / var(--cols) * 0.36); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); pointer-events: none; }
.mp-token-name {
    position: absolute; bottom: 6%; left: 50%; transform: translateX(-50%); max-width: 90%;
    padding: 1px 5px; border-radius: 4px; background: rgba(0, 0, 0, 0.55);
    font-size: calc(100cqw / var(--cols) * 0.24); letter-spacing: 0.02em; text-transform: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
.mp-token.is-dragging { opacity: 0.45; }

/* Selection while drawing, and where a dragged token would land */
.mp-select, .mp-ghost { position: absolute; pointer-events: none; }
.mp-select::before, .mp-ghost.is-select::before { background: rgba(178, 154, 64, 0.18); border: 2px dashed var(--amber); }
.mp-ghost.is-token-ghost::before { inset: 3px; border-radius: 50%; border: 2px dashed var(--amber); background: rgba(178, 154, 64, 0.12); }
.mp-ghost.is-blocked::before { border-color: var(--health); background: rgba(196, 85, 74, 0.15); }
/* Allowed, with a warning: a token over soft cover */
.mp-ghost.is-warn::before { border: 2px solid #e0a030; background: rgba(224, 160, 48, 0.22); }
.mp-ghost.is-warn::after { content: "!"; position: absolute; inset: 0; display: grid; place-items: center; font: 700 calc(100cqw / var(--cols) * 0.4) var(--mono); color: #e0a030; }

/* What the pointer does depends on the GM's tool */
.mp-screen.is-gm[data-tool="draw"] .mp-grid { cursor: crosshair; }
.mp-screen.is-gm[data-tool="move"] .mp-token { cursor: grab; }
.mp-screen.is-gm[data-tool="move"] .mp-obj.is-door, .mp-screen.is-gm[data-tool="erase"] .mp-obj, .mp-screen.is-gm[data-tool="erase"] .mp-token { cursor: pointer; }
.mp-screen.is-gm[data-tool="erase"] .mp-obj:hover::before, .mp-screen.is-gm[data-tool="erase"] .mp-token:hover::before { outline: 2px solid var(--health); outline-offset: 1px; }
.mp-screen.is-gm[data-tool="move"] .mp-obj.is-door:hover::before { filter: brightness(1.3); }
.mp-screen.is-gm[data-tool="erase"] .mp-obj.is-shaped:hover .mp-shape-edge { stroke: var(--health); stroke-width: 2px; }
.mp-screen.is-gm[data-tool="move"] .mp-obj.is-door.is-shaped:hover .mp-shape { filter: brightness(1.3); }
.mp-screen.is-gm[data-tool="move"] .mp-obj.is-door.is-shaped .mp-shape-fill, .mp-screen.is-gm[data-tool="erase"] .mp-obj.is-shaped .mp-shape-fill { cursor: pointer; }
.mp-screen .mp-obj:focus-visible, .mp-screen .mp-token:focus-visible { outline: 2px solid var(--amber); outline-offset: -1px; }

/* ---------------------------------------------------------------- draw popup */
.mp-popup {
    position: absolute; z-index: 5; width: 240px; display: flex; flex-direction: column; gap: 6px;
    padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.mp-popup-title { margin: 0 0 2px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.mp-popup-bad { margin: 0; color: var(--health); font-size: 13px; line-height: 1.4; }
.mp-popup-warn { margin: 0; color: #e0a030; font-size: 12.5px; line-height: 1.4; }
.mp-popup-title.mp-popup-sub { margin-top: 6px; }
.mp-screen button.mp-kind.mp-join { font-size: 13px; line-height: 1.3; text-align: left; }
.mp-input { width: 100%; box-sizing: border-box; padding: 8px 10px; font-family: var(--body); font-size: 14px; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; }
.mp-input:focus { outline: none; border-color: var(--amber); }
.mp-screen button.mp-kind { justify-content: flex-start; gap: 10px; padding: 8px 10px; font-family: var(--body); font-size: 14px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.mp-screen button.mp-cancel { padding: 7px 10px; font-size: 11px; }

/* Clear map confirmation, under the toolbar */
.mp-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 12px; padding: 10px 12px; border: 1px dashed var(--health); border-radius: 8px; background: rgba(196, 85, 74, 0.05); }
.mp-confirm p { flex: 1 1 200px; margin: 0; font-size: 13px; color: var(--ink); }
.mp-screen button.mp-confirm-yes { border-color: var(--health); }

.mp-swatch { position: relative; flex: none; width: 13px; height: 13px; border-radius: 3px; }
.mp-swatch.is-hard { background: #55554e; border: 1px solid #6c6c64; }
.mp-swatch.is-soft { background: repeating-linear-gradient(135deg, rgba(160, 160, 150, 0.55) 0 2px, rgba(0, 0, 0, 0.25) 2px 5px); border: 1px solid #6c6c64; }
.mp-swatch.is-door { background: rgba(196, 85, 74, 0.28); border: 1px solid var(--health); }
.mp-swatch.is-door.is-open { background: rgba(63, 174, 156, 0.22); border-color: var(--teal); }
.mp-swatch.is-hazard { background: repeating-linear-gradient(45deg, rgba(214, 128, 40, 0.6) 0 2px, rgba(0, 0, 0, 0.3) 2px 5px); border: 1px solid #d6802a; }

/* ---------------------------------------------------------------- party vitals */
.mp-party-wrap [hidden] { display: none !important; }
.mp-party { display: flex; flex-direction: column; gap: 16px; }
.mp-empty { margin: 0; font-size: 13px; line-height: 1.5; color: var(--faint); }
.mp-member { display: flex; flex-direction: column; gap: 5px; }
/* A divider between everyone: the GM can mix characters and NPCs in any order */
.mp-member + .mp-member { padding-top: 12px; border-top: 1px dashed var(--line); }
.mp-member-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mp-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.mp-member-head b { min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-member-head > span:not(.mp-dot) { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em; color: var(--faint); white-space: nowrap; }
.mp-party-wrap button.mp-sheet-link {
    margin-left: auto; min-height: 30px; padding: 0 8px; border: 0; background: none;
    font-size: 10.5px; color: var(--amber); transform: none !important;
}
.mp-party-wrap button.mp-sheet-link:not(:disabled):hover { color: #fff; }
.mp-party-wrap button.mp-sheet-link.is-remove { color: var(--muted); }
.mp-vital { display: grid; grid-template-columns: 46px minmax(0, 1fr) 40px; align-items: center; gap: 8px; }
.mp-vital.has-steps { grid-template-columns: 46px minmax(0, 1fr) 40px 24px 24px; gap: 6px; }
.mp-vlabel { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.mp-vbar { height: 7px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.mp-vbar span { display: block; height: 100%; background: var(--fill); transition: width 0.2s ease; }
.mp-vital.is-hp { --fill: var(--health); }
.mp-vital.is-stress { --fill: var(--amber); }
.mp-vital.is-void { --fill: var(--teal); }
.mp-vnum { font-family: var(--mono); font-size: 11px; color: var(--ink); text-align: right; }
.mp-party-wrap button.mp-vstep { width: 24px; height: 24px; padding: 0; font-size: 14px; font-weight: 400; transform: none !important; }
.mp-party-wrap button.mp-add {
    width: 100%; margin-top: 16px; border-style: dashed; color: var(--muted); font-size: 11px;
}
.mp-npc-form { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.mp-field-row { flex-direction: row; align-items: center; justify-content: space-between; }
.mp-input.mp-num { width: 90px; text-align: center; }

/* ---------------------------------------------------------------- token dialog */
.mp-dialog { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, 0.6); }
.mp-dialog-box { width: min(380px, 100%); box-sizing: border-box; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6); }
.mp-dialog-box h3 { margin: 0 0 16px; font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink); }
.mp-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.mp-field > span { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.mp-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.mp-color { position: relative; cursor: pointer; }
.mp-color input { position: absolute; opacity: 0; pointer-events: none; }
.mp-color span { display: block; width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.25); }
.mp-color input:checked + span { border-color: var(--ink); }
.mp-color input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: 2px; }
.mp-color em { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mp-sizes { display: flex; flex-wrap: wrap; gap: 10px; }
.mp-size { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.mp-size span { padding: 0 4px; letter-spacing: 0.08em; text-transform: uppercase; }
.mp-size output { min-width: 1.4em; text-align: center; font-size: 14px; color: var(--ink); }
button.mp-step { width: 28px; height: 28px; padding: 0; font-size: 15px; font-weight: 400; }
.mp-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* ---------------------------------------------------------------- narrow */
@container (max-width: 520px) {
    .mp-legend { margin-left: 0; }
    .mp-screen button.mp-tool { padding: 0 10px; }
    .mp-board { grid-template-columns: 18px minmax(0, 1fr); grid-template-rows: 16px auto; }
    .mp-cols, .mp-rows { font-size: 9px; }
}

/* =====================================================================
 *  TABLE TAB: dice roller (drawn by /scripts/dice.js), and rolls in chat
 * ===================================================================== */
.dz-roller { display: flex; flex-direction: column; gap: 14px; }
.dz-roller [hidden] { display: none !important; }
.dz-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dz-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.dz-hint { margin: 2px 0 0; font-size: 12px; line-height: 1.45; color: var(--faint); }
.dz-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dz-roller button.dz-opt { min-height: 40px; font-size: 13px; }
.dz-roller button[aria-pressed="true"] { border-color: var(--amber); background: rgba(178, 154, 64, 0.16); color: #fff; }
.dz-stepper { display: flex; align-items: center; justify-content: space-between; min-height: 40px; padding: 0 4px; border: 1px solid var(--line); border-radius: 8px; }
.dz-stepper output { font-family: var(--mono); font-size: 14px; color: var(--ink); }
.dz-roller button.dz-step { width: 30px; height: 30px; padding: 0; font-size: 15px; font-weight: 400; transform: none !important; }
.dz-adv { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.dz-roller button.dz-adv-btn { min-height: 36px; padding: 0; border: 0; border-right: 1px solid var(--line); border-radius: 0; font-size: 11px; font-weight: 400; transform: none !important; }
.dz-roller button.dz-adv-btn:last-child { border-right: 0; }
.dz-roller button.dz-adv-btn[aria-pressed="true"] { font-weight: 700; }
.dz-toggle-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dz-roller button.dz-toggle { flex: none; min-width: 56px; min-height: 32px; padding: 0 12px; border-radius: 999px; font-size: 11px; }
.dz-roller button.dz-roll-btn { min-height: 44px; font-size: 12px; }
.dz-result:empty { display: none; }
.dz-result { padding-top: 12px; border-top: 1px solid var(--line); }

/* A roll: dice (unused ones struck), modifier, total; then any outcome */
.dz-roll { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.dz-dice { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dz-die { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 4px; box-sizing: border-box; border: 1px solid var(--line); border-radius: 7px; font-family: var(--mono); font-size: 13px; color: var(--faint); text-decoration: line-through; }
.dz-die.is-kept { border-color: var(--amber); color: var(--ink); text-decoration: none; font-weight: 700; }
.dz-die.is-six { background: rgba(178, 154, 64, 0.2); }
.dz-mod { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.dz-total { margin-left: auto; font-family: var(--display); font-size: 26px; font-weight: 700; color: var(--ink); }
.dz-outcome { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; color: var(--muted); }
.dz-outcome b { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; }
.dz-outcome.is-reward, .dz-outcome.is-critical { border-color: var(--amber); background: rgba(178, 154, 64, 0.07); }
.dz-outcome.is-reward b, .dz-outcome.is-critical b { color: var(--amber); }
.dz-outcome.is-complication { border-color: var(--health); background: rgba(196, 85, 74, 0.07); }
.dz-outcome.is-complication b { color: var(--health); }

/* Attack mode */
.dz-mode { display: flex; flex-direction: column; gap: 14px; }
.dz-switch { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.dz-round { display: flex; flex-direction: column; gap: 4px; }
.dz-round + .dz-round { padding-top: 8px; border-top: 1px dashed var(--line); }
.dz-round-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.dz-die.is-hit { border-color: var(--amber); background: rgba(178, 154, 64, 0.16); }
.dz-die.is-miss { border-color: var(--line); color: var(--muted); font-weight: 400; }
.dz-round-dmg { margin-left: auto; font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--amber); }
.dz-damage { display: flex; align-items: baseline; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--line); }
.dz-damage span { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.dz-damage .dz-total { margin-left: 0; }
.dz-total.dz-pending { color: var(--muted); }
.dz-resolve { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px dashed var(--amber); border-radius: 8px; }
.dz-resolve-row { display: flex; gap: 8px; align-items: center; }
.dz-resolve-row .dz-stepper { flex: 1; }
.dz-resolve-row output { font-family: var(--mono); font-size: 14px; color: var(--ink); }

/* GM: who rolls the attack, and requests still waiting */
.dz-who { display: flex; flex-wrap: wrap; gap: 6px; }
.dz-roller button.dz-chip { min-height: 34px; padding: 0 12px; border-radius: 999px; font-family: var(--body); font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.dz-pending:empty { display: none; }
.dz-pending { display: flex; flex-direction: column; gap: 6px; }
.dz-wait { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px dashed var(--amber); border-radius: 8px; font-size: 12.5px; color: var(--muted); }
.dz-wait span { flex: 1; }

/* Player: the GM's attack request */
.dz-prompt { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, 0.6); }
.dz-prompt-box { width: min(420px, 100%); box-sizing: border-box; padding: 22px; border: 1px solid var(--amber); border-radius: 12px; background: var(--panel); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6); color: var(--ink); }
.dz-prompt-box h2 { margin: 0 0 12px; font-family: var(--display); font-size: 24px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; }
.dz-prompt-body p { margin: 0 0 8px; font-size: 15px; line-height: 1.5; }
.dz-prompt-body .dz-hint { font-size: 12.5px; }
.dz-prompt-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dz-note { width: 100%; box-sizing: border-box; min-height: 40px; padding: 0 11px; font-family: var(--body); font-size: 14px; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.dz-note:focus { outline: none; border-color: var(--amber); }
.dz-wait { flex-wrap: wrap; }
.dz-prompt-box.dz-approve { width: min(460px, 100%); }
.dz-prompt-box .dz-roller { margin-top: 6px; }

/* Compact roll cards */
.dz-tag { padding: 2px 7px; border: 1px solid var(--amber); border-radius: 999px; font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--amber); white-space: nowrap; }
.dz-tag.is-complication { border-color: var(--health); color: var(--health); }
/* A risky roll's Reward or Complication, drawn from its table */
.dz-drew { padding: 8px 10px; border-left: 2px solid var(--amber); border-radius: 0 6px 6px 0; background: rgba(178, 154, 64, 0.07); }
.dz-drew.is-complication { border-left-color: var(--health); background: rgba(200, 80, 70, 0.07); }
.dz-drew.is-table { border-left-color: var(--muted); background: rgba(255, 255, 255, 0.03); }
.dz-drew.is-table .dz-drew-table { color: var(--ink); }
.dz-drew-table { display: block; margin-bottom: 3px; font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--amber); }
.dz-drew.is-complication .dz-drew-table { color: var(--health); }
.dz-drew-text { margin: 0; white-space: pre-wrap; font-size: 13.5px; line-height: 1.45; color: var(--ink); }
.dz-roll .dz-tag:last-of-type { margin-left: auto; }
.dz-roll .dz-tag + .dz-total { margin-left: 8px; }
.dz-row .dz-tag, .dz-row .dz-round-dmg { margin-left: auto; }
.dz-roll.is-attack { gap: 6px; }
.dz-resolve { flex-direction: row; align-items: center; gap: 8px; padding: 6px 8px; }
.dz-resolve .dz-stepper { flex: 1; min-height: 34px; }
.dz-resolve .dz-stepper output { font-family: var(--mono); font-size: 14px; color: var(--ink); }
/* In chat the cards sit in a narrow column: smaller dice so a round fits on one line */
.chat-log .dz-dice { gap: 4px; flex-wrap: nowrap; }
.chat-log .dz-die { min-width: 24px; height: 24px; padding: 0 3px; border-radius: 6px; font-size: 12px; }
.chat-log .dz-tag { padding: 1px 6px; font-size: 9.5px; }
.chat-log .dz-total { font-size: 22px; }

/* Attack card: round numbers, per-round hits, damage breakdown */
.dz-rnum { min-width: 20px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; color: var(--muted); }
.dz-rnum:empty { display: none; }
.dz-round-dmg.is-pending { font-weight: 400; color: var(--muted); }
.dz-row .dz-mod { font-size: 12px; }
.dz-damage > div { display: flex; flex-direction: column; gap: 2px; }
.dz-breakdown { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.02em; }
.chat-log .dz-round-dmg { font-size: 12px; white-space: nowrap; }
.dz-rmeta { margin: -2px 0 4px; padding-left: 26px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.dz-rmeta.is-crit::after { content: " ↓"; color: var(--amber); }
.chat-log .dz-rmeta { font-size: 10.5px; padding-left: 24px; }
.dz-prompt-body p.dz-rmeta { margin: -2px 0 4px; font-size: 11px; line-height: 1.3; }

/* Attack targets: pick a token on the map, outline the chosen one */
.mp-screen .mp-token.is-target { outline: 2px solid var(--amber); outline-offset: 2px; z-index: 3; }
.mp-screen[data-tool="target"] .mp-token { cursor: crosshair; box-shadow: 0 0 0 2px rgba(178, 154, 64, 0.55); }
.mp-screen[data-tool="target"] .mp-grid { cursor: not-allowed; }
.dz-types { display: flex; flex-wrap: wrap; gap: 6px; }
.dz-target-row { display: flex; gap: 8px; align-items: stretch; }
.dz-select { flex: 1; min-width: 0; min-height: 40px; padding: 0 10px; font-family: var(--mono); font-size: 13px; color: var(--ink); background: var(--panel-2, transparent); border: 1px solid var(--line); border-radius: 8px; }
.dz-select:focus { outline: none; border-color: var(--amber); }
.dz-pick[aria-pressed="true"] { border-color: var(--amber); color: var(--amber); }

/* GM: proposed attacks, across the top of the map */
.mp-notices { display: flex; flex-direction: column; gap: 8px; }
.mp-notices:empty { display: none; }
.dz-banner { display: flex; flex-direction: column; gap: 8px; padding: 8px 10px; border: 1px solid var(--amber); border-radius: 8px; background: rgba(178, 154, 64, 0.08); }
.dz-banner-what { margin: 0; font-family: var(--mono); font-size: 12.5px; color: var(--ink); }
.dz-banner-what b { font-family: var(--body); font-size: 14px; font-weight: 600; margin-right: 4px; }
.dz-banner-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dz-banner-row .dz-stepper { min-height: 34px; min-width: 110px; }
.dz-banner-row .dz-stepper output { font-family: var(--mono); font-size: 14px; color: var(--ink); }
.dz-banner-row .btn-primary { margin-left: auto; }
.dz-banner-adjust { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.dz-banner-adjust[hidden] { display: none; }

/* GM: NPC defenses */
.mp-def { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.mp-def-cell { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.mp-def-input { width: 3.4em; min-height: 26px; box-sizing: border-box; padding: 0 4px; font-family: var(--mono); font-size: 12px; text-align: center; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 6px; }
.mp-def-input:focus { outline: none; border-color: var(--amber); }
.mp-def-new { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mp-def-new .mp-def-cell { flex-direction: column; align-items: stretch; gap: 4px; }
.mp-note { margin: 0; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.dz-banner button[aria-pressed="true"] { border-color: var(--amber); background: rgba(178, 154, 64, 0.16); color: #fff; }
.dz-banner button.dz-step { width: 30px; height: 30px; padding: 0; font-size: 15px; font-weight: 400; transform: none !important; }
.dz-banner button.dz-chip { min-height: 32px; padding: 0 12px; border-radius: 999px; font-family: var(--body); font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: none; }

/* GM: reorder Party vitals by the grip. It sits in the margin and shows on hover, so names line up as before. */
.mp-member { position: relative; }
.mp-grip { position: absolute; left: -17px; top: 0; display: grid; place-items: center; width: 14px; height: 22px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--faint, #5f6253); cursor: grab; touch-action: none; opacity: 0; transition: opacity 0.12s ease; transform: none !important; }
.mp-member + .mp-member .mp-grip { top: 12px; }
.mp-member:hover .mp-grip, .mp-grip:focus-visible, .mp-member.is-dragging .mp-grip { opacity: 1; }
.mp-grip:hover, .mp-grip:focus-visible { color: var(--amber); }
@media (hover: none) { .mp-grip { opacity: 0.7; } }
.mp-member.is-dragging { z-index: 2; background: #1b1c16; outline: 1px solid var(--amber); outline-offset: 4px; box-shadow: 0 0 0 4px #1b1c16, 0 10px 24px rgba(0, 0, 0, 0.55); border-radius: 6px; }
.mp-member.is-dragging .mp-grip { cursor: grabbing; color: var(--amber); }
.mp-member.is-drop-above { box-shadow: 0 -2px 0 var(--amber); }
.mp-member.is-drop-below { box-shadow: 0 2px 0 var(--amber); }

/* GM: an NPC's controls, open only while editing */
.mp-edit { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; padding-top: 8px; border-top: 1px dashed var(--line); }
.mp-edit .mp-def { margin-top: 0; }
.mp-party-wrap button.mp-sheet-link + button.mp-sheet-link { margin-left: 0; }
.dz-select.dz-roll-to.is-whisper { border-color: var(--amber); border-style: dashed; color: var(--amber); }
/* NPC form: the three defenses share the row evenly */
.mp-def-new .mp-input.mp-num { width: 100%; min-width: 0; padding-left: 4px; padding-right: 4px; }
.mp-npc-form .mp-num::-webkit-inner-spin-button, .mp-npc-form .mp-num::-webkit-outer-spin-button,
.mp-def-input::-webkit-inner-spin-button, .mp-def-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.mp-npc-form .mp-num, .mp-def-input { -moz-appearance: textfield; appearance: textfield; }
/* Health lines up with the defenses below it */
.mp-npc-form .mp-field-row { flex-direction: column; align-items: stretch; }
.mp-npc-form .mp-field-row .mp-input.mp-num { width: calc((100% - 16px) / 3); }
/* Temporary health in vitals: "+5" after the numbers, and a brighter edge on the bar */
.mp-vtemp { color: var(--health); font-weight: 700; }
.mp-vbar.has-temp { border-color: var(--health); }
.mp-vital.is-hp:has(.mp-vtemp) { grid-template-columns: 46px minmax(0, 1fr) auto; }
.mp-vital.is-hp.has-steps:has(.mp-vtemp) { grid-template-columns: 46px minmax(0, 1fr) auto 24px 24px; }

/* Companion checkbox (NPC form and an NPC's Edit panel) */
.mp-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); cursor: pointer; }
.mp-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--amber); }
.mp-check em { font-style: normal; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.mp-npc-form .mp-check { flex-wrap: wrap; row-gap: 2px; }
.mp-edit { flex-wrap: wrap; row-gap: 8px; }
.mp-edit { flex-direction: column; align-items: stretch; }
.mp-edit-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mp-edit-row .mp-sheet-link { margin-left: auto; }
.mp-npc-form .mp-check { margin-top: 2px; }

/* Invisible tokens: only the GM sees them, faded with a dashed ring */
.mp-screen .mp-token.is-hidden::before { opacity: 0.45; border: 2px dashed rgba(240, 236, 220, 0.9); }
.mp-screen .mp-token.is-hidden .mp-token-face { opacity: 0.75; }
.mp-dialog-box .mp-check { margin-top: 2px; }
.mp-dialog-actions .mp-dialog-delete { margin-right: auto; color: var(--health); border-color: transparent; background: none; }

/* ---------------------------------------------------------------- tile requests */
/* A dashed ring on the tile with a pin (move) or hand (interact). Player: their own; GM: everyone's. */
.mp-screen .mp-request {
    --req: var(--amber);
    position: absolute; z-index: 2; display: block; box-sizing: border-box; min-width: 0;
    padding: 0; margin: 0; border: 0; border-radius: 0; background: none; color: var(--req);
    transform: none !important; transition: none; pointer-events: none; /* the tile stays usable; only the badge takes clicks */
}
.mp-request::before {
    content: ""; position: absolute; inset: 3px; border-radius: 50%;
    border: 2px dashed var(--req); background: color-mix(in srgb, var(--req) 14%, transparent);
    animation: mp-req-pulse 2.4s ease-in-out infinite;
}
.mp-request.is-interact::before { border-radius: 6px; }
.mp-request-icon {
    position: absolute; top: -6%; right: -6%; width: 46%; height: 46%; padding: 6%; box-sizing: border-box;
    border-radius: 50%; background: #17150f; color: var(--req); border: 1px solid var(--req);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); pointer-events: none;
}
.mp-request-icon svg { display: block; pointer-events: none; }
.mp-screen button.mp-request .mp-request-icon, .mp-screen button.mp-request .mp-request-name { pointer-events: auto; cursor: pointer; }
.mp-request-name {
    position: absolute; top: 100%; left: 50%; transform: translate(-50%, -2px); max-width: 160%;
    padding: 1px 5px; border-radius: 4px; background: rgba(0, 0, 0, 0.7); color: var(--ink);
    font-family: var(--mono); font-size: calc(100cqw / var(--cols) * 0.2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
.mp-screen button.mp-request:has(:hover)::before { background: color-mix(in srgb, var(--req) 26%, transparent); }
.mp-screen button.mp-request:focus-visible { outline: 2px solid var(--amber); outline-offset: -1px; }
@keyframes mp-req-pulse { 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .mp-request::before { animation: none; } }

/* Players can tap any tile */
.mp-screen:not(.is-gm) .mp-grid { cursor: pointer; }
.mp-screen:not(.is-gm)[data-tool="target"] .mp-grid { cursor: default; }

.mp-request-popup { width: 232px; }
.mp-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mp-screen .mp-kinds button.mp-kind { justify-content: center; padding: 8px 6px; font-size: 13px; }
.mp-screen .mp-kinds button.mp-kind[aria-pressed="true"] { border-color: var(--amber); background: rgba(178, 154, 64, 0.16); color: #fff; }
.mp-popup-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-top: 2px; }
.mp-popup-actions .mp-send { padding: 7px 12px; font-size: 11px; }
.mp-popup-note { margin: 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.mp-popup-quote { margin: 0; font-size: 14px; line-height: 1.4; color: var(--ink); }

/* Attacks: who attacks (GM) and which of their attacks */
.dz-roller button[aria-checked="true"] { border-color: var(--amber); background: rgba(178, 154, 64, 0.16); color: #fff; }
.dz-roller button.dz-chip.is-npc[aria-checked="false"] { border-style: dashed; }
.dz-attacks { display: flex; flex-direction: column; gap: 6px; }
.dz-roller button.dz-attack {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 48px; padding: 7px 12px; text-align: left;
    font-family: var(--body); font-size: 14px; font-weight: 600; letter-spacing: 0; text-transform: none;
}
.dz-attack span { font-family: var(--mono); font-size: 11.5px; font-weight: 400; color: var(--muted); }
.dz-attack[aria-checked="true"] span { color: #d8d4c0; }
.dz-field[hidden], .dz-hint:empty { display: none; }

/* NPC attacks: from the API, or by hand */
.mp-found { display: flex; flex-direction: column; gap: 4px; }
.mp-found:empty { display: none; }
.mp-found-item, .mp-picked { display: flex; align-items: baseline; gap: 8px; width: 100%; box-sizing: border-box; padding: 8px 10px; text-align: left; font: inherit; font-size: 13.5px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.mp-found-item:hover, .mp-found-item:focus-visible { outline: none; border-color: var(--amber); background: rgba(178, 154, 64, 0.08); }
.mp-found-item em, .mp-picked em { margin-left: auto; font-family: var(--mono); font-size: 10.5px; font-style: normal; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.mp-picked { flex-wrap: wrap; cursor: default; border-color: var(--amber); background: rgba(178, 154, 64, 0.07); }
.mp-picked > span { display: flex; align-items: baseline; gap: 8px; flex: 1 1 100%; }
.mp-picked small { font-size: 12px; color: var(--muted); }
.mp-picked .mp-sheet-link { margin-left: auto; }
.mp-picked[hidden], .mp-npc-form input[hidden] { display: none; }
.mp-attacks { display: flex; flex-direction: column; gap: 8px; }
.mp-attack { display: flex; flex-direction: column; gap: 5px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.mp-attack small { padding-left: 2px; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
/* Name on top, then type, dice and remove: fits the narrow side panel */
.mp-attack-line { display: grid; grid-template-columns: minmax(0, 1fr) 62px 28px; gap: 6px; align-items: center; }
.mp-attack-line > .mp-input:first-child { grid-column: 1 / -1; }
.mp-attack-line .mp-input { padding: 7px 8px; font-size: 13.5px; }
select.mp-input { appearance: auto; }
.mp-attack-dice { display: flex; align-items: center; gap: 3px; font-family: var(--mono); font-size: 12px; color: var(--faint); }
.mp-attack-dice .mp-input.mp-num { width: 100%; min-width: 0; padding-left: 2px; padding-right: 2px; -moz-appearance: textfield; appearance: textfield; }
.mp-attack-dice .mp-num::-webkit-inner-spin-button, .mp-attack-dice .mp-num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.mp-attack-del { width: 28px; height: 30px; padding: 0; font-size: 16px; line-height: 1; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.mp-attack-del:hover, .mp-attack-del:focus-visible { color: var(--ink); border-color: var(--amber); outline: none; }
.mp-add-attack { align-self: flex-start; padding: 6px 10px; font: inherit; font-size: 12.5px; color: var(--amber); background: transparent; border: 1px dashed var(--line); border-radius: 6px; cursor: pointer; }
.mp-add-attack:hover, .mp-add-attack:focus-visible { border-color: var(--amber); outline: none; }
.mp-add-attack[hidden] { display: none; }
.mp-edit-attacks { margin: 4px 0 0; }
.mp-attacks .mp-note { margin: 0; }

/* NPC stats and defense: six stats, then each defense worked out (stat + 2) with its bonus */
.mp-statblock { display: flex; flex-direction: column; gap: 8px; }
.mp-stats6 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 8px; }
.mp-stats6 .mp-def-cell { flex-direction: row; justify-content: space-between; gap: 6px; }
.mp-stats6 .mp-input.mp-num, .mp-def-bonus .mp-input.mp-num { width: 3.2em; min-width: 0; padding: 4px; text-align: center; font-family: var(--mono); font-size: 12.5px; -moz-appearance: textfield; appearance: textfield; }
.mp-statblock .mp-num::-webkit-inner-spin-button, .mp-statblock .mp-num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.mp-defs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mp-def-total { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border: 1px solid var(--line); border-radius: 8px; }
.mp-def-total > span { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.mp-def-total > b { font-family: var(--mono); font-size: 18px; line-height: 1.1; color: var(--ink); }
.mp-def-bonus { display: flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.mp-statblock .mp-note { margin: 0; font-size: 11.5px; }

/* The stat added to each die: six chips, each with its value */
.dz-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.dz-roller button.dz-chip.dz-stat, .dz-banner button.dz-chip.dz-stat { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 44px; padding: 4px 0; border-radius: 10px; }
.dz-chip.dz-stat b { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; }
.dz-chip.dz-stat span { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.dz-chip.dz-stat[aria-checked="true"] span { color: inherit; }
@media (max-width: 380px) { .dz-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.dz-banner button.dz-stat[aria-checked="true"] { border-color: var(--amber); background: rgba(178, 154, 64, 0.16); color: #fff; }
.mp-stats6 .mp-input.mp-num[readonly] { border-style: dashed; color: var(--muted); background: transparent; cursor: default; }

/* ---------------------------------------------------------------- containers */
/* GM only: a small box mark on objects that hold things */
.mp-obj-badge { position: absolute; display: grid; place-items: center; padding: 18%; box-sizing: border-box; color: #e0b452; pointer-events: none; }
.mp-obj-badge svg { width: 100%; height: 100%; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8)); }
.mp-obj-badge.is-open, .mp-obj-badge.is-revealed { color: #9fe0d4; }
.mp-screen.is-gm[data-tool="container"] .mp-obj { cursor: pointer; }
.mp-screen.is-gm[data-tool="container"] .mp-obj:hover::before { outline: 2px solid #e0b452; outline-offset: 1px; }
.mp-screen.is-gm[data-tool="container"] .mp-obj.is-shaped:hover .mp-shape-edge { stroke: #e0b452; stroke-width: 2px; }
.mp-screen.is-gm[data-tool="container"] .mp-obj.is-shaped .mp-shape-fill { cursor: pointer; }
.mp-screen button.mp-open-box { width: 100%; }

/* The container window: beside the map, not in the way of it */
.ct-window {
    position: fixed; right: 16px; top: 88px; z-index: 40; width: min(380px, calc(100vw - 32px)); max-height: calc(100vh - 110px);
    display: flex; flex-direction: column; border: 1px solid var(--amber); border-radius: 12px; background: var(--panel); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
}
.ct-window[hidden] { display: none; }
.ct-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ct-title { flex: 1; margin: 0; font-family: var(--display); font-size: 20px; font-weight: 700; text-transform: uppercase; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-close { min-width: 36px; min-height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; }
.ct-close:hover { border-color: var(--amber); }
.ct-body { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 16px; overflow-y: auto; }
.ct-state { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.ct-wait { padding: 24px 0; text-align: center; font-size: 15px; color: var(--ink); animation: ct-pulse 2s ease-in-out infinite; }
@keyframes ct-pulse { 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .ct-wait { animation: none; } }
.ct-flash { margin: 0; padding: 6px 10px; border-left: 2px solid var(--amber); font-size: 13px; color: var(--ink); background: rgba(178, 154, 64, 0.08); }
.ct-label { margin: 4px 0 0; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.ct-empty, .ct-hint { margin: 0; font-size: 12.5px; color: var(--muted); }
/* Slots, as in the inventory: four to a row, an item spans its slot count */
.ct-slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.ct-slot { min-height: 54px; box-sizing: border-box; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); }
.ct-slot.is-empty { border-style: dashed; opacity: 0.45; }
.ct-slot.is-more { font-family: var(--body); display: grid; place-items: center; padding: 4px; font-size: 11px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.ct-slot.is-item { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 4px; padding: 6px 7px; color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
button.ct-slot.is-item:hover { border-color: var(--amber); }
.ct-slot.is-picked { border-color: var(--amber); background: rgba(178, 154, 64, 0.16); }
.ct-slot.is-hidden { opacity: 0.55; border-style: dashed; }
button.ct-slot.is-rolled { border-left: 3px solid rgba(178, 154, 64, 0.55); }
button.ct-slot.is-table { border-style: dashed; border-color: rgba(178, 154, 64, 0.55); background: rgba(178, 154, 64, 0.05); }
button.ct-slot.is-table .ct-slot-name { color: var(--amber); }
button.ct-slot.is-add { display: grid; place-items: center; border-style: dashed; background: transparent; color: var(--amber); font-size: 22px; font-weight: 300; cursor: pointer; }
button.ct-slot.is-add:hover, button.ct-slot.is-add.is-picked { border-color: var(--amber); background: rgba(178, 154, 64, 0.1); }
.ct-put { display: flex; flex-direction: column; gap: 8px; }
.ct-put p { margin: 0; }
.ct-detail > .ct-detail-meta + .ct-actions { margin-top: 6px; }
.ct-notes-in { margin: 0 0 8px; }
.ct-slot-name { font-family: var(--body); font-size: 13px; font-weight: 600; line-height: 1.25; letter-spacing: 0; text-transform: none; overflow-wrap: break-word; hyphens: auto; max-width: 100%; }
.ct-slot-meta { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.ct-detail { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.ct-detail p { margin: 0 0 6px; }
.ct-detail-name { font-weight: 700; color: var(--ink); }
.ct-detail-meta { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.ct-detail-text { font-size: 13px; line-height: 1.5; color: #c9c6b6; white-space: pre-line; }
.ct-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ct-actions button, .ct-add button, .ct-stop { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--ink); font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; }
.ct-actions button:hover, .ct-add button:hover { border-color: var(--amber); }
.ct-actions button:disabled { opacity: 0.45; cursor: default; }
.ct-actions button.btn-primary { border-color: var(--amber); background: var(--amber); color: #17150f; }
.ct-danger { color: var(--health) !important; }
.ct-stop { align-self: flex-start; margin-top: 4px; border-style: dashed; }
.ct-main { padding-top: 4px; }
.ct-add { display: flex; gap: 6px; }
.ct-add .mp-input { flex: 1; }
.ct-notes ul, .ct-list { margin: 4px 0 0; padding: 0; list-style: none; font-size: 13px; color: #c9c6b6; }
.ct-notes li { padding: 3px 0; }
.ct-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.ct-x { min-width: 28px; min-height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
