:root {
  --rv-ink: #33261f;
  --rv-muted: #74685f;
  --rv-brown: #5c3c2d;
  --rv-brown-dark: #39251c;
  --rv-gold: #caa25a;
  --rv-cream: #f8f4ee;
  --rv-line: #e7ddd2;
  --rv-white: #fff;
}

.rv-page {
  min-height: 100vh;
  color: var(--rv-ink);
  background: linear-gradient(180deg, #fbf9f6 0, #f5efe8 100%);
}

.rv-shell {
  width: min(calc(100% - 32px), 1180px);
  margin-inline: auto;
}

.rv-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(64px, 10vw, 104px) 0;
  color: #fff;
  text-align: center;
  background:
    radial-gradient(circle at 76% 14%, rgba(202, 162, 90, .25), transparent 26%),
    linear-gradient(135deg, var(--rv-brown-dark), var(--rv-brown));
}

.rv-hero::after {
  content: "";
  position: absolute;
  inset: auto -10% -80px;
  height: 140px;
  border-radius: 50%;
  background: #fbf9f6;
}

.rv-hero .rv-shell { position: relative; z-index: 1; }
.rv-eyebrow,
.rv-step {
  margin: 0 0 8px;
  color: var(--rv-gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .16em;
}

.rv-hero h1 {
  margin: 0;
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 900;
  letter-spacing: .02em;
}

.rv-hero p:last-child {
  margin: 18px auto 0;
  color: #efe5d9;
  font-size: clamp(15px, 2.4vw, 18px);
  line-height: 1.9;
}

.rv-sp-only { display: none; }
.rv-content { position: relative; z-index: 2; padding: 20px 0 80px; }

.rv-panel,
.rv-results,
.rv-commentary {
  margin-bottom: 28px;
  padding: clamp(24px, 5vw, 44px);
  border: 1px solid var(--rv-line);
  border-radius: 24px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 16px 44px rgba(56, 37, 28, .07);
}

.rv-section-heading { margin-bottom: 28px; }
.rv-section-heading h2 {
  margin: 0;
  color: var(--rv-ink);
  font-size: clamp(21px, 4vw, 29px);
}

.rv-main-inputs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.rv-field { display: grid; align-content: start; gap: 8px; }
.rv-field > span:first-child,
#periodLabel { font-size: 14px; font-weight: 800; }
.rv-field small { color: var(--rv-muted); font-size: 11px; line-height: 1.5; }

.rv-input-unit {
  display: flex;
  align-items: center;
  overflow: hidden;
  min-height: 58px;
  border: 1px solid #d9cdc0;
  border-radius: 13px;
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
}

.rv-input-unit:focus-within {
  border-color: var(--rv-gold);
  box-shadow: 0 0 0 4px rgba(202, 162, 90, .15);
}

.rv-input-unit input {
  min-width: 0;
  width: 100%;
  padding: 14px 4px 14px 16px;
  border: 0;
  outline: 0;
  color: var(--rv-ink);
  background: transparent;
  font-size: 21px;
  font-weight: 800;
  text-align: right;
}

.rv-input-unit input::placeholder { color: #c7bbb0; }
.rv-input-unit b { padding: 0 15px 0 8px; color: var(--rv-muted); font-size: 13px; white-space: nowrap; }
.rv-clear-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: 7px;
  margin-right: 3px;
  border: 0;
  cursor: pointer;
  color: transparent;
  background: transparent;
  font-size: 0;
  line-height: 1;
}
.rv-clear-button::before {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  content: "×";
  color: #988b80;
  background: #f3eee8;
  font-size: 14px;
  transition: color .2s, background .2s;
}
.rv-clear-button:hover::before { color: var(--rv-brown-dark); background: #e9dfd4; }
.rv-clear-button[hidden] { display: none; }
.rv-duration-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.rv-segmented,
.rv-mode-switch {
  display: inline-grid;
  grid-auto-flow: column;
  padding: 4px;
  border: 1px solid var(--rv-line);
  border-radius: 12px;
  background: var(--rv-cream);
}

.rv-segmented button,
.rv-mode-switch button,
.rv-personas button {
  border: 0;
  cursor: pointer;
  color: var(--rv-muted);
  background: transparent;
  font-weight: 800;
}

.rv-segmented button { min-width: 52px; padding: 7px 9px; border-radius: 8px; }
.rv-segmented button.is-active,
.rv-mode-switch button.is-active {
  color: var(--rv-brown-dark);
  background: #fff;
  box-shadow: 0 2px 8px rgba(57, 37, 28, .1);
}

.rv-error { min-height: 24px; margin: 14px 0 0; color: #a53b2b; font-size: 13px; font-weight: 700; }

.rv-calculate-button,
.rv-retry-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(100%, 420px);
  min-height: 60px;
  margin: 30px auto 0;
  padding: 14px 22px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--rv-brown-dark), var(--rv-brown));
  box-shadow: 0 10px 25px rgba(57, 37, 28, .2);
  font-size: 17px;
  font-weight: 900;
  transition: transform .2s, box-shadow .2s;
}

