:root {
  color-scheme: light;
  --app-width: 480px;
  --bg: #ffffff;
  --surface: #fff;
  --surface-muted: #eff1f1;
  --surface-pressed: #e2e3e6;
  --text: #0f1419;
  --text-soft: #333b46;
  --muted: #536471;
  --placeholder: #60666f;
  --faint: #92969c;
  --line: #cfd4d8;
  --line-strong: rgba(6, 21, 41, .24);
  --blue: #006edc;
  --blue-fill: #006edc;
  --blue-pressed: #0058b4;
  --blue-soft: rgba(0, 110, 220, .1);
  --verified: #0f1419;
  --verified-bright: #0f1419;
  --answer: #0f1419;
  --amber: #986400;
  --warning-bg: #fff6dc;
  --danger: #b42318;
  --nav: rgba(255, 255, 255, .96);
  --overlay: rgba(5, 12, 22, .48);
  --shadow: 0 10px 35px rgba(6, 21, 41, .08);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
}

:root[data-theme="day"] {
  color-scheme: light;
}

:root[data-theme="night"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #0a0a0a;
  --surface-muted: #16181c;
  --surface-pressed: #202327;
  --text: #e7e9ea;
  --text-soft: #c8cdd0;
  --muted: #aab0b5;
  --placeholder: #a6adba;
  --faint: #7f8999;
  --line: #2f3336;
  --line-strong: #536471;
  --blue: #4aa5ff;
  --blue-fill: #0870c9;
  --blue-pressed: #005da8;
  --blue-soft: rgba(74, 165, 255, .13);
  --verified: #e7e9ea;
  --verified-bright: #e7e9ea;
  --answer: #e7e9ea;
  --amber: #ffc038;
  --warning-bg: rgba(255, 192, 56, .09);
  --danger: #ff8a80;
  --nav: rgba(0, 0, 0, .96);
  --overlay: rgba(0, 4, 10, .76);
  --shadow: 0 12px 38px rgba(0, 0, 0, .28);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #000000;
    --surface: #0a0a0a;
    --surface-muted: #16181c;
    --surface-pressed: #202327;
    --text: #e7e9ea;
    --text-soft: #c8cdd0;
    --muted: #aab0b5;
    --placeholder: #a6adba;
    --faint: #7f8999;
    --line: #2f3336;
    --line-strong: #536471;
    --blue: #4aa5ff;
    --blue-fill: #0870c9;
    --blue-pressed: #005da8;
    --blue-soft: rgba(74, 165, 255, .13);
    --verified: #e7e9ea;
    --verified-bright: #e7e9ea;
    --answer: #e7e9ea;
    --amber: #ffc038;
    --warning-bg: rgba(255, 192, 56, .09);
    --danger: #ff8a80;
    --nav: rgba(0, 0, 0, .96);
    --overlay: rgba(0, 4, 10, .76);
    --shadow: 0 12px 38px rgba(0, 0, 0, .28);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

:root[data-theme="night"] body {
  background: #000000;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

button:focus-visible,
input:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app-shell {
  position: relative;
  width: min(100%, var(--app-width));
  min-height: 100dvh;
  margin: 0 auto;
  overflow: clip;
  background: var(--bg);
  box-shadow: var(--shadow);
}

.app-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 78px;
  align-items: center;
  min-height: calc(66px + env(safe-area-inset-top));
  padding: calc(8px + env(safe-area-inset-top)) 15px 8px;
  border-bottom: 1px solid transparent;
  background: var(--nav);
  backdrop-filter: saturate(150%) blur(18px);
}

.app-header h1 {
  overflow: hidden;
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 720;
  letter-spacing: -.025em;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button,
.theme-toggle,
.clear-search {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.back-button {
  justify-self: start;
  padding: 0 8px 0 0;
  color: var(--blue);
  font-size: 30px;
  text-align: left;
}

#back-button[hidden] {
  display: block !important;
  visibility: hidden;
  pointer-events: none;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  gap: 7px;
  min-width: 76px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 680;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .07);
}

.theme-toggle .ph {
  color: var(--amber);
  font-size: 21px;
}

:root[data-theme="night"] .theme-toggle .ph {
  color: #9fd4ff;
}

.app-content {
  min-height: calc(100dvh - 66px);
  padding-bottom: calc(90px + env(safe-area-inset-bottom));
}

.search-block {
  padding: 10px 17px 16px;
  border-bottom: 1px solid var(--line);
}

.universal-search,
.takeout-search {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface-muted);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.search-icon {
  justify-self: center;
  color: var(--muted);
  font-size: 25px;
}

.universal-search input,
.takeout-search input {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 17px;
  letter-spacing: -.012em;
}

.universal-search input::placeholder,
.takeout-search input::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

input[type="search"]::-webkit-search-cancel-button {
  display: none;
  appearance: none;
}

.clear-search {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 22px;
}

.example-searches {
  display: flex;
  gap: 8px;
  margin-top: 11px;
  overflow-x: auto;
  padding-bottom: 1px;
  scrollbar-width: none;
}

.example-searches::-webkit-scrollbar,
#category-list::-webkit-scrollbar,
.takeout-tabs::-webkit-scrollbar {
  display: none;
}

.example-searches button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 13px;
  font-weight: 620;
}

