/* Very Good Encounter Builder — encounter panel, live difficulty, mobile bar */

/* ── Difficulty banner ── */
.eb-diff {
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
    padding: 12px;
    margin-bottom: 10px;
}

.eb-diff-main { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.eb-diff-tier { font-size: 1.4rem; font-weight: 700; }
.eb-diff-xp { font-size: 0.8rem; color: var(--text-secondary); }
.eb-diff-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.eb-diff-secondary { font-size: 0.8rem; color: var(--text-secondary); margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.08); }

.eb-diff-trivial  { color: #95a5a6; }
.eb-diff-easy     { color: #2ecc71; }
.eb-diff-medium,
.eb-diff-balanced { color: #f39c12; }
.eb-diff-hard     { color: #e67e22; }
.eb-diff-deadly   { color: #e74c3c; }

/* Threshold bar: fill = adjusted XP / deadly threshold; ticks at easy/medium/hard (set via --pos) */
.eb-diff-bar { position: relative; height: 8px; border-radius: 4px; background: rgba(0,0,0,0.25); margin: 10px 0 14px; }
.eb-diff-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: currentColor; max-width: 100%; }
.eb-diff-tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: rgba(255,255,255,0.35); left: var(--pos); }
.eb-diff-tick span { position: absolute; top: 12px; left: -14px; width: 30px; text-align: center; font-size: 0.6rem; color: var(--text-muted); }

/* ── Monster rows ── */
.eb-enc-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.eb-enc-info { min-width: 0; }
.eb-enc-name { color: var(--text-primary); font-size: 0.9rem; }
.eb-enc-meta { display: block; font-size: 0.7rem; color: var(--text-muted); }

.eb-qty { display: flex; align-items: center; gap: 4px; }
.eb-qty .eb-btn { width: 32px; min-height: 32px; padding: 0; font-size: 1rem; }
.eb-qty-value { min-width: 24px; text-align: center; font-weight: 600; font-size: 0.9rem; }

.eb-enc-remove { width: 32px; min-height: 32px; padding: 0; color: var(--text-muted); }

/* ── Note (matches the dice roller's text inputs) ── */
.eb-enc-note { margin-top: 12px; }
.eb-enc-note-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 64px;
    resize: vertical;
    padding: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid #4a5f7a;
    border-radius: var(--border-radius);
    font: inherit;
    font-size: 0.85rem;
}
.eb-enc-note-input::placeholder { color: var(--text-muted); opacity: 0.7; font-style: italic; }
.eb-enc-note-input:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 2px rgba(52,152,219,0.2); }
.eb-enc-note-count { font-size: 0.65rem; color: var(--text-muted); text-align: right; margin-top: 2px; }

/* ── Footer ── */
.eb-enc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; }

/* ── Mobile/tablet: panel lives in a bottom sheet (css/bottom-sheet.css) ── */
@media (max-width: 768px) {
    #eb-right-column { display: none; }
    #eb-left-column,
    #eb-saved-column { padding-bottom: 80px; }
    #seo-description { margin-bottom: 96px; }   /* clear of the fixed encounter bar */
}

@media (min-width: 769px) {
    /* Encounter stays in view while browsing a long monster list */
    #eb-right-column {
        position: sticky;
        top: 16px;
        align-self: start;
        max-height: calc(100vh - 32px);
        overflow-y: auto;
    }

    #eb-mobile-bar,
    #eb-bottom-sheet,
    #eb-sheet-backdrop { display: none !important; }
}

/* ── Saved Encounters list ── */
.eb-saved-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin-bottom: 8px; }

.eb-saved-btn {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;          /* override the global centred button */
    justify-content: flex-start;
    gap: 4px;
    text-align: left;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px 12px;
    cursor: pointer;
    font: inherit;
}

.eb-saved-btn:hover { background: #4a5f7a; }
.eb-saved-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.eb-saved-tier { font-size: 1rem; font-weight: 700; }
.eb-saved-stat { font-size: 0.75rem; color: var(--text-secondary); }
.eb-saved-meta { font-size: 0.7rem; color: var(--text-muted); padding-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.eb-saved-items { display: flex; flex-direction: column; gap: 2px; }
.eb-saved-item { display: grid; grid-template-columns: 2.2em 1fr auto; gap: 6px; font-size: 0.8rem; }
.eb-saved-qty { color: var(--accent-warning); font-weight: 600; text-align: right; }
.eb-saved-item-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eb-saved-item-cr { font-size: 0.7rem; color: var(--text-muted); }
.eb-saved-note { font-size: 0.75rem; font-style: italic; color: var(--text-secondary); white-space: pre-wrap; overflow-wrap: anywhere; padding-top: 6px; border-top: 1px solid rgba(255,255,255,0.07); }

.eb-saved-tools { display: grid; grid-auto-rows: 1fr; gap: 4px; width: 40px; }
.eb-saved-tool { padding: 0; color: var(--text-muted); }

.eb-saved-undo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    padding: 6px 6px 6px 12px;
    border: 1px dashed rgba(255,255,255,0.15);
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.eb-saved-undo .eb-btn { width: auto; padding: 5px 16px; }

/* ── Touch: finger-sized steppers ── */
@media (hover: none) and (pointer: coarse) {
    .eb-qty .eb-btn,
    .eb-enc-remove { width: 44px; min-height: 44px; }
}