.rv-calculate-button:hover,
.rv-retry-button:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(57, 37, 28, .24); }
.rv-calculate-button:disabled {
  cursor: wait;
  opacity: .62;
  transform: none;
}
.rv-calculate-button:focus-visible,
.rv-retry-button:focus-visible,
.rv-personas button:focus-visible,
.rv-random-button:focus-visible { outline: 3px solid rgba(202, 162, 90, .5); outline-offset: 3px; }

.rv-distance {
  margin-top: 14px;
  border-top: 1px solid var(--rv-line);
}

.rv-distance summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 2px 4px;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.rv-distance summary::-webkit-details-marker { display: none; }
.rv-distance summary span { display: flex; align-items: center; gap: 9px; }
.rv-distance summary i { color: var(--rv-gold); }
.rv-distance summary small { color: var(--rv-muted); font-size: 11px; font-weight: 500; }
.rv-distance-body { padding-top: 20px; }
.rv-mode-switch { margin-bottom: 20px; }
.rv-mode-switch button { padding: 9px 15px; border-radius: 8px; }
.rv-distance-fields { max-width: 360px; }
.rv-distance-fields--two { max-width: none; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.rv-distance-fields--two:not([hidden]) { display: grid; }

.rv-results {
  color: #fff;
  border: 0;
  background:
    radial-gradient(circle at 84% 12%, rgba(202, 162, 90, .25), transparent 30%),
    linear-gradient(135deg, #3b271e, #604232);
}

.rv-section-heading--result h2 { color: #fff; }
.rv-normalized-period { margin: 8px 0 0; color: #d8cbc2; font-size: 13px; font-weight: 700; }
.rv-result-grid { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 12px; }
.rv-result-card {
  display: grid;
  align-content: center;
  min-height: 132px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 18px;
  background: rgba(255, 255, 255, .07);
}

.rv-result-card--primary { border-color: rgba(202, 162, 90, .55); background: rgba(202, 162, 90, .13); }
.rv-result-card span { color: #dbcfc6; font-size: 13px; font-weight: 700; }
.rv-result-card strong { margin-top: 8px; color: #fff; font-size: clamp(24px, 4vw, 38px); line-height: 1.2; }
.rv-result-card--primary strong { color: #f2c978; font-size: clamp(36px, 6vw, 54px); }

.rv-distance-results {
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 22px;
  overflow: hidden;
  border-radius: 12px;
  background: rgba(255, 255, 255, .15);
}

.rv-distance-results:not([hidden]) { display: grid; }
.rv-distance-results div { display: grid; gap: 3px; padding: 14px 18px; background: rgba(33, 20, 15, .36); }
.rv-distance-results span { color: #cfc2b9; font-size: 11px; }
.rv-distance-results strong { color: #fff; font-size: 17px; }

.rv-personas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.rv-personas button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 54px;
  padding: 10px;
  border: 1px solid var(--rv-line);
  border-radius: 13px;
  background: #fff;
}

.rv-personas button span { font-size: 20px; }
.rv-personas button.is-active {
  color: #fff;
  border-color: var(--rv-brown);
  background: var(--rv-brown);
  box-shadow: 0 8px 22px rgba(92, 60, 45, .18);
}

.rv-comment-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  min-height: 150px;
  margin-top: 0;
  padding: clamp(22px, 4vw, 32px);
  border-radius: 18px;
  background: var(--rv-cream);
}

.rv-comment-avatar {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #eadfce;
  box-shadow: 0 5px 16px rgba(57, 37, 28, .1);
  font-size: 30px;
}

.rv-comment-name { margin: 0 0 5px; color: var(--rv-gold); font-size: 12px; font-weight: 900; letter-spacing: .1em; }
.rv-comment-text { margin: 0; color: var(--rv-ink); font-size: clamp(17px, 3vw, 23px); font-weight: 800; line-height: 1.7; }

.rv-comment-settings {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--rv-line);
}

.rv-comment-settings h3 { margin: 0; font-size: 17px; }
.rv-comment-settings > p { margin: 5px 0 16px; color: var(--rv-muted); font-size: 12px; }
.rv-random-button {
  display: block;
  margin: 12px auto 0;
  padding: 7px 12px;
  border: 0;
  cursor: pointer;
  color: var(--rv-muted);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}
.rv-random-button.is-active { color: var(--rv-gold); }
.rv-retry-button { margin-top: 28px; color: var(--rv-brown-dark); border: 1px solid var(--rv-line); background: #fff; box-shadow: none; }
.rv-retry-button:hover { box-shadow: 0 9px 22px rgba(57, 37, 28, .09); }

.rv-next { margin: 34px auto 28px; text-align: center; }
.rv-next h2 { margin: 0 0 18px; font-size: clamp(20px, 3.4vw, 27px); }
.rv-next-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 680px; margin-inline: auto; }
.rv-next-card {
  --rv-next-accent: var(--rv-gold);
  --rv-next-soft: #fff9e9;
  position: relative;
  display: flex;
  min-height: 128px;
  box-sizing: border-box;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 12px 28px;
  color: var(--rv-ink);
  text-decoration: none;
  border: 1px solid var(--rv-line);
  border-top: 6px solid var(--rv-next-accent);
  border-radius: 15px;
  background: var(--rv-next-soft);
  box-shadow: 0 5px 14px rgba(56, 37, 28, .08);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.rv-next-card--cost { --rv-next-accent: #6da965; --rv-next-soft: #f1f8ef; }
.rv-next-card--loan { --rv-next-accent: #7b3d0b; --rv-next-soft: #f8f0ea; }
.rv-next-card-icon { display: grid; width: 38px; height: 38px; margin-bottom: 8px; place-items: center; color: #fff; font-size: 16px; border-radius: 50%; background: var(--rv-next-accent); }
.rv-next-card-title { font-size: 16px; font-weight: 900; line-height: 1.4; }
.rv-next-card-meta { margin-top: 3px; color: var(--rv-muted); font-size: 11px; line-height: 1.4; }
.rv-next-card-arrow { position: absolute; right: 12px; bottom: 8px; color: var(--rv-next-accent); font-size: 16px; font-weight: 900; }
.rv-next-card:hover { transform: translateY(-3px); border-color: var(--rv-next-accent); box-shadow: 0 9px 20px rgba(56, 37, 28, .13); }
.rv-next-card:focus-visible { outline: 3px solid rgba(202, 162, 90, .4); outline-offset: 3px; }
.rv-note { padding: 0 18px; color: var(--rv-muted); font-size: 11px; line-height: 1.8; text-align: center; }

@media (max-width: 1200px) and (min-width: 761px) {
  .rv-main-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rv-main-inputs > .rv-field:last-child { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .rv-sp-only { display: initial; }
  .rv-hero { padding: 52px 0 76px; }
  .rv-content { margin-top: -18px; }
  .rv-panel, .rv-results, .rv-commentary { border-radius: 18px; }
  .rv-main-inputs { grid-template-columns: 1fr; }
  .rv-result-grid { grid-template-columns: 1fr 1fr; }
  .rv-result-card--primary { grid-column: 1 / -1; min-height: 122px; text-align: center; }
  .rv-result-card:not(.rv-result-card--primary) { min-height: 112px; padding: 16px; }
  .rv-personas { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 500px) {
  .rv-shell { width: min(calc(100% - 20px), 1180px); }
  .rv-panel, .rv-results, .rv-commentary { padding: 22px 16px; }
  .rv-next { margin-top: 30px; }
  .rv-next-grid { grid-template-columns: 1fr; gap: 10px; }
  .rv-next-card { min-height: 108px; }
  .rv-duration-inputs { grid-template-columns: 1fr 1fr; }
  .rv-duration-inputs .rv-input-unit input { padding-left: 10px; font-size: 19px; }
  .rv-duration-inputs .rv-input-unit b { padding-right: 10px; padding-left: 4px; }
  .rv-duration-inputs .rv-clear-button { width: 36px; height: 36px; margin-left: 4px; margin-right: 0; }
  .rv-duration-inputs .rv-clear-button::before { width: 20px; height: 20px; font-size: 13px; }
  .rv-distance summary { align-items: flex-start; flex-direction: column; }
  .rv-mode-switch { width: 100%; }
  .rv-mode-switch button { width: 100%; padding-inline: 8px; }
  .rv-distance-fields--two { grid-template-columns: 1fr; }
  .rv-result-card strong { font-size: 22px; }
  .rv-result-card--primary strong { font-size: 46px; }
  .rv-distance-results { grid-template-columns: 1fr; }
  .rv-comment-card { grid-template-columns: 1fr; text-align: center; }
  .rv-comment-avatar { margin-inline: auto; }
  .rv-comment-text { font-size: 17px; line-height: 1.75; }
  .rv-calculate-button, .rv-retry-button { min-height: 56px; font-size: 15px; }
}

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