/* Pop-out overlay: an opaque window background, because OBS Window Capture cannot see transparency.
   Crop to the card, or key out the green/magenta background (?bg=green, ?bg=magenta). */
html:has(.local-overlay), .local-overlay { background:#14181f; }
html:has(.local-overlay[data-bg="green"]), .local-overlay[data-bg="green"] { background:#00ff00; }
html:has(.local-overlay[data-bg="magenta"]), .local-overlay[data-bg="magenta"] { background:#ff00ff; }
.local-overlay { overflow:hidden; }

.local-overlay:not([data-layout="live"], [data-layout="chart"], [data-layout="items"]) #card { height:auto; }
.local-overlay:is([data-layout="card"], [data-layout="bar"], [data-layout="rates"]) #card { padding-bottom:8px; }
.local-overlay[data-layout="chart"] .hour-chart { padding-bottom:12px; }

/* Live layout (local only): big EXP/hour, time to next level, a thin progress bar, the live EXP line and
   a row of mesos/hour, % of level and EXP. */
.live-panel { display:none; }
[data-layout="live"] #card { width:360px; height:290px; }
[data-layout="live"] :is(.reading, .general-stats, .rate-stats, .hour-chart) { display:none; }
[data-layout="live"] .live-panel { display:flex; flex-direction:column; gap:7px; flex:1; min-height:0; padding:10px 14px 12px; font-variant-numeric:tabular-nums; }
.live-top { display:flex; justify-content:space-between; align-items:flex-end; gap:10px; }
.live-rate strong { display:block; color:var(--text); font:600 40px/1 "Fredoka", sans-serif; }
.live-eta { text-align:right; }
.live-eta strong { display:block; color:var(--bar); font:600 21px/1 "Fredoka", sans-serif; }
.live-panel span { display:block; margin-top:3px; color:var(--muted); font-size:11px; font-weight:700; }
#live-progress { height:8px; border-radius:4px; }
#live-chart { display:block; width:100%; flex:1; min-height:0; --stroke:var(--graph); --grid:var(--line); --tip:var(--badge); --label:var(--ink); }
.live-stats { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); padding-top:7px; border-top:1px solid var(--line); }
.live-stats > div + div { padding-left:10px; border-left:1px solid var(--line); }
.live-stats strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text); font:600 18px/1.1 "Fredoka", sans-serif; }

/* Items layout (local only): icons and counts of the items picked up in the last 24 hours. */
.items-panel { display:none; }
[data-layout="items"] #card { width:360px; height:193px; }  /* Fits the 370 x 203 window with every slot shown. */
[data-layout="items"] :is(.reading, .general-stats, .rate-stats, .hour-chart) { display:none; }
[data-layout="items"] .items-panel { display:flex; flex-direction:column; gap:6px; flex:1; min-height:0; padding:8px 12px 12px; }
/* An item whose count just went up glows in the theme's accent for a moment. */
.items-grid li.bumped { animation:item-bump 1.2s ease-out both; }
@keyframes item-bump { 0% { transform:scale(1.12); box-shadow:0 0 0 2px var(--accent), 0 0 12px color-mix(in srgb, var(--accent) 60%, transparent); } 100% { transform:none; box-shadow:0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .items-grid li.bumped { animation-duration:.01s; } }
.items-caption { display:flex; justify-content:space-between; color:var(--muted); font-size:11px; font-weight:700; }
.items-caption strong { color:var(--text); }
.items-grid { display:flex; flex-wrap:wrap; align-content:flex-start; gap:6px; flex:1; min-height:0; margin:0; padding:0; overflow:hidden; list-style:none; }
.items-grid li { display:flex; align-items:center; gap:2px; padding:2px 7px 2px 2px; border-radius:8px; background:var(--badge); }
.items-grid .icon { width:32px; height:32px; flex:none; background-repeat:no-repeat; image-rendering:pixelated; }
.items-grid strong { color:var(--text); font:600 13px/1 "Fredoka", sans-serif; font-variant-numeric:tabular-nums; }
/* An empty slot: a faint pill the size of one item, so the overlay keeps its size with few items. */
.items-grid .items-slot { width:62px; height:32px; padding:2px; background:var(--badge); opacity:.3; }
/* An empty header (no title, no name) is half height; the fixed-height layouts are as much shorter, so their
   contents keep their size (view.js overlaySize takes the same 14 px off the window). */
.local-overlay[data-compact="true"] header { height:14px; }
.local-overlay[data-compact="true"][data-layout="chart"] #card { height:156px; }
.local-overlay[data-compact="true"][data-layout="live"] #card { height:276px; }
.local-overlay[data-compact="true"][data-layout="items"] #card { height:179px; }
/* No background (?bg=none): the card fills the window edge to edge, a plain rectangle (keying out a background
   took bits of item icons with it). */
.local-overlay[data-bg="none"] #card { width:100vw; height:100vh; margin:0; border:0; border-radius:0; box-shadow:none; box-sizing:border-box; }
/* Tells viewers this overlay is the local tracker, not the Twitch one: a quiet "/local" pill after the site name,
   in the header's own ink (the Twitch overlay has none). Hidden with the title. */
.local-tag { flex:none; margin-left:-2px; padding:1px 5px 2px; border-radius:999px; background:#0000002e;
  font:600 10px/1 "Fredoka", sans-serif; letter-spacing:.3px; opacity:.85; white-space:nowrap; }
[data-header-ink="dark"] .local-tag { background:#ffffff4d; }
[data-title="none"] .local-tag { display:none; }

.live-rate { min-width:0; }
.live-rate strong[data-size="long"] { font-size:30px; }
.live-panel span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
