:root {
  --bg: #181c1a;
  --panel: #232a26;
  --panel-2: #2c352f;
  --text: #f2f2f2;
  --muted: #b8c0bb;
  --accent: #ffdc78;
  --green: #2e703a;
  --green-bright: #3fa552;
  --danger: #ff7a7a;
  --line: #45524a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* otherwise our own display rules would show hidden buttons */
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans Hebrew", Arial, sans-serif;
  padding: 1rem;
}
.wrap { max-width: 46rem; margin: 0 auto; padding-block: 1.5rem; }
h1 { color: var(--accent); margin: 0 0 .25rem; letter-spacing: .04em; }
h2 { margin: 0 0 .75rem; font-size: 1.2rem; }
h2.section { margin-top: 2rem; color: var(--accent); }
h3 { margin: 0 0 .25rem; font-size: 1.1rem; overflow-wrap: anywhere; }
.sub { color: var(--muted); margin: 0 0 1.5rem; }
.card { background: var(--panel); border-radius: .75rem; padding: 1.25rem; margin-bottom: 1rem; }
label { display: block; margin: .75rem 0 .4rem; }
label:first-child { margin-top: 0; }

input[type=text], input[type=password], input[type=file] {
  width: 100%; padding: .8rem; font-size: 1.05rem; border-radius: .5rem;
  border: 1px solid var(--line); background: #12160f; color: var(--text); font-family: inherit;
}
input[type=password] { direction: ltr; text-align: center; letter-spacing: .1em; }
input[type=text].ranges { text-align: left; letter-spacing: .05em; }
input[type=file] { padding: .6rem; }

button, .btn {
  display: inline-block; padding: .7rem 1.2rem; font-size: 1rem; border: 0; border-radius: .5rem;
  background: var(--green); color: #fff; cursor: pointer; font-family: inherit; text-decoration: none;
  line-height: 1.2; text-align: center;
}
button:hover, .btn:hover { background: var(--green-bright); }
button:disabled { opacity: .5; cursor: default; }
button.secondary, .btn.secondary { background: var(--panel-2); border: 1px solid var(--line); }
button.secondary:hover, .btn.secondary:hover { background: #38443c; }
button.small, .btn.small { padding: .4rem .8rem; font-size: .9rem; }
button.link { background: none; color: var(--muted); text-decoration: underline; padding: 0; font-size: .95rem; }
button.link:hover { background: none; color: var(--text); }
button:focus-visible, .btn:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
#upload-btn { margin-top: 1rem; }

.error { color: var(--danger); min-height: 1.4em; margin-top: .6rem; white-space: pre-line; }
.error:empty { min-height: 0; margin: 0; }
.empty { color: var(--muted); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* upload progress */
#progress { margin-top: 1rem; }
.bar { height: 1.1rem; background: #12160f; border: 1px solid var(--line); border-radius: .6rem; overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--green-bright); transition: width .2s; }
.progress-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: .5rem; color: var(--muted); }

/* videos and clips */
.vhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.vmeta { color: var(--muted); margin: 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.cutform { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.cutrow { display: flex; gap: .5rem; flex-wrap: wrap; }
.cutrow input { flex: 1 1 14rem; width: auto; }
.clips { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .5rem; }
.clip {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  background: var(--panel-2); border-radius: .5rem; padding: .6rem .8rem;
}
.clip .ctitle { flex: 1 1 8rem; }
.clip .cerror { color: var(--danger); }
.clip .cbody { flex: 1 1 16rem; display: grid; gap: .5rem; min-width: 0; }
.clip .crow { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.clip.annotated { border-inline-start: 4px solid var(--green-bright); }
.thumb { flex: 0 0 18rem; max-width: 100%; line-height: 0; border-radius: .4rem; overflow: hidden; border: 1px solid var(--line); background: #0d100e; }
.thumb canvas { width: 100%; height: auto; display: block; aspect-ratio: 16 / 9; }
.saved-tag { margin: 0; color: #8fe39f; font-weight: 700; }
.note { color: #8c958f; font-size: .82rem; }
.export { border-top: 1px solid var(--line); padding-top: .6rem; display: grid; gap: .45rem; }
.export .bar.small, .bar.small { height: .6rem; }
.badge[data-status=ready] { background: var(--green); color: #fff; }
.badge[data-status=failed] { background: #6b2b2b; color: #fff; }
.badge[data-status=processing], .badge[data-status=queued] { background: #6b5a1e; color: #fff; }
.clip.has-export { border-inline-start-color: var(--accent); }
.btn.primary { background: var(--green-bright); font-weight: 700; padding: .65rem 1.2rem; box-shadow: 0 0 0 2px rgba(63, 165, 82, .35); }
.btn.primary:hover { background: #4fbd63; }
.badge {
  font-size: .8rem; padding: .15rem .6rem; border-radius: 1rem; background: #38443c; color: var(--muted);
  white-space: nowrap;
}
.clip[data-status=ready] .badge { background: var(--green); color: #fff; }
.clip[data-status=failed] .badge { background: #6b2b2b; color: #fff; }
.clip[data-status=processing] .badge { background: #6b5a1e; color: #fff; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .clip[data-status=processing] .badge { animation: none; } }

dialog { background: var(--panel); border: 0; border-radius: .75rem; padding: 1rem; width: min(92vw, 60rem); color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, .75); }
dialog video { width: 100%; max-height: 75vh; background: #000; border-radius: .5rem; display: block; margin-bottom: .75rem; }
