:root {
  color-scheme: light;
  --bg: #f3f7fb;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #65717d;
  --line: #d6dde5;
  --orange: #f05a28;
  --orange-dark: #c8431e;
  --blue: #2563eb;
  --blue-soft: #e6efff;
  --green: #15966b;
  --red: #dc2626;
  --shadow: 0 22px 70px rgba(22, 34, 51, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 18% 10%, rgba(240, 90, 40, 0.16), transparent 30rem),
    radial-gradient(circle at 84% 4%, rgba(37, 99, 235, 0.14), transparent 28rem),
    linear-gradient(rgba(17, 24, 39, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 24, 39, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, 46px 46px, 46px 46px, auto;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Archivo, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 58px) 0;
  display: grid;
  align-content: start;
  gap: 22px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow,
.hint,
.field > span,
.result-card span,
.message {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow::before {
  display: inline-block;
  width: 28px;
  height: 3px;
  margin-right: 10px;
  vertical-align: middle;
  background: linear-gradient(90deg, var(--orange), var(--blue));
  content: "";
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4.4vw, 4rem);
  line-height: 0.9;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.hint {
  max-width: 260px;
  margin: 0;
  line-height: 1.5;
  text-align: right;
}

.calculator,
.result-card {
  border: 1px solid rgba(214, 221, 229, 0.9);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(246, 250, 255, 0.88)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.calculator {
  position: relative;
  overflow: hidden;
  padding: clamp(18px, 3vw, 32px);
  border-radius: 8px;
}

.calculator::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  content: "";
  background: linear-gradient(90deg, var(--orange), var(--blue));
}

.fields {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto minmax(250px, 1fr);
  gap: clamp(10px, 1.35vw, 18px);
  align-items: end;
}

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

.field > span {
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.money-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.money-input input {
  width: 100%;
  min-width: 0;
  height: clamp(92px, 10vw, 118px);
  padding: 0 12px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-family: "IBM Plex Sans Condensed", Archivo, sans-serif;
  font-size: clamp(3rem, 5vw, 4.5rem);
  font-weight: 700;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.money-input input:focus {
  border-color: var(--orange);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(240, 90, 40, 0.16);
}

.money-input input::placeholder {
  color: rgba(17, 24, 39, 0.18);
  opacity: 1;
}

.money-input input::-webkit-outer-spin-button,
.money-input input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.money-input input {
  appearance: textfield;
}

.money-input span {
  color: var(--muted);
  font-weight: 800;
}

.divider {
  width: 2px;
  height: 100px;
  margin-bottom: 4px;
  border-radius: 999px;
  background: linear-gradient(var(--orange), var(--blue));
  opacity: 0.72;
}

.actions {
  margin-top: clamp(28px, 4vw, 46px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(16px, 4vw, 60px);
}

.actions[hidden] {
  display: none;
}

button {
  min-width: min(190px, 100%);
  min-height: 50px;
  padding: 0 24px;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid rgba(17, 24, 39, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font: 800 0.88rem/1 Inter, sans-serif;
  text-transform: none;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

button svg {
  width: 17px;
  height: 17px;
  display: block;
  fill: currentColor;
}

button span {
  display: block;
  line-height: 1;
  transform: translateY(1px);
}

button:hover,
button:focus-visible {
  background: linear-gradient(135deg, var(--orange), var(--blue));
  border-color: transparent;
  color: #fff;
}

button:active {
  transform: translateY(1px);
}

.message {
  min-height: 1.4em;
  margin: 18px 0 0;
  text-align: center;
}

.message:empty {
  display: none;
}

.message.is-error {
  color: var(--orange-dark);
}

.results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.results[hidden] {
  display: none;
}

.result-card {
  min-height: 150px;
  padding: 22px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  border-radius: 8px;
}

.result-card span {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.result-card strong {
  font-size: clamp(1.7rem, 4vw, 3rem);
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.result-card.discount {
  border-left: 6px solid var(--green);
}

.result-card.discount strong {
  color: var(--green);
}

.result-card.discount.is-increase {
  border-left-color: var(--red);
}

.result-card.discount.is-increase strong {
  color: var(--red);
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    align-content: start;
    padding: 14px 0;
    gap: 14px;
  }

  .topbar {
    display: grid;
    align-items: start;
  }

  .hint {
    max-width: none;
    text-align: left;
  }

  h1 {
    font-size: clamp(1.68rem, 7vw, 2.25rem);
    line-height: 0.92;
    white-space: nowrap;
  }

  .fields,
  .results {
    grid-template-columns: 1fr;
  }

  .divider {
    width: 100%;
    height: 1px;
    margin: 8px 0;
    opacity: 0.54;
  }

  .calculator,
  .result-card {
    padding: 14px;
  }

  .result-card {
    min-height: 76px;
    gap: 6px;
    align-content: center;
  }

  .result-card strong {
    font-size: clamp(1.55rem, 8vw, 2.25rem);
  }

  .field {
    gap: 8px;
  }

  .field > span {
    font-size: 1.95rem;
    text-align: center;
  }

  .money-input {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .money-input input {
    height: 78px;
    padding: 0 8px 4px;
    border-radius: 8px;
    font-size: clamp(3.1rem, 14vw, 4rem);
  }

  .money-input span {
    justify-self: center;
    font-size: 0.82rem;
  }

  .actions {
    display: flex;
    flex-wrap: nowrap;
    margin-top: 22px;
    gap: 8px;
  }

  button {
    width: auto;
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 0.78rem;
    gap: 7px;
  }

  button svg {
    width: 15px;
    height: 15px;
  }
}

@media (max-width: 390px) {
  .app-shell {
    width: min(100% - 16px, 1180px);
  }

  h1 {
    font-size: clamp(1.52rem, 6.5vw, 1.74rem);
  }

  .calculator,
  .result-card {
    padding: 12px;
  }

  .result-card {
    min-height: 70px;
  }

  .field > span {
    font-size: 1.7rem;
  }

  .money-input input {
    height: 74px;
    font-size: clamp(2.55rem, 12vw, 3.25rem);
  }

  .actions {
    margin-top: 18px;
  }
}
