:root {
  --header-height: 170px;
  --page-gap: 14px;
  --frame-margin: clamp(10px, 2vw, 28px);
  --burgundy: #660000;
  --burgundy-dark: #660000;
  --bg: #fff6dc;
  --panel: #fffaf0;
  --ink: #2d150d;
  --muted: #74502c;
  --line: #d7ad54;
  --accent: #660000;
  --accent-soft: rgba(102, 0, 0, 0.16);
  --warning-line: #d99b18;
  --shadow: 0 14px 34px rgba(77, 27, 5, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(123, 11, 5, 0.10), transparent 34rem),
    linear-gradient(180deg, #fff8e5 0%, var(--bg) 42%, #fff1c7 100%);
  font-family: Arial, Helvetica, sans-serif;
  overflow-x: hidden;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.page-header {
  max-width: 1600px;
  margin: 14px auto 0;
  min-height: var(--header-height);
  padding: 10px;
  border: 1px solid rgba(255, 226, 147, 0.28);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--burgundy), #660000 62%, var(--burgundy-dark));
  box-shadow: 0 14px 34px rgba(77, 27, 5, 0.12);
  overflow: hidden;
}

.image-banner {
  display: grid;
  place-items: center;
  min-height: 148px;
  border: 1px solid rgba(255, 231, 166, 0.20);
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(255, 236, 168, 0.07), transparent 38%),
    transparent;
  overflow: hidden;
  text-decoration: none;
}

.image-banner img {
  display: block;
  width: min(900px, 96%);
  height: auto;
  max-height: 132px;
  object-fit: contain;
}

.app-shell {
  max-width: 1600px;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  min-height: 0;
  margin: 16px auto 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sidebar {
  grid-column: 1;
  grid-row: 1;
  position: sticky;
  top: 0;
  align-self: start;
  width: 100%;
  min-height: 100%;
  z-index: 10;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(255, 224, 140, 0.05), transparent 170px),
    linear-gradient(180deg, var(--burgundy), var(--burgundy-dark));
  color: #fff8dc;
  overflow-y: auto;
  border-radius: 13px 0 0 13px;
  box-shadow: inset -1px 0 0 rgba(255, 231, 163, 0.16);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 241, 184, 0.28);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #f0c03a;
  color: #660000;
  font-weight: 800;
  box-shadow: inset 0 -2px 0 rgba(77, 5, 2, 0.18);
}

.brand-title {
  display: block;
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.brand p {
  margin: 5px 0 0;
  color: #ffd979;
  font-size: 0.86rem;
}

.menu-label {
  display: block;
  margin: 24px 0 8px;
  color: #ffd979;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.mobile-select {
  display: none;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255, 241, 184, 0.36);
  border-radius: 6px;
  background: #660000;
  color: #fff8dc;
}

.specialty-menu {
  display: grid;
  gap: 10px;
}

.about-menu {
  margin: 22px 0 0;
}

.specialty-button {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 11px 13px;
  border: 1px solid rgba(255, 232, 164, 0.15);
  border-radius: 8px;
  background: rgba(255, 244, 202, 0.045);
  color: #fff9e8;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  font-size: 1rem;
}

.specialty-button.active {
  border-color: rgba(255, 232, 164, 0.48);
  background: rgba(255, 244, 202, 0.16);
  color: #ffffff;
  box-shadow: inset 4px 0 0 #f0c03a;
}

@media (hover: hover) {
  .specialty-button:hover {
    border-color: rgba(255, 232, 164, 0.34);
    background: rgba(255, 244, 202, 0.1);
    color: #ffffff;
  }
}

.specialty-button span {
  display: block;
  margin-top: 4px;
  color: #ffd979;
  font-size: 0.78rem;
}

.specialty-button .favorite-label {
  display: inline;
  margin: 0;
  color: #fff9e8;
  font-size: 1rem;
  font-weight: 400;
}

