:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --ink: #20211f;
  --muted: #6f726d;
  --line: #dedfd8;
  --soft: #ffffff;
  --accent: #10a37f;
  --accent-dark: #087a62;
  --shadow: 0 16px 45px rgba(20, 24, 21, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
a {
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: min(100%, 460px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-mark,
.icon-button,
.status-mark {
  display: grid;
  place-items: center;
}

.brand-mark {
  width: 34px;
  height: 34px;
  color: var(--ink);
}

.brand-mark svg {
  width: 28px;
  height: 28px;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.icon-button svg {
  width: 24px;
  height: 24px;
}

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  gap: 18px;
}

.screen.active {
  display: flex;
}

.intro {
  padding-top: 52px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(42px, 13vw, 60px);
  line-height: 0.96;
  letter-spacing: 0;
  font-weight: 650;
}

h2 {
  margin-top: 18px;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
  font-weight: 650;
  text-align: center;
}

.intro p,
#exportStatus {
  margin-top: 14px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.drop-zone {
  min-height: 185px;
  margin-top: 16px;
  border: 1px dashed #bfc2ba;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  display: grid;
  place-items: center;
  gap: 10px;
  align-content: center;
  color: var(--ink);
  font-weight: 560;
  cursor: pointer;
}

.drop-zone input {
  position: fixed;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #e9f7f2;
  color: var(--accent-dark);
  display: grid;
  place-items: center;
}

.drop-icon svg {
  width: 28px;
  height: 28px;
}

.preview-video,
.crop-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background: #eeefea;
  box-shadow: var(--shadow);
}

.preview-video {
  object-fit: contain;
}

.control-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 15px;
}

.panel-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 570;
}

output {
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  margin: 18px 0 4px;
  accent-color: var(--accent);
}

.hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 54px;
  border-radius: 8px;
  font: inherit;
  font-weight: 620;
  text-decoration: none;
  display: grid;
  place-items: center;
}

.primary-button {
  margin-top: auto;
  border: 0;
  background: var(--ink);
  color: #fff;
}

.primary-button:disabled {
  opacity: 0.55;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.crop-wrap {
  position: relative;
  margin-top: 12px;
  overflow: hidden;
  touch-action: none;
}

#cropCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.crop-border {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14);
  pointer-events: none;
}

.status-mark {
  width: 72px;
  height: 72px;
  margin: 92px auto 0;
  border-radius: 50%;
  background: #e9f7f2;
  color: var(--accent-dark);
}

.status-mark svg {
  width: 34px;
  height: 34px;
}

progress {
  width: 100%;
  height: 8px;
  margin-top: 18px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #e1e2dc;
}

progress::-webkit-progress-bar {
  background: #e1e2dc;
}

progress::-webkit-progress-value,
progress::-moz-progress-bar {
  background: var(--accent);
}

.action-row {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.source-video {
  position: fixed;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

@media (min-height: 760px) {
  .intro {
    padding-top: 82px;
  }
}
