/* Takes — justified grid, full-screen viewer, Takes / Favorites library. Classes are prefixed tk-. */

/* ---------- justified grid ----------
   The grid's own width (a container query on .tk-wrap) picks a column count: about 300 px per 16:9 tile in
   the large size, about 190 px in compact. --tk-unit is the width of one 16:9 tile so that exactly --tk-cols
   of them fill a row. Every tile's flex-basis and flex-grow are proportional to its aspect ratio (--tk-ar),
   so a row of mixed ratios still shares one height and fills edge to edge; the ::after filler soaks up the
   last row, which therefore keeps the same tile size as the rows above. (At 1440 px with the sidebar open
   the grid is ~1110 px wide: 4 tiles of ~270 px, or 6 of ~178 px in compact.) */
.tk-wrap { container: tk-wrap / inline-size; position: relative; width: 100%; min-width: 0; }
.tk-grid {
  --tk-cols: 1; --tk-gap: 12px;
  --tk-unit: calc((100cqw - (var(--tk-cols) - 1) * var(--tk-gap)) / var(--tk-cols) - .5px);
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--tk-gap); min-width: 0;
}
.tk-grid::after { content: ""; flex: 1000 1 0px; height: 0; }
.tk-wrap.tk-sm .tk-grid { --tk-gap: 8px; --tk-cols: 1; }
@container tk-wrap (min-width: 456px)  { .tk-grid { --tk-cols: 2; } }
@container tk-wrap (min-width: 768px)  { .tk-grid { --tk-cols: 3; } }
@container tk-wrap (min-width: 1080px) { .tk-grid { --tk-cols: 4; } }
@container tk-wrap (min-width: 1392px) { .tk-grid { --tk-cols: 5; } }
@container tk-wrap (min-width: 1704px) { .tk-grid { --tk-cols: 6; } }
@container tk-wrap (min-width: 2016px) { .tk-grid { --tk-cols: 7; } }
@container tk-wrap (min-width: 289px)  { .tk-wrap.tk-sm .tk-grid { --tk-cols: 2; } }
@container tk-wrap (min-width: 487px)  { .tk-wrap.tk-sm .tk-grid { --tk-cols: 3; } }
@container tk-wrap (min-width: 685px)  { .tk-wrap.tk-sm .tk-grid { --tk-cols: 4; } }
@container tk-wrap (min-width: 883px)  { .tk-wrap.tk-sm .tk-grid { --tk-cols: 5; } }
@container tk-wrap (min-width: 1081px) { .tk-wrap.tk-sm .tk-grid { --tk-cols: 6; } }
@container tk-wrap (min-width: 1279px) { .tk-wrap.tk-sm .tk-grid { --tk-cols: 7; } }
@container tk-wrap (min-width: 1477px) { .tk-wrap.tk-sm .tk-grid { --tk-cols: 8; } }
@container tk-wrap (min-width: 1675px) { .tk-wrap.tk-sm .tk-grid { --tk-cols: 9; } }
@container tk-wrap (min-width: 1873px) { .tk-wrap.tk-sm .tk-grid { --tk-cols: 10; } }

.tk-tile {
  --tk-ar: 1.7778;
  container: tk-tile / inline-size;
  position: relative; flex: var(--tk-ar) 1 calc(var(--tk-ar) / 1.7778 * var(--tk-unit)); aspect-ratio: var(--tk-ar);
  /* a lone narrow tile (a portrait take that wraps by itself) may not balloon to fill a whole row */
  min-width: 0; max-width: min(100%, calc(var(--tk-ar) / 1.7778 * var(--tk-unit) * 1.6));
  border-radius: var(--r-lg); background: #03080e;
  box-shadow: 0 0 0 1px var(--line), var(--shadow-sm);
  transition: box-shadow var(--t), transform var(--t);
}
.tk-tile:hover, .tk-tile:focus-within { z-index: 2; box-shadow: 0 0 0 1px var(--line-2), 0 18px 40px rgba(0, 0, 0, .55); }
.tk-tile.skeleton { box-shadow: none; border-radius: var(--r-lg); }
.tk-wrap.tk-sm .tk-tile { border-radius: var(--r); }

