:root {
  --bg: #f3f4f2;
  --ink: #1c2820;
  --muted: #5c6a62;
  --line: #d5dbd6;
  --danger: #8d3b34;
  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

a, button { touch-action: manipulation; }
button, input, textarea { font: inherit; }
a { color: var(--ink); }

main {
  width: min(880px, 100%);
  margin: 0 auto;
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
}

.top {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 -16px 8px;
  padding: 8px 16px;
  background: var(--bg);
}

.top-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55em;
  margin: 0;
  min-width: 0;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

.path a,
.path .here { overflow-wrap: anywhere; }
.path a {
  color: var(--muted);
  text-decoration: none;
}
.path a:hover { color: var(--ink); }
.path .here { color: var(--ink); }
.path .sep { color: #8b978f; }
.path .root {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}
.path .root svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.where {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.where .path { flex: 1 1 auto; }
.count {
  margin: 0;
  flex: none;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.end { display: flex; flex: none; flex-wrap: nowrap; align-items: center; gap: 2px; }
.account { margin: 0; }

.login { width: min(22rem, 100%); margin: 12vh auto 0; }
.login h1 { margin: 0 0 16px; font-size: 22px; font-weight: 600; line-height: 1.3; text-align: center; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.login .field { position: relative; display: block; }
.login .field-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  display: flex;
  color: var(--muted);
  pointer-events: none;
  transform: translateY(-50%);
}
.login .field-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.login input {
  width: 100%;
  padding: 8px 10px 8px 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f7f8f6;
  color: var(--ink);
  font: 16px/1.4 inherit;
}
.login input::placeholder { color: #8b978f; }
.login input:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.field-pass input { padding-right: 40px; }
.field-reveal {
  position: absolute;
  top: 50%;
  right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transform: translateY(-50%);
}
.field-reveal svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.field-reveal [hidden] { display: none; }
.login button[type="submit"] {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: #145233;
  color: #f4f8f5;
  font: inherit;
  cursor: pointer;
}
.login button[type="submit"]:hover { background: #0f3f27; }
.login button[type="submit"]:disabled,
.login button[type="submit"]:disabled:hover {
  opacity: 0.45;
  cursor: not-allowed;
  background: #145233;
}
.slide {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.slide[hidden] { display: none; }
.slide-img {
  position: relative;
  width: 100%;
  height: 100px;
  overflow: hidden;
  background: #f7f8f6;
  user-select: none;
}
.slide-skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #eef1ee, #e2e7e3, #eef1ee);
  background-size: 200% 100%;
  animation: slide-shimmer 1.2s ease-in-out infinite;
}
.slide-skeleton[hidden] { display: none; }
.slide-master {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.slide-master[hidden],
.slide-tile[hidden] { display: none; }
.slide-tile {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}
.slide-refresh {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(247, 248, 246, 0.94);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.slide-refresh:disabled { opacity: 0.45; cursor: default; }
.slide-track {
  position: relative;
  height: 40px;
  border-top: 1px solid var(--line);
  background: #f7f8f6;
}
.slide-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}
.slide-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #145233;
  color: #f4f8f5;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.slide-thumb:active { cursor: grabbing; }
@keyframes slide-shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

.tools { display: flex; align-items: center; gap: 2px; }
.tools form { display: flex; align-items: center; gap: 2px; margin: 0; }

.pick-bar { display: none; align-items: center; gap: 2px; margin: 0; }
.pick-bar form { display: flex; align-items: center; gap: 2px; margin: 0; }
main:has(input[name="name"]:checked) .pick-bar { display: flex; }
.view-switch { display: flex; align-items: center; gap: 2px; }
.icon[aria-pressed="true"] { background: rgba(28, 40, 32, 0.12); }
#pick-mode,
#pick-mode:hover { background: transparent; }
body.selecting #pick-mode,
body.selecting #pick-mode:hover { background: rgba(28, 40, 32, 0.12); }
.icon[hidden] { display: none; }
body.selecting [data-item] { cursor: pointer; }
tr.is-picked td {
  background: rgba(28, 40, 32, 0.12);
  border-bottom-color: transparent;
}
tr.is-picked td:first-child {
  border-top-left-radius: 5px;
  border-bottom-left-radius: 5px;
}
tr.is-picked td:last-child {
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
}
.card.is-picked { border-radius: 5px; background: rgba(28, 40, 32, 0.12); }
body.selecting .table-wrap,
body.selecting .grid { padding-bottom: 28px; }
body.selecting { user-select: none; }
.marquee {
  display: none;
  position: fixed;
  z-index: 7;
  box-sizing: border-box;
  border: 1px solid rgba(28, 40, 32, 0.28);
  border-radius: 5px;
  background: rgba(28, 40, 32, 0.12);
  pointer-events: none;
}
.marquee.on { display: block; }

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  position: relative;
}

.icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  z-index: 4;
  transform: translateX(-50%);
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--ink);
  color: #f7f8f6;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
}
.ops .icon[data-tip]::after,
dialog .icon[data-tip]::after {
  top: auto;
  bottom: calc(100% + 6px);
  left: auto;
  right: 0;
  transform: none;
}

.icon:active { background: rgba(28, 40, 32, 0.06); }
@media (hover: hover) {
  .icon:hover { background: rgba(28, 40, 32, 0.06); }
  .icon[data-tip]:hover::after { opacity: 1; }
}
.top .icon.tip-on::after { opacity: 1; }
.top .icon.tip-hide::after { opacity: 0; }
button,
a.icon {
  -webkit-tap-highlight-color: transparent;
}
button:focus,
button:focus-visible,
a.icon:focus,
a.icon:focus-visible,
.icon:focus,
.icon:focus-visible,
.icon:focus-within {
  outline: none;
  box-shadow: none;
}
.icon.danger { color: var(--danger); }
.icon input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.icon:has(input:checked) { background: rgba(28, 40, 32, 0.12); }

.clip {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.drop-veil {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(243, 244, 242, 0.9);
  color: var(--ink);
  font-size: 16px;
  pointer-events: none;
}
.drop-veil[hidden] { display: none; }

.toast {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  left: 50%;
  z-index: 6;
  margin: 0;
  padding: 8px 14px;
  border-radius: 6px;
  background: rgba(28, 40, 32, 0.72);
  color: #f7f8f6;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(28, 40, 32, 0.16);
  transform: translateX(-50%);
}
.toast.hide {
  opacity: 0;
  transform: translateX(-50%) translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.note { margin: 0 0 8px; }
.note.bad { color: var(--danger); }
.empty { margin: 24px 0; color: var(--muted); }

.table-wrap { overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
th { color: var(--muted); font-weight: 500; font-size: 13px; }
td.name { min-width: 0; overflow-wrap: anywhere; }
td.name a,
td.name .plain {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
  text-decoration: none;
}
td.name .label {
  min-width: 0;
  white-space: normal;
}
.kind {
  display: inline-flex;
  flex: none;
  margin-top: 1px;
  color: var(--muted);
}
.kind svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--muted);
}
.ops { white-space: nowrap; text-align: right; }
.ops form { display: inline; margin: 0; }
.tag { margin-left: 6px; color: var(--danger); font-size: 13px; }
.name a, .card-name { overflow-wrap: anywhere; }

.grid {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 16px 12px;
  margin: 4px 0 0;
}
body[data-view="grid"] .table-wrap { display: none; }
body[data-view="grid"] .grid { display: grid; }
.card { position: relative; min-width: 0; }
.card-open {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.card-thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
}
.card-thumb img {
  position: relative;
  z-index: 1;
  width: 64px;
  height: 64px;
  object-fit: contain;
}
.card-thumb svg {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 64px;
  height: 64px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.card-thumb:has(img:not([hidden])) > svg { display: none; }
.card-thumb .play-badge {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(28, 40, 32, 0.55);
  color: #f7f8f6;
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.card-thumb .play-badge svg {
  position: static;
  width: 14px;
  height: 14px;
  margin: 0 0 0 1px;
  fill: currentColor;
  stroke: none;
}
.card-thumb img[hidden] + .play-badge { display: none; }
.card-face { position: relative; }
.card-name {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  min-height: 36px;
  padding-right: 36px;
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
}
.card-ops {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  height: 36px;
}
.card-ops form { display: inline; margin: 0; }
.op-menu { display: none; }
.ops.is-open,
.card-ops.is-open { z-index: 6; }
.ops.is-open .op-menu,
.card-ops.is-open .op-menu {
  display: flex;
  flex-direction: column;
  position: fixed;
  z-index: 6;
  min-width: 7.5rem;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(28, 40, 32, 0.16);
}
.ops.is-open .op-menu .icon,
.card-ops.is-open .op-menu .icon { color: var(--ink); }
.ops.is-open .op-menu .icon.danger,
.card-ops.is-open .op-menu .icon.danger { color: var(--danger); }
.ops.is-open .op-menu .icon:active,
.card-ops.is-open .op-menu .icon:active { background: rgba(28, 40, 32, 0.08); }
.ops.is-open .op-menu form,
.card-ops.is-open .op-menu form { display: block; }
.op-menu .icon {
  width: auto;
  height: 36px;
  justify-content: flex-start;
  gap: 8px;
  padding: 0 8px;
}
.ops.is-open .op-menu .icon,
.card-ops.is-open .op-menu .icon { width: 100%; }
.op-menu .icon[data-tip]::after {
  content: attr(data-tip);
  position: static;
  inset: auto;
  left: auto;
  top: auto;
  right: auto;
  bottom: auto;
  z-index: auto;
  transform: none;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0;
  opacity: 1;
  pointer-events: auto;
}
@media (hover: none) {
  .card-ops {
    top: 0;
    right: 0;
    bottom: auto;
    left: auto;
    width: 0;
    height: 0;
    overflow: visible;
    pointer-events: none;
  }
  .card-ops.is-open .op-menu { pointer-events: auto; }
  .card-name { padding-right: 0; }
  tr[data-item],
  .card,
  .card img,
  .card a,
  tr[data-item] a {
    -webkit-touch-callout: none;
    user-select: none;
  }
}
.ops .op-menu {
  display: inline-flex;
  visibility: visible;
  position: static;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: auto;
}
.ops .op-menu .icon {
  width: 32px;
  height: 32px;
  justify-content: center;
  gap: 0;
  padding: 0;
}
.ops .op-menu .icon[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  inset: auto;
  top: auto;
  right: 0;
  bottom: calc(100% + 6px);
  left: auto;
  z-index: 4;
  transform: none;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--ink);
  color: #f7f8f6;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.01em;
  opacity: 0;
}
@media (hover: hover) {
  .card-name { padding-right: 0; }
  .icon.more { display: none; }
  .ops.is-open .op-menu .icon:hover,
  .card-ops.is-open .op-menu .icon:hover { background: rgba(28, 40, 32, 0.08); }
  .ops .op-menu .icon[data-tip]:hover::after { opacity: 1; }
  .card-ops { pointer-events: none; }
  .card-ops.is-open .op-menu { pointer-events: auto; }
}
.card .tag { display: block; margin: 4px 0 0; text-align: center; }

.preview {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  background: rgba(28, 40, 32, 0.94);
  color: #f7f8f6;
}
.preview[hidden] { display: none; }
body.preview-open { overflow: hidden; }
.preview-top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 56px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
}
.preview-title {
  position: absolute;
  top: 50%;
  right: 144px;
  left: 144px;
  transform: translateY(-50%);
  pointer-events: none;
}
.preview-title p {
  margin: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#preview-name { font-size: 14px; }
#preview-meta {
  margin-top: 2px;
  color: rgba(247, 248, 246, 0.72);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.preview-actions { position: relative; z-index: 1; display: flex; flex: none; align-items: center; }
.preview-actions form { display: flex; margin: 0; }
.preview .icon { color: #f7f8f6; }
.preview .icon.danger { color: var(--danger); }
.preview .icon:hover { background: rgba(247, 248, 246, 0.12); }
.preview .icon[data-tip]::after {
  background: #f7f8f6;
  color: var(--ink);
}
.preview-stage {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  flex: 1;
  align-items: center;
  justify-items: center;
  min-height: 0;
  padding: 8px 8px calc(16px + env(safe-area-inset-bottom));
}
.preview-media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}
.preview-side {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(247, 248, 246, 0.1);
}
.preview .preview-side:hover { background: rgba(247, 248, 246, 0.2); }
.preview-side svg { width: 26px; height: 26px; }
.preview-stage img,
.preview-stage video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.preview-error { margin: 0; font-size: 16px; }

textarea {
  display: block;
  width: 100%;
  min-height: 70vh;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f8f6;
  color: var(--ink);
  font: 16px/1.5 ui-monospace, "SF Mono", Menlo, monospace;
  resize: vertical;
}
textarea:focus {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

body.is-fullscreen { overflow: hidden; }
body.is-fullscreen main {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  width: auto;
  max-width: none;
  margin: 0;
  padding:
    calc(8px + env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    calc(8px + env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  background: var(--bg);
  overflow: hidden;
}
body.is-fullscreen .top { flex: none; margin-bottom: 0; }
body.is-fullscreen #edit-form {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}
body.is-fullscreen textarea {
  flex: 1 1 auto;
  min-height: 0;
  resize: none;
}

dialog {
  width: min(22rem, calc(100vw - 32px));
  margin: auto;
  padding: 16px;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
}
dialog::backdrop { background: rgba(28, 40, 32, 0.4); }
dialog form { display: flex; align-items: center; gap: 4px; }
#confirm-dialog form,
#mkdir-dialog form,
#file-dialog form {
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}
#confirm-dialog .confirm-text {
  flex: none;
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.dialog-actions button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.dialog-actions button.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #f7f8f6;
}
.dialog-actions button[type="submit"] {
  border-color: var(--ink);
  background: var(--ink);
  color: #f7f8f6;
}
dialog input:not([type="hidden"]) {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f7f8f6;
  color: var(--ink);
  font: 16px/1.4 inherit;
}
dialog input:not([type="hidden"]):focus {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}
dialog input::placeholder { color: #8b978f; }

.info-head { display: flex; align-items: center; justify-content: space-between; }
.info-head p { margin: 0; font-size: 16px; }
.info-thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  margin-top: 12px;
  border-radius: 6px;
  background: #f7f8f6;
  overflow: hidden;
}
.info-thumb[hidden] { display: none; }
.info-thumb img {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
}
.info-thumb .play-badge {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(28, 40, 32, 0.55);
  color: #f7f8f6;
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.info-thumb .play-badge[hidden] { display: none; }
.info-thumb .play-badge svg {
  width: 16px;
  height: 16px;
  margin: 0 0 0 1px;
  fill: currentColor;
  stroke: none;
}
.info-list { margin: 12px 0 0; }
.info-list div {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 8px;
  padding: 8px 0;
  font-size: 14px;
}
.info-list div[hidden] { display: none; }
.info-list dt { margin: 0; color: var(--muted); }
.info-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

#upload-dialog {
  width: min(640px, calc(100vw - 32px));
  padding: 16px;
}
.progress-head { display: flex; align-items: center; justify-content: space-between; }
.progress-head p { margin: 0; font-size: 16px; }
.progress-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.progress-top strong { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
#upload-cancel {
  flex: none;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.bar { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; }
.bar i { display: block; flex: 1; height: 6px; overflow: hidden; border-radius: 2px; background: var(--line); }
.bar i span { display: block; height: 100%; background: var(--ink); }
.bar.success i span { background: #145233; }
.bar.fail i span { background: var(--danger); }
.bar em { flex: none; min-width: 3.25em; font-size: 12px; font-style: normal; font-variant-numeric: tabular-nums; text-align: right; }
.progress-list { max-height: min(360px, 50vh); margin: 0; padding: 0; overflow: auto; list-style: none; }
.progress-list li { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.progress-list li + li { border-top: 1px solid var(--line); }
.progress-no { width: calc(var(--index-ch) * 1ch); flex: none; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.progress-list b { flex: 0 1 9rem; min-width: 0; overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.progress-list em { flex: none; min-width: 4.5em; color: var(--muted); font-size: 12px; font-style: normal; white-space: nowrap; }
.progress-list em.upload,
.progress-list em.save { color: var(--ink); }
.progress-list em.fail { color: var(--danger); }

@media (hover: none), (max-width: 720px) {
  .top-line {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .top-line .end {
    justify-content: flex-start;
    flex-wrap: wrap;
    width: 100%;
  }
  body.is-fullscreen .top-line {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  body.is-fullscreen .path {
    flex: 1 0 auto;
    max-width: 100%;
  }
  body.is-fullscreen .top-line .end {
    margin-left: auto;
    width: auto;
    flex: none;
    justify-content: flex-end;
  }
  .preview-top {
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    gap: 4px;
  }
  .preview-title {
    position: static;
    transform: none;
    width: 100%;
  }
  .preview-title p {
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .preview-actions { justify-content: flex-end; }
}

@media (max-width: 720px) {
  main { padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); }
  .top { margin-right: -12px; margin-left: -12px; padding-right: 12px; padding-left: 12px; }
  .icon { width: 36px; height: 36px; }
  textarea { min-height: 50dvh; }
  table, thead, tbody { width: 100%; }
  thead tr, tbody tr {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 4px 0;
    border-bottom: 1px solid var(--line);
  }
  tr.is-picked {
    border-radius: 5px;
    background: rgba(28, 40, 32, 0.12);
    border-bottom-color: transparent;
  }
  tr.is-picked td,
  tr.is-picked td:first-child,
  tr.is-picked td:last-child {
    background: transparent;
    border-radius: 0;
  }
  thead tr { border: 0; padding: 0 0 4px; }
  thead th:not(.pick) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  th.pick, td.pick {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    line-height: 0;
  }
  th.pick { border: 0; padding: 0; }
  td { border: 0; padding: 0; }
  td.name { display: flex; align-items: center; flex: 1 1 auto; min-width: 0; }
  td.num {
    flex: none;
    align-self: center;
    line-height: 1.35;
  }
  td.name a, td.name .plain {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    min-width: 0;
    min-height: 44px;
    line-height: 1.35;
  }
  td.name .kind { margin-top: 0; }
  td.ops { margin-left: auto; flex: none; align-self: center; }
}

@media (max-width: 520px) {
  tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    column-gap: 8px;
    row-gap: 1px;
    align-items: center;
  }
  td.name { grid-column: 1; grid-row: 1 / span 2; }
  td.size {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    font-size: 12px;
    line-height: 1.2;
  }
  td.when {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    font-size: 12px;
    line-height: 1.2;
  }
  td.ops {
    grid-column: 3;
    grid-row: 1 / span 2;
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
  .toast.hide { transition: none; }
}
