/* ===========================
   RESET & BASE
=========================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:       #1a1b1e;
  --bg2:      #242628;
  --bg3:      #2e3033;
  --border:   rgba(255,255,255,0.08);
  --orange:   #f6821f;
  --orange2:  #fbab40;
  --green:    #36d399;
  --red:      #ff6b6b;
  --white:    #ffffff;
  --muted:    rgba(255,255,255,0.45);
  --code-bg:  rgba(246,130,31,0.12);
  --radius:   8px;
}

html, body {
  min-height: 100%;
  background-color: var(--bg);
  color: var(--white);
  font-family: 'Syne', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ===========================
   GRID BACKGROUND
=========================== */
.grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* ===========================
   CONTAINER
=========================== */
.container {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 64px 24px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

/* ===========================
   HEADER
=========================== */
.header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(246,130,31,0.12);
  border: 1px solid rgba(246,130,31,0.3);
  color: var(--orange2);
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 6px 14px;
  border-radius: 100px;
}

.header h1 {
  font-size: clamp(52px, 9vw, 96px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--white);
}

.header h1 .arrow { color: var(--orange); }

.header p {
  font-size: 18px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.6;
}

/* ===========================
   KBD BAR
=========================== */
.kbd-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: center;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 20px;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: var(--muted);
}

.kbd-sep { color: rgba(255,255,255,0.15); }

.kbd-item { display: flex; align-items: center; gap: 4px; }

kbd {
  display: inline-block;
  background: var(--bg3);
  border: 1px solid rgba(255,255,255,0.12);
  border-bottom-width: 2px;
  color: var(--white);
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.4;
}

/* ===========================
   DROP ZONE
=========================== */
.drop-zone {
  width: 100%;
  max-width: 560px;
  border: 2px dashed rgba(246,130,31,0.3);
  border-radius: 16px;
  background: rgba(246,130,31,0.04);
  padding: 48px 32px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.drop-zone:hover,
.drop-zone:focus,
.drop-zone.drag-over {
  border-color: var(--orange);
  background: rgba(246,130,31,0.08);
  box-shadow: 0 0 0 3px rgba(246,130,31,0.15);
  outline: none;
}

.drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.drop-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(246,130,31,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.drop-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--white);
}

.drop-sub {
  font-size: 13px;
  color: var(--muted);
  margin: -4px 0;
}

.drop-limit {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.2);
  margin-top: 4px;
}

code {
  font-family: 'Space Mono', monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  color: var(--orange2);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ===========================
   STATUS BAR
=========================== */
.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(246,130,31,0.08);
  border: 1px solid rgba(246,130,31,0.25);
  border-radius: 6px;
  padding: 8px 16px;
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  color: var(--orange2);
  width: 100%;
  max-width: 560px;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--orange);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ===========================
   ERROR BOX
=========================== */
.error-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(255,107,107,0.08);
  border: 1px solid rgba(255,107,107,0.3);
  border-radius: 6px;
  padding: 10px 16px;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  color: var(--red);
  width: 100%;
  max-width: 560px;
}

.error-icon { flex-shrink: 0; margin-top: 1px; }

/* ===========================
   STATS ROW
=========================== */
.stats-row {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  width: 100%;
}

.stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
}

.stat-val {
  font-family: 'Space Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--orange2);
}

.stat-lbl {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
  flex-shrink: 0;
}

/* ===========================
   EDITOR SECTION
=========================== */
.editor-section {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg2);
}

.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}

.panel-label {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.fmt-tag {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--white);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
}

.fmt-tag.vtt {
  background: rgba(246,130,31,0.12);
  border-color: rgba(246,130,31,0.3);
  color: var(--orange2);
}

.line-count {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: var(--muted);
}

.editor-panel textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: var(--white);
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  line-height: 1.7;
  padding: 16px;
  min-height: 300px;
  tab-size: 2;
}

.editor-panel textarea::placeholder {
  color: rgba(255,255,255,0.2);
}

/* Convert column */
.convert-col {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: var(--bg2);
}

/* ===========================
   BUTTONS
=========================== */
.btn-upload {
  display: inline-block;
  background: var(--orange);
  color: var(--white);
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 24px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  border: none;
  user-select: none;
}
.btn-upload:hover { background: var(--orange2); transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--white);
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 24px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.btn-outline:hover { border-color: var(--orange); background: rgba(246,130,31,0.06); }

.btn-convert {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--orange);
  color: var(--white);
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 13px;
  padding: 20px 16px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  min-width: 72px;
  box-shadow: 0 0 20px rgba(246,130,31,0.2);
}
.btn-convert:hover {
  background: var(--orange2);
  transform: scale(1.05);
  box-shadow: 0 0 32px rgba(246,130,31,0.4);
}
.btn-convert:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--orange);
  color: var(--white);
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 15px;
  padding: 13px 28px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-download:hover { background: var(--orange2); transform: translateY(-1px); }

.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  color: var(--white);
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 15px;
  padding: 13px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-copy:hover { background: #383a3e; border-color: rgba(255,255,255,0.15); }

.btn-reset {
  background: transparent;
  color: var(--muted);
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 14px;
  padding: 13px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn-reset:hover { color: var(--white); border-color: var(--border); }

/* Focus ring for all buttons */
button:focus-visible, label:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
}

/* ===========================
   PASTE SECTION
=========================== */
.paste-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.paste-hint {
  font-size: 14px;
  color: var(--muted);
}

/* ===========================
   ACTION ROW
=========================== */
.action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ===========================
   STEPS
=========================== */
.steps {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 190px;
  text-align: center;
}

.step-num {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--orange);
  letter-spacing: 0.05em;
}

.step p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.step-divider {
  font-size: 20px;
  color: rgba(255,255,255,0.1);
  margin: 0 8px;
  margin-bottom: 28px;
}

/* ===========================
   FOOTER
=========================== */
.footer {
  text-align: center;
}
.footer p {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.18);
}

/* ===========================
   TOAST
=========================== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--white);
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  padding: 12px 24px;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 9999;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: rgba(54,211,153,0.4); color: var(--green); }
.toast.error   { border-color: rgba(255,107,107,0.4); color: var(--red); }

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 700px) {
  .editor-section { flex-direction: column; }

  .convert-col {
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 12px;
  }

  .btn-convert {
    flex-direction: row;
    width: 100%;
    justify-content: center;
  }

  .steps     { flex-direction: column; }
  .step-divider { transform: rotate(90deg); margin: 0; }

  .kbd-bar { display: none; }

  .stats-row { flex-wrap: wrap; }
  .stat { min-width: 45%; }
  .stat-divider { display: none; }
}
