@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=DM+Serif+Display:ital@0;1&display=swap');

:root {
  color-scheme: light;
  --ink: #17332f;
  --muted: #697672;
  --cream: #f6f1e7;
  --paper: #fffdf8;
  --mint: #bce7d1;
  --orange: #ef754b;
  --line: #dedbd1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(188, 231, 209, .55), transparent 26rem),
    var(--cream);
  font-family: "DM Sans", sans-serif;
}

.shell {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 72px 0;
}

header { margin-bottom: 40px; }
.eyebrow {
  margin: 0 0 14px;
  color: var(--orange);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 700px;
  font: 400 clamp(3rem, 8vw, 5.8rem)/.91 "DM Serif Display", serif;
  letter-spacing: -.045em;
}

h1 em { color: var(--orange); font-weight: 400; }
.intro { margin: 20px 0 0; color: var(--muted); font-size: 1.05rem; }

.calculator {
  display: grid;
  grid-template-columns: 1.25fr .8fr;
  overflow: hidden;
  border: 1px solid rgba(23, 51, 47, .12);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 24px 70px rgba(34, 55, 48, .1);
}

.inputs { padding: 44px; }
label, legend { font-weight: 700; font-size: .9rem; }
.money-field {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 34px;
  border-bottom: 2px solid var(--ink);
}
.money-field span { font: 400 2rem "DM Serif Display", serif; }
.money-field input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font: 400 3.2rem "DM Serif Display", serif;
}
.money-field input::placeholder { color: #bbc1bb; }

fieldset { margin: 0; padding: 0; border: 0; }
.tips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 12px; }
.tips button, .custom-tip {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font: 700 .9rem "DM Sans", sans-serif;
}
.tips button { cursor: pointer; transition: .15s ease; }
.tips button:hover { border-color: var(--ink); transform: translateY(-1px); }
.tips button.active { border-color: var(--ink); background: var(--ink); color: white; }
.custom-tip { display: flex; align-items: center; padding: 0 9px; }
.custom-tip:focus-within { outline: 2px solid var(--orange); outline-offset: 2px; }
.custom-tip input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
}

.people-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 38px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.people-row p { margin: 5px 0 0; color: var(--muted); font-size: .8rem; }
.stepper { display: flex; align-items: center; gap: 5px; }
.stepper button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--mint);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.35rem;
}
.stepper output { min-width: 42px; text-align: center; font-weight: 700; font-size: 1.1rem; }

.results {
  display: flex;
  flex-direction: column;
  padding: 44px;
  color: white;
  background: var(--ink);
}
.result-line { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 21px; }
.result-line span { color: #b9cac5; }
.result-line strong { font-size: 1.15rem; }
.divider { height: 1px; margin: 5px 0 30px; background: rgba(255,255,255,.16); }
.per-person span, .per-person small { display: block; }
.per-person span { color: var(--mint); font-weight: 700; font-size: .86rem; }
.per-person strong {
  display: block;
  margin: 5px 0;
  color: var(--mint);
  font: 400 clamp(3.1rem, 7vw, 5rem)/1 "DM Serif Display", serif;
  letter-spacing: -.04em;
  overflow-wrap: anywhere;
}
.per-person small { color: #9eb1ab; }
.reset {
  margin-top: auto;
  padding: 15px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 12px;
  background: transparent;
  color: white;
  cursor: pointer;
  font: 600 .9rem "DM Sans", sans-serif;
}
.reset:hover { background: rgba(255,255,255,.08); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (max-width: 760px) {
  .shell { width: min(100% - 24px, 560px); padding: 42px 0; }
  .calculator { grid-template-columns: 1fr; }
  .inputs, .results { padding: 28px; }
  .results { min-height: 390px; }
  .tips { grid-template-columns: repeat(4, 1fr); }
  .custom-tip { grid-column: span 2; }
}

@media (max-width: 430px) {
  .tips { grid-template-columns: repeat(2, 1fr); }
  .custom-tip { grid-column: span 2; }
  .people-row { align-items: flex-start; flex-direction: column; }
}
