:root {
  color-scheme: light;
  font-family: "Inter", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  background: #f5f5f5;
  color: #1b1b1b;
  --subtle: #5e5e5e;
  --border: #e3e3e3;
  --accent: #c82420;
  --paper: #fff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0 !important; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.shell { width: min(1460px, 100% - 88px); margin: 0 auto; }
.masthead { background: var(--paper); border-bottom: 1px solid var(--border); }
.masthead-inner { height: 66px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 800; letter-spacing: .02em; }
.brand-mark { display: flex; justify-content: center; align-items: center; gap: 3px; width: 33px; height: 33px; border-radius: 9px; background: var(--accent); }
.brand-mark i { display: block; height: 9px; width: 3px; border-radius: 1px; background: white; }
.brand-mark i:nth-child(2) { height: 15px; }
.site-nav { display: flex; align-items: center; gap: 6px; }
.site-nav a { display: inline-flex; align-items: center; gap: 5px; padding: 8px 11px; border-radius: 7px; color: var(--subtle); font-size: .875rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: #232323; background: #f1f1f1; }
.nav-count { font-size: .8rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.account { display: flex; align-items: center; gap: 8px; font-size: .875rem; color: var(--subtle); }
.text-button { border: 0; padding: 5px 7px; background: transparent; color: inherit; border-radius: 4px; }
.text-button:hover { background: #eee; }
.viewer .dialog-sidebar { display: none; }
.viewer .dialog-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); }
.viewer .player-area { border-right: 0; }
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(380px, 100%); padding: 30px; border: 1px solid var(--border); border-radius: 14px; background: white; box-shadow: 0 12px 40px #00000008; }
.login-card h1 { font-size: 1.65rem; letter-spacing: -.02em; }
.login-card > p { margin-top: 9px; color: var(--subtle); font-size: .875rem; }
.login-card form { display: grid; gap: 15px; margin-top: 25px; }
.login-card label { display: grid; gap: 6px; font-size: .875rem; font-weight: 650; }
.login-card input { min-width: 0; width: 100%; border: 1px solid #d9d9d9; border-radius: 7px; min-height: 42px; padding: 8px 10px; font-size: 1rem; }
#login-status { font-size: .875rem; color: #a32922; overflow-wrap: anywhere; }
#login-status:empty { display: none; }
[data-review="excellent"], [data-review-page="excellent"] { --review-edge: #94bd9d; --review-glow: #48885b44; --review-fill: #f1f8f2; --review-selected: #dfefe2; --review-ink: #315c3d; }
[data-review="rework"], [data-review-page="rework"] { --review-edge: #dca39b; --review-glow: #ba473344; --review-fill: #fdf1ef; --review-selected: #f9e1de; --review-ink: #8d3d33; }
body[data-review-page]::before { position: fixed; inset: 0; z-index: 1; border: 1px solid var(--review-edge); box-shadow: inset 0 0 17px var(--review-glow); pointer-events: none; content: ""; }
main { padding-bottom: 56px; }
.intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; padding: 40px 0 30px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.15rem, 4.2vw, 3.4rem); letter-spacing: -.05em; line-height: 1.15; font-weight: 850; }
.intro p { margin-top: 13px; font-size: 1rem; color: var(--subtle); }
.library-count { display: grid; gap: 2px; text-align: right; }
.library-count strong { font-size: 2.15rem; font-variant-numeric: tabular-nums; letter-spacing: -.055em; line-height: 1; }
.library-count span { font-size: .875rem; color: var(--subtle); white-space: nowrap; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; padding-bottom: 13px; border-bottom: 1px solid var(--border); }
.search, .select { display: flex; align-items: center; position: relative; }
.search { flex: 1; min-width: 175px; }
.search-icon { position: absolute; left: 16px; width: 13px; height: 13px; border: 1.6px solid #676767; border-radius: 50%; pointer-events: none; }
.search-icon::after { content: ""; position: absolute; width: 6px; height: 1.6px; border-radius: 1px; background: #676767; right: -4px; bottom: -2px; transform: rotate(45deg); }
.search input, select {
  border: 1px solid #d9d9d9; border-radius: 8px; background: var(--paper); color: inherit;
}
.search input { width: 100%; height: 44px; padding: 7px 14px 7px 42px; font-size: .95rem; }
.number-range { padding-top: 10px; color: var(--subtle); font-size: .875rem; }
.number-range-heading { display: flex; align-items: center; gap: 12px; }
.id-range { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.id-range input { width: 52px; min-width: 0; height: 26px; padding: 2px 4px; border: 1px solid #dedede; border-radius: 5px; background: white; color: #252525; text-align: center; font-variant-numeric: tabular-nums; font-size: .875rem; }
.number-range-heading button { margin-left: auto; border: 0; background: transparent; color: #9b2720; padding: 4px 7px; font-size: .875rem; border-radius: 4px; }
.number-range-heading button:hover { background: #f7e9e7; }
.number-range-heading button:disabled { color: #797979; cursor: default; }
.range-slider { position: relative; height: 28px; touch-action: none; cursor: pointer; }
.range-rail { position: absolute; inset: 12px 10px; height: 4px; background: #dadada; border-radius: 4px; }
.range-rail span { position: absolute; height: 100%; background: var(--accent); border-radius: 4px; }
.range-slider input { position: absolute; inset: 0; width: 100%; height: 28px; margin: 0; padding: 0; background: transparent; appearance: none; pointer-events: none; }
.range-slider input:focus-visible { outline: none; }
.range-slider input::-webkit-slider-runnable-track { height: 4px; background: transparent; }
.range-slider input::-webkit-slider-thumb { appearance: none; width: 20px; height: 20px; margin-top: -8px; border: 2px solid var(--accent); border-radius: 50%; background: white; box-shadow: 0 1px 4px #0002; pointer-events: auto; cursor: grab; }
.range-slider input:focus-visible::-webkit-slider-thumb { outline: 3px solid #c8242030; outline-offset: 2px; }
.range-slider input::-moz-range-track { height: 4px; background: transparent; }
.range-slider input::-moz-range-thumb { width: 16px; height: 16px; border: 2px solid var(--accent); border-radius: 50%; background: white; box-shadow: 0 1px 4px #0002; pointer-events: auto; cursor: grab; }
.range-slider input:focus-visible::-moz-range-thumb { outline: 3px solid #c8242030; outline-offset: 2px; }
.range-limits { display: flex; justify-content: space-between; font-size: .8125rem; line-height: 1; font-variant-numeric: tabular-nums; }
select { appearance: none; min-width: 118px; width: 100%; max-width: 200px; height: 44px; padding: 0 34px 0 13px; font-size: .875rem; text-overflow: ellipsis; }
.select::after { content: ""; position: absolute; width: 6px; height: 6px; border: solid #686868; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); right: 14px; margin-top: -4px; pointer-events: none; }
.results { padding: 15px 0 12px; color: var(--subtle); font-size: .875rem; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.card { display: block; width: 100%; min-width: 0; padding: 0; border: 1px solid var(--border); background: var(--paper); color: inherit; border-radius: 12px; overflow: hidden; text-align: left; box-shadow: 0 2px 4px #00000005; transition: border-color .15s, transform .15s, box-shadow .15s; }
.card:hover { border-color: #c7c7c7; transform: translateY(-2px); box-shadow: 0 6px 16px #0000000e; }
.card[data-review] { border-color: var(--review-edge); box-shadow: 0 0 13px var(--review-glow); }
.card[data-review]:hover { box-shadow: 0 4px 17px var(--review-glow); }
.poster { position: relative; height: clamp(170px, 17vw, 260px); background: white; overflow: hidden; }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 9px; }
.play { position: absolute; bottom: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; background: #1e1e1eeb; box-shadow: 0 2px 7px #0002; display: grid; place-items: center; }
.play::after { content: ""; width: 0; height: 0; margin-left: 2px; border-left: 9px solid #fff; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.card:is(:hover, :focus-visible) .play { background: var(--accent); }
.card-info { padding: 13px 13px 14px; border-top: 1px solid #ededed; }
.card-title, .card-meta { display: flex; align-items: center; justify-content: space-between; gap: 7px; min-width: 0; }
.card-title .name { font-size: .98rem; font-weight: 720; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-id { color: #626262; font: 600 .82rem/1.2 ui-monospace, "Cascadia Mono", monospace; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-meta { margin-top: 9px; }
.review-badge { flex: none; border-radius: 5px; background: var(--review-fill); color: var(--review-ink); padding: 4px 7px; font-size: .82rem; white-space: nowrap; }
.review-grid { gap: 14px; }
.review-grid .card { display: flex; flex-direction: column; }
.review-grid .poster { flex: none; width: 100%; height: clamp(124px, 13vw, 185px); }
.review-grid .card-info { width: 100%; }
.review-grid .card-title .name { white-space: normal; overflow-wrap: anywhere; }
.card-review-note { margin-top: 10px; padding-top: 9px; border-top: 1px solid #ededed; color: #454545; font-size: .875rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (min-width: 1200px) { .review-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
body[data-review-page="rework"] main { padding-bottom: 8px; }
body[data-review-page="rework"] .masthead-inner { height: 48px; }
body[data-review-page="rework"] .intro { padding: 13px 0 9px; align-items: center; }
body[data-review-page="rework"] h1 { font-size: 1.65rem; }
body[data-review-page="rework"] .library-count { display: flex; align-items: baseline; gap: 5px; }
body[data-review-page="rework"] .library-count strong { font-size: 1.2rem; letter-spacing: 0; }
body[data-review-page="rework"] .toolbar { padding: 0; border: 0; margin-bottom: 10px; }
body[data-review-page="rework"] .toolbar :is(.search input, select) { height: 34px; }
body[data-review-page="rework"] .number-range { padding: 0 0 10px; }
.rework-filter { flex: 0 1 190px; min-width: 0; }
.rework-list { --table-columns: 1; display: grid; grid-template-columns: repeat(var(--table-columns), minmax(0, 1fr)); align-items: start; gap: 14px; }
@media (min-width: 900px) { .rework-list { --table-columns: 2; } }
.rework-table { width: 100%; table-layout: fixed; border-spacing: 0; border: 1px solid #e3d2cf; border-radius: 6px; background: var(--paper); font-size: .875rem; line-height: 1.3; }
.rework-number-col { width: 58px; }
.rework-type-col { width: 33%; }
.rework-table :is(th, td) { padding: 3px 8px; vertical-align: top; text-align: left; overflow-wrap: anywhere; }
.rework-table thead th { background: #f9f7f7; color: #645c5b; }
.rework-table thead th:first-child { border-radius: 5px 0 0 0; }
.rework-table thead th:last-child { border-radius: 0 5px 0 0; }
.rework-group th { border-top: 1px solid #ead9d6; background: #f9eae7; color: #843f37; font-weight: 750; }
.rework-table td { border-top: 1px solid #efe9e8; }
.rework-table td:first-child { font-variant-numeric: tabular-nums; color: #5e5e5e; }
.rework-table tbody tr:nth-child(even) { background: #fbf9f8; }
.rework-name { display: block; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; overflow-wrap: anywhere; }
.rework-name:hover { color: var(--review-ink); text-decoration: underline; text-underline-offset: 2px; }
.rework-pagination { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 8px 0; color: var(--subtle); font-size: .875rem; }
.rework-pagination .button { min-height: 32px; padding: 4px 12px; }
.more-wrap { text-align: center; padding-top: 22px; }
.empty { text-align: center; padding: 48px 16px; background: white; border-radius: 10px; border: 1px solid var(--border); }
.empty p { margin-bottom: 15px; color: var(--subtle); }
.button { min-height: 40px; padding: 9px 16px; border: 1px solid transparent; border-radius: 8px; font-size: .9rem; font-weight: 700; }
.secondary { background: white; border-color: var(--border); color: #222; }
.secondary:hover { background: #ededed; }
.primary { background: var(--accent); color: white; }
.primary:hover { background: #a71d19; }
.button:disabled { cursor: wait; opacity: .65; }
dialog { width: min(1120px, calc(100% - 28px)); height: min(700px, calc(100dvh - 24px)); max-height: none; overflow: clip; border: 0; padding: 0; border-radius: 15px; margin: auto; background: #fff; color: #1b1b1b; box-shadow: 0 28px 90px #0005; }
dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
dialog:is([data-review="excellent"], [data-review="rework"]) { box-shadow: 0 0 0 2px var(--review-edge), 0 0 22px var(--review-glow), 0 28px 90px #0005; }
dialog::backdrop { background: #16161696; }
html:has(dialog[open]) { overflow: hidden; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 17px; border-bottom: 1px solid var(--border); }
.dialog-heading { min-width: 0; }
.dialog-head h2 { font-size: clamp(1.06rem, 2.5vw, 1.35rem); line-height: 1.27; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog-head-actions { display: flex; flex: none; align-items: center; gap: 8px; }
.dialog-head .button { min-height: 34px; padding: 5px 10px; }
.close { flex: none; width: 35px; height: 35px; border: 0; color: #333; background: #f3f3f3; border-radius: 8px; font-size: 1.55rem; line-height: 1; }
.close:hover { background: #e9e9e9; }
.rename-form { display: flex; flex: 1; min-width: 0; flex-wrap: wrap; align-items: center; gap: 6px; }
.rename-form input { flex: 1; min-width: 90px; }
#save-status { color: var(--subtle); font-size: .875rem; }
#save-status:empty { display: none; }
.dialog-body { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(295px, 1fr); min-height: 0; }
.dialog-sidebar { display: grid; place-items: center; min-width: 0; min-height: 0; padding: 12px 18px; }
.player-area { display: grid; grid-template-rows: minmax(0, 1fr) auto; background: #fafafa; border-right: 1px solid var(--border); padding: 11px; min-width: 0; min-height: 0; }
.player-area video { display: block; width: 100%; height: 100%; min-height: 0; background: white; border-radius: 8px; object-fit: contain; }
.video-status { margin-top: 4px; color: var(--subtle); font-size: .875rem; }
.type-controls input, .rename-form input { border: 1px solid #d9d9d9; border-radius: 8px; width: 100%; padding: 5px 8px; min-height: 36px; color: inherit; font-size: .9375rem; }
.review-panel { display: grid; gap: 12px; width: min(100%, 360px); }
.review-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.review-option, .type-controls .button { min-height: 36px; padding: 6px 11px; }
.review-option { background: var(--review-fill); border-color: var(--review-edge); color: var(--review-ink); }
.review-option:hover { background: var(--review-selected); }
.review-option[aria-pressed="true"] { background: var(--review-selected); border-color: var(--review-ink); box-shadow: inset 0 0 0 1px var(--review-edge); }
.review-context { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.review-context:not(:has(a:not([hidden]), #review-status:not(:empty))), #review-status:empty { display: none; }
.review-context a { font-size: .875rem; color: var(--review-ink, var(--subtle)); text-underline-offset: 3px; }
.rework-fields { display: grid; gap: 7px; padding-top: 11px; border-top: 1px solid var(--border); }
.rework-fields label { font-size: .875rem; font-weight: 700; }
.type-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.type-controls select { min-width: 0; max-width: none; height: 36px; appearance: auto; padding: 0 7px; }
.review-status { min-width: 0; font-size: .875rem; color: var(--subtle); overflow-wrap: anywhere; }
.detail-nav { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 17px; background: white; border-top: 1px solid var(--border); }
.detail-nav .button { min-height: 34px; padding: 5px 12px; }
.detail-nav .button:disabled, .rework-pagination .button:disabled, #save-rework-type:disabled { cursor: default; }
#detail-position { text-align: center; color: var(--subtle); font-size: .875rem; font-variant-numeric: tabular-nums; }
@media (max-width: 1050px) { .shell { width: calc(100% - 48px); } .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .shell { width: calc(100% - 30px); }
  .site-nav { gap: 2px; }
  .site-nav a { padding: 8px 6px; }
  .masthead-inner { flex-wrap: wrap; height: auto; min-height: 66px; gap: 4px 12px; padding-block: 8px; }
  body[data-review-page="rework"] .masthead-inner { height: auto; min-height: 48px; }
  .intro { padding: 27px 0 23px; align-items: flex-start; }
  .library-count strong { font-size: 1.7rem; }
  .toolbar { flex-wrap: wrap; }
  .search { flex-basis: 100%; }
  .select { flex: 1 0 calc(33.33% - 10px); min-width: 0; }
  select { max-width: none; min-width: 0; padding-left: 9px; padding-right: 25px; }
  .select::after { right: 10px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .poster { height: clamp(121px, 37vw, 205px); }
  .card-info { padding: 10px 8px; }
  .card-title { align-items: flex-start; }
  .card-title .name { font-size: .87rem; line-height: 1.4; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 2.8em; }
  .card-title .video-id { margin-top: 2px; }
  .play { width: 31px; height: 31px; right: 8px; bottom: 8px; }
  body[data-review-page="rework"] .toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(152px, 1fr); }
  body[data-review-page="rework"] .search { min-width: 0; }
  .rework-number-col { width: 49px; }
}
@media (max-width: 690px) and (min-height: 450px), (max-width: 540px) {
  .dialog-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .dialog-sidebar { padding: 9px 10px; }
  .player-area { border-right: 0; border-bottom: 1px solid var(--border); padding: 7px; }
  .dialog-head, .detail-nav { padding-inline: 10px; }
}
@media (max-height: 450px) {
  dialog { height: calc(100dvh - 12px); }
  .review-panel { gap: 8px; }
  .rework-fields { padding-top: 7px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