.example-searches button:active,
.category-button:active,
.fact-card:active,
.topic-card:active,
.alternative-row:active {
  background: var(--surface-pressed);
}

.has-query .example-searches {
  display: none;
}

.recent-searches {
  margin-top: 14px;
}

.recent-searches[hidden],
.has-query .recent-searches {
  display: none;
}

.recent-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.recent-heading button {
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--blue);
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.recent-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  overflow: hidden;
}

.recent-list button {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  text-align: left;
}

.recent-list button:first-child {
  border-top: 0;
}

.recent-list button:active {
  background: var(--surface-pressed);
}

.recent-list .ph {
  font-size: 18px;
  color: var(--muted);
}

.recent-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.database-workspace {
  display: block;
}

.database-sidebar {
  padding: 22px 17px 12px;
}

.has-query .database-sidebar {
  display: none;
}

.sidebar-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}

.sidebar-heading span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-heading strong {
  display: block;
  font-size: 24px;
  letter-spacing: -.035em;
}

.sidebar-heading button {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
}

#category-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}

.category-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 49px;
  padding: 0 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: 15px;
}

.category-button:last-child {
  border-bottom: 0;
}

.category-button span:last-child {
  min-width: 30px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 680;
  text-align: center;
}

.category-button.active {
  color: var(--blue);
  font-weight: 680;
}

.trust-note {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 14px 2px 0;
  color: var(--muted);
}

.trust-note > .ph {
  margin-top: 1px;
  color: var(--verified);
  font-size: 20px;
}

.trust-note strong,
.trust-note small {
  display: block;
}

.trust-note strong {
  color: var(--text-soft);
  font-size: 12px;
}

.trust-note small {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.4;
}

.results-panel {
  min-width: 0;
  padding: 18px 17px 36px;
}

.has-focused-result .results-panel {
  padding: 0 0 32px;
}

.results-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.has-focused-result .results-header {
  display: none;
}

.results-header p {
  margin: 0 0 5px;
  color: var(--amber);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.results-header h2 {
  margin: 0;
  font-size: 23px;
  letter-spacing: -.03em;
}

#results-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.active-filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  margin: 13px 0 0;
  padding: 0 4px 0 13px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 13px;
  font-weight: 660;
}

.active-filter button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 19px;
}

.focused-heading {
  padding: 14px 18px 9px;
}

.focused-heading p {
  margin: 0 0 8px;
  color: var(--amber);
  font-size: 13px;
  font-weight: 720;
  letter-spacing: .015em;
  text-transform: uppercase;
}

