/* Deteksi Video by.FM: dark, focused, no decoration that doesn't help.
   Principles: one accent color (neon) for action & progress, status colors only for results,
   high contrast text, fits one laptop screen (1366×768) without zooming out.
   Responsive: phone (1 column) → iPad (1 wide column) → laptop (2 columns). */

:root {
  --bg: #0a0c0e;
  --surface: #12161a;
  --surface-2: #181d22;
  --border: #262e35;
  --border-2: #34404a;
  --text: #eef3f0;
  --text-2: #b4bfb9;
  --text-3: #85918b;
  --accent: #c8ff3d;          /* action + progress */
  --accent-ink: #0a0c0e;      /* text on top of accent */
  --pass: #c8ff3d;
  --warn: #ffb547;
  --fail: #ff5a45;
  --info: #7fd3ff;
  --track: #2c353d;           /* empty meter track: clearly visible */

  --display: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: 16px;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
p { margin: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--display);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: var(--accent); color: var(--accent-ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Top bar ---------- */
.bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px var(--gutter);
  padding-top: calc(12px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
}
.logo { font-weight: 700; font-size: 17px; letter-spacing: .01em; white-space: nowrap; }
.by {
  font-family: var(--mono); font-weight: 500; font-size: 12px;
  color: var(--accent-ink); background: var(--accent);
  padding: 2px 6px; border-radius: 4px; margin-left: 4px; vertical-align: 2px;
}
.bar-note { margin-left: auto; color: var(--text-2); font-size: 13px; }

/* ---------- Layout ---------- */
.page {
  flex: 1; width: 100%; max-width: 1240px; margin: 0 auto;
  padding: 24px var(--gutter) 32px;
  display: grid; gap: 24px;
  grid-template-columns: minmax(0, 1fr);
}

h1 {
  margin: 0; font-weight: 700; letter-spacing: -.01em; line-height: 1.1;
  font-size: clamp(26px, 6.5vw, 34px); text-wrap: balance;
}
.lede { margin-top: 8px; color: var(--text-2); max-width: 44ch; text-wrap: pretty; }

/* ---------- Pick-a-video box ---------- */
.drop {
  margin-top: 20px;
  background: var(--surface);
  border: 1.5px dashed var(--border-2);
  border-radius: var(--radius);
  transition: border-color .15s ease, background-color .15s ease;
}
.drop.over { border-color: var(--accent); background: var(--surface-2); }
.drop-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 16px; text-align: center; }
.drop-hint { color: var(--text-2); font-size: 13px; }
.drop-file { display: none; align-items: center; gap: 14px; padding: 12px; }
.drop.has-file { border-style: solid; border-color: var(--border); }
.drop.has-file .drop-empty { display: none; }
.drop.has-file .drop-file { display: flex; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 22px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 15px; cursor: pointer; user-select: none;
  transition: transform .1s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
#file:focus-visible + .drop-empty .btn, .btn:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.btn-ghost {
  background: transparent; color: var(--text); border: 1px solid var(--border-2);
  min-height: 36px; padding: 0 14px; font-size: 14px; font-weight: 600; margin-left: auto; flex: none;
}

.thumb {
  flex: none; width: 112px; height: 63px; border-radius: 6px; background: #000;
  object-fit: contain; border: 1px solid var(--border);
}
.file-meta { min-width: 0; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-sub { margin-top: 2px; font-family: var(--mono); font-size: 12px; color: var(--text-2); }

.on-touch { display: none; }
@media (hover: none) and (pointer: coarse) { .on-pointer { display: none; } }

/* ---------- Result / progress ---------- */
.verdict {
  margin-top: 16px; padding: 16px; display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.verdict[hidden] { display: none; }
.ring { position: relative; flex: none; width: 76px; height: 76px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring-track { stroke: var(--track); }
.ring-fill {
  stroke: var(--c, var(--accent)); stroke-linecap: round;
  stroke-dasharray: 326.7; stroke-dashoffset: 326.7;
  transition: stroke-dashoffset .6s cubic-bezier(.2, .8, .2, 1);
}
.ring-num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--mono); font-size: 19px; font-weight: 500; color: var(--c, var(--accent));
}
.ring-num::after { content: "%"; font-size: 10px; margin-left: 1px; transform: translateY(-5px); }
.verdict-word { font-size: 22px; font-weight: 700; line-height: 1.15; }
.verdict-word.pass { color: var(--pass); }
.verdict-word.warn { color: var(--warn); }
.verdict-word.fail { color: var(--fail); }
.verdict-word.busy { color: var(--accent); }
.verdict-note { margin-top: 4px; color: var(--text-2); font-size: 14px; }

/* ---------- Conclusion: fix suggestions ---------- */
.saran {
  margin-top: 12px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.saran[hidden] { display: none; }
.saran-title { font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.saran-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.saran-list li {
  padding-left: 12px; border-left: 3px solid var(--c, var(--accent));
  font-size: 13.5px; color: var(--text-2); line-height: 1.45;
}
.saran-list li.bad { --c: var(--fail); }
.saran-list li.warn { --c: var(--warn); }
.saran-list li.ok { --c: var(--pass); color: var(--text); }
.saran-list strong { display: block; color: var(--c); font-size: 14px; margin-bottom: 1px; }

/* ---------- Checks list ---------- */
.checks {
  list-style: none; margin: 0; padding: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.check {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  grid-template-areas:
    "idx body  badge"
    ".   value value"
    ".   meter meter";
  column-gap: 12px; row-gap: 6px; align-items: center;
  padding: 14px 16px;
}
.check + .check { border-top: 1px solid var(--border); }
.idx {
  grid-area: idx; align-self: start; margin-top: 1px;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  color: var(--text-2); border: 1px solid var(--border-2);
}
.body { grid-area: body; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.name { font-size: 17px; font-weight: 600; line-height: 1.2; }
.detail { font-size: 13px; color: var(--text-2); text-wrap: pretty; }
.value { grid-area: value; font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums; }
.value:empty { display: none; }

.badge {
  grid-area: badge; justify-self: end; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px;
}
.badge:empty { display: none; }
.check.ok   { --c: var(--pass); }
.check.warn { --c: var(--warn); }
.check.bad  { --c: var(--fail); }
.check.info { --c: var(--info); }
.check.busy { --c: var(--accent); }
.check.ok .badge, .check.warn .badge, .check.bad .badge, .check.info .badge {
  color: var(--accent-ink); background: var(--c);
}
.check.busy .badge { color: var(--accent); border: 1px solid var(--accent); }
.check.ok .idx, .check.warn .idx, .check.bad .idx, .check.info .idx {
  color: var(--accent-ink); background: var(--c); border-color: var(--c);
}
.check.busy .idx { color: var(--accent); border-color: var(--accent); }

/* Progress / score bar: bright fill on a clearly visible track */
.meter {
  grid-area: meter; display: block; height: 6px; border-radius: 999px;
  background: var(--track); overflow: hidden;
}
.meter i {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: var(--c, var(--accent));
  transition: width .5s cubic-bezier(.2, .8, .2, 1);
}
.check.ok .meter i, .check.warn .meter i, .check.bad .meter i, .check.info .meter i, .check.busy .meter i { width: var(--pct, 0%); }
.check.busy .meter i {
  background-image: linear-gradient(90deg, transparent 0, rgba(255, 255, 255, .55) 50%, transparent 100%);
  background-size: 200% 100%; background-color: var(--accent);
  animation: kilau 1.2s linear infinite;
}
@keyframes kilau { from { background-position: 150% 0; } to { background-position: -50% 0; } }

/* Extra info */
.extra { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 12px 0 0; }
.extra[hidden] { display: none; }
.extra > div { padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; min-width: 0; }
.extra dt { font-size: 12px; color: var(--text-3); }
.extra dd { margin: 2px 0 0; font-family: var(--mono); font-size: 15px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.extra dd small { display: block; margin-top: 2px; font-family: var(--display); font-size: 12px; }
.extra dd.warn { color: var(--warn); }
.extra dd.bad { color: var(--fail); }

/* ---------- Footer ---------- */
.foot {
  display: flex; flex-wrap: wrap; gap: 4px 20px; justify-content: space-between;
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-3);
}

@media (prefers-reduced-motion: reduce) {
  .check.busy .meter i { animation: none; }
  .ring-fill, .meter i { transition: none; }
}

/* ===== Phone (< 480px) ===== */
@media (max-width: 479px) {
  .bar-note { margin-left: 0; width: 100%; font-size: 12px; }
  .check { grid-template-columns: 26px minmax(0, 1fr); grid-template-areas: "idx body" ". value" ". meter" ". badge"; }
  .badge { justify-self: start; }
  .extra { grid-template-columns: 1fr 1fr; }
  .thumb { width: 88px; height: 50px; }
}

/* ===== iPad / tablet (≥ 768px) ===== */
@media (min-width: 768px) {
  :root { --gutter: 28px; }
  .check {
    grid-template-columns: 26px minmax(0, 1fr) minmax(96px, auto) 120px;
    grid-template-areas: "idx body value badge" ". meter meter meter";
  }
  .value { text-align: right; }
}

/* ===== Laptop (≥ 1024px): 2 columns, fits one screen ===== */
@media (min-width: 1024px) {
  :root { --gutter: 32px; }
  .page {
    grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
    column-gap: 32px; align-items: start; padding-top: 28px;
  }
  h1 { font-size: 30px; }
  .check { padding: 12px 18px; row-gap: 5px; }
}

/* Short laptop screens (e.g. 1366×768 with browser bars): tighten vertically */
@media (min-width: 1024px) and (max-height: 760px) {
  .page { padding-top: 18px; padding-bottom: 18px; }
  .drop { margin-top: 14px; }
  .drop-empty { padding: 20px 16px; }
  .check { padding: 9px 18px; }
  .name { font-size: 16px; }
  .detail { font-size: 12.5px; }
  .extra > div { padding: 8px 12px; }
}
