:root {
  --ink: #173d35;
  --ink-soft: #58726b;
  --cream: #f6f0e5;
  --paper: #fffdf8;
  --sage: #dce8dd;
  --sage-light: #edf3eb;
  --coral: #ef765d;
  --coral-dark: #d95e48;
  --line: #d9dfd9;
  --shadow: 0 24px 70px rgba(30, 63, 53, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(239, 118, 93, 0.1), transparent 22rem),
    linear-gradient(115deg, var(--cream) 0%, #f8f4eb 48%, #eef3e9 100%);
  font-family: "DM Sans", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 30px 0 22px;
  display: flex;
  flex-direction: column;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(23, 61, 53, 0.14);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--paper);
  background: var(--ink);
}

.brand-mark svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.site-header > p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(440px, 0.78fr);
  gap: clamp(50px, 8vw, 120px);
  align-items: center;
  padding: 55px 4% 52px;
}

.hero-copy {
  max-width: 570px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--coral-dark);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.eyebrow::before {
  width: 32px;
  height: 2px;
  content: "";
  background: var(--coral);
}

h1 {
  margin: 22px 0 24px;
  font-family: "DM Serif Display", serif;
  font-size: clamp(3.5rem, 6vw, 5.5rem);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 0.94;
}

h1 em {
  color: var(--coral);
  font-weight: 400;
}

.hero-intro {
  max-width: 510px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.06rem;
  line-height: 1.75;
}

.help-card {
  max-width: 500px;
  margin-top: 36px;
  padding: 17px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(23, 61, 53, 0.09);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.5);
}

.help-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.83rem;
  line-height: 1.55;
}

.help-icon {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink-soft);
  border-radius: 50%;
  font-family: "DM Serif Display", serif;
  font-size: 0.9rem;
}

.calculator-card {
  overflow: hidden;
  border: 1px solid rgba(23, 61, 53, 0.12);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

#tip-form {
  padding: 32px 34px 28px;
}

.field-group {
  margin: 0 0 24px;
  padding: 0;
  border: 0;
}

.field-group:last-child {
  margin-bottom: 0;
}

.field-group > label,
.field-group > legend {
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 700;
}

.input-wrap {
  height: 52px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.input-wrap:focus-within {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(239, 118, 93, 0.13);
}

.input-wrap input {
  width: 100%;
  height: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 1.1rem;
  font-weight: 600;
}

.input-wrap input::placeholder {
  color: #9ba9a4;
  font-weight: 500;
}

.currency-input > span {
  padding-left: 16px;
  color: var(--coral);
  font-weight: 700;
}

.currency-input input {
  padding: 0 16px 0 9px;
}

.error-message {
  min-height: 15px;
  margin: 5px 0 -15px;
  color: var(--coral-dark);
  font-size: 0.72rem;
}

.tip-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}

.tip-button {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 150ms ease, color 150ms ease, background 150ms ease;
}

.tip-button:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}

.tip-button.active {
  color: #fff;
  border-color: var(--ink);
  background: var(--ink);
}

.custom-tip-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 11px;
}

.custom-tip-wrap > label {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.percent-input {
  width: 118px;
  height: 42px;
}

.percent-input input {
  padding: 0 4px 0 13px;
  font-size: 0.88rem;
}

.percent-input span {
  padding-right: 13px;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.stepper {
  height: 50px;
  display: grid;
  grid-template-columns: 50px 1fr 50px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.stepper button {
  border: 0;
  background: var(--sage-light);
  font-size: 1.35rem;
  cursor: pointer;
  transition: background 150ms ease;
}

.stepper button:hover {
  background: var(--sage);
}

.stepper input {
  width: 100%;
  border: 0;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  outline: 0;
  color: var(--ink);
  background: #fff;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  -moz-appearance: textfield;
}

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

.results {
  padding: 25px 34px 30px;
  color: #fff;
  background: var(--ink);
}

.results-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.results-heading span,
.receipt-lines span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  font-weight: 500;
}

.results-heading strong {
  display: block;
  margin-top: 2px;
  font-family: "DM Serif Display", serif;
  font-size: 2.55rem;
  font-weight: 400;
  letter-spacing: -0.03em;
}

.results-heading > span {
  margin-top: 5px;
  padding: 6px 10px;
  border-radius: 99px;
  color: var(--ink);
  background: var(--sage);
  font-size: 0.68rem;
  font-weight: 700;
}

.receipt-lines {
  margin: 20px 0;
  padding: 18px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.receipt-lines > div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.receipt-lines > div + div {
  margin-top: 10px;
}

.receipt-lines strong {
  font-size: 0.84rem;
}

.reset-button {
  width: 100%;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  background: var(--sage);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}

.reset-button:hover {
  background: #e7f0e5;
  transform: translateY(-1px);
}

.reset-button svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding-top: 20px;
  border-top: 1px solid rgba(23, 61, 53, 0.14);
  color: var(--ink-soft);
  font-size: 0.72rem;
}

footer p {
  margin: 0;
}

footer span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--coral);
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 42px;
    padding: 55px 6% 60px;
  }

  .hero-copy {
    max-width: 650px;
  }

  h1 {
    font-size: clamp(3.4rem, 10vw, 5.2rem);
  }

  .calculator-card {
    width: min(100%, 560px);
    justify-self: center;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 28px, 1180px);
    padding-top: 18px;
  }

  .site-header {
    padding-bottom: 18px;
  }

  .site-header > p {
    display: none;
  }

  .hero {
    gap: 32px;
    padding: 42px 0;
  }

  h1 {
    margin-top: 16px;
    font-size: clamp(3rem, 16vw, 4.3rem);
  }

  .hero-intro {
    font-size: 0.96rem;
  }

  .help-card {
    display: none;
  }

  #tip-form,
  .results {
    padding-right: 22px;
    padding-left: 22px;
  }

  .tip-options {
    grid-template-columns: repeat(2, 1fr);
  }

  footer {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }

  footer span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