.content {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  padding: clamp(20px, 2.4vw, 34px);
  background:
    linear-gradient(90deg, rgba(123, 11, 5, 0.045), transparent 110px),
    var(--panel);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
  gap: 18px;
  align-items: center;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #660000;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.topbar h1,
.topbar h2 {
  margin: 0;
  color: #660000;
  font-size: clamp(1.55rem, 2.1vw, 2.2rem);
  line-height: 1.1;
}

.search-panel {
  position: relative;
  display: grid;
  gap: 8px;
}

.search-wrap {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid #d5ac52;
  border-radius: 8px;
  background: #fffdf5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.search-icon {
  position: relative;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--muted);
  border-radius: 50%;
}

.search-icon::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: -4px;
  width: 8px;
  height: 2px;
  border-radius: 2px;
  background: var(--muted);
  transform: rotate(45deg);
}

.search-wrap input {
  width: 100%;
  border: 0;
  outline: 0;
  padding: 0 0 0 8px;
  background: transparent;
  color: var(--ink);
}

.search-scope {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.search-scope select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 8px;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: min(560px, 100%);
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf4;
  box-shadow: 0 18px 38px rgba(77, 27, 5, 0.18);
}

.search-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: start;
  padding: 10px 10px 10px 12px;
  border-bottom: 1px solid rgba(102, 0, 0, 0.12);
}

.search-result:last-child {
  border-bottom: 0;
}

.search-result a {
  color: inherit;
  text-decoration: none;
}

.search-result strong,
.search-result span span {
  display: block;
}

.search-result strong {
  color: #660000;
  font-size: 0.94rem;
}

.search-result span span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.search-empty-result,
.empty-state {
  margin: 0;
  padding: 16px;
  border-radius: 8px;
  background: #fff0bd;
  color: #660000;
  font-weight: 700;
}

.notice {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #d0a54b;
  border-radius: 8px;
  background: #fff0bd;
  color: #5b4410;
  line-height: 1.45;
}

.notice.notice-after-grid {
  margin-top: 30px;
  padding: 10px 12px;
  font-size: 0.92rem;
  line-height: 1.4;
}

.notice.notice-after-calculator {
  margin-top: 18px;
  padding: 7px 10px;
  font-size: 0.82rem;
  line-height: 1.35;
}

.notice a {
  color: #660000;
  font-weight: 700;
  text-decoration: underline;
}

.about-page {
  display: grid;
  gap: 18px;
  color: #660000;
}

.about-intro,
.about-section {
  border-left: 4px solid #660000;
  background: #fff0bd;
  padding: 22px 24px;
}

.about-intro {
  background: linear-gradient(135deg, #fff0bd, #fff8dc);
}

.about-kicker {
  margin: 0 0 10px;
  color: #8b1209;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.about-page h3 {
  margin: 0 0 12px;
  color: #660000;
  font-size: clamp(1.12rem, 1.8vw, 1.55rem);
  line-height: 1.2;
}

.about-page p {
  margin: 0;
  color: #660000;
  font-size: 1rem;
  line-height: 1.65;
}

.about-page p + p {
  margin-top: 10px;
}

.about-image {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center center;
  border-radius: 8px;
  border: 0;
  margin: 0 0 22px;
  box-shadow: 0 12px 28px rgba(77, 27, 5, 0.14);
}

.calculator-grid {
  display: grid;
  gap: 0;
  border-top: 1px solid #e1c986;
}

.calculator-card-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.calculator-card-shell {
  position: relative;
  min-height: 238px;
}

.calculator-card {
  position: relative;
  display: block;
  height: 100%;
  min-height: 238px;
  border: 1px solid #d8b35b;
  border-left: 4px solid var(--card-accent, var(--accent));
  border-radius: 8px;
  background: #fffaf0;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(77, 27, 5, 0.08);
  transition: background 160ms ease, transform 160ms ease;
}

.calculator-card:hover {
  background: #fff4cf;
  transform: translateY(-1px);
}

.calculator-card:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 3px;
}

.card-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: start;
  height: 100%;
  padding: 20px 16px 18px 22px;
}