.tk-media { position: absolute; inset: 0; border-radius: inherit; }
.tk-media > .tk-img { width: 100%; height: 100%; object-fit: cover; }
.tk-tile:hover .tk-media > .tk-img { transform: scale(1.03); }
.tk-rev-rejected .tk-media > .tk-img { filter: grayscale(.75) brightness(.55); transition: filter .3s, transform .5s var(--ease), opacity .3s; }
.tk-rev-rejected:hover .tk-media > .tk-img { filter: grayscale(.3) brightness(.85); }
.tk-rev-approved { box-shadow: 0 0 0 1px rgba(143, 224, 181, .38), var(--shadow-sm); }
.tk-is-hero { box-shadow: 0 0 0 1px rgba(201, 160, 99, .7), 0 0 0 4px rgba(201, 160, 99, .12), var(--shadow-sm); }

/* the whole tile opens the viewer */
.tk-hit { position: absolute; inset: 0; z-index: 1; padding: 0; border: 0; border-radius: inherit; background: none; cursor: zoom-in; }
.tk-hit:focus-visible { outline: 2px solid var(--bronze); outline-offset: 2px; }

.tk-scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; border-radius: inherit; opacity: .55;
  background: linear-gradient(180deg, rgba(2, 5, 9, .62) 0%, rgba(2, 5, 9, 0) 30%, rgba(2, 5, 9, 0) 52%, rgba(2, 5, 9, .92) 100%);
  transition: opacity var(--t);
}
.tk-tile:hover .tk-scrim, .tk-tile:focus-within .tk-scrim { opacity: 1; }

.tk-badges { position: absolute; z-index: 2; top: 9px; left: 9px; right: 96px; display: flex; flex-wrap: wrap; gap: 5px; pointer-events: none; }
.tk-badges .badge { height: 21px; }
.tk-wrap.tk-sm .tk-badges { top: 6px; left: 6px; right: 40px; gap: 3px; }
.tk-wrap.tk-sm .tk-badges .badge { height: 19px; padding: 0 6px; font-size: 9.5px; }

