:root { color-scheme: dark; }
* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, sans-serif; color: #e6e6ea;
  background: #17171b; min-height: 100vh; display: flex; flex-direction: column;
}
header {
  display: flex; align-items: center; gap: 1rem; padding: .7rem 1.1rem;
  background: #1f1f25; border-bottom: 1px solid #2c2c33;
}
h1 { font-size: 1.15rem; margin: 0; }
h1 .web { color: #ffb86c; font-size: .75em; vertical-align: super; }
h2 { font-size: .95rem; margin: 0 0 .6rem; color: #b9b9c2; }
.status { color: #9a9aa2; font-size: .85rem; flex: 1; }
.status.ready { color: #6bd97a; }
button {
  background: #2f6fdb; color: #fff; border: 0; border-radius: 6px;
  padding: .45rem .9rem; font-size: .9rem; cursor: pointer;
}
button:disabled { opacity: .45; cursor: default; }
button:not(:disabled):hover { filter: brightness(1.12); }
#selftest { background: #3a3a42; }
main {
  flex: 1; display: grid; grid-template-columns: 240px 1fr 250px;
  gap: 1rem; padding: 1rem; align-items: start;
}
section { background: #1f1f25; border: 1px solid #2c2c33; border-radius: 10px; padding: .9rem; }
.hint { color: #8a8a92; font-size: .78rem; }
#filelist { list-style: none; margin: .6rem 0 0; padding: 0; max-height: 60vh; overflow: auto; }
#filelist li {
  display: flex; align-items: center; gap: .5rem; padding: .25rem .3rem;
  border-radius: 6px; font-size: .82rem;
}
#filelist li:hover { background: #26262c; }
#filelist img { width: 44px; height: 33px; object-fit: cover; border-radius: 3px; }
#filelist .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#filelist li { transition: transform .12s ease, background .2s; }
#filelist li.dragging { opacity: .55; background: #2c2c34; }
#filelist li.dup { outline: 1px solid #e5484d; background: #3a1c20; }
#filelist .dup-badge { color: #ff8a8f; font-size: .68rem; }
.widebtn { display: block; width: 100%; margin-top: .5rem; background: #3a3a42; }
#filelist .move, #filelist .del {
  background: #33333b; padding: .1rem .45rem; font-size: .8rem; border-radius: 4px;
}
#filelist .del { background: #55272c; }
.filebtn {
  display: inline-block; background: #2f6fdb; border-radius: 6px;
  padding: .45rem .9rem; cursor: pointer; font-size: .9rem;
}
.filebtn input { display: none; }
#stage {
  position: relative;
  background: #101013; border-radius: 8px; min-height: 320px;
  display: flex; align-items: center; justify-content: center;
}
#saveproject { display: block; width: 100%; margin-top: .4rem; background: #3a3a42; }
#resetcrop { background: #55272c; }
#preview { max-width: 100%; max-height: 56vh; image-rendering: auto; }
.controls { display: flex; gap: .8rem; align-items: center; margin-top: .7rem; }
#scrub { flex: 1; }
#frameno { font-size: .82rem; color: #9a9aa2; min-width: 70px; text-align: right; }
form label { display: block; margin: .55rem 0; font-size: .85rem; }
form input[type="number"], form input[type="text"] {
  width: 5.2em; background: #26262c; color: inherit; border: 1px solid #3a3a42;
  border-radius: 5px; padding: .25rem .4rem;
}
form input[type="text"] { width: 100%; }
#export { display: block; width: 100%; margin-top: .8rem; background: #2c9c56; }
#download { display: block; margin-top: .6rem; color: #6bd97a; font-size: .9rem; }
footer { padding: .6rem 1.1rem; color: #77777f; font-size: .78rem; }
footer code { background: #232329; padding: .1em .3em; border-radius: 4px; }
@media (max-width: 900px) { main { grid-template-columns: 1fr; } }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-box { background: #1f1f25; border: 1px solid #2c2c33; border-radius: 10px;
  padding: 1rem; max-width: 92vw; }
.crop-holder { position: relative; display: inline-block; background: #101013;
  border-radius: 6px; }
.crop-holder img { max-width: 640px; max-height: 60vh; display: block; }
.rubber { position: absolute; border: 1px dashed #ffb86c;
  background: rgba(255,184,108,.15); pointer-events: none; }
.modal-bar { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .6rem; }