.card-copy h3 {
  margin: 0 0 10px;
  color: #660000;
  font-size: 1.02rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.card-copy h3 sub {
  font-size: 0.68em;
}

.calculator-row {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 92px;
  border: 0;
  border-bottom: 1px solid #e1c986;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  text-decoration: none;
  transition: background 160ms ease;
}

.calculator-row:last-child {
  border-bottom: 0;
}

.calculator-row::before {
  content: "";
  position: absolute;
  inset: 14px auto 14px 0;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: var(--card-accent, var(--accent));
}

.calculator-row:hover {
  background: #fff2c8;
}

.calculator-row:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 3px;
}

.row-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 16px;
  align-items: start;
  padding: 18px 16px 18px 22px;
  min-height: 92px;
}

.row-copy > div {
  grid-column: 1;
}

.row-copy h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.tile-description {
  margin: 8px 0 0;
  color: #6c4a29;
  font-size: 0.92rem;
  line-height: 1.45;
}

.favorite {
  position: absolute;
  top: 16px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #6e5a3a;
  font-size: 1.3rem;
  justify-self: end;
}

.favorite-toggle {
  cursor: pointer;
}

.favorite-toggle:hover,
.favorite-toggle.active {
  color: #b78616;
}

.search-result .favorite {
  position: static;
}

.calculator-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.calculator-title-row .favorite {
  position: static;
  flex: 0 0 38px;
}

.tile-specialty {
  margin: 0 0 5px;
  color: #660000;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.site-footer {
  max-width: 1600px;
  margin: 0 auto 20px;
  border-radius: 14px;
  background: linear-gradient(90deg, var(--burgundy), var(--burgundy-dark));
  color: #6a4826;
}

.site-footer p {
  margin: 0;
  padding: 14px 18px;
  font-weight: 700;
  text-align: center;
}

.site-footer a {
  color: yellow;
  font-weight: 700;
}

.legal-page {
  max-width: 1600px;
  margin: 18px auto 30px;
  padding: 34px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(102, 0, 0, 0.18);
  border-radius: 18px;
  box-shadow: 0 18px 45px rgba(66, 42, 20, 0.12);
  color: #2f2419;
  line-height: 1.65;
}

.legal-page h1 {
  margin: 12px 0 6px;
  color: #660000;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.08;
}

.legal-page h2 {
  margin-top: 30px;
  color: #660000;
  font-size: 1.35rem;
}

.legal-page p,
.legal-page li {
  font-size: 1rem;
}

.legal-page a {
  color: #660000;
  font-weight: 700;
}

.legal-page ul {
  padding-left: 1.35rem;
}

.legal-updated {
  color: #76583b;
}

.legal-alert {
  margin: 24px 0;
  padding: 18px 20px;
  background: #fff6df;
  border-left: 5px solid #660000;
  border-radius: 12px;
}

.back-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 999px;
  background: #660000;
  color: #fff !important;
  text-decoration: none;
}

@media (max-width: 920px) {
  :root {
    --header-height: 116px;
  }

  .page-header {
    margin: 8px 10px 0;
    min-height: var(--header-height);
  }

  .image-banner {
    min-height: 94px;
  }

  .image-banner img {
    max-height: 82px;
  }

  .app-shell {
    margin: 10px;
    display: block;
  }

  .sidebar {
    position: static;
    border-radius: 12px 12px 0 0;
    min-height: 0;
  }

  .brand {
    display: none;
  }

  .mobile-select {
    display: block;
    border-radius: 8px;
  }

  .specialty-menu {
    display: none;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .calculator-grid {
    grid-template-columns: 1fr;
  }

  .calculator-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .legal-page {
    margin: 10px;
    padding: 22px;
    border-radius: 14px;
  }

  .about-image {
    height: 340px;
    object-fit: cover;
    object-position: center 18%;
  }
}

@media (max-width: 620px) {
  .calculator-card-grid {
    grid-template-columns: 1fr;
  }
}
