/* The Bard tab in the dice tray. Uses the board's theme variables so the combat colors apply. */

/* The video sits in the tray, between the grip and the body (see renderTray). */
/* Width follows the screen height, so the video shrinks on a short screen and leaves room for the list. */
.tray-video { flex: none; width: min(calc(100% - 24px), calc(24dvh * 16 / 9)); aspect-ratio: 16 / 9; margin: 0 auto; border-radius: 12px; overflow: hidden; background: #000; border: 1px solid var(--border); }
.tray-video[hidden] { display: none; }
/* Two players, stacked, so a track can fade in over the one before it (the newest on top). */
.tray-video { position: relative; }
.tray-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border: 0; }
/* Reads a pasted playlist's video list; cued, never played, and off screen. */
.bard-helper { position: fixed; left: -10000px; top: 0; width: 320px; height: 180px; pointer-events: none; }

/* The controls sit at the bottom of the window, by the d20 button, and stay put while the list scrolls under them.
   (-12px: flush with the bottom edge, past the body's padding.) */
.bard-now { position: sticky; bottom: -12px; z-index: 2; flex: none; display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; border: 1.5px solid var(--border-soft); background: var(--panel-2); box-shadow: 0 -10px 14px -10px rgba(0, 0, 0, 0.7); }
.bard-now[hidden] { display: none; }
.bard-now-title { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.bard-now-title small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }
.bard-now-name { font-size: 14px; font-weight: 700; }
.bard-transport { display: flex; gap: 6px; }
.bard-transport .tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; height: 38px; padding: 0; border: 1px solid var(--border); border-radius: 10px; }
.bard-transport .tab[disabled] { opacity: 0.4; cursor: default; }
.bard-transport .icon { width: 18px; height: 18px; }
.bard-seek-row, .bard-volume-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bard-seek-row input, .bard-volume-row input { flex: 1; min-width: 0; accent-color: var(--link); }
.bard-volume-row .icon { width: 16px; height: 16px; flex: none; }
.bard-fade-row output { min-width: 3ch; text-align: right; }
.bard-error { margin: 0; font-size: 12.5px; color: var(--warn); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bard-error .tab { border: 1px solid var(--border); border-radius: 9px; padding: 4px 10px; font-size: 12.5px; }

/* Browse / Queue */
.bard-views.tabs { display: flex; flex: none; }
.bard-views .tab { flex: 1; text-align: center; }
.bard-count { margin-left: 4px; font-variant-numeric: tabular-nums; }
.bard-browse-controls { flex: none; display: flex; flex-direction: column; gap: 10px; }
.bard-browse-controls[hidden], .bard-link-form[hidden] { display: none; }
.bard-input { flex: 1; min-width: 0; width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font: inherit; font-size: 14px; }
.bard-input::placeholder { color: var(--faint); }
.bard-link-form { flex: none; display: flex; gap: 8px; }
.bard-link-form .tab { flex: none; border: 1px solid var(--border); border-radius: 10px; padding: 0 14px; }
.bard-toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.bard-toolbar-row .tab { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 9px; padding: 6px 11px; font-size: 12.5px; }
.bard-toolbar-row .tab[disabled] { opacity: 0.5; cursor: default; }
.bard-toolbar-row .icon { width: 15px; height: 15px; }

/* One track: the star and queue buttons sit inside the card. */
/* Seven cards or so tall, then it scrolls inside its own box (less on a short screen). */
.bard-list { flex: none; display: flex; flex-direction: column; gap: 8px; max-height: min(450px, 48dvh); overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
.bard-card { display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px 4px; border-radius: 12px; border: 1.5px solid var(--border-soft); background: var(--panel-2); }
.bard-card.playing { border-color: var(--link); }
.bard-card-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; border: 0; border-radius: 9px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.bard-card-main:hover, .bard-card-main:focus-visible { background: var(--tint-1); }
.bard-card-icon { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--tint-1); color: var(--warn); }
.bard-card.playing .bard-card-icon { color: var(--link); }
.bard-card-icon .icon { width: 16px; height: 16px; }
.bard-card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.bard-card-title { font-size: 14px; font-weight: 700; }
.bard-card-sub { font-size: 12px; color: var(--muted); }
.bard-card-actions { display: flex; gap: 2px; flex: none; }
.bard-card-btn { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 9px; background: none; color: var(--muted); cursor: pointer; }
.bard-card-btn:hover:not([disabled]), .bard-card-btn:focus-visible { background: var(--tint-2); color: var(--text); }
.bard-card-btn.on { color: var(--warn); }
.bard-card-btn.queued { color: var(--good); }
.bard-card-btn[disabled] { cursor: default; }
.bard-card-btn .icon { width: 17px; height: 17px; }
.bard-link-form input[disabled] { opacity: 0.6; }
.bard-link-form .tab[disabled] { opacity: 0.5; cursor: default; }

/* Who is the Bard */
.bard-card-main.static { cursor: default; }
.bard-card-main.static:hover { background: none; }

/* A chunk of rows sits in the list as if its rows were direct children (so the gap applies). */
.bard-chunk { display: contents; }
.bard-more { flex: none; height: 1px; }

/* Mood chips: an even grid, three to a row, so none sits alone. */
.bard-filters { flex: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.bard-filters .tab { min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 4px; border: 1px solid var(--border); border-radius: 9px; font-size: 12.5px; white-space: nowrap; }
.bard-filters .tab .icon { width: 14px; height: 14px; flex: none; }
.bard-filters .tab span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* An odd chip out on the last row takes the whole row instead of sitting alone. */
.bard-filters .tab:last-child:nth-child(3n + 1) { grid-column: 1 / -1; }
.bard-filters .tab + .tab { border-left: 1px solid var(--border); }
.bard-filters .tab.active { border-color: transparent; }

/* Bardcast, on a screen that's listening */
.bard-cast { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; border: 1.5px solid var(--border-soft); background: var(--panel-2); }
.bard-cast-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bard-cast-head .tab { border: 1px solid var(--border); border-radius: 9px; padding: 4px 10px; font-size: 12.5px; }
.bard-cast-head .tab.active { border-color: transparent; }
.bard-cast-line { font-size: 13px; color: var(--muted); }
.bard-cast-hint { margin: 0; font-size: 12px; }

/* The Bard tab's header: title (hover for who and where) and, at the right, your buttons. */
.tray-head:has(.bard-title) { justify-content: space-between; }
.bard-title { position: relative; flex: none; cursor: help; outline: none; }
.bard-title:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 6px; }
.bard-head-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.bard-head-actions:empty { display: none; }
.bard-head-actions .tab { border: 1px solid var(--border); border-radius: 9px; padding: 4px 10px; font-size: 12.5px; white-space: nowrap; }
.bard-head-actions .tab.active, .bard-head-actions .tab[aria-pressed="true"] { border-color: transparent; }
.bard-who { position: absolute; left: 0; top: calc(100% + 8px); z-index: 6; width: max-content; min-width: 210px; max-width: min(320px, 78vw); padding: 10px 12px; border-radius: 10px; background: var(--tooltip-bg); border: 1px solid var(--border); box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45); color: var(--text); font-size: 12.5px; font-weight: 500; line-height: 1.45; cursor: default;
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.16s ease-in-out, visibility 0s 0.16s; }
.bard-title:hover .bard-who, .bard-title:focus .bard-who, .bard-title:focus-within .bard-who { opacity: 1; visibility: visible; transition: opacity 0.16s ease-in-out, visibility 0s; }
.bard-who-row { display: flex; justify-content: space-between; gap: 16px; }
.bard-who-row span { color: var(--muted); }
.bard-who-row b { font-weight: 700; text-align: right; }
.bard-who p { margin: 6px 0 0; color: var(--muted); font-weight: 400; }

