:root {
  color-scheme: light;
  --paper: #f5f0e7;
  --paper-deep: #e9e0d1;
  --ink: #191816;
  --muted: #777168;
  --line: rgba(25, 24, 22, 0.14);
  --accent: #ef5a35;
  --accent-deep: #d84625;
  --white: #fffdf8;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 18% 8%, rgba(255,255,255,.92), transparent 31rem),
    radial-gradient(circle at 88% 76%, rgba(220,120,72,.12), transparent 34rem),
    var(--paper);
}

button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .28;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.page-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(32px, 7vw, 88px) 20px;
}

.hero { width: min(100%, 620px); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .06em;
  background: rgba(255,255,255,.38);
}

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(239,90,53,.11); }

h1 {
  margin: 0;
  font-family: ui-serif, "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(56px, 11vw, 92px);
  line-height: .96;
  letter-spacing: -.055em;
  font-weight: 760;
}

.lead {
  margin: 24px 0 34px;
  font-size: clamp(18px, 3vw, 22px);
  line-height: 1.68;
  color: #4e4a44;
  letter-spacing: -.015em;
}

.tip-card {
  position: relative;
  padding: 26px;
  border: 1px solid rgba(25,24,22,.13);
  border-radius: 28px;
  background: rgba(255,253,248,.82);
  box-shadow: 0 28px 70px rgba(73,57,38,.10), inset 0 1px 0 rgba(255,255,255,.9);
  backdrop-filter: blur(14px);
}

fieldset { margin: 0; padding: 0; border: 0; }
legend, .field > span:first-child {
  display: block;
  margin-bottom: 11px;
  color: #4b4741;
  font-size: 13px;
  font-weight: 720;
  letter-spacing: .02em;
}

.amount-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.amount {
  min-height: 57px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: transparent;
  font-size: 18px;
  font-weight: 760;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, color .16s ease;
}

.amount:hover { transform: translateY(-1px); border-color: rgba(25,24,22,.28); }
.amount.selected { background: var(--ink); color: var(--white); border-color: var(--ink); }

.field { display: block; margin-top: 20px; }
.field em { color: #aaa298; font-style: normal; font-weight: 500; }
.field input, .field select {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  outline: 0;
  border-radius: 15px;
  background: rgba(255,255,255,.62);
  color: var(--ink);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.field input:focus, .field select:focus { border-color: rgba(239,90,53,.65); box-shadow: 0 0 0 4px rgba(239,90,53,.09); }
.field input::placeholder { color: #aaa39a; }

.money-input { position: relative; display: block; }
.money-input b { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 18px; }
.money-input input { padding-left: 39px; }

.submit {
  width: 100%;
  min-height: 62px;
  margin-top: 22px;
  padding: 0 18px 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 18px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  font-size: 17px;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(216,70,37,.22);
  transition: transform .16s ease, background .16s ease, opacity .16s ease;
}
.submit:hover { background: var(--accent-deep); transform: translateY(-1px); }
.submit:disabled { cursor: wait; opacity: .62; transform: none; }
.arrow { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.17); font-size: 17px; }

.payment-note { margin: 14px 4px 0; color: #8a8278; font-size: 12px; line-height: 1.65; }
.payment-note strong { color: #655e55; }

.status-card {
  margin-top: 18px;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,253,248,.72);
}
.status-icon { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border-radius: 14px; background: var(--ink); color: white; font-weight: 800; }
.status-card h2 { margin: 0 0 5px; font-size: 16px; }
.status-card p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 13px; }
.status-card.paid .status-icon { background: #267a55; }
.status-card.error .status-icon { background: #9a4b37; }

.status-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.secondary-action, .text-action {
  border: 0;
  cursor: pointer;
  font-weight: 720;
}

.secondary-action {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,253,248,.7);
  color: var(--ink);
}

.secondary-action:hover { border-color: rgba(25,24,22,.3); }
.secondary-action:disabled { opacity: .58; cursor: wait; }

.text-action {
  padding: 9px 8px;
  background: transparent;
  color: #6c655c;
}
.text-action:hover { color: var(--ink); }

.problem-dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: min(88dvh, 840px);
  padding: 0;
  border: 0;
  border-radius: 26px;
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 30px 90px rgba(25,24,22,.24);
}

.problem-dialog::backdrop { background: rgba(25,24,22,.42); backdrop-filter: blur(4px); }
.problem-card { padding: 26px; overflow: auto; }
.problem-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.problem-heading h2 { margin: 4px 0 8px; font-size: 27px; letter-spacing: -.035em; }
.problem-heading p { margin: 0; max-width: 500px; color: var(--muted); line-height: 1.6; font-size: 13px; }
.mini-label { font-size: 10px; letter-spacing: .14em; font-weight: 800; color: var(--accent); }
.dialog-close { width: 36px; height: 36px; flex: 0 0 36px; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; font-size: 22px; }
.problem-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }

.rich-field { margin-top: 20px; }
.rich-toolbar { display: flex; gap: 6px; padding: 7px; border: 1px solid var(--line); border-bottom: 0; border-radius: 15px 15px 0 0; background: #f4efe6; }
.rich-toolbar button { min-width: 34px; height: 31px; padding: 0 9px; border: 0; border-radius: 8px; background: transparent; color: #5e574e; cursor: pointer; }
.rich-toolbar button:hover { background: rgba(25,24,22,.07); color: var(--ink); }
.rich-editor {
  min-height: 150px;
  max-height: 260px;
  overflow: auto;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 0 0 15px 15px;
  outline: 0;
  background: white;
  line-height: 1.65;
  font-size: 14px;
}
.rich-editor:focus { border-color: rgba(239,90,53,.65); box-shadow: 0 0 0 4px rgba(239,90,53,.09); }
.rich-editor:empty::before { content: attr(data-placeholder); color: #aaa39a; pointer-events: none; }
.rich-editor ul, .rich-editor ol { padding-left: 24px; }
.problem-actions { margin-top: 22px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.problem-submit { width: auto; min-width: 165px; min-height: 50px; margin-top: 0; }

.footnote { margin-top: 24px; display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; color: #8d867d; font-size: 12px; line-height: 1.55; }
.footnote p { margin: 0; max-width: 330px; }
.footnote a { color: var(--ink); text-decoration: none; white-space: nowrap; font-weight: 700; }
.footnote a span { display: inline-block; transition: transform .16s ease; }
.footnote a:hover span { transform: translateX(3px); }

@media (max-width: 560px) {
  .page-shell { place-items: start center; padding: 42px 16px 32px; }
  h1 { font-size: clamp(56px, 18vw, 78px); }
  .lead { margin: 20px 0 28px; }
  .tip-card { padding: 20px; border-radius: 24px; }
  .amount-grid { gap: 8px; }
  .amount { min-height: 53px; border-radius: 14px; font-size: 16px; }
  .status-actions { align-items: stretch; flex-direction: column; }
  .secondary-action, .text-action { width: 100%; }
  .problem-card { padding: 20px; }
  .problem-grid { grid-template-columns: 1fr; }
  .footnote { flex-direction: column; gap: 12px; }
}

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