@font-face {
  font-family: "KOMIKAX";
  src: url("/assets/fonts/KOMIKAX.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("/assets/fonts/Montserrat-Black.ttf") format("truetype");
  font-weight: 900;
  font-display: swap;
}

:root {
  --bg: #000000;
  --bg-elev: #1c1c1e;
  --card: #1c1c1e;
  --card-hover: #2c2c2e;
  --border: #2c2c2e;
  --text: #f2f2f7;
  --text-dim: #8e8e93;
  --accent: #af52de;
  --accent-2: #0a84ff;
  --success: #30d158;
  --warn: #ffd60a;
  --danger: #ff453a;
  --radius: 20px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 64px;
  flex: 1;
}

/* ── top bar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 22px;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 30px; height: 30px; object-fit: contain; }
.brand-word { font-family: "KOMIKAX", sans-serif; font-size: 22px; letter-spacing: 0.5px; }
.topnav { display: flex; gap: 4px; }
.topnav a {
  padding: 7px 14px; border-radius: 999px; color: var(--text-dim);
  font-size: 14px; font-weight: 500; transition: 0.15s;
}
.topnav a:hover { color: var(--text); background: var(--bg-elev); }
.topnav a.active { color: var(--text); background: var(--bg-elev); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* ── generic UI ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer; font: inherit; font-weight: 600;
  padding: 12px 20px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; transition: 0.15s; font-size: 15px;
}
.btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; filter: none; }
.btn.secondary { background: var(--bg-elev); border: 1px solid var(--border); color: var(--text); }
.btn.secondary:hover { background: var(--card-hover); }
.btn.small { padding: 8px 14px; font-size: 13.5px; }
.btn.block { width: 100%; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text-dim);
}
.badge.ok { color: var(--success); border-color: rgba(52, 209, 123, 0.35); }
.badge.warn { color: var(--warn); border-color: rgba(255, 176, 32, 0.35); }
.badge.err { color: var(--danger); border-color: rgba(255, 92, 108, 0.35); }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
.spinner.dark { border-color: rgba(124, 92, 255, 0.25); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── auth / paywall ── */
.center-screen {
  min-height: 62vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 18px;
}
.center-screen h1 { font-family: "Montserrat", sans-serif; font-weight: 900; font-size: 34px; letter-spacing: -1px; }
.center-screen p { color: var(--text-dim); max-width: 440px; line-height: 1.55; }

.apple-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: #fff; color: #000; border: none; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 15.5px;
  padding: 13px 26px; border-radius: 10px; transition: 0.15s;
}
.apple-btn:hover { background: #e9e9ee; }
.apple-btn svg { width: 17px; height: 17px; }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; width: 100%; max-width: 620px; margin-top: 8px; }
.plan {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; text-align: left; display: flex; flex-direction: column; gap: 10px;
  position: relative; transition: 0.15s;
}
.plan:hover { border-color: var(--accent); }
.plan .plan-name { font-weight: 700; font-size: 16px; }
.plan .plan-price { font-size: 30px; font-weight: 800; letter-spacing: -1px; }
.plan .plan-price small { font-size: 14px; font-weight: 500; color: var(--text-dim); }
.plan .plan-note { font-size: 13px; color: var(--text-dim); }
.plan .plan-flag {
  position: absolute; top: -11px; right: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}

/* ── tools grid ── */
.section-title { font-family: "Montserrat", sans-serif; font-weight: 900; font-size: 26px; letter-spacing: -0.5px; margin: 8px 0 4px; }
.section-sub { color: var(--text-dim); font-size: 14.5px; margin-bottom: 22px; }

.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.tool-card {
  aspect-ratio: 1; border-radius: 20px; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 16px; transition: transform 0.15s, filter 0.15s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.tool-card:hover { transform: translateY(-2px) scale(1.02); filter: brightness(1.1); }
.tool-img {
  width: 58%; flex: 1; min-height: 0; object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}
.tool-card h3 {
  font-size: 16px; font-weight: 600; color: #fff; text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); line-height: 1.25;
}

/* ── video saver ── */
.vs-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.vs-thumb { width: 108px; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.vs-list { display: flex; flex-direction: column; gap: 8px; }
.vs-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.05);
}
.vs-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vs-q { font-weight: 600; font-size: 14px; }
.vs-ext { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.3px; }
.vs-flag {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
  color: #FF9F0A; border: 1px solid rgba(255, 159, 10, 0.5);
  padding: 1px 5px; border-radius: 999px; margin-left: 6px; vertical-align: 1px;
}

