@font-face {
  font-family: "Space Grotesk";
  src: url("../assets/space-grotesk.woff2") format("woff2");
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --surface: #f3f0e8;
  --surface-raised: #faf8f2;
  --surface-sunken: #eae7df;
  --text: #252923;
  --muted: #66695f;
  --line: #d9d8ce;
  --accent: #ff9b60;
  --accent-soft: #f6e1d0;
  --accent-ink: #8c421e;
  --result-bg: #262b25;
  --result-text: #f6f3e9;
  --result-muted: #bcc2b2;
  --success-bg: #dce8bf;
  --success-ink: #324323;
  --danger: #a13b2c;
  --line-strong: #878a7e;
  --lowest-dot: #4f7d2c;
  --shadow: 0 16px 48px #20251b14;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --dock-height: 125px;
  --visual-height: 100dvh;
  --visual-top: 0px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --surface: #1c201b;
  --surface-raised: #252b23;
  --surface-sunken: #30362d;
  --text: #f0f0e5;
  --muted: #b6bcad;
  --line: #3c4437;
  --accent-soft: #443326;
  --accent-ink: #ffb580;
  --result-bg: #30382c;
  --shadow: 0 16px 48px #00000029;
  --danger: #ffaaa0;
  --line-strong: #737b6a;
  --lowest-dot: #a9cf7f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { margin: 0; padding: 0; background: var(--surface); scroll-padding-block: 16px calc(var(--dock-height) + 20px); }
body { margin: 0; min-width: 280px; min-height: 100vh; min-height: 100dvh; font: 400 16px/1.5 "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--surface); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
h1, h2, p, dl, dd { margin: 0; }
button, input, textarea { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .35; }
a { color: inherit; text-decoration: none; }
svg { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
h1:focus, .sheet h2:focus { outline: none; }
::selection { background: var(--accent); color: #252923; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell { max-width: 560px; margin: 0 auto; padding: 0 max(18px, env(safe-area-inset-left)) calc(var(--dock-height) + 28px) max(18px, env(safe-area-inset-right)); }
.topbar { min-height: calc(56px + env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px); display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; min-height: 48px; gap: 10px; font-size: .79rem; font-weight: 700; letter-spacing: .055em; white-space: nowrap; }
.brand-divider { margin: 0 4px; color: var(--muted); font-weight: 400; }
.brand-mark { display: grid; grid-template-columns: repeat(3, 5px); gap: 2px; flex-shrink: 0; }
.brand-mark i { width: 5px; height: 5px; background: var(--text); }
.brand-mark i:nth-child(3), .brand-mark i:nth-child(6) { opacity: .28; }
.brand-mark i:nth-child(5) { background: var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.edition { color: var(--muted); font: 500 .6875rem/1.4 ui-monospace, "SFMono-Regular", Consolas, monospace; letter-spacing: .12em; }
.icon-button { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; }
.icon-button svg { width: 20px; height: 20px; }
.icon-button:active { background: var(--surface-sunken); }

.view { padding-top: 20px; }
.view-heading { margin-bottom: 22px; }
.eyebrow, .field-label, .section-heading h2, .result-heading { font: 600 .6875rem/1.4 ui-monospace, "SFMono-Regular", Consolas, monospace; letter-spacing: .1em; }
.eyebrow { color: var(--muted); margin-bottom: 6px; }
h1 { font-size: 2.15rem; line-height: 1.1; letter-spacing: -.055em; font-weight: 600; text-wrap: balance; }
.accent-dot { color: var(--accent-ink); }
.view-heading > p:last-child { margin-top: 10px; color: var(--muted); font-size: .94rem; }
.compact-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.compact-heading .eyebrow { order: 2; margin: 0; white-space: nowrap; }
.compact-heading h1 { font-size: 1.625rem; letter-spacing: -.045em; }
#view-raid { padding-top: 14px; }
.planner { background: var(--surface-raised); border: 1px solid var(--line); border-radius: 16px; }
.target-select { width: 100%; min-height: 72px; display: flex; align-items: center; gap: 12px; padding: 10px 14px; text-align: left; border: 0; border-radius: 16px 16px 0 0; background: transparent; }
.target-select:active { background: var(--surface-sunken); }
.target-icon { flex: 0 0 34px; height: 40px; display: grid; place-items: center; color: var(--accent-ink); }
.target-icon svg { width: 29px; height: 29px; stroke-width: 1.5; }
.target-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.field-label { color: var(--muted); }
.target-copy strong { font-size: 1.04rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.target-arrow { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-sunken); color: var(--muted); }
.target-arrow svg { width: 16px; height: 16px; }
.quantity-row { min-height: 62px; margin: 0 14px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.quantity-row p { font-size: .75rem; color: var(--muted); margin-top: 1px; }
.stepper { display: flex; align-items: center; gap: 2px; }
.stepper button { width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 10px; background: var(--surface-sunken); }
.stepper button:active:not(:disabled) { background: var(--accent-soft); }
.stepper button svg { width: 17px; height: 17px; }
.stepper .quantity-value { min-width: 52px; width: auto; padding: 0 4px; background: transparent; gap: 4px; font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stepper .quantity-value svg { width: 11px; height: 11px; color: var(--muted); }

.method-section { margin: 6px 0 14px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; min-height: 42px; }
.section-heading h2 { color: var(--muted); }
.text-button { min-height: 44px; min-width: 44px; padding: 0 0 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: transparent; font-size: .8125rem; font-weight: 500; }
.text-button svg { width: 14px; height: 14px; }
.methods { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.methods button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; padding: 7px 2px; background: var(--surface-raised); border: 1px solid var(--line); border-radius: 11px; }
.methods strong { font-size: .75rem; font-weight: 600; white-space: nowrap; }
.methods [data-method-cost] { display: inline-flex; align-items: center; gap: 3px; font-size: .6875rem; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.methods button[data-lowest] [data-method-cost]::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--lowest-dot); }
.methods button[aria-checked="true"] { background: var(--accent); color: #29281f; border-color: var(--accent); box-shadow: inset 0 0 0 1px #29281f0c; }
.methods button[aria-checked="true"] [data-method-cost] { color: #5f3b21; }
.methods button[aria-checked="true"][data-lowest] [data-method-cost]::before { background: #29281f; }
.methods button:active { transform: translateY(1px); }

.result { color: var(--result-text); background: var(--result-bg); border-radius: 18px; padding: 16px 18px 0; overflow: hidden; }
.result-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; min-height: 22px; color: var(--result-muted); }
.best-badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 5px; padding: 3px 7px; background: var(--success-bg); color: var(--success-ink); font-size: .6875rem; letter-spacing: .04em; white-space: nowrap; }
.best-badge[data-state="over"] { background: #f6e1d0; color: #8c421e; }
.best-badge svg { width: 11px; height: 11px; stroke-width: 2.5; }
.sulfur-total { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 5px; min-height: 59px; }
.sulfur-total strong { min-width: 0; font-size: min(3.25rem, 12vw); line-height: 1.1; font-weight: 500; letter-spacing: -.055em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sulfur-total svg { width: 33px; height: 33px; color: var(--accent); stroke-width: 1.2; }
.result-context { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; min-height: 22px; font-size: .8rem; }
.result-context p { min-width: 0; overflow-wrap: anywhere; }
.result-context strong { font-weight: 500; font-variant-numeric: tabular-nums; }
#result-method { flex-shrink: 0; color: var(--result-muted); text-align: right; font-size: .75rem; }
.craft-details { border-top: 1px solid #f6f3e925; margin-top: 12px; }
.craft-details summary, .info-details summary { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; }
.craft-details summary { min-height: 48px; color: #dfe2d5; font-size: .8125rem; }
.craft-details summary::-webkit-details-marker, .info-details summary::-webkit-details-marker { display: none; }
.craft-details summary svg, .info-details summary svg { width: 15px; height: 15px; transform: rotate(90deg); transition: transform 150ms ease; }
.craft-details[open] summary svg, .info-details[open] summary svg { transform: rotate(-90deg); }
.craft-content { padding-bottom: 16px; }
.craft-note { color: var(--result-muted); font-size: .75rem; line-height: 1.5; margin: 1px 0 11px; }
.craft-details dl > div { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 5px 0; font-size: .82rem; }
.craft-details dt { color: var(--result-muted); }
.craft-details dd { font-variant-numeric: tabular-nums; text-align: right; }
.copy-button { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; padding: 8px 14px; width: 100%; min-height: 44px; border: 1px solid #f6f3e933; border-radius: 10px; background: #f6f3e908; color: var(--result-text); font-size: .8rem; }
.copy-button svg { width: 17px; height: 17px; }
.calculation-footnote { padding: 10px 2px 0; font-size: .6875rem; color: var(--muted); }

.bottom-dock { position: fixed; z-index: 10; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px; padding: 0 max(18px, env(safe-area-inset-left)) max(3px, var(--safe-bottom)) max(18px, env(safe-area-inset-right)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -10px 24px #20251b04; }
.dock-action { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 65px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dock-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.dock-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .75rem; color: var(--muted); }
.dock-copy strong { font-size: .875rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.primary-button, .secondary-button { width: 100%; min-height: 50px; border-radius: 12px; padding: 12px 16px; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: .875rem; border: 1px solid transparent; text-align: center; }
.primary-button { background: var(--accent); color: #27271f; }
.secondary-button { background: var(--surface-raised); border-color: var(--line); color: var(--text); }
.primary-button svg, .secondary-button svg { width: 18px; height: 18px; }
.primary-button:active, .secondary-button:active { filter: brightness(.96); }
.dock-action .primary-button { width: auto; min-width: 150px; min-height: 48px; transition: background-color 160ms ease, border-color 160ms ease; }
.dock-action .primary-button.is-saved { background: var(--surface-sunken); border-color: var(--line); color: var(--text); }
.dock-action .primary-button.is-saved svg { color: var(--accent-ink); }
.bottom-nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 3px 0; }
.bottom-nav a { position: relative; min-height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 10px; color: var(--muted); font-size: .6875rem; font-weight: 500; }
.bottom-nav a svg { width: 19px; height: 19px; }
.bottom-nav a[aria-current="page"] { color: var(--accent-ink); }
.bottom-nav a:active { background: var(--accent-soft); }
.nav-icon { position: relative; }
.nav-icon b { position: absolute; top: -5px; right: -12px; min-width: 15px; height: 15px; padding: 0 3px; background: var(--accent); color: #27271f; border-radius: 10px; font: 600 .625rem/15px "Space Grotesk", sans-serif; text-align: center; font-variant-numeric: tabular-nums; }

.empty-state { text-align: center; padding: 30px 14px; border: 1px dashed var(--line); border-radius: 18px; }
.empty-glyph { width: 48px; height: 48px; color: var(--accent-ink); margin: 2px auto 18px; stroke-width: 1.2; }
.empty-state h2 { font-size: 1.25rem; letter-spacing: -.035em; }
.empty-state p { max-width: 270px; color: var(--muted); font-size: .875rem; margin: 8px auto 22px; }
.saved-items { display: grid; gap: 12px; }
.saved-item { border: 1px solid var(--line); background: var(--surface-raised); border-radius: 16px; overflow: hidden; scroll-margin-block: 16px calc(var(--dock-height) + 16px); }
.saved-item[data-current] { border-color: var(--accent-ink); }
.saved-item[data-current] .saved-item-date { color: var(--accent-ink); }
.saved-item.flash { animation: flash 900ms ease-out; }
.saved-item-main { padding: 16px; }
.saved-item-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.saved-item h2 { min-width: 0; font-size: 1.06rem; line-height: 1.3; font-weight: 600; letter-spacing: -.03em; overflow-wrap: anywhere; }
.saved-item-date { flex-shrink: 0; color: var(--muted); font-size: .6875rem; }
.saved-item-target { margin-top: 6px; color: var(--muted); font-size: .75rem; overflow-wrap: anywhere; }
.saved-item-cost { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 8px; margin-top: 14px; }
.saved-item-cost strong { font-size: 1.65rem; line-height: 1.1; font-weight: 500; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.saved-item-cost span { font-size: .75rem; color: var(--muted); }
.saved-item-actions { display: grid; grid-template-columns: 1fr 48px 48px; border-top: 1px solid var(--line); }
.saved-item-actions button { min-height: 48px; padding: 0; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-left: 1px solid var(--line); background: transparent; font-size: .8rem; font-weight: 500; }
.saved-item-actions button:first-child { justify-content: flex-start; padding-left: 16px; border-left: 0; }
.saved-item-actions button:active { background: var(--surface-sunken); }
.saved-item-actions svg { width: 17px; height: 17px; }

.guide-steps { padding: 0; list-style: none; border-top: 1px solid var(--line); margin: 0 0 20px; }
.guide-steps li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.guide-steps li > span { color: var(--accent-ink); font: 500 .6875rem/1.7 ui-monospace, monospace; }
.guide-steps h2 { font-size: 1rem; font-weight: 600; letter-spacing: -.025em; }
.guide-steps p { color: var(--muted); font-size: .85rem; margin-top: 5px; line-height: 1.65; }
.sample-card { width: 100%; display: flex; align-items: center; gap: 12px; padding: 16px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-raised); text-align: left; }
.sample-icon { color: var(--accent-ink); }
.sample-icon svg { width: 28px; height: 28px; }
.sample-card > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sample-card strong { font-size: .94rem; font-weight: 600; }
.sample-card > span > span:last-child { color: var(--muted); font-size: .75rem; }
.sample-card .chevron { width: 18px; height: 18px; }
.guide-faq { margin-top: 24px; }
.info-details { border-bottom: 1px solid var(--line); }
.info-details summary { min-height: 58px; font-size: .875rem; font-weight: 500; }
.info-details p { padding: 0 0 18px; color: var(--muted); font-size: .82rem; line-height: 1.7; }
.guide-signoff { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 34px 12px 10px; color: var(--muted); }
.guide-signoff p { font-size: .875rem; }
.guide-signoff > span:last-child { font-size: .6875rem; letter-spacing: .16em; }
.storage-warning { margin: 16px 0 0; padding: 12px; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 10px; color: var(--text); font-size: .8rem; }

.sheet { position: fixed; inset: auto 0; top: var(--visual-top, 0px); height: var(--visual-height, 100dvh); width: 100%; max-width: none; max-height: none; margin: 0; padding: 12px max(10px, env(safe-area-inset-right)) max(10px, var(--safe-bottom)) max(10px, env(safe-area-inset-left)); border: 0; background: transparent; color: var(--text); overflow: hidden; }
.sheet[open] { display: flex; align-items: flex-end; justify-content: center; }
.sheet::backdrop { background: rgb(19 25 15 / var(--backdrop-alpha, .8)); }
.sheet-panel { width: 100%; max-width: 520px; max-height: 100%; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 24px 24px 18px 18px; box-shadow: var(--shadow); overflow: hidden; animation: sheet-in 160ms ease-out; }
.sheet-header { flex: 0 0 auto; padding: 0 18px 12px; touch-action: none; cursor: grab; }
.sheet-handle { display: flex; align-items: center; justify-content: center; height: 22px; margin: 0 -18px 2px; }
.sheet-handle::before { content: ""; display: block; width: 36px; height: 5px; background: var(--line-strong); opacity: .55; border-radius: 3px; }
.sheet-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sheet-heading h2 { font-size: 1.35rem; line-height: 1.2; font-weight: 600; letter-spacing: -.045em; }
.sheet-heading .eyebrow { margin-bottom: 5px; }
.sheet-heading .icon-button { margin-right: -8px; align-self: center; background: var(--surface-sunken); width: 36px; height: 44px; flex-basis: 44px; }
.sheet-description { color: var(--muted); font-size: .8125rem; line-height: 1.5; margin-top: 10px; }
.sheet-body { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 18px 10px; -webkit-overflow-scrolling: touch; }
.sheet-panel > form { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.sheet-footer { flex: 0 0 auto; padding: 10px 18px 18px; background: var(--surface); }
.sheet-note { margin: 12px 0 3px; color: var(--muted); font-size: .75rem; text-align: center; }
:root[data-compact-sheet] .sheet { padding-top: 6px; padding-bottom: 6px; }
:root[data-compact-sheet] .sheet-header { padding-bottom: 6px; }
:root[data-compact-sheet] .sheet-handle { height: 12px; margin-bottom: 0; }
:root[data-compact-sheet] .sheet-heading .eyebrow,
:root[data-compact-sheet] .sheet-description,
:root[data-compact-sheet] .input-hint { display: none; }
:root[data-compact-sheet] .sheet-heading h2 { font-size: 1.125rem; }
:root[data-compact-sheet] .sheet-footer { padding-top: 6px; padding-bottom: 10px; }
.target-group + .target-group { margin-top: 14px; }
.target-group-title { position: sticky; top: 0; z-index: 1; padding: 6px 3px; background: var(--surface); color: var(--muted); font: 600 .6875rem/1.4 ui-monospace, "SFMono-Regular", Consolas, monospace; letter-spacing: .1em; border-bottom: 1px solid var(--line); }
.target-option { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 9px 3px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.target-option > svg:first-child { width: 24px; height: 24px; color: var(--muted); }
.target-option-copy { min-width: 0; flex: 1; }
.target-option-copy strong { display: block; font-size: .9375rem; font-weight: 500; }
.target-option-copy > span { display: block; color: var(--muted); font-size: .75rem; margin-top: 2px; }
.target-option-price { display: flex; flex-direction: column; flex-shrink: 0; align-items: flex-end; gap: 2px; }
.target-option-price strong { font-size: .9375rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.target-option-price small, .target-option-price span { color: var(--muted); font-size: .6875rem; }
.target-option .selected-check, .compare-option .selected-check { width: 18px; height: 18px; flex: 0 0 18px; color: var(--accent-ink); }
.target-option[aria-pressed="true"] { color: var(--accent-ink); }
.target-option[aria-pressed="true"] .target-option-copy strong { font-weight: 600; }
.target-option:active { background: var(--surface-sunken); }
.input-label { display: block; margin: 16px 0 8px; font-size: .8125rem; font-weight: 500; color: var(--muted); }
.sheet input, .sheet textarea { width: 100%; min-height: 52px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface-raised); color: var(--text); font-size: max(16px, 1rem); line-height: 1.4; scroll-margin-block: 12px; }
.sheet input:focus, .sheet textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.sheet textarea { resize: vertical; min-height: 100px; max-height: 34vh; }
.input-hint { margin: 9px 0 1px; color: var(--muted); font-size: .75rem; }
.input-error { margin: 7px 0 0; color: var(--danger); font-size: .8125rem; }
.sheet .quantity-input { font-size: 2rem; line-height: 1.25; text-align: center; font-variant-numeric: tabular-nums; padding: 9px; }
.quantity-presets { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-top: 4px; }
.quantity-presets button { min-height: 48px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-raised); font-size: 1.0625rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.quantity-presets button[aria-pressed="true"] { border-color: var(--accent-ink); color: var(--accent-ink); font-weight: 600; }
.quantity-presets button:active { background: var(--accent-soft); }
.compare-list { display: grid; gap: 8px; }
.compare-option { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 68px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-raised); text-align: left; }
.compare-option[aria-pressed="true"] { border-color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--accent-ink); }
.compare-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; flex: 1; }
.compare-copy strong { font-size: .875rem; font-weight: 600; }
.compare-copy > span { font-size: .75rem; color: var(--muted); overflow-wrap: anywhere; }
.compare-price { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.compare-price strong { font-size: 1.125rem; font-weight: 500; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.compare-price > span, .compare-price small { color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.compare-badge { display: inline-block; background: var(--success-bg); color: var(--success-ink) !important; padding: 2px 6px; border-radius: 4px; font-size: .6875rem !important; font-weight: 600; white-space: nowrap; }

.toast { position: fixed; z-index: 20; left: 50%; bottom: calc(var(--dock-height) + 12px); transform: translateX(-50%); display: flex; align-items: center; justify-content: space-between; gap: 12px; width: calc(100% - 36px); max-width: 440px; min-height: 52px; padding: 10px 14px; border: 1px solid #f6f3e922; border-radius: 12px; background: #272d24; color: #f6f3e9; box-shadow: var(--shadow); font-size: .8125rem; animation: toast-in 160ms ease-out; }
.toast button { flex-shrink: 0; min-width: 64px; min-height: 44px; padding: 4px 10px; margin: -6px -8px -6px 0; border: 0; background: transparent; color: var(--accent); font-weight: 600; font-size: .8125rem; }

@keyframes sheet-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bump { from { opacity: .35; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.sulfur-total strong.bump { animation: bump 200ms ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (hover: hover) {
  .icon-button:hover, .target-select:hover, .target-option:hover, .saved-item-actions button:hover { background: var(--surface-sunken); }
  .methods button:hover:not([aria-checked="true"]), .compare-option:hover, .quantity-presets button:hover { border-color: var(--muted); }
  .primary-button:hover { filter: brightness(1.04); }
  .text-button:hover { color: var(--accent-ink); }
}
@media (max-height: 720px) and (max-width: 599px), (max-height: 450px) {
  .topbar { min-height: calc(48px + env(safe-area-inset-top, 0px)); }
  .view { padding-top: 12px; }
  .compact-heading { margin-bottom: 10px; }
  #view-raid { padding-top: 10px; }
  .target-select { min-height: 64px; }
  .quantity-row { min-height: 56px; }
  .method-section { margin-top: 2px; margin-bottom: 12px; }
  .methods button { min-height: 52px; }
  .result { padding-top: 13px; }
  .sulfur-total { min-height: 52px; }
}
@media (max-width: 350px) {
  .app-shell { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .edition { display: none; }
  .compact-heading .eyebrow, .quantity-row p { display: none; }
  .target-select { padding-left: 10px; padding-right: 10px; gap: 8px; }
  .quantity-row { margin-left: 10px; margin-right: 10px; }
  .methods { gap: 4px; }
  .methods strong { font-size: .69rem; }
  .bottom-dock { padding-left: 14px; padding-right: 14px; }
  .dock-action .primary-button { min-width: 132px; padding-left: 12px; padding-right: 12px; }
  .sheet-header, .sheet-body { padding-left: 14px; padding-right: 14px; }
  .sheet-heading h2 { font-size: 1.2rem; }
  .target-option { gap: 7px; }
  .target-option-copy strong { font-size: .8125rem; }
  .target-option-price strong { font-size: .8125rem; }
}
@media (min-width: 600px) and (min-height: 451px) {
  .app-shell { padding-left: 28px; padding-right: 28px; }
  .topbar { min-height: 72px; }
  .brand { font-size: .875rem; }
  .edition { font-size: .75rem; }
  .view { padding-top: 28px; }
  .compact-heading { margin-bottom: 22px; }
  .compact-heading h1 { font-size: 2.1rem; }
  #view-raid { padding-top: 24px; }
  .target-select { min-height: 80px; }
  .quantity-row { min-height: 68px; }
  .methods button { min-height: 62px; }
  .methods strong { font-size: .875rem; }
  .methods span { font-size: .75rem; }
  .result { padding: 22px 24px 0; }
  .sulfur-total { min-height: 76px; }
  .result-context { font-size: .94rem; }
  #result-method { font-size: .75rem; }
  .bottom-dock { padding-left: 28px; padding-right: 28px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
@media (max-height: 450px) {
  .sheet { padding-top: 6px; padding-bottom: 6px; }
  .sheet-handle { height: 14px; }
  .sheet-header { padding-bottom: 8px; }
  .sheet-heading .eyebrow { display: none; }
  .sheet-heading h2 { font-size: 1.125rem; }
  .sheet-description { margin-top: 4px; }
  .sheet-footer { padding-top: 6px; padding-bottom: 10px; }
}
/* Phone landscape: keep the dock to one slim row so content keeps most of the 375px height. */
@media (max-height: 450px) and (orientation: landscape) {
  .app-shell { max-width: 640px; }
  .compact-heading { display: none; }
  .bottom-dock { max-width: 760px; display: flex; align-items: center; gap: 16px; }
  .dock-action { flex: 1 1 55%; min-height: 0; padding: 6px 0; border-bottom: 0; }
  .bottom-nav { flex: 1 1 45%; }
  .dock-action .primary-button { min-width: 0; min-height: 44px; padding-top: 8px; padding-bottom: 8px; }
  .bottom-nav a { min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Save-copy options use the same native bottom sheet and 44px+ touch targets. */
.save-copy-actions { display: grid; gap: 8px; padding-top: 8px; }
@media (max-height: 670px) and (max-width: 599px) {
  /* Preserve a little breathing room above the fixed dock on short Safari viewports. */
  .compact-heading { margin-bottom: 8px; }
  .method-section { margin-bottom: 8px; }
}
@media (max-height: 670px) and (max-width: 350px) {
  .quantity-row p { display: none; }
}

/* v5: local, downscaled Rust artwork. Keep imagery inside existing touch targets. */
.item-art { display: block; object-fit: contain; flex-shrink: 0; width: 100%; height: 100%; }
.target-icon { flex-basis: 42px; height: 46px; }
.target-hero-art { width: 46px; height: 46px; margin-left: -2px; }
.target-option-art { width: 42px; height: 46px; flex: 0 0 42px; display: grid; place-items: center; }
.target-option-art > .item-art { width: 43px; height: 43px; }
.target-option-art svg { width: 25px; height: 25px; color: var(--muted); }
.target-option { min-height: 64px; }
.methods .method-title { min-width: 0; display: flex; align-items: center; justify-content: center; gap: 2px; }
.methods .method-title .method-item-art { width: 15px; height: 19px; }
.methods .method-title strong { font-size: .715rem; }
.sulfur-total .sulfur-graphic { width: 43px; height: 43px; }
.craft-details dl > div { align-items: center; min-height: 33px; }
.craft-details dt { display: inline-flex; align-items: center; min-width: 0; gap: 9px; }
.craft-details .craft-resource-icon { width: 24px; height: 24px; }
.compare-visual { width: 40px; height: 44px; flex: 0 0 40px; display: grid; place-items: center; }
.compare-visual .item-art { width: 42px; height: 42px; }
.sample-item-art { width: 38px; height: 38px; }
@media (max-width: 350px) {
  /* At 320px the labels have priority over tiny illustrative images. */
  .methods .method-title .method-item-art { display: none; }
  .target-icon { flex-basis: 36px; }
  .target-hero-art { width: 40px; height: 40px; }
  .target-option-art { flex-basis: 34px; width: 34px; }
  .target-option-art > .item-art { width: 36px; height: 36px; }
}

/* v7: thumb-friendly, no-framework saved-plan search and backup controls. */
.saved-tools { display: grid; gap: 10px; margin: -4px 0 16px; }
.saved-search { position: relative; }
.saved-search > svg { position: absolute; pointer-events: none; top: 50%; left: 14px; transform: translateY(-50%); width: 19px; height: 19px; color: var(--muted); }
.saved-search input { display: block; width: 100%; min-height: 48px; padding: 11px 14px 11px 44px; color: var(--text); background: var(--surface-raised); border: 1px solid var(--line); border-radius: 12px; font-size: 16px; outline-offset: 2px; -webkit-appearance: none; appearance: none; }
.saved-search input:focus { outline: 2px solid var(--accent-ink); }
.saved-search input::-webkit-search-cancel-button { -webkit-appearance: searchfield-cancel-button; }
.saved-filter-count { color: var(--muted); font-size: .8rem; }
.saved-transfer { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.utility-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-raised); font-size: .8125rem; font-weight: 600; }
.utility-button svg { width: 18px; height: 18px; }
.utility-button:active:not(:disabled) { background: var(--surface-sunken); }
@media (hover: hover) { .utility-button:hover:not(:disabled) { border-color: var(--muted); } }

.raid-columns, .raid-setup, .raid-output, .guide-reference { display: contents; }

@media (min-width: 900px) {
  html { scroll-padding-block: 24px; }
  .app-shell { max-width: 1184px; padding: 0 32px 48px; }
  .topbar { display: grid; grid-template-columns: 1fr auto 1fr; min-height: 76px; }
  .topbar .brand { justify-self: start; }
  .topbar-actions { justify-self: end; }
  .bottom-dock { display: none; }
  .topbar .bottom-nav { display: flex; gap: 4px; padding: 0; }
  .bottom-nav a { flex-direction: row; gap: 8px; min-height: 42px; padding: 0 14px; font-size: .875rem; }
  .bottom-nav a svg { width: 17px; height: 17px; }
  .bottom-nav a[aria-current="page"] { background: var(--accent-soft); }
  .bottom-nav a:hover:not([aria-current="page"]) { background: var(--surface-sunken); }
  .nav-icon b { position: static; display: inline-block; margin-left: 5px; vertical-align: middle; }
  .nav-icon { display: inline-flex; align-items: center; }

  .view, #view-raid { padding-top: clamp(28px, 5vh, 56px); }
  .view-heading { margin-bottom: 28px; }
  .compact-heading { display: block; }
  .compact-heading .eyebrow { margin-bottom: 8px; }
  .view-heading h1 { font-size: clamp(2.5rem, 4vw, 3.5rem); letter-spacing: -.055em; }

  .raid-columns { display: grid; grid-template-columns: minmax(0, 1.17fr) minmax(0, 1fr); gap: 24px; }
  .raid-setup, .raid-output { display: block; min-width: 0; }
  .target-select { min-height: 104px; padding: 16px 20px; gap: 16px; }
  .target-icon { flex-basis: 60px; height: 60px; }
  .target-hero-art { width: 60px; height: 60px; margin: 0; }
  .target-copy strong { font-size: 1.25rem; }
  .target-arrow { flex: 0 0 32px; height: 32px; }
  .quantity-row { min-height: 76px; margin: 0 20px; }
  .method-section { margin: 16px 0 0; }
  .section-heading { margin-bottom: 4px; }
  .methods { gap: 8px; }
  .methods button { min-height: 96px; gap: 5px; }
  .methods .method-title { flex-direction: column; gap: 3px; }
  .methods .method-title .method-item-art { width: 32px; height: 29px; }
  .methods .method-title strong, .methods [data-method-cost] { font-size: .8125rem; }

  .result { padding: 24px 24px 0; }
  .sulfur-total { min-height: 99px; }
  .sulfur-total strong { font-size: clamp(3.5rem, 6vw, 5rem); }
  .sulfur-total .sulfur-graphic { width: 62px; height: 62px; }
  .craft-details { margin-top: 20px; }
  .craft-details summary { min-height: 52px; }
  .raid-output .dock-action { min-height: 0; margin-top: 12px; padding: 0; border: 0; justify-content: flex-end; }
  .raid-output .dock-copy { display: none; }
  .calculation-footnote { padding-top: 16px; font-size: .75rem; }

  .saved-tools { grid-template-columns: minmax(0, 400px) auto; align-items: center; justify-content: space-between; }
  .saved-search { grid-column: 1; }
  .saved-transfer { grid-column: 2; grid-row: 1; }
  .saved-filter-count { grid-column: 1 / -1; }
  .saved-items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .saved-item { display: flex; flex-direction: column; }
  .saved-item-main { flex: 1; }
  #view-guide { display: grid; grid-template-columns: minmax(0, 1.17fr) minmax(0, 1fr); column-gap: 32px; }
  #view-guide > .view-heading { grid-column: 1 / -1; }
  .guide-reference { display: block; }
  .guide-steps { margin-bottom: 0; }
  .guide-faq { margin-top: 12px; }
  .guide-signoff { grid-column: 1 / -1; }

  .sheet { padding: 24px; }
  .sheet[open] { align-items: center; }
  .sheet-panel { border-radius: 18px; max-height: min(100%, 760px); }
  .sheet-header { padding: 16px 22px 12px; cursor: auto; touch-action: auto; }
  .sheet-handle { display: none; }
  .sheet-body { padding-right: 22px; padding-left: 22px; }
  .sheet-footer { padding-right: 22px; padding-left: 22px; }
  .small-sheet { max-width: 450px; }
  #target-dialog .sheet-panel { max-width: 800px; }
  .target-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .target-group + .target-group { margin-top: 0; }

  .toast { bottom: 24px; }
}
