:root {
  --pink: #ff8fb1;
  --pink-dark: #e75f8b;
  --cream: #fff8f3;
  --ink: #302936;
  --muted: #786d7b;
  --white: #ffffff;
  --lavender: #f1eaff;
  --border: #eadde5;
  --shadow: 0 18px 50px rgba(90, 57, 80, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 143, 177, .22), transparent 34%),
    radial-gradient(circle at bottom right, rgba(178, 145, 255, .22), transparent 36%),
    var(--cream);
}

button, textarea, input { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(760px, calc(100% - 28px));
  margin: 0 auto;
  padding: 38px 0 28px;
}

.hero {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.cat-badge {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  flex: 0 0 74px;
  font-size: 42px;
  border-radius: 24px;
  background: var(--white);
  box-shadow: var(--shadow);
  transform: rotate(-4deg);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--pink-dark);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3.6rem);
  line-height: .98;
  letter-spacing: -.05em;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.translator-card,
.examples-card,
.note-card {
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 28px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.translator-card { padding: 24px; }

.direction-picker,
.level-picker {
  margin: 0 0 22px;
  padding: 0;
  border: 0;
}

.direction-picker legend,
.level-picker legend,
.field-header label {
  font-weight: 800;
}

.direction-picker legend,
.level-picker legend {
  margin-bottom: 10px;
}

.direction-control,
.segmented-control {
  display: grid;
  padding: 4px;
  border-radius: 16px;
  background: #f5eff3;
}

.direction-control { grid-template-columns: repeat(2, 1fr); }
.segmented-control { grid-template-columns: repeat(3, 1fr); }

.direction-control input,
.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.direction-control label,
.segmented-control label {
  padding: 11px 9px;
  text-align: center;
  font-size: .88rem;
  font-weight: 750;
  border-radius: 12px;
  transition: .2s ease;
}

.direction-control label {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.direction-control input:checked + label,
.segmented-control input:checked + label {
  color: var(--pink-dark);
  background: var(--white);
  box-shadow: 0 5px 14px rgba(89, 62, 81, .10);
}

.field-header,
.under-field,
.output-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

textarea {
  width: 100%;
  min-height: 150px;
  margin-top: 10px;
  padding: 17px 18px;
  resize: vertical;
  color: var(--ink);
  line-height: 1.5;
  border: 1px solid var(--border);
  border-radius: 18px;
  outline: none;
  background: #fffdfd;
  transition: .2s ease;
}

textarea:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(255, 143, 177, .14);
}

.under-field {
  margin-top: 8px;
  color: var(--muted);
  font-size: .83rem;
}

.text-button {
  padding: 2px 0;
  color: var(--pink-dark);
  font-weight: 750;
  border: 0;
  background: transparent;
}

.level-picker { margin-top: 23px; }

.primary-button,
.secondary-button,
.copy-button {
  border: 0;
  border-radius: 15px;
  font-weight: 850;
  transition: transform .15s ease, opacity .15s ease, box-shadow .15s ease;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 15px 18px;
  color: white;
  background: linear-gradient(135deg, var(--pink), var(--pink-dark));
  box-shadow: 0 12px 24px rgba(231, 95, 139, .26);
}

.secondary-button {
  flex: 1;
  margin-top: 12px;
  padding: 11px 15px;
  color: var(--ink);
  background: var(--lavender);
}

.primary-button:hover,
.secondary-button:hover,
.copy-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.output-section {
  margin-top: 25px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.output-wrap { position: relative; }

#outputText {
  min-height: 140px;
  padding-right: 86px;
  background: linear-gradient(180deg, #fffefd, #fff8fc);
}

.copy-button {
  position: absolute;
  top: 22px;
  right: 12px;
  padding: 9px 12px;
  color: white;
  background: var(--ink);
}

.status-text {
  min-height: 1em;
  color: var(--pink-dark);
  font-size: .82rem;
  font-weight: 750;
}

.examples-card,
.note-card {
  margin-top: 18px;
  padding: 20px 22px;
}

.examples-card h2,
.note-card h2 {
  margin: 0 0 14px;
  font-size: 1rem;
}

.note-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.example-grid {
  display: grid;
  gap: 9px;
}

.example-chip {
  padding: 12px 14px;
  color: var(--ink);
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--white);
}

.example-chip:hover { border-color: var(--pink); }

.hidden { display: none; }

footer {
  padding: 22px 8px 0;
  color: var(--muted);
  text-align: center;
  font-size: .82rem;
}

@media (max-width: 540px) {
  .app-shell {
    width: min(100% - 18px, 760px);
    padding-top: 22px;
  }

  .hero { gap: 13px; }

  .cat-badge {
    width: 62px;
    height: 62px;
    flex-basis: 62px;
    border-radius: 20px;
    font-size: 35px;
  }

  .translator-card {
    padding: 18px;
    border-radius: 23px;
  }

  .direction-control label,
  .segmented-control label {
    padding: 10px 5px;
    font-size: .78rem;
  }

  .output-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .secondary-button {
    width: 100%;
    margin-top: 8px;
  }
}
