@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;600&display=swap');

:root {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background: rgb(255, 152, 0);
  color: #111;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(145deg, rgba(255, 189, 96, 0.9), rgba(255, 152, 0, 0.95));
  color: inherit;
}

.app-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 4rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero h1 {
  margin: 0 0 0.5rem 0;
  font-size: clamp(2rem, 4vw, 3rem);
}

.hero p {
  margin: 0;
  color: #2d2d2d;
}
.language-switcher {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #1f2937;
}

.language-switcher label {
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.language-control {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.85);
  padding: 0.2rem 0.4rem 0.2rem 0.2rem;
}

.language-control select {
  border: none;
  background: transparent;
  color: inherit;
  padding: 0.2rem 0.6rem 0.2rem 0.2rem;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.language-control select:focus-visible {
  outline: none;
  box-shadow: none;
}

.language-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  font-size: 1.1rem;
  line-height: 1;
}

.card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 18px;
  padding: 1.75rem;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
  color: #111;
}

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.95rem;
  color: #1f2937;
}

.capture-panel {
  border: 1px dashed rgba(17, 17, 17, 0.2);
  border-radius: 14px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.7);
}

.capture-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: #1f2937;
}

.capture-preview-shell {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.08);
  min-height: 180px;
}

#capture-preview {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.capture-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.capture-controls button {
  flex: 1 1 140px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.capture-controls button:nth-child(1) {
  background: #f97316;
  color: #fff;
}

.capture-controls button:nth-child(2) {
  background: #fb923c;
  color: #111;
}

.capture-controls button:nth-child(3) {
  background: #fdba74;
  color: #7c2d12;
}

.capture-hint {
  margin: 0;
  font-size: 0.85rem;
  color: #4b5563;
}

.trim-panel {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: rgba(15, 23, 42, 0.02);
}

.trim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: #111;
}

.trim-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.trim-track {
  position: relative;
  width: 100%;
  height: 76px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.08), rgba(15, 23, 42, 0.05));
  border: 1px solid rgba(15, 23, 42, 0.15);
  touch-action: none;
}

.trim-filmstrip {
  position: absolute;
  inset: 0;
  display: flex;
  gap: 0;
  overflow: hidden;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 12px, rgba(15, 23, 42, 0.15) 12px 24px);
  pointer-events: none;
  z-index: 0;
}

.trim-filmstrip img {
  flex: 1 1 auto;
  object-fit: cover;
  height: 100%;
  filter: saturate(1.05) contrast(1.05);
}

.trim-filmstrip::after {
  content: attr(data-state);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity 140ms ease;
  z-index: 1;
}

.trim-filmstrip.is-loading::after,
.trim-filmstrip.has-error::after {
  opacity: 1;
}

.trim-filmstrip.has-error::after {
  background: rgba(127, 29, 29, 0.82);
}

.trim-mask {
  position: absolute;
  top: 0;
  bottom: 0;
  pointer-events: none;
  transition: width 80ms ease;
  z-index: 2;
}

.trim-mask-left {
  left: 0;
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.7), rgba(15, 23, 42, 0));
}

.trim-mask-right {
  right: 0;
  background: linear-gradient(270deg, rgba(15, 23, 42, 0.7), rgba(15, 23, 42, 0));
}

.trim-window {
  position: absolute;
  top: 8%;
  bottom: 8%;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 0 0 2px rgba(15, 23, 42, 0.25);
  pointer-events: none;
  transition: left 80ms ease, right 80ms ease;
  z-index: 3;
}

.trim-handle {
  position: absolute;
  top: 6px;
  bottom: 6px;
  width: 24px;
  border: 2px solid rgba(255, 255, 255, 0.65);
  border-radius: 12px;
  background: #f97316;
  color: transparent;
  cursor: ew-resize;
  transform: translateX(-50%);
  box-shadow: 0 6px 18px rgba(249, 115, 22, 0.35);
  transition: background 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
  z-index: 4;
  touch-action: none;
  appearance: none;
  -webkit-appearance: none;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trim-handle::after {
  content: '';
  width: 6px;
  height: 36px;
  border-left: 2px solid rgba(255, 255, 255, 0.7);
  border-right: 2px solid rgba(255, 255, 255, 0.7);
}

.trim-handle:focus-visible {
  outline: 2px solid rgba(249, 115, 22, 0.8);
  outline-offset: 2px;
}

.trim-panel.is-dragging .trim-handle,
.trim-handle:hover {
  background: #fb923c;
  box-shadow: 0 8px 22px rgba(249, 115, 22, 0.45);
}

.trim-handle:active {
  transform: translateX(-50%);
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
}

.trim-markers {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #4b5563;
}

.trim-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.trim-actions button {
  flex: 0 0 auto;
  padding: 0.55rem 1.1rem;
  font-size: 0.85rem;
}

.trim-hint {
  font-size: 0.8rem;
  color: #4b5563;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: #1f2937;
}

.toggle input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: #6366f1;
}

input[type="file"],
input[type="email"],
input[type="text"] {
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.7);
  color: #111;
}

button {
  padding: 0.9rem 1.5rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: #f97316;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(249, 115, 22, 0.25);
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

button:not(:disabled):hover {
  transform: translateY(-2px);
  background: #fb923c;
  box-shadow: 0 14px 32px rgba(249, 115, 22, 0.35);
}

#status-card header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

#status-text {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  letter-spacing: 0.08em;
  font-size: 0.9rem;
  text-transform: uppercase;
  color: #1f2937;
}

#status-text.is-running::after {
  content: '';
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  border: 2px solid rgba(99, 102, 241, 0.6);
  border-top-color: transparent;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#status-message,
#email-status {
  margin: 0.25rem 0;
  color: #1f2937;
}

.command-line {
  margin: 0.75rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: #1f2937;
}

.command-line code {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  padding: 0.5rem;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.85rem;
  color: #111;
  line-height: 1.3;
  word-break: break-word;
}

#download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  text-decoration: none;
  font-weight: 600;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.95);
  color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.log-card {
  max-height: 360px;
  overflow: hidden;
}

#log-output {
  margin: 0;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.4;
  height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
}