.focused-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -.025em;
}

.focused-heading h2 span {
  color: var(--text-soft);
}

.pressure-control {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  min-height: 44px;
  margin: 11px 17px 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface-muted);
}

.pressure-control button {
  min-width: 0;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  font-weight: 560;
}

.pressure-control button[aria-pressed="true"] {
  background: var(--blue-fill);
  color: #fff;
  font-weight: 670;
  box-shadow: 0 5px 16px rgba(0, 110, 220, .25);
}

.verified-answer {
  display: grid;
  min-height: 248px;
  place-content: center;
  padding: 26px 16px 28px;
  text-align: center;
}

.answer-label {
  color: var(--verified);
  font-size: 16px;
  font-weight: 690;
}

.answer-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  margin-top: 17px;
  color: var(--answer);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.07em;
  white-space: nowrap;
}

.answer-value strong {
  font-size: clamp(76px, 26vw, 104px);
  font-weight: 650;
  line-height: .88;
}

.answer-value span {
  margin-left: 9px;
  font-size: 37px;
  font-weight: 620;
  letter-spacing: -.035em;
}

.verification-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 27px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 590;
}

.verification-line .ph {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  background: var(--verified-bright);
  color: #173000;
  font-size: 19px;
}

:root[data-theme="night"] .verification-line {
  color: var(--verified);
}

:root[data-theme="night"] .verification-line .ph {
  background: transparent;
  color: var(--verified);
  font-size: 26px;
}

.measurement-note {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.alternative-values {
  border-top: 1px solid var(--line);
}

.alternative-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 64px;
  padding: 0 17px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: 19px;
}

.alternative-row strong {
  font-size: 20px;
  font-weight: 510;
  text-align: right;
}

.alternative-row .ph {
  color: var(--faint);
  font-size: 22px;
  text-align: right;
}

.direct-answer,
.result-section {
  margin-top: 18px;
}

.has-focused-result .result-section {
  margin: 24px 17px 0;
}

.result-section-label {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 690;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.fact-grid,
.topic-grid {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}

.fact-card,
.topic-card {
  min-width: 0;
  padding: 15px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.fact-card:last-child,
.topic-card:last-child {
  border-bottom: 0;
}

.direct-answer .result-section-label {
  margin-bottom: 9px;
}

.direct-answer .fact-card {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}

.search-notice {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}

.search-notice + .search-notice {
  margin-top: 8px;
}

.search-notice .ph {
  font-size: 20px;
  color: var(--blue);
}

.search-notice p {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
}

.fact-meta,
.topic-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 660;
}

.fact-card h3,
.topic-card h3 {
  margin: 9px 0 5px;
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: -.018em;
}

.fact-value {
  margin: 0;
  color: var(--answer);
  font-size: 25px;
  font-weight: 690;
  letter-spacing: -.03em;
}

.fact-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.fact-trust,
.topic-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 12px;
}

.topic-card-footer button {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-weight: 660;
}

.topic-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.48;
}

.topic-card mark {
  border-radius: 3px;
  background: var(--blue-soft);
  color: var(--text);
}

.status-badge {
  color: var(--muted);
}

.status-badge.verified {
  color: var(--verified);
}

.status-badge.calculated {
  color: var(--blue);
}

.empty-state,
.takeout-empty {
  padding: 64px 24px;
  text-align: center;
}

.empty-state > .ph,
.takeout-empty > .ph {
  color: var(--blue);
  font-size: 36px;
}

.empty-state h3,
.takeout-empty h2 {
  margin: 13px 0 6px;
  font-size: 19px;
}

.empty-state p,
.takeout-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.loading-card {
  min-height: 118px;
  border-radius: 14px;
  background: var(--surface-muted);
  opacity: .72;
  animation: loading 1s ease-in-out infinite alternate;
}

@keyframes loading {
  to { opacity: .38; }
}

