/* HiruAI Media workspace: analysis/library views, library cards, dialogs and mobile dock. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Signed-in users go straight to their tools: the marketing intro steps aside. */
body.is-signed-in .hiru-studio-intro, body.is-signed-in .trust-strip { display: none; }
body.hiru-cloud.is-signed-in .workspace { padding-top: 28px; }

/* ---------- workspace bar & tabs ---------- */
.studio-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.studio-tabs { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft, #e8f4ef); }
.studio-tabs button { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 18px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 15px; font-weight: 760; white-space: nowrap; transition: background .15s, color .15s, box-shadow .15s; }
.studio-tabs button:hover { color: var(--ink); }
.studio-tabs button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 2px 10px rgba(8, 19, 29, .08); }
.studio-tabs svg, .mobile-dock svg, .primary-action svg, .lib-searchbar svg { width: 20px; height: 20px; flex: none; }
.tab-badge { min-width: 20px; padding: 2px 7px; border-radius: 999px; background: #dfe9e5; color: var(--ink); font-size: 12px; font-weight: 800; line-height: 1.4; text-align: center; }
.tab-badge.busy { background: var(--accent, #0b7f63); color: #fff; }
body.hiru-cloud .studio-bar .account-pill { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; }
body.hiru-cloud .studio-bar .account-pill strong { font-size: 14px; }
body.hiru-cloud .studio-bar .account-pill span { color: var(--accent, #0b7f63); font-weight: 800; }
body.hiru-cloud .studio-bar .account-pill button { margin: 0; min-height: 34px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; background: #f5faf8; color: #45566b; font-size: 13px; }

.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px 28px; flex-wrap: wrap; margin-bottom: 22px; }
.view-head > div:first-child { min-width: 0; max-width: 760px; }
.view-kicker { margin: 0 0 6px; color: var(--accent, #0b7f63); font-size: 13px; font-weight: 800; letter-spacing: .04em; }
body.hiru-cloud .view-head h2 { margin: 0; color: var(--ink); font-size: clamp(22px, 2.4vw, 28px); line-height: 1.3; letter-spacing: -.03em; }
.view-switch { color: var(--blue); font-size: 14px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.view-switch:hover { text-decoration: underline; }
.section-title { margin: 0; color: var(--ink); font-size: 20px; letter-spacing: -.02em; }
body.hiru-cloud #view-analysis .history-section { margin-top: 36px; }

/* ---------- library header ---------- */
.library-lead { margin: 10px 0 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.lib-top-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.lib-usage { display: grid; gap: 6px; min-width: 200px; }
.lib-usage small { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.lib-usage-bar { height: 6px; border-radius: 6px; background: #e3ece8; overflow: hidden; }
.lib-usage-bar i { display: block; height: 100%; width: 0; border-radius: 6px; background: var(--accent, #0b7f63); transition: width .4s ease; }
.lib-usage-bar.warn i { background: #c88a1c; }
.primary-action, .secondary-action { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border: 0; border-radius: 11px; font-size: 15px; font-weight: 780; white-space: nowrap; }
.primary-action { background: var(--navy); color: #fff; box-shadow: 0 8px 20px rgba(8, 19, 29, .16); }
.primary-action:hover { background: var(--navy-soft, #102331); }
.secondary-action { background: #fff; color: var(--ink); border: 1px solid var(--line); }

.lib-upload-tray { display: grid; gap: 8px; margin: 0 0 16px; padding: 14px 16px; border: 1px solid #bfe3d5; border-radius: 12px; background: #eef9f4; }
.lib-upload-tray > div:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.lib-upload-tray strong { color: var(--ink); font-size: 14px; overflow-wrap: anywhere; }
.lib-upload-tray small { color: #3c5a4f; font-size: 13px; }

.lib-searchbar { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border: 1px solid #bac6d5; border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.lib-searchbar:focus-within { border-color: var(--accent, #0b7f63); box-shadow: 0 0 0 4px rgba(11, 127, 99, .12); }
.lib-searchbar svg { color: var(--muted); }
body.hiru-cloud .lib-searchbar input:not([type="checkbox"]):not([type="radio"]):not([type="file"]) { flex: 1; min-width: 0; min-height: 44px; height: 44px; padding: 0 4px; border: 0; box-shadow: none; background: transparent; font-size: 16px; }
.lib-searchbar input::-webkit-search-cancel-button { cursor: pointer; }
body.hiru-cloud .lib-searchbar input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus, body.hiru-cloud .lib-searchbar input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus-visible { outline: none; border: 0; box-shadow: none; }
.lib-searchbar button { min-height: 44px; padding: 0 20px; border: 0; border-radius: 10px; background: var(--navy); color: #fff; font-weight: 780; }
.lib-filters { display: flex; gap: 8px; margin: 14px 0 20px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.lib-filters::-webkit-scrollbar { display: none; }
.lib-filters button { flex: none; min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: #45566b; font-size: 14px; font-weight: 700; }
.lib-filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- search results ---------- */
.lib-results { margin: 0 0 24px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.lib-results-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.lib-results-head strong { color: var(--ink); font-size: 15px; }
.library-search-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 8px; max-height: 480px; overflow-y: auto; }
.lib-moment { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: left; color: var(--ink); font: inherit; }
.lib-moment.item { grid-template-columns: minmax(0, 1fr); }
.lib-moment:hover { border-color: var(--accent, #0b7f63); background: #f7fbf9; }
.lib-moment img { width: 112px; height: 63px; object-fit: cover; border-radius: 8px; background: #e5edf0; }
.lib-moment span { display: grid; gap: 2px; min-width: 0; }
.lib-moment b { color: var(--accent, #0b7f63); font-size: 12px; font-variant-numeric: tabular-nums; }
.lib-moment b.kind-visual { color: var(--violet, #695ba0); }
.lib-moment b.kind-ocr, .lib-moment b.kind-book_page { color: var(--blue); }
.lib-moment strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-moment small { color: var(--muted); font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- cards ---------- */
.library-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.lib-card { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s, transform .15s; }
.lib-card:hover { border-color: #b4cfc4; box-shadow: 0 10px 26px rgba(8, 19, 29, .08); }
.lib-thumb { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 9; padding: 0; border: 0; background: #e5edf0; color: var(--muted); font: inherit; overflow: hidden; }
button.lib-thumb { cursor: pointer; }
.lib-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.lib-card:hover .lib-thumb img { transform: scale(1.03); }
.lib-thumb-label { font-size: 13px; font-weight: 700; }
.lib-duration { position: absolute; right: 8px; bottom: 8px; padding: 2px 7px; border-radius: 6px; background: rgba(8, 19, 29, .78); color: #fff; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lib-thumb-progress { position: absolute; inset: auto 0 0; display: grid; gap: 6px; padding: 10px 12px; background: linear-gradient(transparent, rgba(8, 19, 29, .82)); color: #fff; text-align: left; }
.lib-thumb-progress strong { font-size: 13px; }
.lib-thumb-progress .lib-track { margin: 0; background: rgba(255, 255, 255, .25); }
.lib-card-body { display: grid; align-content: start; gap: 6px; padding: 14px 16px 16px; min-width: 0; }
.lib-card-body h3 { margin: 2px 0 0; font-size: 16px; line-height: 1.4; color: var(--ink); overflow-wrap: anywhere; }
.lib-title-link { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.lib-title-link:hover { text-decoration: underline; }
.lib-card-actions { display: flex; gap: 6px; margin-top: 4px; }
.lib-none { grid-column: 1 / -1; color: var(--muted); }
.lib-track { height: 6px; margin: 6px 0; border-radius: 6px; overflow: hidden; background: #e3ece8; }
.lib-track i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent, #0b7f63), var(--acid, #73e2c0)); transition: width .4s ease; }

.lib-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.lib-badge { padding: 2px 8px; border-radius: 999px; background: #eef3f1; color: #45566b; font-size: 12px; font-weight: 750; }
.lib-badge.ok { background: #e2f5ec; color: #1d6a47; }
.lib-badge.bad { background: #fbe9ec; color: var(--red); }
.lib-badge.busy { background: #e6eef8; color: var(--blue); }
.lib-badge.warn { background: #fff3dc; color: #8a5d10; }
.lib-summary { margin: 0; color: #3b4d5c; font-size: 14px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lib-summary.large { font-size: 15px; display: block; -webkit-line-clamp: unset; overflow: visible; }
.lib-detail { display: block; color: var(--muted); font-size: 13px; line-height: 1.5; }
.lib-detail.error, .lib-clip-result.error { color: var(--red); }
.lib-meta { color: var(--muted); font-size: 12.5px; line-height: 1.5; overflow-wrap: anywhere; }

.lib-empty { display: grid; justify-items: center; gap: 10px; padding: 48px 20px; border: 1px dashed #bcd2c8; border-radius: 16px; background: #fbfdfc; text-align: center; }
.lib-empty strong { font-size: 18px; color: var(--ink); }
.lib-empty p { max-width: 520px; margin: 0; color: var(--muted); line-height: 1.65; }
.lib-empty > div { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }
.library-mcp { margin: 28px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.library-mcp code, .lib-spans code { font-size: 12px; background: #eef3f1; padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }

.lib-button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 14px; border: 0; border-radius: 9px; background: var(--navy); color: #fff; font-size: 14px; font-weight: 760; white-space: nowrap; }
.lib-button.ghost { background: #eef3f1; color: var(--ink); }
.lib-button.danger { background: #fbe9ec; color: var(--red); }
.lib-button.small { min-height: 30px; padding: 0 10px; font-size: 13px; }
.lib-button:disabled { opacity: .5; cursor: default; }

/* ---------- dialogs ---------- */
body.dialog-open { overflow: hidden; }
.lib-dialog { width: min(560px, calc(100vw - 48px)); max-height: calc(100dvh - 48px); padding: 0; border: 0; border-radius: 18px; background: #fff; color: var(--ink); box-shadow: 0 30px 80px rgba(8, 19, 29, .28); overflow: auto; overscroll-behavior: contain; }
.lib-dialog::backdrop { background: rgba(8, 19, 29, .55); backdrop-filter: blur(3px); }
.lib-detail-dialog { width: min(1180px, calc(100vw - 48px)); }
.lib-dialog-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 18px 22px 14px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); }
.lib-dialog-head h2 { margin: 6px 0 0; font-size: 20px; line-height: 1.35; letter-spacing: -.02em; overflow-wrap: anywhere; }
.lib-add-dialog .lib-dialog-head h2 { margin: 0; }
.lib-close { flex: none; width: 38px; height: 38px; border: 0; border-radius: 10px; background: #eef3f1; color: var(--ink); font-size: 22px; line-height: 1; }
.lib-close:hover { background: #e2ebe7; }
.library-tabs { display: flex; gap: 4px; margin: 16px 22px 0; padding: 4px; border-radius: 12px; background: #eef3f1; }
.library-tabs button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 760; }
.library-tabs button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(8, 19, 29, .08); }
.lib-add-form { display: grid; gap: 6px; padding: 16px 22px 22px; }
.lib-add-form label { margin: 8px 0 0; color: var(--ink); font-size: 14px; font-weight: 760; }
.lib-add-form label small, .lib-more summary small { margin-left: 4px; color: var(--muted); font-weight: 500; }
body.hiru-cloud .lib-add-form :is(input:not([type=checkbox]):not([type=file]), select) { width: 100%; }
body.hiru-cloud .lib-add-form textarea { width: 100%; min-height: 64px; resize: vertical; color: var(--ink) !important; background: #fff; font: inherit; }
.lib-drop { position: relative; display: grid; gap: 6px; justify-items: center; margin: 4px 0 6px !important; padding: 26px 16px; border: 2px dashed #a9cbbd; border-radius: 14px; background: #f5fbf8; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.lib-drop:hover, .lib-drop:focus-within { border-color: var(--accent, #0b7f63); background: #eef9f4; }
.lib-drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.lib-drop strong { font-size: 16px; overflow-wrap: anywhere; }
.library-hint { color: var(--muted); font-size: 13px; font-weight: 500; line-height: 1.5; }
.lib-more { margin-top: 6px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; }
.lib-more[open] { padding-bottom: 12px; }
.lib-more summary { padding: 12px 0; font-size: 14px; font-weight: 760; cursor: pointer; }
.lib-more > label:first-of-type { margin-top: 0; }
.library-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.library-row > div { display: grid; gap: 6px; min-width: 0; }
.lib-add-form .check-row { margin: 10px 0 0; }
.lib-add-form .lib-book-option { padding: 12px; border: 1px solid #c9e2d7; border-radius: 12px; background: #f5fbf8; }
.lib-book-option:has(input:checked) { border-color: var(--accent, #0b7f63); background: #eef9f4; }
.lib-add-form .submit-button { margin-top: 12px; }

/* ---------- detail ---------- */
#library-detail-body { padding: 20px 22px 24px; }
.lib-detail-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 24px; align-items: start; }
.lib-player, .lib-info { min-width: 0; }
@media (min-width: 901px) { .lib-player { position: sticky; top: 92px; } }
.lib-player video { display: block; width: 100%; max-height: 62vh; border-radius: 12px; background: #000; }
.lib-downloads { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.lib-chip { display: inline-flex; align-items: center; min-height: 32px; padding: 0 10px; border-radius: 8px; background: #eef3f1; color: var(--ink); font-size: 13px; font-weight: 700; text-decoration: none; }
.lib-chip:hover { background: #e2ebe7; }
.lib-chip.strong { background: var(--navy); color: #fff; }
.lib-clip { display: grid; gap: 8px; margin-top: 12px; padding: 14px; border: 1px solid #c9e2d7; border-radius: 12px; background: #f5fbf8; }
.lib-clip > strong { font-size: 15px; }
.lib-clip > small { color: var(--muted); font-size: 13px; }
.lib-clip-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto; gap: 8px; }
body.hiru-cloud .lib-clip-row input:not([type="checkbox"]):not([type="radio"]):not([type="file"]) { min-height: 40px; height: 40px; padding: 0 10px; font-variant-numeric: tabular-nums; }
.lib-clip-result { margin: 0; display: grid; gap: 6px; justify-items: start; }
.lib-clip-result small { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.lib-policy { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: #eef7f2; color: #2f5a48; font-size: 13.5px; line-height: 1.55; }
.lib-policy.reference_only { background: #fff6e4; color: #7a5410; }
.lib-sensitive { padding: 10px 12px; border-radius: 10px; background: #fff3dc; color: #7a5410; font-size: 13px; line-height: 1.55; }
.lib-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 14px; margin: 10px 0; font-size: 13.5px; }
.lib-facts dt { color: var(--muted); white-space: nowrap; }
.lib-facts dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.lib-section { border-top: 1px solid var(--line); }
.lib-section > summary { padding: 12px 0; font-size: 14.5px; font-weight: 780; cursor: pointer; }
.lib-section[open] > summary { padding-bottom: 8px; }
.lib-spans { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 8px; }
.lib-spans li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 13.5px; line-height: 1.55; color: #3b4d5c; }
.lib-spans strong { color: var(--ink); }
.lib-spans code { white-space: normal; }
.lib-time { border: 0; padding: 1px 8px; border-radius: 6px; background: #e2f5ec; color: #1d6a47; font-size: 12px; font-weight: 780; font-variant-numeric: tabular-nums; }
.lib-edit-form { display: grid; gap: 10px; padding-bottom: 12px; }
.lib-edit-form label { display: grid; gap: 6px; margin: 0; font-size: 13.5px; }
.lib-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.lib-scenes-title { margin: 22px 0 10px; font-size: 15px; color: var(--ink); }
.lib-scenes { display: grid; grid-auto-flow: column; grid-auto-columns: 136px; gap: 8px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; }
.lib-scene { position: relative; padding: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #e5edf0; scroll-snap-align: start; }
.lib-scene:hover { border-color: var(--accent, #0b7f63); }
.lib-scene img { display: block; width: 136px; height: 77px; object-fit: cover; }
.lib-scene time { position: absolute; left: 4px; bottom: 4px; padding: 1px 5px; border-radius: 5px; background: rgba(8, 19, 29, .75); color: #fff; font-size: 11px; }
.lib-loading { color: var(--muted); font-size: 14px; }

/* ---------- page text and its video evidence ---------- */
.lib-book-pages { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.lib-book-pages h3 { margin: 0 0 8px; color: var(--ink); font-size: 18px; }
.lib-book-search { display: grid; gap: 6px; max-width: 520px; margin: 16px 0 8px; font-size: 14px; }
.lib-book-list { display: grid; gap: 10px; margin: 10px 0 14px; }
.lib-book-page { min-width: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.lib-book-page > summary { padding: 14px 16px; color: var(--ink); cursor: pointer; font-size: 14px; }
.lib-book-page > summary .lib-detail { margin-top: 6px; overflow-wrap: anywhere; }
.lib-book-page[open] > summary { border-bottom: 1px solid var(--line); background: #f7fbf9; }
.lib-book-page-content { display: grid; grid-template-columns: minmax(150px, 240px) minmax(0, 1fr); gap: 20px; padding: 16px; align-items: start; }
.lib-book-evidence { display: grid; gap: 8px; justify-items: start; }
.lib-book-frame { display: block; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #e5edf0; cursor: pointer; }
.lib-book-frame img { display: block; width: 100%; max-height: 320px; object-fit: contain; }
.lib-book-text { margin: 0; color: var(--ink); font-size: 15px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.lib-book-warning { margin: 0 0 12px; padding: 9px 12px; border-radius: 8px; background: #fff6e4; color: #7a5410; font-size: 13px; line-height: 1.55; }
.lib-book-pages > .lib-button { min-height: 42px; }

/* ---------- mobile dock ---------- */
.mobile-dock { display: none; }

@media (max-width: 900px) {
  .lib-detail-grid { grid-template-columns: minmax(0, 1fr); }
  .view-head { align-items: flex-start; }
}

@media (max-width: 760px) {
  body.is-signed-in { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .mobile-dock:not([hidden]) { position: fixed; z-index: 90; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; padding: 8px 14px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
  .mobile-dock button { position: relative; display: grid; justify-items: center; gap: 2px; min-height: 52px; padding: 4px 6px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 760; }
  .mobile-dock button[aria-current="page"] { color: var(--ink); background: #eef3f1; }
  .mobile-dock .tab-badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; padding: 1px 5px; font-size: 10.5px; }
  .mobile-dock .dock-add { grid-auto-flow: column; gap: 6px; align-items: center; min-height: 48px; padding: 0 18px; border-radius: 999px; background: var(--navy); color: #fff; font-size: 14px; box-shadow: 0 8px 20px rgba(8, 19, 29, .22); }
  .studio-bar { margin-bottom: 18px; }
  .studio-tabs { display: none; }
  body.hiru-cloud .studio-bar .account-pill { width: 100%; justify-content: space-between; }
  body.hiru-cloud .studio-bar .account-pill strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .view-switch, .library-lead { display: none; }
  .lib-top-actions { width: 100%; }
  .lib-usage { flex: 1; min-width: 0; }
  #library-add-open { display: none; }
  .library-list { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .lib-card { display: grid; grid-template-columns: 132px minmax(0, 1fr); border-radius: 12px; }
  .lib-thumb { aspect-ratio: auto; height: 100%; min-height: 86px; }
  .lib-thumb-progress { padding: 6px 8px; }
  .lib-thumb-progress strong { font-size: 11px; }
  .lib-card-body { padding: 10px 12px; gap: 4px; }
  .lib-card-body h3 { font-size: 15px; }
  .lib-card .lib-summary { -webkit-line-clamp: 2; font-size: 13px; }
  .lib-badge { font-size: 11px; }
  .library-search-results { grid-template-columns: minmax(0, 1fr); max-height: none; }
  .lib-moment { grid-template-columns: 96px minmax(0, 1fr); }
  .lib-moment img { width: 96px; height: 54px; }

  .lib-dialog { width: 100vw; max-width: 100vw; max-height: 100dvh; margin: 0; border-radius: 0; }
  .lib-detail-dialog { height: 100dvh; }
  .lib-add-dialog { margin: auto 0 0; max-height: 94dvh; border-radius: 18px 18px 0 0; }
  .lib-dialog-head { padding: 14px 16px 12px; }
  .lib-dialog-head h2 { font-size: 17px; }
  .library-tabs { margin: 12px 16px 0; }
  .lib-add-form { padding: 12px 16px calc(20px + env(safe-area-inset-bottom)); }
  .library-row { grid-template-columns: minmax(0, 1fr); }
  #library-detail-body { padding: 0 0 calc(24px + env(safe-area-inset-bottom)); }
  .lib-player video { border-radius: 0; max-height: 42vh; }
  .lib-info { padding: 0 16px; }
  .lib-clip { margin: 12px 16px 0; }
  .lib-downloads { padding: 0 16px; }
  .lib-scenes-title { margin: 18px 16px 8px; }
  .lib-scenes { padding: 0 16px 6px; grid-auto-columns: 112px; }
  .lib-scene img { width: 112px; height: 63px; }
  .lib-book-pages { margin: 20px 16px 0; }
  .lib-book-page-content { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 12px; }
  .lib-book-evidence { grid-template-columns: minmax(0, 112px) minmax(0, 1fr); align-items: center; }
  .lib-book-frame img { max-height: 120px; }
  .lib-book-evidence .lib-button { white-space: normal; text-align: left; }
  .lib-clip-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .lib-clip-row .lib-button { width: 100%; }
}

/* ---------- analysis ⇄ library links ---------- */
.lib-badge.report { background: #ece9f8; color: #4f438a; }
.lib-analysis { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 0 0 12px; padding: 10px 12px; border: 1px solid #ddd8f2; border-radius: 10px; background: #f7f5fd; color: #3e3670; font-size: 13.5px; line-height: 1.5; }
.lib-analysis span { flex: 1 1 220px; }
.library-keep { display: grid; gap: 8px; margin: 2px 0 18px; padding: 12px 14px; border: 1px solid #cfe3d9; border-radius: 12px; background: #f5fbf8; }
.library-keep .check-row { margin: 0; }
body.hiru-cloud .library-keep select { width: 100%; min-height: 42px; padding: 8px 12px; font-size: 14px; }
body.hiru-cloud .library-keep select:disabled { opacity: .5; }
#history-list .history-item { scroll-margin-top: 150px; }
