:root {
  color-scheme: light;
  --paper: #fbf3dc;
  --paper-deep: #f3e6c8;
  --sheet: #fffaf0;
  --ink: #11100d;
  --muted: #625a4b;
  --accent: #e8c33f;
  --accent-strong: #c44d2d;
  --accent-soft: #f7dfa1;
  --danger: #a13728;
  --radius-soft: 14px 18px 13px 20px;
  --shadow-ink: 7px 8px 0 var(--ink);
  font-family: "Gaegu", ui-rounded, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 30% 20%, rgba(17, 16, 13, 0.045) 0 1px, transparent 1px),
    radial-gradient(circle at 70% 80%, rgba(17, 16, 13, 0.035) 0 1px, transparent 1px),
    var(--paper);
  background-size: 18px 18px, 24px 24px, auto;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-items: center;
  padding: 28px 18px;
}

.phone-frame {
  position: relative;
  width: 100%;
  min-height: min(780px, calc(100vh - 56px));
  border: 4px solid var(--ink);
  border-radius: 34px 27px 39px 30px;
  background: var(--sheet);
  box-shadow: var(--shadow-ink);
  overflow: hidden;
  transform: rotate(-0.35deg);
}

.phone-frame::before {
  content: "";
  position: absolute;
  inset: 10px 14px auto;
  height: 10px;
  border-top: 3px solid var(--ink);
  border-radius: 50%;
  opacity: 0.9;
}

.app-bar {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 64px;
  padding: 22px 18px 12px;
  border-bottom: 4px solid var(--ink);
  background: #fffdf6;
}

.app-dot {
  width: 17px;
  height: 17px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--accent-strong);
  box-shadow: 2px 2px 0 var(--ink);
}

.app-name,
.language-pill,
.eyebrow,
legend {
  letter-spacing: 0;
  text-transform: uppercase;
}

.app-name {
  justify-self: center;
  font-size: 19px;
  font-weight: 700;
}

.language-pill {
  display: inline-grid;
  place-items: center;
  min-width: 58px;
  min-height: 28px;
  border: 3px solid var(--ink);
  border-radius: 999px 820px 999px 760px;
  background: var(--accent);
  font-size: 16px;
  font-weight: 700;
  transform: rotate(2deg);
}

.language-pill select {
  width: 74px;
  min-height: 28px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  outline: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.converter {
  display: grid;
  gap: 18px;
  padding: 22px 20px 24px;
}

.intro {
  display: grid;
  gap: 8px;
  padding: 3px 2px 4px;
}

.eyebrow {
  width: fit-content;
  margin: 0;
  padding: 2px 10px 0;
  border: 3px solid var(--ink);
  border-radius: 999px 850px 820px 999px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  transform: rotate(-1deg);
}

h1 {
  margin: 0;
  font-size: clamp(44px, 13vw, 64px);
  line-height: 0.92;
  letter-spacing: 0;
  text-wrap: balance;
}

.summary {
  margin: 0;
  color: var(--muted);
  font-size: 23px;
  line-height: 1.18;
  text-wrap: pretty;
}

.drop-zone {
  position: relative;
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 210px;
  padding: 34px 22px 26px;
  border: 4px dashed var(--ink);
  border-radius: 26px 18px 30px 20px;
  background:
    linear-gradient(160deg, rgba(232, 195, 63, 0.28), transparent 62%),
    #fff8e8;
  text-align: center;
  cursor: pointer;
  transform: rotate(0.45deg);
  transition-property: background-color, transform, box-shadow;
  transition-duration: 160ms;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  touch-action: manipulation;
}

.drop-zone.is-dragging {
  background-color: #ffeaa5;
  box-shadow: 5px 6px 0 var(--ink);
  transform: rotate(-0.35deg) translateY(-2px);
}

.drop-zone.has-file {
  border-style: solid;
  background: #fff0b8;
}

.drop-zone.is-jiggling {
  animation: paper-jiggle 360ms cubic-bezier(0.16, 1, 0.3, 1);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.drop-zone:focus-within,
fieldset label:focus-within,
.gap-control:focus-within,
button:focus-visible,
.language-pill:focus-within {
  outline: 4px solid var(--accent-strong);
  outline-offset: 3px;
}

.drop-pin {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 20px;
  height: 20px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--accent-strong);
  box-shadow: 2px 2px 0 var(--ink);
}

.drop-icon {
  display: inline-grid;
  place-items: center;
  width: 82px;
  height: 62px;
  border: 4px solid var(--ink);
  border-radius: 8px 13px 9px 15px;
  background: #ffffff;
  color: var(--ink);
  font-size: 30px;
  font-weight: 700;
  box-shadow: 4px 5px 0 var(--ink);
  transform: rotate(-3deg);
}

.drop-title {
  font-size: 31px;
  font-weight: 700;
  line-height: 1;
}

.drop-meta,
.status {
  color: var(--muted);
  font-size: 21px;
  line-height: 1.12;
}

.options {
  display: grid;
  gap: 14px;
}

fieldset {
  display: grid;
  grid-template-columns: 48px repeat(3, 1fr);
  gap: 8px;
  align-items: center;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  display: contents;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
}

fieldset label,
.gap-control {
  min-height: 48px;
  border: 3px solid var(--ink);
  border-radius: var(--radius-soft);
  background: #fffdf6;
}

fieldset label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 22px;
  font-weight: 700;
  transition-property: transform, background-color, box-shadow;
  transition-duration: 140ms;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  touch-action: manipulation;
}