/* ── teleprompter ── */
.tp-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 14px 0; }
.tp-controls input[type="range"] { width: 100%; accent-color: #FFD60A; }
.tp-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.tp-stage { margin-top: 18px; background: #000; }
.tp-stage:fullscreen { display: flex; align-items: center; padding: 6vw; }
.tp-words { line-height: 1.7; max-height: 46vh; overflow-y: auto; color: #6b7280; }
.tp-words span { transition: color 0.12s; }
.tp-words span.read { color: #9ca3af; }
.tp-words span.now { color: #fff; background: rgba(255, 214, 10, 0.22); border-radius: 5px; padding: 0 3px; }

/* iOS features that do not have a web backend yet */
.tool-card.soon { cursor: default; position: relative; filter: grayscale(0.55); opacity: 0.55; }
.tool-card.soon:hover { transform: none; filter: grayscale(0.55); }
.tool-card.soon::after {
  content: "Coming soon"; position: absolute; top: 10px; right: 10px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase;
  color: #fff; background: rgba(0, 0, 0, 0.55); padding: 3px 7px; border-radius: 999px;
}

/* ── tool page banner ── */
.tool-banner {
  border-radius: 20px; padding: 20px 22px; margin-bottom: 22px;
  display: flex; align-items: center; gap: 18px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.tool-banner img { width: 74px; height: 74px; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35)); flex-shrink: 0; }
.tool-banner h1 { font-size: 22px; font-weight: 700; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
.tool-banner p { font-size: 13.5px; color: rgba(255, 255, 255, 0.85); margin-top: 4px; line-height: 1.45; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }

/* ── tool page ── */
.tool-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 860px) { .tool-layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px;
}
.panel h2 { font-size: 18px; margin-bottom: 4px; }
.panel .panel-sub { color: var(--text-dim); font-size: 13.5px; margin-bottom: 18px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-dim); margin-bottom: 7px; }
.field input[type="text"],
.field input[type="url"],
.field input[type="number"],
.field textarea,
.field select {
  width: 100%; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font: inherit; font-size: 14px;
  padding: 11px 13px; outline: none; transition: border 0.15s;
}
.field textarea { resize: vertical; min-height: 88px; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field .hint { font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.range-row output { font-size: 13px; min-width: 34px; text-align: right; color: var(--text-dim); }

.check-row { display: flex; align-items: center; gap: 10px; }
.check-row input { width: 17px; height: 17px; accent-color: var(--accent); }
.check-row label { margin: 0; color: var(--text); font-weight: 500; }

.dropzone {
  border: 1.5px dashed var(--border); border-radius: var(--radius-sm);
  padding: 22px; text-align: center; cursor: pointer; transition: 0.15s;
  color: var(--text-dim); font-size: 13.5px;
}
.dropzone:hover { border-color: var(--accent); color: var(--text); }
.dropzone.has-file { border-style: solid; border-color: var(--accent); color: var(--text); }
.dropzone input { display: none; }
.file-preview { margin-top: 10px; }
.file-preview video, .file-preview img { max-width: 100%; max-height: 180px; border-radius: 8px; }

.url-or-file { display: flex; flex-direction: column; gap: 8px; }
.url-toggle { background: none; border: none; color: var(--accent); font: inherit; font-size: 12.5px; cursor: pointer; text-align: left; padding: 0; font-weight: 600; }

/* ── result ── */
.result-panel { position: sticky; top: 84px; }
.result-empty { color: var(--text-dim); font-size: 14px; text-align: center; padding: 48px 12px; border: 1.5px dashed var(--border); border-radius: var(--radius); }
.result-media video, .result-media img { width: 100%; border-radius: var(--radius-sm); background: #000; }
.result-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.progress-steps { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.step { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-dim); }
.step.done { color: var(--success); }
.step.active { color: var(--text); }
.step .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* ── history ── */
.jobs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.job-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.job-thumb { aspect-ratio: 16/10; background: var(--bg-elev); display: flex; align-items: center; justify-content: center; color: var(--text-dim); }
.job-thumb video, .job-thumb img { width: 100%; height: 100%; object-fit: cover; }
.job-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; }
.job-body .job-tool { font-size: 13px; font-weight: 700; text-transform: capitalize; }
.job-body .job-date { font-size: 11.5px; color: var(--text-dim); }

/* ── account ── */
.account-grid { display: grid; gap: 16px; max-width: 560px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-dim); }
.kv .v { font-weight: 600; word-break: break-all; text-align: right; }

/* ── misc ── */
.alert { padding: 13px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; }
.alert.err { background: rgba(255, 92, 108, 0.1); border: 1px solid rgba(255, 92, 108, 0.3); color: var(--danger); }
.alert.info { background: rgba(79, 140, 255, 0.1); border: 1px solid rgba(79, 140, 255, 0.3); color: var(--accent-2); }

.footer {
  border-top: 1px solid var(--border); padding: 18px 22px;
  display: flex; gap: 16px; justify-content: center;
  color: var(--text-dim); font-size: 13px;
}

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 13.5px; font-weight: 600; margin-bottom: 18px; }
.back-link:hover { color: var(--text); }

.dev-login { margin-top: 10px; }
.dev-login details { color: var(--text-dim); font-size: 13px; }
.dev-login summary { cursor: pointer; }
.dev-login input { margin: 10px 0; width: 260px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); padding: 10px 12px; font: inherit; }

@media (max-width: 640px) {
  .topnav { display: none; }
  .center-screen h1 { font-size: 27px; }
}