/* hover actions (top right). A favourited heart stays visible. They never reach past the tile's own edge. */
.tk-actions { position: absolute; z-index: 3; top: 8px; right: 8px; display: flex; gap: 5px; max-width: calc(100% - 16px); }
.tk-wrap.tk-sm .tk-actions { top: 5px; right: 5px; gap: 3px; max-width: calc(100% - 10px); }
.tk-actions > *, .tk-quick { opacity: 0; transform: translateY(-3px); transition: opacity var(--t), transform var(--t); }
.tk-quick { transform: translateY(3px); }
.tk-tile:hover .tk-actions > *, .tk-tile:focus-within .tk-actions > *, .tk-tile:hover .tk-quick, .tk-tile:focus-within .tk-quick, .tk-actions > .tk-fav.on { opacity: 1; transform: none; }
.tk-ibtn {
  width: 30px; height: 30px; display: inline-grid; place-items: center; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line-2); background: rgba(2, 5, 9, .68); color: var(--pearl); backdrop-filter: blur(8px);
  transition: background var(--t), color var(--t), border-color var(--t);
}
.tk-ibtn:hover:not(:disabled) { background: rgba(15, 33, 53, .92); border-color: rgba(201, 160, 99, .55); color: var(--bronze-hi); }
.tk-ibtn:disabled { opacity: .5; cursor: progress; }
.tk-wrap.tk-sm .tk-ibtn { width: 26px; height: 26px; }
.tk-fav.on { color: var(--bronze-hi); border-color: rgba(201, 160, 99, .55); background: rgba(26, 18, 6, .7); }
.tk-fav.on svg { fill: currentColor; }
.tk-rv.approved.on { color: #0b1f15; background: var(--ok); border-color: transparent; }
.tk-rv.rejected.on { color: #fff; background: var(--blood); border-color: transparent; }
.tk-rv.approved:hover:not(.on) { color: var(--ok); border-color: rgba(143, 224, 181, .55); }
.tk-rv.rejected:hover:not(.on) { color: #f3a39b; border-color: rgba(196, 72, 63, .6); }

/* Narrow tiles (portrait takes, compact size): keep only the heart (and Cancel) up top, the badges below it,
   and smaller review buttons. The tile itself still opens the take and the viewer has Download. */
@container tk-tile (max-width: 150px) {
  .tk-wrap .tk-tile .tk-actions { top: 5px; right: 5px; gap: 3px; max-width: calc(100% - 10px); }
  .tk-wrap .tk-actions > .tk-dl, .tk-wrap .tk-actions > .tk-open { display: none; }
  .tk-wrap .tk-tile .tk-ibtn { width: 26px; height: 26px; }
  .tk-wrap .tk-tile .tk-badges { top: 36px; left: 5px; right: 5px; gap: 3px; }
  .tk-wrap .tk-tile .tk-badges .badge { height: 19px; padding: 0 5px; font-size: 9.5px; }
  .tk-wrap .tk-tile .tk-mock { display: none; }
  .tk-wrap .tk-tile .tk-info { padding: 6px; gap: 4px; }
  .tk-wrap .tk-tile .tk-quick { gap: 3px; }
  .tk-wrap .tk-tile .tk-live-core small, .tk-wrap .tk-tile .tk-fail small { display: none; }
}
/* Very narrow (a portrait take in compact size): the viewer is where these live. */
@container tk-tile (max-width: 96px) {
  .tk-wrap .tk-tile .tk-info-text, .tk-wrap .tk-tile .tk-quick, .tk-wrap .tk-actions > .tk-cancel { display: none; }
}

/* bottom info (prompt + who/when) */
.tk-info { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; display: flex; align-items: flex-end; gap: 10px; padding: 10px 11px; pointer-events: none; }
.tk-info-text { flex: 1; min-width: 0; opacity: 0; transform: translateY(4px); transition: opacity var(--t), transform var(--t); }
.tk-tile:hover .tk-info-text, .tk-tile:focus-within .tk-info-text { opacity: 1; transform: none; }
.tk-info-text p { font-size: 12.5px; line-height: 1.4; color: var(--pearl); text-shadow: 0 1px 8px rgba(0, 0, 0, .8); }
.tk-info-text small { display: block; margin-top: 4px; font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-quick { display: flex; gap: 5px; pointer-events: auto; }
.tk-wrap.tk-sm .tk-info { padding: 6px 7px; }

/* live tiles: queued / running */
.tk-live {
  position: absolute; inset: 0; overflow: hidden; display: grid; place-items: center; border-radius: inherit;
  background: radial-gradient(ellipse at 50% 115%, rgba(159, 211, 224, .14), transparent 62%), linear-gradient(180deg, var(--tide), var(--abyss));
}
.tk-live::before {
  content: ""; position: absolute; left: 0; right: 0; height: 45%; top: -45%;
  background: linear-gradient(180deg, rgba(159, 211, 224, 0), rgba(159, 211, 224, .13) 60%, rgba(191, 243, 255, .32) 98%, rgba(191, 243, 255, 0));
  animation: tk-scan 2.4s cubic-bezier(.45, .05, .55, .95) infinite;
}
.tk-live::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .018) 0 1px, transparent 1px 3px); pointer-events: none; }
.tk-live.queued::before { animation-duration: 4.5s; opacity: .45; }
.tk-live-core { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 10px; }
.tk-live-core .eyebrow { color: var(--lure); }
.tk-live-core small { color: var(--muted); font-size: 11px; }
.tk-wrap.tk-sm .tk-live-core .eyebrow { font-size: 9px; }
@keyframes tk-scan { to { top: 100%; } }

.tk-fail {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 16px; text-align: center; border-radius: inherit;
  background: radial-gradient(ellipse at 50% 0%, rgba(196, 72, 63, .16), transparent 65%), linear-gradient(180deg, #0b0f17, #05070c); color: #f08a82;
}
.tk-fail.cancelled { color: var(--muted); background: linear-gradient(180deg, #08111b, #03070c); }
.tk-fail .eyebrow { color: inherit; }
.tk-fail small { color: var(--muted); font-size: 11.5px; max-width: 34ch; }
.tk-wrap.tk-sm .tk-fail small { display: none; }

.tk-state:empty { display: none; }
.tk-state .tk-skel { margin-bottom: 0; }
.tk-err { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tk-err.inline { margin-bottom: 12px; }
.tk-foot { display: flex; justify-content: center; padding: 22px 0 6px; }
.tk-more { min-width: 160px; }
.spinner.tk-spin-sm { width: 14px; height: 14px; border-width: 2px; }
.tk-pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--shaft); box-shadow: 0 0 0 0 rgba(159, 211, 224, .6); animation: tk-pulse 1.6s ease-out infinite; }
@keyframes tk-pulse { 70% { box-shadow: 0 0 0 7px rgba(159, 211, 224, 0); } 100% { box-shadow: 0 0 0 0 rgba(159, 211, 224, 0); } }

/* prompt text with @tags */
.tk-tag { border-radius: 4px; font-family: var(--mono); font-size: .9em; }
.tk-tag.known { background: rgba(116, 173, 155, .14); color: var(--verdigris); padding: 0 3px; }
.tk-tag.unknown { color: #f3a39b; text-decoration: underline wavy rgba(196, 72, 63, .8); text-underline-offset: 3px; }

/* ---------- full-screen viewer ---------- */
.overlay.tk-vw-overlay { padding: 0; place-items: stretch; background: rgba(1, 2, 4, .94); backdrop-filter: blur(10px); }
.overlay.tk-vw-overlay > .modal.tk-vw {
  max-width: none; width: 100vw; height: 100vh; height: 100dvh; max-height: none; border: 0; border-radius: 0; box-shadow: none;
  background: radial-gradient(ellipse at 40% 0%, rgba(20, 54, 80, .22), transparent 55%), var(--abyss); animation: fade .2s ease both;
}
.tk-vw:focus { outline: none; }
.tk-vw > .modal-head { flex: none; padding: 10px 14px 10px 20px; gap: 12px; border-bottom: 1px solid var(--line); background: rgba(2, 5, 9, .7); }
.tk-vw > .modal-head h2 { flex: none; font-size: 15px; letter-spacing: .12em; }
.tk-vw-bar { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.tk-vw-badges { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.tk-vw-nav { display: flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: rgba(2, 5, 9, .5); }
.tk-vw-count { min-width: 64px; text-align: center; color: var(--muted); font-size: 11.5px; }
.tk-vw-count:empty { display: none; }
.tk-vw-nav:has(.tk-vw-count:empty) { display: none; }
.tk-vw-tools { display: flex; align-items: center; gap: 2px; }
.tk-vw-fav.on { color: var(--bronze-hi); }
.tk-vw-fav.on svg { fill: currentColor; }
.tk-vw-bar > .btn[aria-pressed="true"] { color: var(--bronze-hi); }

.tk-vw > .modal-body { flex: 1; min-height: 0; padding: 0; overflow: hidden; display: flex; }
.tk-vw-body { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 420px; grid-template-rows: minmax(0, 1fr); }
.tk-vw-body.no-side { grid-template-columns: minmax(0, 1fr); }
.tk-vw-body.no-side .tk-vw-side { display: none; }
.tk-vw-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }

.tk-vw-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.tk-vw-frame { position: absolute; inset: 24px 76px; display: flex; align-items: center; justify-content: center; }
.tk-vw-media { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 6px; background: #000; box-shadow: 0 40px 90px rgba(0, 0, 0, .7), 0 0 0 1px rgba(159, 211, 224, .08); animation: fade .25s ease both; transition: opacity .3s; }
img.tk-vw-media[data-loading] { opacity: 0; }
.tk-vw-live { position: relative; inset: auto; width: min(100%, 960px); max-height: 100%; aspect-ratio: var(--tk-ar, 1.7778); border-radius: 10px; box-shadow: 0 0 0 1px var(--line); }
.tk-vw-live .tk-live-core { gap: 10px; }
.tk-vw-live .tk-live-core p { font-size: 12.5px; max-width: 38ch; }
.tk-vw-live .eyebrow { font-size: 12px; }
.tk-vw-msg { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; color: var(--muted); max-width: 440px; }
.tk-vw-msg h3 { font: 500 17px var(--display); letter-spacing: .08em; color: var(--pearl); }
.tk-vw-msg.fail > .icon { color: #f08a82; }

.tk-vw-arrow {
  position: absolute; top: 50%; z-index: 2; width: 46px; height: 46px; margin-top: -23px; display: grid; place-items: center; padding: 0; cursor: pointer;
  border-radius: 50%; border: 1px solid var(--line-2); background: rgba(2, 5, 9, .55); color: var(--pearl); backdrop-filter: blur(8px);
  opacity: .55; transition: opacity var(--t), background var(--t), border-color var(--t), color var(--t);
}
.tk-vw-arrow.prev { left: 16px; } .tk-vw-arrow.next { right: 16px; }
.tk-vw-stage:hover .tk-vw-arrow, .tk-vw-arrow:focus-visible { opacity: 1; }
.tk-vw-arrow:hover { background: rgba(15, 33, 53, .9); border-color: rgba(201, 160, 99, .55); color: var(--bronze-hi); }

.tk-vw-strip { flex: none; display: flex; gap: 6px; padding: 10px 16px 12px; overflow-x: auto; overflow-y: hidden; border-top: 1px solid var(--line); background: rgba(2, 5, 9, .65); scrollbar-width: thin; }
.tk-vw-ti { flex: none; display: flex; }
.tk-vw-thumb {
  --tk-ar: 1.7778; position: relative; flex: none; height: 46px; aspect-ratio: var(--tk-ar); max-width: 110px; padding: 0; overflow: hidden; cursor: pointer;
  border: 1px solid var(--line); border-radius: 6px; background: #03080e; opacity: .55; transition: opacity var(--t), border-color var(--t), transform var(--t);
}
.tk-vw-thumb > img { width: 100%; height: 100%; object-fit: cover; }
.tk-vw-thumb > img[data-loading] { opacity: 0; }
.tk-vw-thumb:hover { opacity: .9; }
.tk-vw-thumb.on { opacity: 1; border-color: var(--bronze); box-shadow: 0 0 0 1px var(--bronze), 0 6px 16px rgba(0, 0, 0, .5); }
.tk-vw-thumb-ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); }
.tk-vw-thumb-dot { position: absolute; right: 4px; bottom: 4px; width: 7px; height: 7px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(2, 5, 9, .8); }
.tk-vw-thumb-dot.ok { background: var(--ok); } .tk-vw-thumb-dot.danger { background: var(--blood); }

/* side panel */
.tk-vw-side { min-height: 0; overflow: auto; padding: 18px 20px 26px; display: flex; flex-direction: column; gap: 22px; border-left: 1px solid var(--line); background: linear-gradient(180deg, rgba(9, 24, 40, .92), rgba(4, 11, 20, .96)); }
.tk-vw-sec { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tk-vw-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.tk-vw-sec-head .eyebrow { color: var(--bronze); }
.tk-vw-review { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.tk-review > button { height: 30px; }
.tk-review > button.rv-approved[aria-pressed="true"] { background: rgba(143, 224, 181, .16); color: var(--ok); box-shadow: inset 0 0 0 1px rgba(143, 224, 181, .45); }
.tk-review > button.rv-rejected[aria-pressed="true"] { background: rgba(196, 72, 63, .2); color: #f6a69e; box-shadow: inset 0 0 0 1px rgba(196, 72, 63, .55); }
.tk-hero-btn.on { border-color: rgba(201, 160, 99, .6); color: var(--bronze-hi); background: var(--bronze-dim); }
.tk-hero-btn.on svg { fill: currentColor; }

.tk-prompt { margin: 0; font: 14px/1.62 var(--sans); color: var(--pearl); white-space: pre-wrap; word-break: break-word; max-height: 300px; overflow: auto; padding-right: 4px; }
.tk-note { font-size: 11.5px; }
.tk-vw-details { border: 1px solid var(--line); border-radius: var(--r); background: rgba(2, 5, 9, .35); }
.tk-vw-details > summary { cursor: pointer; padding: 9px 12px; color: var(--muted); font-size: 12.5px; list-style: none; display: flex; align-items: center; gap: 4px; }
.tk-vw-details > summary::-webkit-details-marker { display: none; }
.tk-vw-details > summary::before { content: "▸"; color: var(--faint); transition: transform var(--t); display: inline-block; margin-right: 4px; }
.tk-vw-details[open] > summary::before { transform: rotate(90deg); }
.tk-vw-details > summary:hover { color: var(--ink); }
.tk-vw-details > .code { margin: 0 10px 8px; max-height: 320px; }
.tk-vw-details > .btn { margin: 0 10px 10px; }
.tk-vw-shot { font-size: 17px; line-height: 1.4; color: #cfdde2; }

.tk-refs { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 10px; }
.tk-ref { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tk-ref-thumb { display: block; width: 100%; aspect-ratio: 4 / 5; padding: 0; border: 1px solid var(--line); cursor: default; }
button.tk-ref-thumb { cursor: pointer; }
button.tk-ref-thumb:hover { border-color: rgba(201, 160, 99, .55); }
button.tk-ref-thumb:hover > img { transform: scale(1.04); }
.tk-ref-ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); }
.tk-ref-kind { position: absolute; top: 5px; left: 5px; height: 18px; padding: 0 5px; }
.tk-ref figcaption { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tk-ref figcaption .eyebrow { font-size: 9.5px; }
.tk-ref-tag { font-size: 11px; color: var(--verdigris); }

.tk-kv { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 7px 14px; margin: 0; font-size: 13px; }
.tk-kv dt { font: 500 10px/1.9 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.tk-kv dd { margin: 0; min-width: 0; color: var(--ink); overflow-wrap: anywhere; }
.tk-crumbs a { color: var(--shaft); } .tk-crumbs a:hover { color: var(--lure); }
.tk-warn-text { color: var(--warn); }

.tk-dir { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tk-dir-item { display: flex; flex-direction: column; gap: 4px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r); background: rgba(2, 5, 9, .35); min-width: 0; }
.tk-dir-item .eyebrow { font-size: 9.5px; color: var(--faint); }
.tk-dir-name { display: flex; align-items: center; gap: 7px; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-swatches { display: inline-flex; flex: none; }
.tk-swatches i { width: 11px; height: 11px; border-radius: 50%; margin-right: -3px; box-shadow: 0 0 0 1.5px #071422; }

.tk-vw-danger { display: flex; gap: 8px; flex-wrap: wrap; }
.tk-vw-keys { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); color: var(--faint); font-size: 11.5px; }

/* ---------- library page ---------- */
.tk-lib-tag { font-size: 17px; line-height: 1.4; }
.tk-stats { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tk-stat { display: inline-flex; align-items: baseline; gap: 6px; height: 34px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line); background: rgba(2, 5, 9, .45); }
.tk-stat b { font: 500 15px var(--mono); color: var(--pearl); }
.tk-stat .eyebrow { font-size: 9.5px; }
.tk-stat.ok b { color: var(--ok); }
.tk-stats .badge.info { height: 34px; padding: 0 12px; border-radius: var(--r); }
.tk-toolbar { z-index: 7; }
.tk-count { font-size: 11.5px; }

.tk-ef { position: relative; display: flex; align-items: center; }
.tk-ef .input.search { width: 240px; min-height: 34px; height: 34px; padding-top: 0; padding-bottom: 0; }
.tk-ef-chip-host:empty { display: none; }
.tk-ef-chip { padding-left: 4px; padding-right: 4px; max-width: 320px; cursor: default; }
.tk-ef-chip-thumb { width: 20px; height: 20px; border-radius: 50%; flex: none; }
.tk-ef-x { display: grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 50%; padding: 0; background: rgba(201, 160, 99, .18); color: var(--bronze-hi); cursor: pointer; }
.tk-ef-x:hover { background: rgba(201, 160, 99, .35); }
.tk-ef-pop {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: 340px; max-width: calc(100vw - 32px); max-height: 360px; overflow: auto; padding: 5px;
  background: #0b1b2c; border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); animation: rise .14s var(--ease) both;
}
.tk-ef-title { padding: 7px 9px 5px; font-size: 9.5px; }
.tk-ef-opt { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.tk-ef-opt.active { background: rgba(159, 211, 224, .1); }
.tk-ef-thumb { width: 34px; height: 34px; flex: none; border-radius: 8px; display: grid; place-items: center; color: var(--faint); }
.tk-ef-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tk-ef-text b { font-weight: 500; font-size: 13px; }
.tk-ef-text .mono { font-size: 11px; color: var(--verdigris); }
.tk-ef-none { padding: 14px 10px; font-size: 12.5px; }

/* ---------- small screens ---------- */
@media (max-width: 1100px) {
  .tk-vw-body { grid-template-columns: minmax(0, 1fr) 360px; }
  .tk-hide-sm { display: none; }
}
@media (max-width: 900px) {
  .tk-vw > .modal-head { padding: 8px 10px 8px 14px; flex-wrap: wrap; }
  .tk-vw > .modal-body { overflow: auto; display: block; }
  .tk-vw-body, .tk-vw-body.no-side { display: flex; flex-direction: column; }
  /* details always sit under the stage here, so the Details toggle (and its I hint) would do nothing */
  .tk-vw-body.no-side .tk-vw-side { display: flex; }
  .tk-vw-sidebtn, .tk-vw-key-i { display: none; }
  .tk-vw-main { flex: none; }
  .tk-vw-stage { flex: none; height: 58vh; height: 58dvh; }
  .tk-vw-frame { inset: 10px 10px; }
  .tk-vw-arrow { width: 38px; height: 38px; margin-top: -19px; opacity: .85; }
  .tk-vw-arrow.prev { left: 6px; } .tk-vw-arrow.next { right: 6px; }
  .tk-vw-side { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .tk-vw-badges { display: none; }
  .tk-ef .input.search { width: 100%; }
  .tk-ef { flex: 1 1 200px; }
  .tk-toolbar .seg { overflow-x: auto; max-width: 100%; }
}
@media (hover: none) {
  /* touch: show actions without hover */
  .tk-actions > *, .tk-quick { opacity: 1; transform: none; }
  .tk-scrim { opacity: .9; }
}