.database-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 17px 0;
  padding: 14px 2px 26px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.lock-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 6px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.bottom-nav {
  position: fixed;
  z-index: 40;
  bottom: 0;
  left: 50%;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: min(100%, var(--app-width));
  min-height: calc(72px + env(safe-area-inset-bottom));
  padding: 5px 5px env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: var(--nav);
  backdrop-filter: saturate(160%) blur(20px);
  transform: translateX(-50%);
}

.bottom-nav-item {
  display: flex;
  min-width: 0;
  min-height: 62px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  text-decoration: none;
}

.bottom-nav-item .ph {
  font-size: 25px;
}

/* Original pipe cross-section icon; no extra font or remote asset needed. */
.bottom-nav-item .ph-circle { position: relative; width: 25px; height: 25px; border: 1.7px solid currentColor; border-radius: 50%; }
.bottom-nav-item .ph-circle::after { content: ""; position: absolute; inset: 4px; border: 1.5px solid currentColor; border-radius: 50%; }

.bottom-nav-item.active,
.bottom-nav-item[aria-current="page"] {
  color: var(--blue);
}

.bottom-nav-item:disabled {
  cursor: default;
  opacity: .48;
}

dialog {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--overlay);
  color: var(--text);
}

dialog::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(8px);
}

.dialog-shell {
  position: relative;
  width: min(100%, var(--app-width));
  min-height: 100dvh;
  max-height: 100dvh;
  margin: 0 auto;
  overflow: auto;
  padding: calc(20px + env(safe-area-inset-top)) 18px calc(34px + env(safe-area-inset-bottom));
  background: var(--bg);
}

.dialog-close {
  position: sticky;
  z-index: 3;
  top: 0;
  display: grid;
  width: 44px;
  height: 44px;
  margin-left: auto;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--muted);
  cursor: pointer;
  font-size: 23px;
}

.eyebrow,
.record-body h3 {
  margin: 14px 0 8px;
  color: var(--amber);
  font-size: 11px;
  font-weight: 720;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.record-hero {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.record-hero h2,
.calculator-shell h2 {
  margin: 9px 0 10px;
  font-size: 32px;
  line-height: 1.02;
  letter-spacing: -.045em;
}

.record-summary,
.dialog-intro {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.record-facts {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.record-fact {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.record-fact:last-child {
  border-bottom: 0;
}

.record-fact span {
  color: var(--muted);
  font-size: 12px;
}

.record-fact small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 560;
  line-height: 1.4;
}

.record-fact strong {
  color: var(--answer);
  font-size: 16px;
}

.record-warning {
  margin-top: 18px;
  padding: 14px;
  border-radius: 12px;
  background: var(--warning-bg);
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.record-body {
  margin-top: 20px;
}

.record-body p {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.55;
}

.calculator-form {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.calculator-form > label {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 14px;
}

.calculator-form > label > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.calculator-form input {
  width: 84px;
  height: 42px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 16px;
  font-weight: 650;
  text-align: right;
}

.calculator-form > button {
  min-height: 50px;
  margin-top: 4px;
  border: 0;
  border-radius: 13px;
  background: var(--blue-fill);
  color: #fff;
  cursor: pointer;
  font-weight: 680;
}

.calculator-form > button:active {
  background: var(--blue-pressed);
}

.calculator-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--line);
}

.calculator-results div {
  min-width: 0;
  padding: 13px;
  background: var(--surface);
}

.calculator-results span,
.calculator-results strong {
  display: block;
}

.calculator-results span {
  color: var(--muted);
  font-size: 11px;
}

.calculator-results strong {
  margin-top: 5px;
  color: var(--answer);
  font-size: 19px;
}

/* Takeout table screen */
.takeout-content {
  padding-bottom: calc(94px + env(safe-area-inset-bottom));
}

.takeout-intro {
  padding: 15px 17px 9px;
}

.takeout-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.takeout-controls {
  padding: 8px 17px 15px;
  border-bottom: 1px solid var(--line);
}

.takeout-search {
  grid-template-columns: 44px minmax(0, 1fr);
}

.takeout-tabs {
  display: flex;
  gap: 7px;
  margin-top: 11px;
  overflow-x: auto;
  scrollbar-width: none;
}

.takeout-tab {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 13px;
  font-weight: 620;
}

.takeout-tab.active {
  border-color: var(--blue);
  background: var(--blue-fill);
  color: #fff;
}

.takeout-safety {
  margin: 14px 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--warning-bg);
}

.takeout-safety summary {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  color: var(--amber);
  cursor: pointer;
  font-size: 13px;
  font-weight: 680;
  list-style: none;
}

.takeout-safety summary::-webkit-details-marker {
  display: none;
}

.takeout-safety p {
  margin: 0;
  padding: 0 13px 13px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
}

.takeout-results-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 17px 0;
  color: var(--muted);
  font-size: 12px;
}

.takeout-results-heading span {
  font-weight: 680;
}

#takeout-sections {
  padding: 0 17px 28px;
}

.takeout-family {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}

.takeout-family-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 15px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.takeout-family-header p {
  margin: 0 0 4px;
  color: var(--amber);
  font-size: 10px;
  font-weight: 680;
  line-height: 1.3;
  text-transform: uppercase;
}

.takeout-family-header h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -.025em;
}

