* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #111317;
  color: #e8e8ea;
}
.top { padding: 20px 24px 8px; }
h1 { margin: 0; font-size: 22px; }
.sub { margin: 4px 0 0; color: #9a9ca3; font-size: 13px; }
main { padding: 12px 24px 40px; max-width: 1400px; margin: 0 auto; }

.format-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.format-label { font-size: 13px; color: #c9cad0; font-weight: 500; }
.format-switch {
  display: inline-flex; background: #171a1f; border: 1px solid #3a3d45;
  border-radius: 9px; padding: 3px; gap: 4px;
}
.fmt-btn {
  border: 0; background: transparent; color: #9a9ca3;
  padding: 7px 14px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background .15s, color .15s;
}
.fmt-btn:hover:not(.active) { color: #e8e8ea; background: #22252c; }
.fmt-btn.active { background: #e8a46a; color: #1a1205; font-weight: 600; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 2px dashed #3a3d45; border-radius: 12px; padding: 36px 16px;
  cursor: pointer; text-align: center; background: #171a1f; transition: border-color .15s, background .15s;
}
.dropzone span { color: #9a9ca3; font-size: 13px; }
.dropzone.over, .dropzone:hover, .dropzone:focus { border-color: #e8a46a; background: #1c1f25; outline: none; }

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 16px;
}
.status { font-size: 14px; color: #c9cad0; }
.status .warn { color: #f0b450; }
.status .err { color: #ff6b6b; }
.actions { display: flex; gap: 8px; }
.btn {
  border: 1px solid #3a3d45; background: #22252c; color: #e8e8ea;
  padding: 9px 14px; border-radius: 8px; font-size: 14px; cursor: pointer;
}
.btn:hover:not(:disabled) { background: #2b2f37; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: #e8a46a; border-color: #e8a46a; color: #1a1205; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: #f0b47e; }
.btn.small { padding: 6px 10px; font-size: 12px; }

.progress { height: 4px; background: #22252c; border-radius: 2px; margin-top: 10px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: #e8a46a; transition: width .2s; }

.grid {
  display: grid; gap: 14px; margin-top: 18px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.grid.landscape {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.card { background: #191c21; border: 1px solid #262930; border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.card.warn { border-color: #7a5a1f; }
.card.error { border-color: #7a2a2a; }
.thumb {
  aspect-ratio: 9 / 16; background: #0c0d10; display: flex; align-items: center; justify-content: center;
  color: #6b6e76; font-size: 12px; cursor: zoom-in;
}
.grid.landscape .thumb {
  aspect-ratio: 16 / 9;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.meta { padding: 8px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #d6d7db; }
.note { color: #f0b450; line-height: 1.35; }
.card.error .note { color: #ff6b6b; }

.viewer {
  position: fixed; inset: 0; background: rgba(0,0,0,.88); display: flex; align-items: center; justify-content: center;
  z-index: 10; padding: 20px;
}
.viewer[hidden] { display: none; }
.viewer img { max-width: 100%; max-height: 100%; box-shadow: 0 0 0 1px #333; }
.viewer-close {
  position: absolute; top: 12px; right: 16px; background: none; border: 0; color: #fff; font-size: 34px; cursor: pointer;
}

@media (max-width: 600px) {
  .top, main { padding-left: 14px; padding-right: 14px; }
  .format-switch { width: 100%; }
  .fmt-btn { flex: 1; text-align: center; padding: 9px 10px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  .grid.landscape { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .actions { width: 100%; }
  .actions .btn { flex: 1; }
  .btn.small { min-height: 38px; padding: 9px 12px; font-size: 13px; }
  .viewer-close {
    width: 42px; height: 42px; border-radius: 50%;
    background: rgba(17, 19, 23, 0.72);
    display: flex; align-items: center; justify-content: center; line-height: 1;
  }
}