fieldset label:has(input:checked) {
  background: var(--accent);
  box-shadow: 3px 4px 0 var(--ink);
  transform: rotate(-1deg);
}

input[type="radio"] {
  accent-color: var(--accent-strong);
}

.gap-control {
  display: grid;
  grid-template-columns: 1fr 90px auto;
  gap: 10px;
  align-items: center;
  padding: 0 14px;
  color: var(--muted);
  font-size: 21px;
  font-weight: 700;
  transform: rotate(-0.25deg);
}

.gap-control input {
  width: 100%;
  min-height: 34px;
  border: 3px solid var(--ink);
  border-radius: 10px 12px 9px 13px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--paper);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

button {
  width: 100%;
  min-height: 58px;
  border: 4px solid var(--ink);
  border-radius: 18px 14px 20px 13px;
  background: var(--ink);
  color: #fff9df;
  font-family: inherit;
  font-size: 27px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 5px 6px 0 var(--accent-strong);
  transition-property: transform, box-shadow, opacity;
  transition-duration: 140ms;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  touch-action: manipulation;
}

button:active {
  transform: translate(3px, 3px) rotate(0.4deg) scale(0.98);
  box-shadow: 2px 3px 0 var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.status {
  min-height: 48px;
  margin: 0;
  padding: 10px 14px 8px;
  border: 3px solid var(--ink);
  border-radius: 14px 18px 12px 20px;
  background: var(--paper-deep);
  transform: rotate(0.3deg);
}

.status.error {
  color: var(--danger);
  background: #ffe0d8;
}

@keyframes paper-jiggle {
  0% {
    transform: rotate(0.45deg) translateX(0);
  }
  25% {
    transform: rotate(-1.8deg) translateX(-3px);
  }
  55% {
    transform: rotate(1.4deg) translateX(3px);
  }
  100% {
    transform: rotate(0.45deg) translateX(0);
  }
}

@media (hover: hover) {
  .drop-zone:hover {
    box-shadow: 5px 6px 0 var(--ink);
    transform: rotate(-0.2deg) translateY(-2px);
  }

  fieldset label:hover {
    background: var(--accent-soft);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 520px) {
  .app-shell {
    align-items: stretch;
    padding: 0;
  }

  .phone-frame {
    min-height: 100vh;
    border-width: 0;
    border-radius: 0;
    box-shadow: none;
    transform: none;
  }

  h1 {
    font-size: 48px;
  }

  .converter {
    padding-inline: 16px;
  }

  .drop-zone {
    min-height: 196px;
  }

  .summary,
  .drop-meta,
  .status,
  .gap-control {
    font-size: 16px;
  }

  .drop-title {
    font-size: 28px;
  }

  fieldset {
    grid-template-columns: 1fr;
  }

  legend {
    display: block;
  }
}