.takeout-family-header > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}

.takeout-table {
  width: 100%;
  border-collapse: collapse;
}

.takeout-table thead {
  display: none;
}

.takeout-table,
.takeout-table tbody,
.takeout-table tr,
.takeout-table td {
  display: block;
  width: 100%;
}

.takeout-table tr {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 5px 13px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.takeout-table tr:last-child {
  border-bottom: 0;
}

.takeout-table td {
  width: auto;
  min-width: 0;
  padding: 0;
  border: 0;
}

.takeout-table td:nth-child(2) {
  text-align: right;
}

.takeout-table td:nth-child(3) {
  grid-column: 1 / -1;
}

.takeout-table td::before {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  content: attr(data-label);
  font-size: 9px;
  font-weight: 650;
  text-transform: uppercase;
}

.takeout-size {
  color: var(--text);
  font-size: 18px;
  font-weight: 660;
}

.takeout-value {
  display: block;
  color: var(--answer);
  font-size: 16px;
  font-weight: 680;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.takeout-record-meta {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  font-size: 12px;
}

.takeout-record-meta::before {
  grid-column: 1 / -1;
}

.takeout-status {
  color: var(--verified);
  font-weight: 680;
}

.takeout-material {
  color: var(--muted);
  text-align: right;
}

.takeout-availability {
  background: var(--warning-bg);
}

.takeout-availability .takeout-value {
  color: var(--amber);
}

.takeout-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 17px;
  padding: 15px 2px 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 360px) {
  .app-header {
    grid-template-columns: 66px minmax(0, 1fr) 72px;
    padding-inline: 11px;
  }

  .app-header h1 {
    font-size: 16px;
  }

  .theme-toggle {
    min-width: 70px;
    padding-inline: 9px;
    font-size: 13px;
  }

  .search-block,
  .database-sidebar,
  .results-panel,
  .takeout-controls,
  #takeout-sections {
    padding-inline: 13px;
  }

  .pressure-control {
    margin-inline: 13px;
  }

  .answer-value strong {
    font-size: clamp(76px, 26vw, 94px);
  }

  .answer-value span {
    font-size: 34px;
  }
}

@media (min-width: 481px) {
  .app-shell,
  .bottom-nav,
  .dialog-shell {
    border-right: 1px solid var(--line);
    border-left: 1px solid var(--line);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Iso Pad uses an original line icon alongside the field tools. */
.nav-drawing-icon { width:25px; height:25px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
