:root {
  --bg: #030303;
  --bg-soft: #0b0b0b;
  --surface: #101010;
  --surface-2: #0a0a0a;
  --ink: #f5f0df;
  --muted: #b2a47c;
  --line: #2a2517;
  --accent: #b88916;
  --accent-2: #d4aa32;
  --accent-ink: #120e03;
  --danger: #b53131;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

html,
body {
  width: 100%;
  min-height: 100%;
  overscroll-behavior: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  overflow-x: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--accent) 24%, transparent) 0%, transparent 30%),
    radial-gradient(circle at 90% 100%, color-mix(in srgb, var(--bg-soft) 88%, var(--accent) 12%) 0%, transparent 35%),
    var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: calc(90px + var(--safe-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--safe-top) calc(1rem + var(--safe-right)) 0 calc(1rem + var(--safe-left));
  background: color-mix(in srgb, #000 72%, var(--bg) 28%);
  border-bottom: 1px solid var(--line);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.topbar-logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.topbar-right {
  position: relative;
  display: flex;
  align-items: center;
}

.account-menu-btn {
  width: auto;
  min-width: 140px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.8rem;
}

.account-caret {
  color: var(--muted);
  font-size: 0.78rem;
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: color-mix(in srgb, var(--surface) 92%, #000 8%);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 34px #00000085;
  backdrop-filter: blur(8px);
  padding: 0.55rem;
  display: grid;
  gap: 0.45rem;
  z-index: 200;
}

.account-menu-user {
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0.3rem 0.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-logout-btn {
  width: 100%;
}

.account-menu-action {
  width: 100%;
  text-align: left;
}

.auth-locked .app {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: calc(1rem + var(--safe-top)) calc(1rem + var(--safe-right)) calc(1rem + var(--safe-bottom)) calc(1rem + var(--safe-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #000000b8;
  backdrop-filter: blur(6px);
}

.auth-modal.visible {
  display: flex;
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: calc(1rem + var(--safe-top)) calc(1rem + var(--safe-right)) calc(1rem + var(--safe-bottom)) calc(1rem + var(--safe-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #000000d0;
  backdrop-filter: blur(6px);
}

.preview-modal.visible {
  display: flex;
}

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: calc(1rem + var(--safe-top)) calc(1rem + var(--safe-right)) calc(1rem + var(--safe-bottom)) calc(1rem + var(--safe-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #000000d0;
  backdrop-filter: blur(6px);
}

.image-preview-modal.visible {
  display: flex;
}

.audio-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: calc(1rem + var(--safe-top)) calc(1rem + var(--safe-right)) calc(1rem + var(--safe-bottom)) calc(1rem + var(--safe-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #000000d0;
  backdrop-filter: blur(6px);
}

.audio-preview-modal.visible {
  display: flex;
}

.image-preview-shell {
  width: min(1080px, 100%);
  background: linear-gradient(180deg, #0f0f10, #070708);
  border: 1px solid #3e3218;
  border-radius: 16px;
  padding: 0.9rem;
  box-shadow: 0 24px 72px #000000d0;
  max-height: min(92dvh, 980px);
  overflow: auto;
}

.image-preview-stage {
  border: 1px solid #2d2516;
  border-radius: 12px;
  background: #000;
  min-height: 360px;
  max-height: 76vh;
  display: grid;
  place-items: center;
  overflow: auto;
}

.image-preview-stage img {
  max-width: 100%;
  max-height: 74vh;
  object-fit: contain;
  display: block;
}

.pdf-preview-shell {
  width: min(1160px, 100%);
}

.pdf-preview-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.55rem;
}

.pdf-preview-shell.pdf-viewer-mode .pdf-preview-controls {
  display: none;
}

.pdf-page-info {
  color: #d2c299;
  font-size: 0.82rem;
  min-width: 90px;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.pdf-preview-stage {
  margin-top: 0.55rem;
  border: 1px solid #2d2516;
  border-radius: 12px;
  background: #000;
  min-height: 360px;
  max-height: 76vh;
  overflow: auto;
  display: grid;
  justify-items: center;
  align-items: start;
  padding: 0.6rem;
}

.pdf-preview-stage canvas {
  max-width: 100%;
  height: auto;
  background: #111;
  border: 1px solid #2e2614;
}

.pdf-preview-frame {
  width: 100%;
  min-height: 70vh;
  height: 76vh;
  border: 1px solid #2e2614;
  border-radius: 10px;
  background: #0a0a0a;
}

.pdf-preview-shell.pdf-viewer-mode .pdf-preview-stage {
  padding: 0.5rem;
}

.pdf-preview-shell.pdf-viewer-mode #pdfPreviewCanvas {
  display: none;
}

.image-nav {
  margin-top: 0.55rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
}

.image-nav-btn {
  height: 34px;
  width: auto;
  min-width: 98px;
  padding: 0.35rem 0.62rem;
  font-size: 0.82rem;
}

.image-nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.image-nav-info {
  color: #d5c39a;
  font-size: 0.82rem;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.audio-preview-shell {
  width: min(980px, 100%);
  background: linear-gradient(180deg, #0f0f10, #070708);
  border: 1px solid #3e3218;
  border-radius: 16px;
  padding: 0.9rem;
  box-shadow: 0 24px 72px #000000d0;
  max-height: min(92dvh, 980px);
  overflow: auto;
}

.audio-preview-stage {
  border: 1px solid #2d2516;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.audio-preview-stage audio {
  width: 100%;
  margin: auto 0;
  min-height: 80px;
  padding: 0.8rem;
  background: #060606;
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.7rem;
  flex-wrap: wrap;
}

.audio-controls button {
  height: 36px;
  padding: 0.45rem 0.8rem;
  font-size: 0.86rem;
}

.audio-ctrl-icon-btn {
  width: 36px;
  min-width: 36px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.audio-ctrl-icon-btn .btn-icon {
  width: 16px;
  height: 16px;
}

.audio-timeline-wrap {
  margin-top: 0.65rem;
  display: grid;
  gap: 0.42rem;
  position: relative;
}

.audio-waveform {
  width: 100%;
  height: 58px;
  border-radius: 10px;
  border: 1px solid #3d3116;
  background: linear-gradient(180deg, #0f0d09, #0a0907);
  display: block;
  cursor: pointer;
}

.audio-wave-hover-time {
  position: absolute;
  top: 6px;
  left: 0;
  transform: translateX(-50%);
  color: #f6e3b7;
  border: 1px solid #463818;
  background: #0d0b08;
  border-radius: 6px;
  padding: 0.16rem 0.36rem;
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
  z-index: 4;
}

.audio-timeline-wrap.show-wave-hover .audio-wave-hover-time {
  opacity: 1;
}

.audio-track {
  display: none;
}

.audio-buffered,
.audio-played {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
}

.audio-buffered {
  background: #4b4637;
}

.audio-played {
  background: linear-gradient(90deg, #b88916, #d4aa32);
}

.audio-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #ffefc2;
  border: 1px solid #5a4618;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px #ffebaf88;
}

.audio-hover-time {
  position: absolute;
  top: -32px;
  left: 0;
  transform: translateX(-50%);
  color: #f6e3b7;
  border: 1px solid #463818;
  background: #0d0b08;
  border-radius: 6px;
  padding: 0.16rem 0.36rem;
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
}

.audio-track.show-hover .audio-hover-time {
  opacity: 1;
}

.audio-seek {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.audio-time {
  margin-left: auto;
  color: #f0d48c;
  border: 1px solid #3e3217;
  background: #120f08;
  border-radius: 8px;
  padding: 0.45rem 0.62rem;
  min-width: 150px;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.9rem;
}

.audio-repeat {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.audio-repeat-btn {
  height: 34px !important;
  min-width: 34px !important;
  width: 34px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.audio-repeat-btn.active {
  border-color: #8a6a21;
  background: #2b210d;
  color: #f2d58c;
  box-shadow: 0 0 0 1px #8a6a2140;
}

.audio-repeat-toggle .btn-icon {
  width: 15px;
  height: 15px;
}

.audio-controls button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.audio-playlist-wrap {
  margin-top: 0.62rem;
  border: 1px solid #2d2516;
  border-radius: 10px;
  background: #0a0a0a;
  padding: 0.45rem;
}

.audio-playlist-head {
  color: #bfa86d;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.34rem;
}

.audio-playlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.24rem;
  max-height: 148px;
  overflow: auto;
}

.audio-playlist-item {
  border: 1px solid #322812;
  border-radius: 8px;
  background: #0f0d09;
  color: #d9caa0;
  padding: 0.34rem 0.5rem;
  font-size: 0.82rem;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-playlist-item:hover {
  border-color: #5a4518;
  background: #181208;
}

.audio-playlist-item.active {
  border-color: #b88916;
  color: #f7de9e;
  background: #1f1709;
  box-shadow: 0 0 0 1px #b8891650;
}

.audio-playlist-empty {
  color: #97885f;
  font-size: 0.8rem;
  padding: 0.2rem 0.1rem;
}

.audio-meta {
  margin-top: 0.75rem;
  border: 1px solid #2d2516;
  border-radius: 12px;
  background: #0a0a0a;
  padding: 0.65rem;
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 0.7rem;
  align-items: start;
}

.audio-cover {
  width: 86px;
  height: 86px;
  border-radius: 10px;
  border: 1px solid #3b2f15;
  object-fit: cover;
  background: #121212;
}

.audio-cover.is-placeholder {
  object-fit: contain;
  padding: 0.45rem;
  background: transparent;
  filter: brightness(0) saturate(100%) invert(76%) sepia(39%) saturate(635%) hue-rotate(5deg) brightness(97%) contrast(93%);
  opacity: 0.95;
}

.audio-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem 0.7rem;
}

.audio-meta-grid > div {
  display: grid;
  gap: 0.14rem;
}

.meta-k {
  color: #a5966c;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.meta-v {
  color: #f4eed8;
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-shell {
  width: min(980px, 100%);
  background: linear-gradient(180deg, #0f0f10, #070708);
  border: 1px solid #3e3218;
  border-radius: 16px;
  padding: 0.9rem;
  box-shadow: 0 24px 72px #000000d0;
  max-height: min(94vh, 980px);
  overflow: auto;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.6rem;
}

.preview-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.preview-title {
  font-weight: 700;
  letter-spacing: 0.02em;
  max-width: 88%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-stage {
  position: relative;
  border: 1px solid #2d2516;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 94px;
}

.preview-stage.stage-resizable {
  min-height: 240px;
}

.preview-stage.stage-resizable.stage-manual-height {
  align-items: stretch;
}

.preview-stage.stage-resizable.stage-manual-height video {
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  object-fit: contain;
}

.preview-stage.stage-resizable.stage-manual-height .meter-panel:not(.meter-horizontal) {
  grid-template-columns: 22px 1fr;
  grid-template-rows: minmax(72px, 1fr) auto;
  align-content: stretch;
  align-items: stretch;
  align-self: stretch;
  height: 100%;
  min-height: 0;
  overflow: visible;
}

.preview-stage.stage-resizable.stage-manual-height .meter-panel:not(.meter-horizontal) .meter-scale {
  grid-column: 1;
  grid-row: 1;
  height: 100%;
  min-height: 72px;
  align-self: stretch;
  overflow: hidden;
}

.preview-stage.stage-resizable.stage-manual-height .meter-panel:not(.meter-horizontal) .meter-wrap {
  grid-column: 2;
  grid-row: 1;
  height: 100%;
  min-height: 72px;
  min-height: 0;
  align-self: stretch;
  overflow: hidden;
}

.preview-stage.stage-resizable.stage-manual-height .meter-panel:not(.meter-horizontal) .meter-col {
  height: 100%;
  grid-template-rows: minmax(72px, 1fr) auto auto;
  min-height: 0;
}

.preview-stage.stage-resizable.stage-manual-height .meter-panel:not(.meter-horizontal) .meter-track {
  height: 100%;
  min-height: 72px;
  max-height: none;
}

.video-stage-resizer-panel {
  -webkit-appearance: none;
  appearance: none;
  grid-column: 1 / -1;
  justify-self: center;
  align-self: end;
  width: 58px !important;
  min-width: 58px !important;
  max-width: 58px !important;
  height: 10px !important;
  min-height: 10px !important;
  max-height: 10px !important;
  padding: 0 !important;
  margin: 0.16rem auto 0.02rem;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, #1a140b 62%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 78%, #0b0a07 22%);
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
  position: relative;
  z-index: 2;
  font-size: 0;
  line-height: 0;
  box-shadow: none;
}

.meter-panel:not(.meter-horizontal) .video-stage-resizer-panel {
  grid-column: 1 / -1;
  grid-row: 2;
}

.video-stage-resizer-panel::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 2px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: color-mix(in srgb, var(--accent) 70%, #1f1a0f 30%);
  opacity: 0.95;
}

.video-stage-resizer-panel:hover,
.video-stage-resizer-panel.is-dragging {
  border-color: color-mix(in srgb, var(--accent) 62%, #1a140b 38%);
}

.video-stage-resizer-panel:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 58%, #ffffff 42%);
  outline-offset: 2px;
}

.preview-stage.video-buffering::after {
  content: 'Buffering...';
  position: absolute;
  right: 12px;
  top: 12px;
  transform: none;
  color: #f6e3b7;
  border: 1px solid #463818;
  background: #0d0b08e6;
  border-radius: 8px;
  padding: 0.2rem 0.48rem;
  font-size: 0.72rem;
  z-index: 8;
  pointer-events: none;
}

.preview-stage.video-buffering video {
  opacity: 0.82;
}

.preview-stage video {
  width: auto;
  max-width: 100%;
  max-height: 58vh;
  display: block;
  background: #000;
  object-fit: contain;
  justify-self: center;
  align-self: center;
}

.retouch-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  touch-action: none;
  z-index: 6;
}

.retouch-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.retouch-path {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.55));
}

.retouch-path.is-drawing {
  stroke-dasharray: 7 5;
}

.retouch-box {
  fill: color-mix(in srgb, var(--retouch-color, #f7b733) 10%, transparent);
  stroke: var(--retouch-color, #f7b733);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.retouch-box.is-drawing {
  border-style: dashed;
}

.retouch-btn-icon {
  width: 12px;
  height: 12px;
  display: block;
  color: var(--accent-2);
}

.ghost-btn.is-drawing-mode {
  border-color: color-mix(in srgb, var(--accent) 72%, #1a1309 28%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent), 0 0 10px color-mix(in srgb, var(--accent) 22%, transparent);
}

.meter-panel {
  border-left: 1px solid #2d2516;
  background: linear-gradient(180deg, #09090a, #060607);
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 0.22rem;
  padding: 0.35rem 0.28rem 0.38rem 0.22rem;
}

.meter-panel:not(.meter-horizontal) {
  align-content: center;
}

.meter-panel:not(.meter-horizontal) .meter-scale,
.meter-panel:not(.meter-horizontal) .meter-wrap {
  height: min(56vh, 430px);
  align-self: center;
}

.meter-panel:not(.meter-horizontal) .meter-wrap {
  align-items: stretch;
}

.meter-panel:not(.meter-horizontal) .meter-col {
  height: 100%;
  align-items: stretch;
}

.meter-panel:not(.meter-horizontal) .meter-track {
  height: 100%;
  max-height: none;
}

.preview-stage.stage-horizontal-meters {
  grid-template-columns: 1fr;
}

.meter-panel.meter-horizontal {
  border-left: 0;
  border-top: 1px solid #2d2516;
  grid-template-columns: 1fr;
  padding: 0.5rem 0.65rem 0.65rem;
  align-content: start;
}

.meter-panel.meter-horizontal .meter-scale {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: auto;
  gap: 0.18rem;
  color: #a7a5a1;
  font-size: 0.6rem;
  margin-bottom: 0.2rem;
  align-items: center;
  align-content: start;
  min-height: 0;
  padding-left: calc(14px + 0.26rem);
  padding-right: calc(34px + 0.26rem);
}

.meter-panel.meter-horizontal .meter-wrap {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: auto;
  gap: 0.24rem;
  width: 100%;
  height: auto;
  align-content: start;
}

.meter-panel.meter-horizontal .meter-col {
  grid-template-columns: 14px 1fr 34px;
  grid-template-rows: auto;
  align-items: center;
  justify-items: stretch;
  gap: 0.26rem;
  width: 100%;
  min-height: 0;
}

.meter-panel.meter-horizontal .meter-col .meter-label {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
}

.meter-panel.meter-horizontal .meter-col .meter-track {
  grid-column: 2;
  grid-row: 1;
}

.meter-panel.meter-horizontal .meter-col .meter-db {
  grid-column: 3;
  grid-row: 1;
}

.meter-panel.meter-horizontal .meter-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  border: 1px solid #2f2f2f;
  background: linear-gradient(90deg, #1a120e 0%, #1a120e 85%, #22100f 85%, #22100f 100%);
}

.meter-panel.meter-horizontal .meter-fill {
  left: 0;
  right: auto;
  top: 0;
  bottom: 0;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #0fcc6b 0%, #bfd31f 68%, #e8533d 100%);
  z-index: 1;
  transition: width 55ms linear;
}

.meter-panel.meter-horizontal .meter-peak {
  top: 0;
  bottom: 0;
  left: 0%;
  width: 2px;
  height: auto;
  z-index: 2;
}

.meter-panel.meter-horizontal .meter-db {
  width: 34px;
  min-width: 34px;
  text-align: right;
  font-size: 0.62rem;
}

.meter-scale {
  display: grid;
  grid-template-rows: repeat(8, 1fr);
  align-items: center;
  color: #a7a5a1;
  font-size: 0.52rem;
  line-height: 1;
  text-align: right;
}

.meter-scale.meter-scale-axis {
  position: relative;
  display: block !important;
  min-height: 0;
}

.audio-meter-scale.meter-scale-axis {
  position: relative;
  display: block !important;
  min-height: 0;
}

.meter-scale.meter-scale-axis span {
  position: absolute;
  right: 0;
  white-space: nowrap;
  pointer-events: none;
}

.audio-meter-scale.meter-scale-axis span {
  position: absolute;
  right: 0;
  white-space: nowrap;
  pointer-events: none;
}

.meter-scale.meter-scale-axis.axis-vertical {
  width: 22px;
}

.audio-meter-scale.meter-scale-axis.axis-vertical {
  width: 22px;
}

.meter-scale.meter-scale-axis.axis-horizontal {
  height: 14px;
}

.audio-meter-scale.meter-scale-axis.axis-horizontal {
  height: 14px;
}

.meter-scale.meter-scale-axis.axis-horizontal span {
  top: 0;
  right: auto;
  text-align: center;
}

.audio-meter-scale.meter-scale-axis.axis-horizontal span {
  top: 0;
  right: auto;
  text-align: center;
}

.meter-wrap {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.2rem;
}

.meter-col {
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 0.16rem;
  align-items: end;
  justify-items: center;
}

.meter-track {
  position: relative;
  width: 6px;
  height: min(56vh, 430px);
  border-radius: 4px;
  border: 1px solid #2f2f2f;
  background: #0a0a0a;
  overflow: hidden;
}

.meter-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  background: linear-gradient(0deg, #0fcc6b 0%, #bfd31f 68%, #e8533d 100%);
  transition: height 55ms linear;
}

.meter-peak {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  bottom: 0%;
  background: #fff6d8;
  box-shadow: 0 0 6px #fff2c2aa;
}

.meter-label {
  color: #d5d1bf;
  font-size: 0.64rem;
  font-weight: 700;
}

.meter-db {
  color: #a8a390;
  font-size: 0.56rem;
  min-width: 1.6rem;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.audio-meter-panel {
  border-left: 0;
  border-top: 1px solid #2d2516;
  grid-template-columns: 1fr;
  padding: 0.5rem 0.65rem 0.65rem;
}

.audio-meter-scale {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.2rem;
  color: #a7a5a1;
  font-size: 0.64rem;
  margin-bottom: 0.36rem;
}

.audio-meter-scale span {
  text-align: right;
}

.audio-meter-panel .meter-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  width: 100%;
}

.audio-meter-panel .meter-col {
  grid-template-columns: 14px 1fr 34px;
  grid-template-rows: 1fr;
  align-items: center;
  justify-items: stretch;
  gap: 0.34rem;
  width: 100%;
}

.audio-meter-panel .meter-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  border: 1px solid #2f2f2f;
  background:
    linear-gradient(90deg, #1a120e 0%, #1a120e 85%, #22100f 85%, #22100f 100%);
}

.audio-meter-panel .meter-fill {
  left: 0;
  right: auto;
  top: 0;
  bottom: 0;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #0fcc6b 0%, #bfd31f 68%, #e8533d 100%);
  transition: width 55ms linear;
}

.audio-meter-panel .meter-peak {
  top: 0;
  bottom: 0;
  left: 0%;
  width: 2px;
  height: auto;
}

.audio-meter-panel .meter-db {
  width: 34px;
  min-width: 34px;
  text-align: right;
  font-size: 0.62rem;
}

.preview-controls {
  display: grid;
  grid-template-columns: repeat(7, auto) 1fr;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.7rem;
}

.video-timeline-wrap {
  margin-top: 0.52rem;
  display: grid;
  gap: 0.24rem;
  position: relative;
}

.timeline-zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  flex-wrap: wrap;
}

.timeline-zoom-btn {
  min-width: 34px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.timeline-zoom-img {
  width: 14px;
  height: 14px;
  display: block;
}

.timeline-zoom-reset {
  min-width: 48px;
  height: 30px;
  padding: 0 0.5rem;
  font-size: 0.78rem;
}

.timeline-wave-mode-btn {
  min-width: 44px;
  height: 30px;
  padding: 0 0.5rem;
  font-size: 0.76rem;
}

.video-timeline-scroll {
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--accent) 50%, #1a150c 50%) color-mix(in srgb, var(--bg) 80%, #120f08 20%);
}

.video-timeline-scroll::-webkit-scrollbar {
  height: 8px;
}

.video-timeline-scroll::-webkit-scrollbar-track {
  background: color-mix(in srgb, var(--bg) 80%, #120f08 20%);
  border-radius: 999px;
}

.video-timeline-scroll::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--accent) 50%, #1a150c 50%);
  border-radius: 999px;
}

.video-timeline-inner {
  min-width: 100%;
  width: 100%;
  position: relative;
}

.video-ruler {
  width: 100%;
  height: 18px;
  display: block;
  border-radius: 8px 8px 0 0;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, #18120a 72%);
  border-bottom: 0;
  background: color-mix(in srgb, var(--bg) 90%, #0a0907 10%);
}

.video-waveform {
  width: 100%;
  height: 56px;
  border-radius: 0 0 10px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, #18120a 68%);
  border-top: 0;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--surface) 90%, #0f0d09 10%),
    color-mix(in srgb, var(--bg) 92%, #0a0907 8%)
  );
  display: block;
  cursor: pointer;
}

.video-wave-hover-time {
  position: absolute;
  top: 6px;
  left: 0;
  transform: translateX(-50%);
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, #1a140d 65%);
  background: color-mix(in srgb, var(--surface) 90%, #0d0b08 10%);
  border-radius: 6px;
  padding: 0.16rem 0.36rem;
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
  z-index: 4;
}

.video-timeline-wrap.show-wave-hover .video-wave-hover-time {
  opacity: 1;
}

.video-track {
  position: relative;
  height: 10px;
  border: 0;
  background: transparent;
  overflow: visible;
  width: 100%;
}

.video-buffered,
.video-played {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
}

.video-buffered {
  display: none;
}

.video-played {
  display: none;
}

.video-marker-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.video-marker-dot {
  position: absolute;
  top: -6px;
  width: 0;
  height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  transform: translateX(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 8px solid var(--marker-color, var(--accent-2));
  filter: drop-shadow(0 0 2px #000000cc);
  border-radius: 0;
  pointer-events: auto;
  cursor: pointer;
}

.video-marker-range {
  position: absolute;
  top: -10px;
  bottom: 2px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--marker-color, var(--accent-2)) 75%, #1a1308 25%);
  border-radius: 4px;
  background: color-mix(in srgb, var(--marker-color, var(--accent-2)) 22%, transparent 78%);
  pointer-events: auto;
  cursor: pointer;
}

.video-thumb {
  display: none;
}

.video-hover-time {
  position: absolute;
  top: -32px;
  left: 0;
  transform: translateX(-50%);
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, #1a140d 65%);
  background: color-mix(in srgb, var(--surface) 90%, #0d0b08 10%);
  border-radius: 6px;
  padding: 0.16rem 0.36rem;
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
}

.video-track.show-hover .video-hover-time {
  opacity: 0;
}

.video-marker-tooltip {
  position: absolute;
  top: -48px;
  left: 0;
  transform: translateX(-50%);
  max-width: min(320px, 70vw);
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, #1a140d 65%);
  background: color-mix(in srgb, var(--surface) 90%, #0d0b08 10%);
  border-radius: 8px;
  padding: 0.22rem 0.42rem;
  font-size: 0.74rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  opacity: 0;
  z-index: 6;
  box-shadow: 0 6px 20px #0000008f;
}

.video-track.show-marker-tip .video-marker-tooltip {
  opacity: 1;
}

.video-seek {
  display: none;
}

.marker-controls {
  margin-top: 0.54rem;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.marker-controls .icon-only-btn {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0 !important;
  align-self: center;
  line-height: 1;
}

#addRetouchBtn,
#svAddRetouch {
  width: 30px !important;
  min-width: 30px !important;
  height: 30px !important;
  min-height: 30px !important;
  padding: 0 !important;
  align-self: center !important;
  box-sizing: border-box !important;
}

.xml-export-wrap {
  position: relative;
}

.xml-export-toggle {
  min-width: 78px;
}

.xml-export-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 170px;
  border: 1px solid #4d3b16;
  border-radius: 10px;
  background: #0d0b08;
  box-shadow: 0 12px 28px #000000b8;
  padding: 0.25rem;
  display: grid;
  gap: 0.2rem;
  z-index: 40;
}

.xml-export-menu.open-up {
  top: auto;
  bottom: calc(100% + 6px);
}

.xml-export-menu button {
  width: 100%;
  height: 30px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: #efdbaa;
  font-size: 0.8rem;
  text-align: left;
  padding: 0 0.5rem;
}

.xml-export-menu button:hover {
  border-color: #5c4618;
  background: #1a1409;
}

.marker-color-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.marker-color-wrap input[type="color"] {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #4d3e18;
  border-radius: 8px;
  background: #120f09;
}

.marker-cut-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #d8c594;
  font-size: 0.82rem;
}

.marker-cut-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #d9b34a;
}

#markerComment {
  height: 36px;
  border-radius: 8px;
  border: 1px solid #4d3e18;
  background: #120f09;
  color: #f5f0df;
  padding: 0 0.6rem;
}

.marker-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: none;
  align-items: center;
  justify-content: center;
  padding: calc(1rem + var(--safe-top)) calc(1rem + var(--safe-right)) calc(1rem + var(--safe-bottom)) calc(1rem + var(--safe-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #000000cf;
  backdrop-filter: blur(4px);
}

.marker-modal.visible {
  display: flex;
}

#uiDialog {
  z-index: 1500;
}

.marker-modal-card {
  width: min(380px, 100%);
  border: 1px solid #4a3912;
  border-radius: 14px;
  background: linear-gradient(180deg, #14110b, #0a0906);
  padding: 0.85rem;
  box-shadow: 0 18px 48px #000000b0;
  display: grid;
  gap: 0.45rem;
  max-height: min(88dvh, 920px);
  overflow: auto;
}

.folder-modal-card {
  width: min(760px, 100%);
}

.folder-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.folder-modal-head h3 {
  margin: 0;
}

.folder-modal-meta {
  color: #c9b887;
  font-size: 0.82rem;
}

.folder-entries-list {
  list-style: none;
  margin: 0.2rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
  max-height: min(60vh, 520px);
  overflow: auto;
}

.folder-entries-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
  align-items: center;
  border: 1px solid #3c3118;
  border-radius: 10px;
  background: #0f0d09;
  padding: 0.45rem 0.52rem;
}

.ui-dialog-card {
  width: min(420px, 100%);
}

.ui-dialog-message {
  margin: 0.1rem 0 0.35rem;
  color: #d5c8a4;
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.35;
  white-space: pre-wrap;
}

.ui-dialog-input {
  height: 38px;
  border-radius: 8px;
  border: 1px solid #4d3e18;
  background: #120f09;
  color: #f5f0df;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  padding: 0 0.62rem;
  width: 100%;
}

.ui-dialog-select {
  height: 38px;
  border-radius: 8px;
  border: 1px solid #4d3e18;
  background: #120f09;
  color: #f5f0df;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  padding: 0 0.62rem;
  width: 100%;
}

.folder-entry-name {
  color: #f5f0df;
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-entry-meta {
  color: #b6a57a;
  font-size: 0.68rem;
  line-height: 1.2;
}

.folder-entry-actions {
  display: inline-flex;
  gap: 0.34rem;
  align-items: center;
}

.folder-entry-actions .ghost-btn,
.folder-entry-actions a {
  height: 30px;
  border-radius: 8px;
  padding: 0.28rem 0.58rem;
  font-size: 0.75rem;
}

.folder-entry-actions a {
  text-decoration: none;
  color: var(--accent-2);
  border: 1px solid #4e3a10;
}

.marker-modal-card h3 {
  margin: 0 0 0.2rem;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
}

.marker-modal-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.05rem;
}

.marker-modal-head h3 {
  margin: 0;
}

.marker-modal-head-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  background: color-mix(in srgb, var(--surface-2) 92%, #000 8%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.marker-modal-head-icon-glyph {
  width: 16px;
  height: 16px;
  display: inline-block;
  color: var(--accent-2);
}

.marker-modal-at {
  margin-top: 0.08rem;
  margin-bottom: 0.2rem;
  color: var(--accent-2);
  font-size: 1.02rem;
  line-height: 1.18;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  background: color-mix(in srgb, var(--surface-2) 90%, #000 10%);
  border-radius: 10px;
  padding: 0.38rem 0.5rem;
  text-align: center;
}

.marker-modal-card label {
  color: color-mix(in srgb, var(--muted) 72%, var(--ink) 28%);
  font-size: 0.82rem;
  font-weight: 400;
}

.marker-modal-card input[type="text"] {
  height: 38px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  background: color-mix(in srgb, var(--surface-2) 90%, #000 10%);
  color: var(--ink);
  padding: 0 0.62rem;
}

.marker-modal-card input[type="color"] {
  width: 54px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid #4d3e18;
  background: #120f09;
  padding: 2px;
  cursor: pointer;
}

.marker-color-cut-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.marker-color-cut-row input[type="color"] {
  margin: 0;
  flex: 0 0 auto;
}

.marker-cut-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  border: 1px solid #3d3217;
  background: #0f0d09;
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  line-height: 1.1;
  margin: 0;
}

.marker-cut-toggle input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  margin: 0;
}

.marker-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.42rem;
  margin-top: 0.25rem;
}

#uiDialog[data-layout="proxy-choice"] .marker-modal-actions {
  justify-content: center;
}

.marker-list {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
  border: 1px solid #2c2313;
  border-radius: 10px;
  background: #0b0a08;
  max-height: min(34vh, 340px);
  overflow: auto;
}

.marker-list li {
  display: grid;
  grid-template-columns: 14px auto auto 1fr auto;
  gap: 0.45rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid #211b10;
  transition: background-color 120ms ease;
}

.marker-list li:hover {
  background: color-mix(in srgb, var(--accent) 10%, #0b0a08 90%);
}

.marker-list li:last-child {
  border-bottom: 0;
}

.marker-list li.marker-empty {
  grid-template-columns: 1fr;
}

.marker-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid #2a220f;
}

.marker-kind {
  color: #d5be84;
  font-size: 0.66rem;
  border: 1px solid #4a3810;
  border-radius: 999px;
  padding: 0.06rem 0.38rem;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.marker-at {
  color: #f0d48c;
  font-size: 0.8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.marker-at-range {
  display: inline-flex;
  flex-direction: column;
  gap: 0.04rem;
  line-height: 1.08;
}

.marker-click {
  cursor: pointer;
}

.marker-click:hover {
  color: color-mix(in srgb, var(--accent) 72%, #ffffff 28%);
}

.marker-note {
  color: #cec5ad;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.marker-list .marker-note {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.22;
}

.marker-actions {
  display: inline-flex;
  gap: 0.28rem;
}

.marker-btn {
  height: 26px;
  border-radius: 7px;
  border: 1px solid #4e3a10;
  padding: 0 0.45rem;
  background: #171208;
  color: #f1d58f;
  font-size: 0.74rem;
}

.marker-btn .btn-icon {
  width: 14px;
  height: 14px;
  background: currentColor;
}

.marker-btn-danger {
  min-width: 28px;
  padding: 0 0.35rem;
  color: #f0b0b0;
  border-color: color-mix(in srgb, #d65a5a 48%, #1a140b 52%);
}

.preview-controls .ghost-btn,
.preview-controls button {
  height: 36px;
  padding: 0.45rem 0.75rem;
  font-size: 0.86rem;
}

.frame-step-btn {
  width: 36px;
  min-width: 36px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.frame-step-btn .btn-icon {
  width: 16px;
  height: 16px;
}

.compact-source-toggle {
  height: 30px !important;
  padding: 0.2rem 0.52rem !important;
  font-size: 0.75rem !important;
  border-radius: 8px;
  line-height: 1;
  width: auto;
  min-width: 0;
}

.marker-controls .compact-source-toggle {
  height: 36px !important;
  padding: 0.45rem 0.75rem !important;
  font-size: 0.86rem !important;
  border-radius: 10px;
}

.fps-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.fps-wrap input {
  width: 66px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 36%, #1b150d 64%);
  background: color-mix(in srgb, var(--surface) 92%, #120f09 8%);
  color: var(--ink);
  padding: 0 0.4rem;
}

.timecode {
  justify-self: end;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95rem;
  color: var(--accent-2);
  border: 1px solid color-mix(in srgb, var(--accent) 36%, #1a140d 64%);
  background: color-mix(in srgb, var(--surface) 92%, #120f08 8%);
  border-radius: 8px;
  padding: 0.45rem 0.62rem;
  min-width: 132px;
  text-align: center;
  cursor: pointer;
}

.timecode-centered {
  display: table;
  width: auto;
  min-width: 132px;
  max-width: max-content;
  justify-self: center;
  margin-left: auto;
  margin-right: auto;
  margin-top: 0.46rem;
  margin-bottom: 0.16rem;
}

.preview-hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.55rem;
}

.preview-close {
  width: 36px;
  height: 36px;
  border: 1px solid #564117;
}

.preview-help-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #564117;
}

.auth-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, #15110a, #0b0906);
  border: 1px solid #4a3912;
  border-radius: 16px;
  padding: 1.1rem;
  box-shadow: 0 20px 60px #000000b8;
  max-height: min(88dvh, 920px);
  overflow: auto;
}

.auth-logo {
  width: 70px;
  height: 70px;
  display: block;
  margin: 0 auto 0.4rem;
  object-fit: contain;
}

.auth-card h2 {
  margin: 0;
  text-align: center;
}

.auth-card p {
  margin: 0.35rem 0 0.9rem;
  text-align: center;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 0.45rem;
}

.auth-form label {
  color: color-mix(in srgb, var(--muted) 70%, var(--ink) 30%);
  font-size: 0.9rem;
}

.auth-form input {
  height: 42px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  background: color-mix(in srgb, var(--surface-2) 90%, #000 10%);
  color: var(--ink);
  padding: 0 0.75rem;
  width: 100%;
}

.auth-input-wrap {
  height: 42px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  background: color-mix(in srgb, var(--surface-2) 90%, #000 10%);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0 0.7rem;
  color: color-mix(in srgb, var(--accent) 72%, var(--ink) 28%);
}

.auth-input-icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 1rem;
  opacity: 0.9;
  display: inline-block;
}

.auth-input-wrap input {
  border: 0;
  background: transparent;
  padding: 0;
  height: 100%;
}

.auth-input-wrap input:focus {
  outline: none;
}

.auth-passkey-inline {
  height: 42px;
  margin-top: 0;
}

.auth-passkey-fallback {
  height: 34px;
  margin-top: -0.15rem;
  font-size: 0.82rem;
}

.auth-passkey-inline[hidden],
.auth-passkey-fallback[hidden] {
  display: none !important;
}

.settings-modal-card {
  width: min(560px, 96vw);
}

.tutorial-modal-card {
  width: min(760px, 96vw);
}

.tutorial-content {
  display: grid;
  gap: 0.9rem;
  max-height: min(58vh, 620px);
  overflow: auto;
  padding-right: 0.3rem;
}

.tutorial-content section {
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: color-mix(in srgb, var(--surface) 92%, #000);
  padding: 0.75rem 0.9rem;
}

.tutorial-content h4 {
  margin: 0 0 0.4rem;
  color: var(--ink);
  font-size: 0.98rem;
}

.tutorial-content ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.32rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.settings-modal-card .ui-dialog-input:not([hidden]),
.settings-modal-card .ui-dialog-select {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #4d3e18;
  background: #120f09;
  color: #f5f0df;
  padding: 0 0.75rem;
  margin: 0 0 0.35rem;
}

.short-share-card {
  width: min(520px, calc(100vw - 1.4rem));
}

.short-share-card .short-share-field {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
}

.short-share-card .short-share-field > span {
  min-width: 150px;
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 400;
}

.short-share-card .short-share-field .ui-dialog-input,
.short-share-card .short-share-field .ui-dialog-select {
  width: 100%;
}

.marker-modal-card button,
.marker-modal-card .ghost-btn {
  font-weight: 500;
}

.short-share-card .short-share-result-row {
  margin-top: 0.25rem;
}

@media (max-width: 560px) {
  .short-share-card .short-share-field {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .short-share-card .short-share-field > span {
    min-width: 0;
    max-width: none;
  }
}

.settings-modal-card input[type="file"].ui-dialog-input {
  height: auto;
  padding: 0.45rem 0.55rem;
}

.settings-color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.7rem;
  margin: 0.25rem 0 0.45rem;
}

.settings-color-grid label {
  color: #d8ca9d;
  font-size: 0.82rem;
  display: grid;
  gap: 0.3rem;
}

.settings-color-grid input[type="color"] {
  width: 100%;
  height: 34px;
  border: 1px solid #4d3e18;
  border-radius: 8px;
  background: #120f09;
  padding: 0.1rem;
}

.settings-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: #d8ca9d;
  font-size: 0.82rem;
  margin: 0.12rem 0;
}

.settings-preview-wrap {
  margin: 0.18rem 0 0.45rem;
  padding: 0.55rem;
  border: 1px solid #3b3015;
  border-radius: 10px;
  background: #0d0a05;
}

.settings-preview-title {
  color: #d8ca9d;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}

.settings-logo-preview {
  width: 100%;
  max-width: 220px;
  max-height: 96px;
  object-fit: contain;
  display: block;
  border: 1px solid #4d3e18;
  border-radius: 8px;
  background: #050505;
}

.settings-preview-empty {
  color: #9f9167;
  font-size: 0.8rem;
}

.auth-form button {
  margin-top: 0.35rem;
}

.auth-error {
  min-height: 1.1rem;
  color: #ff9f9f;
  font-size: 0.85rem;
}

@media (max-width: 700px), (max-height: 760px) {
  .auth-modal {
    align-items: flex-start;
    padding-top: calc(var(--safe-top) + 0.55rem);
  }

  .auth-card {
    margin: 0 auto;
    max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 1.1rem);
  }
}

.settings-status {
  min-height: 1.2rem;
}

.settings-status.status-ok {
  color: #9de7ad;
}

.settings-status.status-info {
  color: #d8ca9d;
}

.settings-status.status-error {
  color: #ff9f9f;
}

.recorder-share-card {
  width: min(620px, 96vw);
}

.recorder-share-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 0.45rem;
  margin-bottom: 0.15rem;
  border-bottom: 1px solid rgba(59, 48, 21, 0.65);
}

.recorder-share-header-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line, #5f4a15);
  background: rgba(18, 15, 9, 0.9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.recorder-share-header-icon .btn-icon {
  width: 18px;
  height: 18px;
  color: color-mix(in srgb, var(--accent-2) 82%, var(--ink) 18%);
}

.recorder-share-header-text {
  min-width: 0;
}

.recorder-share-header-text h3 {
  margin: 0;
}

.recorder-share-header-sub {
  margin: 0.1rem 0 0;
  color: #bca976;
  font-size: 0.84rem;
}

.recorder-share-grid {
  margin-top: 0.18rem;
}

.recorder-share-result {
  margin-top: 0.35rem;
}

.recorder-share-url-row {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.recorder-share-url-input {
  margin: 0 !important;
}

.settings-modal-card .recorder-share-url-input {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  border-right: 0 !important;
  margin: 0 !important;
}

.recorder-share-copy-btn {
  margin: 0 !important;
  min-width: 112px;
}

.settings-modal-card .recorder-share-copy-btn {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  margin-left: -1px !important;
  height: 40px;
}

.recorder-share-links {
  margin-top: 0.55rem;
  border: 1px solid #3b3015;
  border-radius: 10px;
  background: #0d0a05;
  padding: 0.45rem;
}

.recorder-share-links-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.recorder-share-refresh-btn {
  min-width: 88px;
}

.recorder-share-links-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.32rem;
  max-height: 180px;
  overflow: auto;
}

.recorder-share-link-item {
  border: 1px solid #3b3015;
  background: #12100a;
  border-radius: 8px;
  padding: 0.36rem;
}

.recorder-share-link-meta {
  color: #c9bc94;
  font-size: 0.82rem;
  margin-bottom: 0.25rem;
}

.recorder-share-link-row {
  display: flex;
  align-items: center;
  gap: 0.28rem;
}

.recorder-share-link-input {
  margin: 0 !important;
  font-size: 0.84rem;
}

.recorder-share-link-copy,
.recorder-share-link-delete {
  min-width: 68px;
  white-space: nowrap;
}

.recorder-share-link-delete {
  border-color: #5f1e1e;
  color: #ff8f8f;
}

.recorder-share-empty {
  color: #a59466;
  font-size: 0.84rem;
  padding: 0.2rem;
}

.icon-share-rec {
  mask-image: url('assets/svg/camera2.svg');
  -webkit-mask-image: url('assets/svg/camera2.svg');
}

.settings-section {
  margin-bottom: 0.55rem;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 92%, #000 8%);
  padding: 0.6rem;
}

.settings-inline-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.3rem;
}

.settings-passkey-block {
  margin-top: 0.35rem;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 92%, #000 8%);
  padding: 0.6rem;
}

.settings-passkey-block h4 {
  margin: 0 0 0.3rem;
  font-size: 0.92rem;
  color: var(--accent-2);
}

.settings-passkey-list {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.settings-passkey-item {
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 90%, #000 10%);
  padding: 0.45rem 0.55rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.settings-passkey-item-meta {
  min-width: 0;
  display: grid;
  gap: 0.14rem;
}

.settings-passkey-item-name {
  color: #f4edd9;
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-passkey-item-sub {
  color: var(--muted);
  font-size: 0.74rem;
}

.settings-passkey-item .delete-confirm {
  border-color: #7f2a22;
  color: #ffb0a8;
}

.settings-passkey-empty {
  color: #9f9167;
  font-size: 0.8rem;
}

.app {
  max-width: 860px;
  margin: 0 auto;
  padding: 0.9rem calc(0.9rem + var(--safe-right)) calc(0.9rem + var(--safe-bottom)) calc(0.9rem + var(--safe-left));
  display: grid;
  gap: 0.9rem;
  min-height: calc(100vh - (var(--safe-top) + var(--safe-bottom) + 110px));
  align-content: start;
}

.dropzone,
.links {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: inset 0 1px 0 #ffffff0c;
}

.auth-user {
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.storage-stats {
  display: inline-flex;
  align-items: center;
  gap: 0.52rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.storage-pie {
  --storage-p: 0;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background:
    radial-gradient(circle at center, color-mix(in srgb, var(--bg) 90%, #000 10%) 56%, transparent 58%),
    conic-gradient(var(--accent) calc(var(--storage-p) * 1%), color-mix(in srgb, var(--line) 65%, #000 35%) 0);
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  box-shadow: inset 0 1px 0 #ffffff12;
}

.storage-lines {
  display: grid;
  gap: 0.08rem;
}

.storage-line {
  line-height: 1.2;
  white-space: nowrap;
}

.dropzone {
  border-style: dashed;
  text-align: center;
  min-height: 230px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  cursor: pointer;
}

.dropzone h1 {
  margin: 0.2rem 0 0;
  font-size: 1.45rem;
}

.logo {
  width: 62px;
  height: 62px;
  margin: 0 auto;
  display: block;
  object-fit: contain;
  object-position: center;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.selection-summary {
  color: color-mix(in srgb, var(--muted) 72%, var(--ink) 28%);
  font-size: 0.86rem;
  min-height: 1.2em;
}

.clear-selection-btn {
  width: auto;
  min-width: 130px;
}

.upload-progress {
  margin-top: 0.5rem;
  display: grid;
  justify-items: center;
  gap: 0.45rem;
}

.upload-ring {
  --p: 0;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, color-mix(in srgb, var(--bg) 90%, #000 10%) 58%, transparent 59%),
    conic-gradient(var(--accent) calc(var(--p) * 1%), color-mix(in srgb, var(--line) 65%, #000 35%) 0);
  display: grid;
  place-items: center;
}

.upload-ring-inner {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent-2);
  font-weight: 700;
  font-size: 0.95rem;
  background: color-mix(in srgb, var(--surface-2) 92%, #000 8%);
  border: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
}

.upload-progress-meta {
  color: color-mix(in srgb, var(--muted) 74%, var(--ink) 26%);
  font-size: 0.84rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.dropzone.dragover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 48%, transparent), inset 0 1px 0 #ffffff10;
}

@media (min-width: 900px) and (orientation: landscape) {
  .dropzone {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    grid-template-areas:
      "hint progress"
      "summary progress"
      "clear progress"
      "upload progress";
    align-content: center;
    justify-items: start;
    align-items: center;
    text-align: left;
    column-gap: 1rem;
    row-gap: 0.52rem;
    min-height: 240px;
  }

  .dropzone .hint {
    grid-area: hint;
    justify-self: start;
  }

  .dropzone .selection-summary {
    grid-area: summary;
    justify-self: start;
  }

  .dropzone .clear-selection-btn {
    grid-area: clear;
    width: auto;
  }

  .dropzone #startUpload {
    grid-area: upload;
    width: auto;
    min-width: 140px;
  }

  .dropzone .upload-progress {
    grid-area: progress;
    width: 100%;
    min-height: 122px;
    margin-top: 0;
    justify-items: center;
    align-content: center;
  }
}

button {
  border: 0;
  border-radius: 10px;
  padding: 0.7rem 0.95rem;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  font-weight: 700;
  cursor: pointer;
}

#togglePlay,
#audioTogglePlay,
#svToggle,
#saToggle {
  min-width: 118px;
  transition: box-shadow 140ms ease, background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.preview-controls #togglePlay,
.preview-controls #svToggle {
  min-width: 56px;
  width: 56px;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

#togglePlay.is-paused,
#audioTogglePlay.is-paused,
#svToggle.is-paused,
#saToggle.is-paused {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--surface) 92%, #19140a 8%),
    color-mix(in srgb, var(--bg) 92%, #120f08 8%)
  );
  color: var(--accent-2);
  border: 1px solid color-mix(in srgb, var(--accent) 42%, #1a1309 58%);
  box-shadow: inset 0 1px 0 #ffffff12;
}

#togglePlay.is-playing,
#audioTogglePlay.is-playing,
#svToggle.is-playing,
#saToggle.is-playing {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  border: 1px solid color-mix(in srgb, var(--accent) 64%, #1f1708 36%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent), 0 0 18px color-mix(in srgb, var(--accent-2) 45%, transparent);
}

.preview-controls #togglePlay.is-playing,
.preview-controls #svToggle.is-playing {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent), 0 0 8px color-mix(in srgb, var(--accent-2) 42%, transparent);
}

.icon-play-btn {
  min-width: 64px !important;
  padding: 0.66rem 0.8rem;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-play-btn .btn-icon {
  width: 18px;
  height: 18px;
}

.ghost-btn {
  background: transparent;
  color: var(--accent-2);
  border: 1px solid color-mix(in srgb, var(--accent) 42%, #1a1309 58%);
  padding: 0.45rem 0.7rem;
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.queue-header h2,
.links h2 {
  margin: 0;
  font-size: 1rem;
}

.links-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.folder-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.folder-path {
  color: #cbb88a;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.22rem;
}

.folder-crumb-btn {
  border: 0;
  background: transparent;
  color: #d8c99f;
  font-size: 0.82rem;
  padding: 0 0.08rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.folder-crumb-btn:hover {
  color: #f0da9f;
}

.folder-crumb-btn.active {
  color: #f4e2b2;
  text-decoration: none;
  cursor: default;
}

.folder-crumb-sep {
  color: #8f7f58;
  font-size: 0.78rem;
}

.links-toolbar {
  margin-top: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.select-all-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  color: #d7c390;
  font-size: 0.86rem;
}

.selected-info {
  color: var(--muted);
  font-size: 0.84rem;
  min-width: 78px;
}

.links-toolbar-actions {
  display: inline-flex;
  gap: 0.4rem;
  margin-left: auto;
}

.links-toolbar-actions .ghost-btn {
  height: 32px;
  padding: 0.35rem 0.66rem;
  font-size: 0.8rem;
}

.icon-only-btn {
  width: 32px;
  min-width: 32px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  background: currentColor;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}

.icon-zoom-out {
  mask-image: url('assets/svg/zoom-out.svg');
  -webkit-mask-image: url('assets/svg/zoom-out.svg');
}

.icon-username {
  mask-image: url('assets/svg/username.svg');
  -webkit-mask-image: url('assets/svg/username.svg');
}

.icon-password {
  mask-image: url('assets/svg/password.svg');
  -webkit-mask-image: url('assets/svg/password.svg');
}

.icon-marker {
  mask-image: url('assets/svg/marker.svg');
  -webkit-mask-image: url('assets/svg/marker.svg');
}

.icon-zoom-in {
  mask-image: url('assets/svg/zoom-in.svg');
  -webkit-mask-image: url('assets/svg/zoom-in.svg');
}

.icon-add-folder {
  mask-image: url('assets/svg/add-folder.svg');
  -webkit-mask-image: url('assets/svg/add-folder.svg');
}

.icon-move-folder {
  mask-image: url('assets/svg/move-to-folder.svg');
  -webkit-mask-image: url('assets/svg/move-to-folder.svg');
}

.icon-zip {
  mask-image: url('assets/svg/zip.svg');
  -webkit-mask-image: url('assets/svg/zip.svg');
}

.icon-delete {
  mask-image: url('assets/svg/delete.svg');
  -webkit-mask-image: url('assets/svg/delete.svg');
}

.icon-preview {
  mask-image: url('assets/svg/preview.svg');
  -webkit-mask-image: url('assets/svg/preview.svg');
}

.icon-download {
  mask-image: url('assets/svg/download.svg');
  -webkit-mask-image: url('assets/svg/download.svg');
}

.icon-copy-link {
  mask-image: url('assets/svg/copy-link.svg');
  -webkit-mask-image: url('assets/svg/copy-link.svg');
}

.icon-upload-link {
  mask-image: url('assets/svg/upload-link.svg');
  -webkit-mask-image: url('assets/svg/upload-link.svg');
}

.icon-share-rec {
  mask-image: url('assets/svg/camera2.svg');
  -webkit-mask-image: url('assets/svg/camera2.svg');
}

.icon-rename {
  mask-image: url('assets/svg/rename.svg');
  -webkit-mask-image: url('assets/svg/rename.svg');
}

.icon-proxy {
  mask-image: url('assets/svg/proxy.svg');
  -webkit-mask-image: url('assets/svg/proxy.svg');
}

.icon-repeat-off {
  mask-image: url('assets/svg/no-repeat.svg');
  -webkit-mask-image: url('assets/svg/no-repeat.svg');
}

.icon-repeat-all {
  mask-image: url('assets/svg/repeat.svg');
  -webkit-mask-image: url('assets/svg/repeat.svg');
}

.icon-repeat-one {
  mask-image: url('assets/svg/repeat1.svg');
  -webkit-mask-image: url('assets/svg/repeat1.svg');
}

.icon-audio-play {
  mask-image: url('assets/svg/pay.svg');
  -webkit-mask-image: url('assets/svg/pay.svg');
}

.icon-audio-pause {
  mask-image: url('assets/svg/pause.svg');
  -webkit-mask-image: url('assets/svg/pause.svg');
}

.icon-audio-back10 {
  mask-image: url('assets/svg/-10s.svg');
  -webkit-mask-image: url('assets/svg/-10s.svg');
}

.icon-audio-forward10 {
  mask-image: url('assets/svg/+10s.svg');
  -webkit-mask-image: url('assets/svg/+10s.svg');
}

.icon-audio-prev {
  mask-image: url('assets/svg/prev_song.svg');
  -webkit-mask-image: url('assets/svg/prev_song.svg');
}

.icon-audio-next {
  mask-image: url('assets/svg/next_song.svg');
  -webkit-mask-image: url('assets/svg/next_song.svg');
}

.icon-frame-back10 {
  mask-image: url('assets/svg/-10f.svg');
  -webkit-mask-image: url('assets/svg/-10f.svg');
}

.icon-frame-back1 {
  mask-image: url('assets/svg/-1f.svg');
  -webkit-mask-image: url('assets/svg/-1f.svg');
}

.icon-frame-forward1 {
  mask-image: url('assets/svg/+1f.svg');
  -webkit-mask-image: url('assets/svg/+1f.svg');
}

.icon-frame-forward10 {
  mask-image: url('assets/svg/+10f.svg');
  -webkit-mask-image: url('assets/svg/+10f.svg');
}

.zip-status {
  margin-top: 0.55rem;
  border: 1px solid #3d2f12;
  border-radius: 10px;
  background: #0d0b07;
  padding: 0.45rem 0.55rem;
}

.zip-status-text {
  color: #d8c594;
  font-size: 0.8rem;
}

.zip-status-bar {
  margin-top: 0.33rem;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #1f190e;
}

.zip-status-bar > span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #9f7f24, #d6b04a);
}

.queue ul,
.links ul {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

#linksList {
  margin-top: 0.7rem;
  padding: 0.28rem 0.22rem 0.18rem;
}

.queue li,
.links li {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  background: #080808;
}

.meta {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.25;
}

.progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #19160d;
  overflow: hidden;
  margin-top: 0.52rem;
}

.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.file-row {
  display: grid;
  grid-template-columns: 0 46px 1fr auto;
  align-items: center;
  gap: 0.7rem;
}

.file-row.file-row-selected {
  border-color: #cfaa45 !important;
  box-shadow: 0 0 0 1px #cfaa4566, 0 0 16px #cfaa4533;
}

.file-row.folder-drop-target {
  border-color: #b88916;
  box-shadow: inset 0 0 0 1px #d8b04866;
}

.file-row.file-dragging {
  opacity: 0.6;
}

.file-row.folder-entry-inline {
  grid-template-columns: 0 40px minmax(0, 1fr) auto;
  grid-template-areas: "select type info actions";
}

.file-row.folder-entry-inline[data-entry-kind="folder"] {
  background: linear-gradient(180deg, #100d07, #0d0b06);
  border: 1px solid #3f3115;
}

.file-row.folder-entry-inline[data-folder-entry-file-id] {
  cursor: grab;
}

.file-row.folder-entry-inline.file-dragging[data-folder-entry-file-id] {
  cursor: grabbing;
}

.file-row.folder-entry-inline[data-entry-kind="folder"][data-folder-entry-drag-key] {
  cursor: grab;
}

.file-row.folder-entry-inline.file-dragging[data-entry-kind="folder"][data-folder-entry-drag-key] {
  cursor: grabbing;
}

.file-row.folder-parent-lane {
  grid-template-columns: 46px minmax(0, 1fr);
  border: 1px dashed #6a521a;
  background: #12100a;
  cursor: pointer;
}

.file-row[data-file-drag-id] {
  cursor: grab;
}

.file-row.file-dragging[data-file-drag-id] {
  cursor: grabbing;
}

.file-select-wrap {
  display: block;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.file-select {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.file-type {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #3a2f13;
  background: #161005;
  color: #f1ddae;
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  overflow: hidden;
}

.file-type-folder {
  background: #1c1507;
  color: #f7dc98;
  font-size: 1rem;
  letter-spacing: 0;
}

.file-type-image {
  background: #1b1204;
}

.file-type-video {
  background: #17120a;
}

.file-type-audio {
  background: #1a140c;
}

.file-type-doc {
  background: #151006;
}

.file-type-archive {
  background: #171207;
}

.file-type.file-thumb {
  background: #0d0d0d;
  border-color: #5a4820;
  padding: 0;
}

.file-type.select-active {
  border-color: #d4ad49;
  box-shadow: 0 0 0 1px #d4ad4970, 0 0 12px #d4ad4948;
}

.file-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-hover {
  position: fixed;
  z-index: 2500;
  width: 240px;
  height: 135px;
  border: 1px solid #5f4a1b;
  background: #050505;
  box-shadow: 0 10px 28px #000000c4;
  pointer-events: none;
  border-radius: 8px;
  overflow: hidden;
}

.thumb-hover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.file-name {
  font-size: 0.95rem;
  line-height: 1.3;
  word-break: break-word;
}

.proxy-pill {
  display: inline-grid;
  place-items: center;
  margin-left: 0.34rem;
  padding: 0 0.42rem;
  min-height: 20px;
  border-radius: 999px;
  border: 1px solid #6a5220;
  color: #f4db9e;
  background: #1b1408;
  font-size: 0.63rem;
  letter-spacing: 0.06em;
  line-height: 1;
  vertical-align: middle;
  white-space: nowrap;
}

.proxy-pill-btn {
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  line-height: 1;
  padding: 0 0.42rem;
  min-height: 20px;
  appearance: none;
  -webkit-appearance: none;
}

.proxy-pill-btn:hover {
  border-color: #9b772e;
  color: #f8e3b1;
  background: #251a0a;
}

.file-info {
  min-width: 0;
}

.file-actions {
  display: flex;
  gap: 0.32rem;
  position: relative;
}

.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  background: color-mix(in srgb, var(--surface-2) 90%, #000 10%);
  color: var(--accent-2);
  text-decoration: none;
  cursor: pointer;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.share-help-icon-svg {
  width: 16px;
  height: 16px;
  display: block;
  color: currentColor;
}

.share-help-icon-svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.share-help-icon-svg circle {
  fill: currentColor;
}

.share-help-card {
  width: min(560px, calc(100vw - 1.4rem));
}

.share-help-text {
  margin: 0.2rem 0 0.52rem;
  color: color-mix(in srgb, var(--muted) 68%, var(--ink) 32%);
  font-size: 0.88rem;
}

.share-help-list {
  margin: 0 0 0.62rem 1rem;
  padding: 0;
  display: grid;
  gap: 0.28rem;
  color: color-mix(in srgb, var(--muted) 74%, var(--ink) 26%);
  font-size: 0.84rem;
}

.share-help-list code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.76rem;
  color: var(--accent-2);
}

.copy-btn.copied {
  background: #2f260f;
  color: #ffe6a5;
}

.preview-btn {
  border-color: #2f5a2a;
  color: #b7f1b2;
  background: #11250f;
}

.preview-btn:hover {
  background: #163213;
}

.delete-btn {
  border-color: #5f1f1f;
  color: #f3b3b3;
  background: #2b0f0f;
}

.delete-btn:hover {
  background: #3b1212;
}

.menu-btn {
  font-size: 1rem;
  line-height: 1;
}

.file-menu {
  position: absolute;
  top: 38px;
  right: 0;
  min-width: 148px;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 92%, #000 8%);
  box-shadow: 0 12px 28px #000000b8;
  padding: 0.25rem;
  display: none;
  z-index: 30;
}

.file-menu.open {
  display: grid;
}

.file-menu.open-up {
  top: auto;
  bottom: 38px;
}

.file-menu button,
.file-menu a {
  width: 100%;
  height: 30px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: color-mix(in srgb, var(--muted) 60%, var(--ink) 40%);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.15;
  text-align: left;
  padding: 0 0.5rem;
  text-decoration: none;
  display: flex;
  align-items: center;
}

.file-menu button {
  appearance: none;
  -webkit-appearance: none;
}

.file-menu .icon-only-btn {
  width: 30px;
  min-width: 30px;
  height: 30px;
  justify-content: center;
  padding: 0 !important;
}

.file-menu .btn-icon {
  width: 14px;
  height: 14px;
  margin-right: 0.42rem;
  flex: 0 0 auto;
}

.file-menu button:hover,
.file-menu a:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line) 58%);
  background: color-mix(in srgb, var(--surface-2) 84%, var(--accent) 16%);
  color: var(--ink);
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

.splash {
  position: fixed;
  inset: 0;
  background: #030303;
  color: #e3d6af;
  display: grid;
  place-items: center;
  text-align: center;
  z-index: 999;
  transition: opacity 0.35s ease;
}

.splash.hide {
  opacity: 0;
  pointer-events: none;
}

.splash img {
  width: 140px;
  height: 140px;
  display: block;
  object-fit: contain;
  object-position: center;
  margin-bottom: 0.4rem;
}

@media (max-width: 640px) {
  .topbar {
    min-height: calc(84px + var(--safe-top));
    padding: var(--safe-top) calc(0.7rem + var(--safe-right)) 0 calc(0.7rem + var(--safe-left));
  }

  .auth-user {
    max-width: 92px;
  }

  .storage-stats {
    font-size: 0.64rem;
    gap: 0.42rem;
  }

  .storage-pie {
    width: 22px;
    height: 22px;
  }

  .account-menu-btn {
    min-width: 116px;
    padding: 0.5rem 0.6rem;
  }

  .account-menu {
    min-width: 185px;
  }

  .app {
    padding: 0.7rem calc(0.7rem + var(--safe-right)) calc(0.7rem + var(--safe-bottom)) calc(0.7rem + var(--safe-left));
    min-height: calc(100vh - (var(--safe-top) + var(--safe-bottom) + 96px));
  }

  .dropzone {
    min-height: 210px;
    padding: 0.9rem;
  }

  .queue-header {
    flex-direction: column;
    align-items: stretch;
  }

  button {
    width: 100%;
  }

  .ghost-btn {
    width: auto;
  }

  .file-row {
    grid-template-columns: 0 40px 1fr auto;
    grid-template-areas:
      "select type info actions";
  }

  .file-select-wrap {
    grid-area: select;
  }

  .file-type {
    grid-area: type;
    width: 36px;
    height: 36px;
  }

  .file-info {
    grid-area: info;
  }

  .file-actions {
    grid-area: actions;
    margin-top: 0;
  }

  .file-row.folder-parent-lane {
    grid-template-columns: 36px minmax(0, 1fr);
    grid-template-areas: "type info";
    align-items: center;
  }

  .file-row.folder-parent-lane .file-type {
    grid-area: type;
    justify-self: start;
  }

  .file-row.folder-parent-lane .file-info {
    grid-area: info;
    min-width: 0;
  }

  .links-toolbar-actions {
    margin-left: 0;
    width: 100%;
  }

  .links-toolbar-actions .ghost-btn {
    width: auto;
  }

  .preview-shell {
    padding: 0.7rem;
  }

  .image-preview-shell {
    padding: 0.7rem;
  }

  .audio-preview-shell {
    padding: 0.7rem;
  }

  .image-nav {
    grid-template-columns: 1fr 1fr;
  }

  .image-nav-info {
    grid-column: span 2;
  }

  .preview-stage video {
    max-height: 50vh;
  }

  .preview-stage {
    grid-template-columns: 1fr;
  }

  .audio-preview-stage {
    grid-template-columns: 1fr;
  }

  .meter-panel {
    border-left: 0;
    border-top: 1px solid #2d2516;
    grid-template-columns: 1fr;
    padding: 0.55rem 0.5rem 0.7rem;
  }

  .meter-scale {
    display: none;
  }

  .meter-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.42rem;
    width: 100%;
  }

  .meter-col {
    grid-template-columns: 14px 1fr 34px;
    grid-template-rows: 1fr;
    align-items: center;
    justify-items: stretch;
    gap: 0.34rem;
    width: 100%;
  }

  .meter-track {
    width: 100%;
    height: 9px;
    border-radius: 999px;
    background: linear-gradient(90deg, #1a120e 0%, #1a120e 85%, #22100f 85%, #22100f 100%);
  }

  .meter-fill {
    left: 0;
    right: auto;
    top: 0;
    bottom: 0;
    width: 0%;
    height: 100%;
    transition: width 55ms linear;
  }

  .meter-peak {
    top: 0;
    bottom: 0;
    left: 0%;
    width: 2px;
    height: auto;
  }

  .meter-db {
    width: 34px;
    min-width: 34px;
    text-align: right;
  }

  .preview-controls {
    grid-template-columns: 34px 34px 56px 34px 34px 34px 34px minmax(92px, 1fr);
    gap: 0.35rem;
    align-items: center;
  }

  .video-waveform {
    height: 54px;
  }

  .timeline-zoom-controls {
    gap: 0.3rem;
  }

  .marker-controls {
    grid-template-columns: 1fr;
  }

  #markerComment {
    width: 100%;
  }

  .audio-controls {
    flex-wrap: wrap;
  }

  .audio-repeat {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .audio-time {
    margin-left: 0;
    width: 100%;
  }

  .audio-meta {
    grid-template-columns: 1fr;
  }

  .audio-cover {
    width: 96px;
    height: 96px;
    justify-self: center;
  }

  .audio-meta-grid {
    grid-template-columns: 1fr;
  }

  .preview-controls button,
  .preview-controls .ghost-btn {
    width: auto;
  }

  .preview-controls .frame-step-btn {
    width: 34px;
    min-width: 34px;
    padding: 0 !important;
    justify-self: center;
  }

  #togglePlay,
  #svToggle {
    min-width: 56px;
    width: 56px;
    padding: 0.5rem 0 !important;
  }

  .preview-controls .icon-play-btn {
    min-width: 56px !important;
    width: 56px !important;
    padding: 0.5rem 0 !important;
    justify-self: center;
  }

  .compact-source-toggle {
    width: auto !important;
    justify-self: center;
  }

  .fps-wrap {
    grid-column: span 1;
    justify-content: center;
  }

  .timecode {
    grid-column: 8;
    justify-self: stretch;
    min-width: 0;
    padding: 0.4rem 0.38rem;
    font-size: 0.82rem;
  }

  .marker-list li {
    grid-template-columns: 10px auto auto minmax(0, 1fr) auto;
    gap: 0.35rem;
    align-items: center;
  }

  .marker-actions {
    grid-column: auto;
    justify-self: end;
    gap: 0.22rem;
  }

  .marker-list .marker-note {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    display: block;
    line-height: 1.2;
    -webkit-line-clamp: unset;
  }

  .marker-btn {
    width: auto;
    min-width: 34px;
    height: 22px;
    font-size: 0.68rem;
    padding: 0 0.36rem;
  }
}

@media (max-width: 980px) and (orientation: portrait) {
  .preview-stage {
    grid-template-columns: 1fr;
  }

  .preview-stage .meter-panel:not(.audio-meter-panel) {
    border-left: 0;
    border-top: 1px solid #2d2516;
    grid-template-columns: 1fr;
    padding: 0.5rem 0.65rem 0.65rem;
  }

  .preview-stage .meter-panel:not(.audio-meter-panel) .meter-scale {
    display: grid !important;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    grid-template-rows: auto;
    gap: 0.18rem;
    margin-bottom: 0.28rem;
    color: #a7a5a1;
    font-size: 0.58rem;
    align-items: center;
    align-content: start;
    min-height: 0;
    padding-left: calc(14px + 0.34rem);
    padding-right: calc(34px + 0.34rem);
  }

  .preview-stage .meter-panel:not(.audio-meter-panel) .meter-wrap {
    display: grid;
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    gap: 0.2rem;
    width: 100%;
    height: auto;
    align-content: start;
  }

  .preview-stage .meter-panel:not(.audio-meter-panel) .meter-col {
    grid-template-columns: 14px 1fr 34px;
    grid-template-rows: auto;
    align-items: center;
    justify-items: stretch;
    gap: 0.34rem;
    width: 100%;
  }

  .preview-stage .meter-panel:not(.audio-meter-panel) .meter-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    border: 1px solid #2f2f2f;
    background: linear-gradient(90deg, #1a120e 0%, #1a120e 85%, #22100f 85%, #22100f 100%);
  }

  .preview-stage .meter-panel:not(.audio-meter-panel) .meter-fill {
    left: 0;
    right: auto;
    top: 0;
    bottom: 0;
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #0fcc6b 0%, #bfd31f 68%, #e8533d 100%);
    transition: width 55ms linear;
  }

  .preview-stage .meter-panel:not(.audio-meter-panel) .meter-peak {
    top: 0;
    bottom: 0;
    left: 0%;
    width: 2px;
    height: auto;
  }

  .preview-stage .meter-panel:not(.audio-meter-panel) .meter-db {
    width: 34px;
    min-width: 34px;
    text-align: right;
  }
}

@media (max-width: 500px) {
  .preview-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    row-gap: 0.35rem;
  }

  .preview-controls > button,
  .preview-controls > .ghost-btn,
  .preview-controls > .icon-play-btn {
    flex: 0 0 auto;
  }

  .timecode {
    order: -1;
    flex: 0 0 100%;
    width: fit-content;
    min-width: 0;
    max-width: calc(100vw - 2rem);
    margin: 0 auto;
  }

  .timeline-zoom-controls {
    justify-content: flex-start;
  }

}