/* "What's happening?": a scene in words, and the tracks suggested for it. */
.bard-scene-form { flex: none; display: flex; gap: 8px; }
.bard-scene-form .tab { flex: none; border: 1px solid var(--border); border-radius: 10px; padding: 0 14px; }
#bard-scene-results { display: flex; flex-direction: column; gap: 8px; }
#bard-scene-results:empty { display: none; }
.bard-scene-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.bard-scene-head .tab { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 9px; padding: 5px 10px; font-size: 12.5px; }
.bard-scene-head .tab[disabled] { opacity: 0.5; cursor: default; }
.bard-scene-head .icon { width: 15px; height: 15px; }
.bard-card-why { font-size: 12px; color: var(--link); }

/* Hide the video, keep the sound. */
.bard-now-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bard-video-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
.bard-video-toggle:hover, .bard-video-toggle:focus-visible { color: var(--text); background: var(--tint-1); }
.bard-video-toggle .icon { width: 14px; height: 14px; }
.bard-cast-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.bard-cast-hint .tab { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 9px; padding: 3px 9px; font-size: 12.5px; margin-right: 6px; }
.bard-cast-hint .tab .icon { width: 13px; height: 13px; }

/* The popup's card titles use the display font, like the party name. */
.bard-card-title, .bard-now-name, .handout-text b, .tray-title, .dice-tray .ctl-text > b { font-family: var(--display); font-weight: 700; letter-spacing: 0.01em; }

/* Fight music: autoplay switch and the picks for when a fight starts and ends. */
.bard-auto { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: 12px; border: 1.5px solid var(--border-soft); background: var(--panel-2); }
.bard-auto[hidden] { display: none; }
.bard-auto-head, .bard-auto-row { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; }
.bard-auto-head { justify-content: space-between; }
.bard-auto-head b { font-family: var(--display); }
.bard-auto .tab { border: 1px solid var(--border); border-radius: 9px; padding: 3px 9px; font-size: 12.5px; white-space: nowrap; flex: none; }
.bard-auto .tab.active { border-color: transparent; }
.bard-auto-label { flex: none; width: 82px; color: var(--muted); }
.bard-auto-pick { flex: 1; min-width: 0; }
.bard-auto-hint { margin: 0; font-size: 12px; color: var(--link); }

/* The DM's "Pick the Bard…" menu, sized like the other header buttons. */
.bard-head-actions select.bard-assign { appearance: none; max-width: 150px; padding-right: 10px; background-color: transparent; color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer; }
.bard-head-actions select.bard-assign option { color: #000; }

.bard-auto-hint .tab { margin-left: 6px; }
