/* MapleFit's final visual system: readable text, consistent controls and calm spacing. */
:root {
  --orange: #b94b16;
  --orange-dark: #a34010;
  --orange-accent: #ef7a36;
  --ink: #232b36;
  --muted: #586575;
  --line: #e1e6eb;
  --bg: #f5f7f9;
  --green: #167456;
  --focus: #125cb2;
}

html { scroll-padding-top: 24px; }
body { font-size: 16px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { touch-action: manipulation; }
button:disabled { opacity: 1; background: #edf0f3; border-color: #d7dee5; color: #67727e; cursor: not-allowed; }
button:active { transform: none; }
::selection { background: #ffe0c9; color: #622b13; }
:focus-visible, .btn-focus:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--focus); }

.sidebar { width: 248px; padding: 32px 22px; }
.workspace { margin-left: 248px; }
.brand { font-size: 28px; letter-spacing: -1px; }
.brand-mark { background: var(--orange-accent); }
.brand > span:last-child { color: var(--orange-dark); }
.workspace-label { font-size: 12px; color: #596575; letter-spacing: 1.2px; margin: 40px 12px 16px; }
nav { gap: 8px; }
nav button { min-height: 52px; padding: 13px 14px; font-size: 14px; color: #536071; font-weight: 600; }
nav button.active { color: #994010; background: #fff0e4; }
nav button:hover { background: #f4f6f8; }
nav button.active:hover { background: #ffe7d5; }
nav button > .nav-icon { display: inline-block; font-size: 21px; width: 29px; line-height: 1; vertical-align: middle; }
nav button > .nav-label { font-size: inherit; width: auto; line-height: 1.45; }
nav button > .nav-label-long, nav button > .nav-label-short { font-size: inherit; width: auto; line-height: 1.45; }
.nav-label-short { display: none; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 100; padding: 12px 18px; min-height: 44px; background: #253447; color: #fff; border-radius: 8px; font-size: 16px; transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }
.visually-hidden { 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; clip-path: inset(50%)!important; white-space: nowrap!important; border: 0!important; }
.side-note { background: #f8fafb; border-color: var(--line); padding: 20px 17px; }
.side-note strong { font-size: 15px; }
.side-note p, .method-button, .sidebar-footer { font-size: 14px; color: var(--muted); }
.method-button { min-height: 44px; margin: 12px 0; line-height: 1.5; }
.sidebar-footer { padding: 15px 8px 0; font-size: 13px; }

.topbar { min-height: 84px; height: auto; padding: 18px 40px; gap: 20px; }
.breadcrumb { font-size: 14px; color: var(--muted); }
.breadcrumb span { color: #657180; }
.breadcrumb b { color: #344252; font-weight: 600; }
.top-right { gap: 12px; }
.demo-badge { font-size: 13px; line-height: 1.5; color: #824817; background: #fff3e4; border-color: #e9cdae; padding: 6px 10px; }
.small { width: 36px; height: 36px; font-size: 14px; }
.icon-button { min-height: 44px; min-width: 44px; padding: 7px; border-radius: 8px; color: #536071; display: inline-grid; place-items: center; }
.icon-button:hover { background: #f0f3f6; }
.topbar #dataBtn { font-size: 14px; padding: 10px 14px; }
.topbar #accountBtn { font-size: 14px; padding: 10px 14px; }
main { padding: 34px 40px 0; max-width: 1580px; }
.page-heading { margin-bottom: 24px; gap: 24px; }
.eyebrow { font-size: 12px; letter-spacing: 1.4px; color: #994010; }
h1 { font-size: 30px; line-height: 1.35; letter-spacing: -.9px; font-weight: 800; }
.page-heading p { margin-top: 10px; font-size: 16px; color: var(--muted); }
h2 { font-size: 20px; line-height: 1.5; font-weight: 700; letter-spacing: -.45px; }
h3 { line-height: 1.5; }

.button { min-height: 44px; padding: 10px 16px; font-size: 14px; line-height: 1.5; border-color: #cad3dc; color: #354354; border-radius: 8px; font-weight: 600; }
.button:hover { background: #f4f6f8; border-color: #aebac7; }
.button.primary { color: #fff; background: var(--orange); border-color: var(--orange); box-shadow: 0 3px 8px #9b43101a; }
.button.primary:hover { background: #9e3f11; border-color: #9e3f11; }
.button.soft { background: #fff0e4; border-color: #eccdb7; color: #994010; }
.button.soft:hover { background: #ffe5d1; border-color: #dab092; }
.button:disabled, .button.primary:disabled, .button.soft:disabled { background: #edf0f3; border-color: #d7dee5; color: #67727e; box-shadow: none; }
.button.danger, .danger { color: #a2382c; border-color: #d9b5ae; background: #fff7f5; }
.text-button { min-height: 44px; padding: 8px 4px; font-size: 14px; color: #a34010; font-weight: 600; border-radius: 6px; }
.text-button:hover { color: #7d2f0c; text-decoration: underline; text-underline-offset: 3px; }
.actions-inline .button, .table-wrap table .button { min-height: 44px; padding: 8px 12px; font-size: 14px; }
.notice { background: #fff8ee; border-color: #e6cfad; color: #795222; font-size: 14px; line-height: 1.75; padding: 12px 16px; }
.notice > button { min-height: 44px; color: #8c410f; padding: 8px 4px; font-size: 14px; }

.character-strip { padding: 24px; gap: 24px; border-radius: 12px; }
.character-identity { gap: 16px; min-width: 230px; }
.character-name { font-size: 21px; line-height: 1.5; }
.character-name span { font-size: 13px; color: #635444; background: #f4eee6; }
.character-identity p { font-size: 14px; color: #536071; }
.guild { font-size: 14px; color: #596575; }
.character-stat { padding-left: 24px; min-width: 120px; }
.character-stat > span { color: #586575; font-size: 14px; margin-bottom: 7px; }
.character-stat > span b { font-size: 12px; color: #536071; background: #eef1f4; }
.character-stat strong { font-size: 24px; line-height: 1.4; font-weight: 700; }
.character-stat strong span { font-size: 16px; }
.character-strip .text-button { display: block; }

.section-heading { margin-bottom: 16px; gap: 12px; }
.section-heading p { color: var(--muted); font-size: 14px; }
.summary-grid { gap: 20px; margin-bottom: 28px; }
.card { border-radius: 12px; padding: 23px; }
.metric-label { color: #526071; font-size: 14px; gap: 12px; }
.metric-icon { color: #596575; background: #f1f4f7; }
.metric-icon.orange { background: #fff0e4; color: #994010; }
.metric-value { font-size: 32px; font-weight: 750; margin: 10px 0 7px; line-height: 1.3; letter-spacing: -.8px; }
.metric-value small { font-size: 14px; color: #586575; font-weight: 500; }
.metric-foot { font-size: 14px; color: #586575; line-height: 1.7; }
.positive, .delta-list b { color: var(--green); }
.negative, .negative strong { color: #ab392d; }
.orange-text { color: #a34010; }
.overview-grid, .bottom-grid { gap: 24px; grid-template-columns: minmax(0,1.6fr) minmax(330px,1fr); }
.bottom-grid { margin-top: 24px; }
.panel { padding: 24px; border-radius: 12px; min-width: 0; }
.panel-head { gap: 16px; margin-bottom: 20px; }
.panel-head p { color: var(--muted); font-size: 14px; margin-top: 5px; }
.pill { font-size: 13px; color: #536071; background: #eef2f5; padding: 4px 8px; line-height: 1.6; }
.pill.orange { color: #994010; background: #fff0e4; }
.pill.green { color: #176b50; background: #e9f5ef; }
.item-row { padding: 17px 0; gap: 14px; }
.item-details strong, .recommend-item strong { font-size: 15px; line-height: 1.55; font-weight: 650; }
.item-details p, .recommend-item p { font-size: 14px; color: #586575; line-height: 1.65; }
.item-price { flex-shrink: 0; }
.item-price strong { font-size: 16px; font-weight: 700; }
.item-price > span { color: #586575; font-size: 14px; }
.stars { font-size: 14px; color: #806119; }
.recommend-panel { background: #fffaf6; border-color: #eacdb9; }
.recommend-label { font-size: 12px; color: #994010; letter-spacing: 1.2px; }
.recommend-panel h2 { font-size: 23px; line-height: 1.55; margin: 10px 0; }
.recommend-panel > p { font-size: 14px; color: #67564a; line-height: 1.75; }
.recommend-item { padding: 16px; border-color: #e8d7cb; }
.recommend-stats span { color: #67564a; font-size: 14px; margin-bottom: 4px; }
.recommend-stats strong { font-size: 26px; font-weight: 750; }
.recommend-stats > div + div { border-left-color: #e8d7cb; padding-left: 18px; }

.input { min-height: 46px; font-size: 16px; line-height: 1.5; color: #344252; border-color: #bfcbd6; padding: 10px 12px; border-radius: 8px; }
.input::placeholder { color: #667383; opacity: 1; }
.input:hover { border-color: #98a8b8; }
.filters { gap: 12px; }
.filters label, .field, .field label { color: #445264; font-size: 14px; line-height: 1.65; }
.field { gap: 7px; }
.field .input { font-size: 16px; }
.form-grid { gap: 18px 16px; }
.form-grid h3 { font-size: 17px; }
.helper, .table-help, .table-meta, .source-caption { color: #586575; font-size: 14px; line-height: 1.8; }
.form-error { font-size: 14px; color: #a2382c; }
.form-error:not(:empty) { border: 1px solid #e9c6c0; background: #fff6f3; }
.form-inline .helper { max-width: 100%; }
.form-actions { gap: 12px; margin-top: 24px; }
.option-details { padding: 15px 16px; border-color: #cfd8e1; }
.option-details summary { min-height: 44px; display: list-item; align-content: center; font-size: 15px; color: #344252; }
.option-details .field { font-size: 14px; }
.option-details .form-grid { gap: 16px; }
.option-details[open] summary { margin-bottom: 12px; }
.checkbox-line { min-height: 44px; color: #445264; font-size: 14px; cursor: pointer; }
.market-source-row .checkbox-line { font-size: 14px; }
.market-source-row input, .candidate-row > input { height: 22px; width: 22px; accent-color: var(--orange); }
.candidate-toggle { display: grid; place-items: center; min-width: 44px; min-height: 44px; flex-shrink: 0; cursor: pointer; border-radius: 7px; }
.candidate-toggle:hover { background: #f1f4f7; }
.candidate-toggle input { width: 22px; height: 22px; margin: 0; accent-color: var(--orange); }
.market-source-row { gap: 12px 20px; margin-bottom: 20px; }
.table-wrap { border: 1px solid var(--line); border-radius: 9px; max-width: 100%; overscroll-behavior-x: contain; scrollbar-color: #7c8a9a #eef2f5; }
th { color: #435266; background: #f1f4f7; font-size: 14px; font-weight: 600; padding: 14px 16px; }
td { padding: 16px; font-size: 14px; }
tbody tr:hover { background: #fafbfd; }
.table-scroll-hint { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 14px; color: #586575; }
.table-scroll-hint::before { content: '↔'; font-size: 18px; color: #435266; }
@media (min-width: 951px) { .table-scroll-hint { display: none; } }
.table-help { margin-top: 16px; }

.budget-row { gap: 12px; margin: 22px 0 8px; }
.budget-input { min-height: 48px; font-size: 30px; line-height: 1.3; font-weight: 750; border-bottom-color: #9eacba; padding: 2px 0; }
.budget-row > span { font-size: 14px; color: #586575; }
.range { height: 44px; margin: 4px 0 2px; cursor: pointer; }
.range-labels { color: #586575; font-size: 14px; }
.budget-note { background: #f1f4f7; color: #536071; font-size: 14px; line-height: 1.8; padding: 14px 16px; }
.chart-select { font-size: 14px; min-height: 44px; }
.chart polyline { stroke: #b9541b; }
.chart circle { fill: #b9541b; }
.chart-caption { color: #586575; font-size: 14px; line-height: 1.6; gap: 12px; }
.chart-caption b { font-size: 28px; }
.chart-caption small { color: #586575!important; font-size: 14px!important; }
.chart-wrap { height: 152px; gap: 14px; }
.y-axis { color: #586575; font-size: 13px; min-width: 46px; }
.chart-labels { color: #586575; font-size: 13px; margin-left: 60px; }
.segmented { padding: 3px; background: #eef2f5; }
.segmented button { min-height: 44px; min-width: 48px; padding: 7px 10px; font-size: 14px; color: #536071; }
.segmented button.active { color: #25374b; font-weight: 600; box-shadow: 0 1px 4px #2132431a; }

.compare-grid { gap: 24px; }
.compare-item { padding: 20px; }
.compare-item h3 { font-size: 19px; }
.compare-item p { color: #586575; font-size: 14px; }
.stat-lines > div { gap: 16px; color: #536071; font-size: 15px; padding: 13px 0; }
.stat-lines strong { font-weight: 650; }
.stat-lines small { font-size: 13px; }
.result-panel { background: #fff7ef; border-color: #e8cbb4; }
.result-panel h3 { font-size: 20px; }
.result-panel p, .result-metric span { font-size: 14px; color: #67564a; }
.result-metric strong { font-size: 32px; color: var(--green); font-weight: 750; }
.result-metric strong.negative { color: #ab392d; }
.market-stats span { color: #586575; font-size: 14px; }
.market-stats strong { font-size: 23px; font-weight: 700; }
.compare-warning { background: #fff7e9; border: 1px solid #e7d0a5; color: #80501d; font-size: 14px; line-height: 1.8; }
.delta-list { color: #536071; font-size: 14px; }
.planner-tabs { gap: 8px; }
.planner-tabs button { min-height: 48px; font-size: 15px; color: #536071; padding: 12px 18px; }
.planner-tabs button.active { color: #994010; border-bottom-color: var(--orange); }
.package-status { color: #586575; font-size: 14px; }
.plan-card { border-radius: 10px; padding: 24px; }
.plan-card.best-plan { background: #fffaf6; border-color: #dfbfa6; }
.plan-heading h3 { font-size: 20px; }
.plan-heading .eyebrow { font-size: 12px; }
.plan-heading .result-metric strong { font-size: 28px; }
.plan-item { padding: 14px; min-height: 76px; border-color: #d8e0e7; }
.plan-item:hover { background: #f8fafc; border-color: #aab8c6; }
.plan-item strong { font-size: 15px; color: #344252; }
.plan-item small { font-size: 14px; color: #586575; line-height: 1.6; }
.plan-footer { color: #586575; font-size: 14px; line-height: 1.7; padding-top: 16px; }
.plan-footer b { color: #344252; }
.upgrade-row { gap: 16px; padding: 20px 0; }
.rank-number { color: #667383; }
.rank-number.first { color: #a34010; }
.upgrade-metrics span { font-size: 14px; color: #586575; }
.upgrade-metrics strong { font-size: 17px; }
.empty { color: #536071; font-size: 15px; line-height: 1.8; }

dialog { width: min(760px,calc(100% - 32px)); padding: 28px; max-height: 90svh; border-color: #d2dae3; border-radius: 16px; }
dialog::backdrop { background: #17212f75; }
.modal-header { top: -28px; min-height: 64px; margin-bottom: 20px; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.modal-header h2 { font-size: 23px; line-height: 1.45; }
.method-text { font-size: 16px; color: #445264; line-height: 1.85; }
.method-text h3 { font-size: 18px; }
.method-text code, .method-text .formula { font-size: 14px; color: #445264; }
.data-summary { padding: 18px; background: #f1f4f7; }
.data-summary strong { font-size: 20px; }
.data-summary span { font-size: 14px; color: #586575; }
.footer { font-size: 14px; color: #586575; padding: 20px 0 24px; align-items: center; }
.footer .text-button { font-size: 14px; }
#toast { font-size: 15px; line-height: 1.65; padding: 14px 18px; background: #253447; max-width: min(650px,90vw); left: calc(50% + 124px); transition: opacity .2s, transform .2s; }

/* Connection and first-run guidance share the same visual language as the calculator. */
.onboarding-panel { border: 1px solid #e8c9af; border-radius: 12px; background: #fffaf5; padding: 24px; margin-bottom: 24px; }
.onboarding-panel h2 { font-size: 21px; }
.onboarding-panel p { font-size: 14px; color: #67564a; line-height: 1.8; }
.setup-steps { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin: 20px 0 0; padding: 0; list-style: none; counter-reset: setup; }
.setup-steps > li { counter-increment: setup; position: relative; padding: 16px 16px 16px 50px; border: 1px solid #e9d5c5; border-radius: 9px; background: #fff; }
.setup-steps > li::before { content: counter(setup); position: absolute; left: 16px; top: 17px; display: grid; place-items: center; height: 24px; width: 24px; border-radius: 50%; color: #994010; background: #fff0e4; font-size: 13px; font-weight: 700; }
.setup-steps strong { display: block; font-size: 15px; color: #344252; margin-bottom: 4px; }
.setup-steps p { font-size: 14px; color: #586575; }
.connection-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid #d8e1e9; border-radius: 10px; background: #f7fafc; padding: 18px; margin: 18px 0; }
.connection-summary strong { font-size: 17px; }
.connection-summary p { font-size: 14px; color: #586575; line-height: 1.75; flex-basis: 100%; overflow-wrap: anywhere; }
.auth-status { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; line-height: 1.6; color: #445264; }
.auth-status::before { content: ''; width: 8px; height: 8px; flex-shrink: 0; background: #647487; border-radius: 50%; }
.auth-status.connected { color: #176b50; }
.auth-status.connected::before { background: #167456; }
.linked-characters { display: grid; gap: 12px; padding: 0; list-style: none; margin: 16px 0; }
.linked-characters > li { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid #d8e1e9; border-radius: 9px; }
.linked-characters strong { font-size: 16px; }
.linked-characters p { font-size: 14px; color: #586575; }
.linked-character.button { width: 100%; min-height: 76px; padding: 16px; display: flex; justify-content: space-between; align-items: center; gap: 16px; white-space: normal; text-align: left; border-color: #cbd6e0; }
.linked-character > span:first-child { min-width: 0; }
.linked-character strong { display: block; font-size: 16px; color: #253447; font-weight: 700; overflow-wrap: anywhere; }
.linked-character small { display: block; font-size: 14px; line-height: 1.7; font-weight: 400; color: #586575; overflow-wrap: anywhere; margin-top: 3px; }
.linked-character > span:last-child { font-size: 20px; color: #536071; flex-shrink: 0; }
.nexon-login { display: inline-flex; align-items: center; justify-content: center; min-height: 64px; max-width: 100%; margin: 4px 0 8px; border-radius: 7px; }
.nexon-login img { display: block; height: 64px; width: auto; max-width: 100%; object-fit: contain; }
#accountContent .data-actions { align-items: flex-start; }
#accountContent a { overflow-wrap: anywhere; }
#accountContent a.button { white-space: normal; text-align: left; }
#accountContent a.text-button { display: inline-flex; align-items: center; line-height: 1.7; }

@media (max-width: 1200px) {
  .sidebar { width: 216px; padding: 30px 16px; }
  .workspace { margin-left: 216px; }
  main { padding: 28px 28px 0; }
  .topbar { padding: 16px 28px; }
  .character-strip { gap: 18px; padding: 22px; }
  .character-identity { min-width: 200px; }
  .character-stat { min-width: 100px; padding-left: 18px; }
  .character-stat strong { font-size: 22px; }
  .overview-grid, .bottom-grid { grid-template-columns: minmax(0,1.35fr) minmax(300px,1fr); }
  .recommend-stats { gap: 8px; }
  #toast { left: calc(50% + 108px); }
}
@media (min-width: 721px) and (max-width: 950px) {
  .sidebar { width: 88px; padding: 24px 12px; }
  .workspace { margin-left: 88px; }
  .brand { font-size: 0; }
  .brand-mark { width: 44px; height: 44px; margin: 0 auto; }
  nav { margin-top: 32px; }
  nav button { font-size: 0; padding: 13px; min-height: 52px; }
  nav button > .nav-icon { font-size: 23px; width: auto; }
  nav button > .nav-label { display: none; }
  nav button > .nav-label-long { display: none; }
  .character-stat { flex: 1; }
  .overview-grid, .bottom-grid { grid-template-columns: 1fr; }
  .overview-grid .recommend-panel { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .setup-steps { grid-template-columns: 1fr; }
  #toast { left: calc(50% + 44px); }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .sidebar { top: auto; bottom: 0; width: 100%; height: auto; min-height: 76px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -3px 16px #26374a0a; }
  .workspace { margin: 0 0 calc(80px + env(safe-area-inset-bottom)); }
  nav { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; margin: 0; }
  nav button { padding: 8px 2px; min-height: 60px; font-size: 12px; line-height: 1.45; gap: 5px; white-space: normal; }
  nav button > .nav-icon { width: auto; font-size: 20px; }
  nav button > .nav-label { display: block; font-size: 14px; line-height: 1.45; }
  nav button > .nav-label-long { display: none; }
  nav button > .nav-label-short { display: inline; font-size: 14px; }
  .topbar { min-height: 68px; padding: 12px 16px; gap: 8px; align-items: center; }
  .topbar .breadcrumb { display: none; }
  .top-right { width: 100%; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
  .topbar #dataBtn { font-size: 14px; padding: 9px 12px; margin-right: auto; }
  .topbar #accountBtn { font-size: 14px; padding: 9px 12px; }
  .topbar .auth-status { font-size: 13px; }
  .topbar .small { display: none; }
  .demo-badge { font-size: 12px; padding: 5px 8px; }
  main { padding: 24px 16px 0; }
  .page-heading { display: block; margin-bottom: 20px; }
  .page-heading h1 { font-size: 27px; line-height: 1.4; }
  .page-heading p { font-size: 15px; max-width: none; margin-top: 8px; }
  .page-heading .button { margin-top: 16px; min-height: 46px; font-size: 14px; padding: 10px 15px; }
  .notice { font-size: 14px; padding: 10px 14px; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
  .notice > span:nth-child(2) { flex-basis: 100%; }
  .notice > button { margin-left: 0; min-height: 44px; font-size: 14px; padding: 8px 0; }
  .character-strip { padding: 20px; gap: 18px 14px; }
  .character-avatar { width: 56px; height: 56px; }
  .character-identity { flex-basis: 100%; min-width: 0; }
  .character-name { font-size: 20px; }
  .character-name span { display: inline-block; font-size: 12px; margin-left: 5px; }
  .character-identity p, .guild { font-size: 14px; }
  .character-stat { border: 0; padding-left: 0; min-width: 80px; flex: 1; }
  .character-stat > span { font-size: 13px; }
  .character-stat strong { font-size: 21px; }
  .character-stat strong span { font-size: 14px; }
  .character-strip .text-button { min-height: 44px; padding: 8px 0; margin: 0; width: 100%; text-align: left; }
  .section-heading { flex-wrap: wrap; gap: 4px; }
  .section-heading h2 { font-size: 19px; }
  .section-heading p { font-size: 14px; }
  .summary-grid { grid-template-columns: 1fr; gap: 12px; margin-bottom: 24px; }
  .card { padding: 18px 20px; gap: 5px 12px; }
  .metric-label { font-size: 14px; }
  .card .metric-icon { display: none; }
  .metric-value { font-size: 27px; margin: 0; }
  .metric-value small { font-size: 13px; margin-left: 4px; }
  .metric-foot { font-size: 14px; margin-top: 3px; }
  .overview-grid, .bottom-grid, .compare-grid { grid-template-columns: 1fr; gap: 20px; }
  .overview-grid .recommend-panel { display: block; }
  .panel { padding: 20px; }
  .panel-head { flex-wrap: wrap; gap: 10px; }
  .panel-head h2 { font-size: 19px; }
  .panel-head p { font-size: 14px; }
  .item-row { gap: 12px; padding: 16px 0; flex-wrap: wrap; }
  .item-details { min-width: 0; }
  .item-details strong { font-size: 15px; }
  .item-details p { font-size: 14px; }
  .item-price strong { font-size: 15px; }
  .item-price > span { font-size: 13px; }
  .item-icon { width: 44px; height: 44px; }
  .stars { font-size: 13px; margin-left: 3px; }
  .recommend-panel h2 { font-size: 23px; }
  .recommend-stats strong { font-size: 25px; }
  .recommend-stats span { font-size: 14px; }
  .recommend-stats > div + div { padding-left: 14px; }
  .actions-inline { gap: 8px; justify-content: flex-start; }
  .actions-inline .button, .table-wrap table .button { font-size: 14px; min-height: 44px; }
  .filters .input, .filters select.input { font-size: 16px; min-width: 0; }
  .filters select.input { flex: 1 1 140px; }
  .filters .search-input { min-width: 0; flex-basis: 100%; }
  .market-source-row { gap: 8px; align-items: flex-start; }
  .market-source-row > .text-button { margin-left: 0; }
  .table-wrap { margin: 0; }
  .table-help, .table-meta, .source-caption { font-size: 14px; }
  .budget-input { font-size: 28px; width: 120px; }
  .budget-row > span { font-size: 14px; }
  .range-labels, .budget-note { font-size: 14px; }
  .chart-wrap { height: 150px; }
  .chart-caption { flex-wrap: wrap; gap: 8px 12px; }
  .chart-caption .pill { margin-left: 0; }
  .chart-caption b { font-size: 26px; }
  .y-axis, .chart-labels { font-size: 13px; }
  .segmented button { font-size: 14px; }
  .planner-tabs { gap: 4px; }
  .planner-tabs button { font-size: 14px; padding: 10px 12px; line-height: 1.55; }
  .plan-card { padding: 18px; }
  .plan-heading h3 { font-size: 18px; }
  .plan-heading .result-metric strong { font-size: 25px; }
  .plan-heading h3 .pill { display: block; width: fit-content; margin-top: 6px; }
  .plan-items { grid-template-columns: 1fr; }
  .plan-item { padding: 12px; }
  .plan-item strong { font-size: 15px; }
  .plan-item small, .plan-footer { font-size: 14px; }
  .candidate-row .item-details { flex-basis: calc(100% - 112px); }
  .candidate-row .item-price { margin-left: 34px; }
  .candidate-row .actions-inline { margin-left: 34px; }
  .upgrade-metrics { padding-left: 40px; gap: 12px; flex-wrap: wrap; }
  .upgrade-metrics span { font-size: 14px; }
  .upgrade-metrics strong { font-size: 16px; }
  .compare-item { padding: 16px; }
  .compare-item h3 { font-size: 18px; }
  .stat-lines > div { font-size: 14px; }
  .stat-lines strong small { font-size: 13px; }
  .result-panel { align-items: stretch; }
  .result-panel .button { width: 100%; }
  .result-panel h3 { font-size: 19px; }
  .market-stats { grid-template-columns: 1fr; gap: 10px; }
  .market-stats > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px; }
  .market-stats strong { font-size: 21px; }
  .form-grid, .option-details .form-grid { grid-template-columns: 1fr; gap: 16px; }
  .field.full, .option-details .field.full { grid-column: auto; }
  .field, .option-details .field { font-size: 14px; }
  .form-grid .input, .option-details .input { font-size: 16px; min-height: 46px; padding: 10px 12px; }
  .form-inline .button, .data-actions .button { font-size: 14px; min-height: 44px; }
  .form-actions > .button { flex: 1; }
  dialog { width: calc(100% - 24px); padding: 20px; max-height: 92svh; border-radius: 12px; }
  .modal-header { top: -20px; gap: 12px; margin-bottom: 18px; min-height: 64px; }
  .modal-header h2 { font-size: 21px; }
  .method-text { font-size: 15px; }
  .method-text h3 { font-size: 17px; }
  .footer { font-size: 14px; line-height: 1.75; gap: 6px; align-items: flex-start; }
  .footer > span { font-size: 14px; gap: 8px; }
  #toast { left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); max-width: calc(100% - 32px); width: max-content; font-size: 14px; }
  .onboarding-panel { padding: 20px; }
  .setup-steps { grid-template-columns: 1fr; gap: 12px; }
  .connection-summary { padding: 16px; }
  .linked-characters > li { padding: 14px; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto!important; animation: none!important; transition: none!important; }
}
@media (forced-colors: active) {
  .button, .icon-button, nav button, .plan-item, .segmented button { border: 1px solid ButtonText; }
  nav button.active, .planner-tabs button.active, .segmented button.active { outline: 2px solid Highlight; outline-offset: -3px; }
}

/* Preset identity and calculation scope stay visible on every analysis tab. */
.preset-relative { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 7px; padding-top: 10px; border-top: 1px solid #dbe2ea; font-size: 13px; color: #4b5f77; }
.preset-relative b { color: #263e59; font-size: 15px; }
.preset-smart { margin: 20px 0; padding: 18px; border: 1px solid #ccd9e6; background: #f5f9fd; border-radius: 12px; }
.preset-smart>div>p, .preset-estimate-note p { font-size: 14px; line-height: 1.8; color: #425a71; margin: 8px 0; }
.preset-smart-actions { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin: 16px 0 0; }
.preset-smart-actions .button { display: flex; flex-direction: column; gap: 5px; padding: 12px 8px; background: #fff; white-space: normal; min-width: 0; }
.preset-smart-actions .button:disabled { background: #edf0f3; }
.preset-smart-actions .button span { font-size: 13px; }
.preset-smart-actions .button strong { font-size: 15px; overflow-wrap: anywhere; }
.preset-estimate-note { padding: 18px 20px; margin: 18px 0; border: 1px solid #acc8df; background: #f0f7fd; border-radius: 10px; color: #233e57; overflow-wrap: anywhere; }
.preset-estimate-note summary { cursor: pointer; min-height: 44px; align-content: center; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.preset-estimate-note ul { padding-left: 22px; font-size: 14px; line-height: 1.8; }
.preset-calibration { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 14px 0; }
.preset-calibration>div { padding: 12px; background: #fff; border: 1px solid #d3e0eb; border-radius: 8px; }
.preset-calibration dt { font-size: 13px; }
.preset-calibration dd { margin: 4px 0 0; font-size: 18px; font-weight: 700; }
.preset-calibration small { display: block; margin-top: 5px; font-weight: 400; font-size: 12px; color: #4b637b; }
.preset-panel { margin: 0 0 22px; padding: 22px; }
.preset-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.preset-heading h2 { margin: 6px 0; font-size: 21px; }
.preset-heading p, .preset-card small, .preset-scope span, .preset-utility { color: #53647a; font-size: 14px; line-height: 1.7; }
.preset-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.preset-card { display: flex; flex-direction: column; align-items: stretch; text-align: left; gap: 8px; padding: 16px; border: 1px solid #cbd5e1; border-radius: 12px; background: #fff; color: #243142; font: inherit; cursor: pointer; min-width: 0; }
.preset-card:hover { border-color: #b7470f; }
.preset-card.is-selected { border: 2px solid #b7470f; padding: 15px; background: #fff8f0; }
.preset-card:focus-visible { outline: 3px solid #224eb5; outline-offset: 3px; }
.preset-card-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.preset-card-heading strong { font-size: 16px; overflow-wrap: anywhere; }
.preset-card .pill { font-size: 12px; padding: 3px 7px; }
.preset-purpose { font-size: 16px; font-weight: 700; color: #53647a; }
.preset-purpose.hunting { color: #176941; }
.preset-purpose.boss { color: #9e311d; }
.preset-purpose.hybrid { color: #6244a5; }
.preset-settings { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1.3fr); gap: 16px; align-items: end; margin: 20px 0 12px; }
.preset-settings .input { width: 100%; min-height: 44px; }
.preset-scope { display: flex; flex-direction: column; gap: 4px; padding-bottom: 4px; }
.preset-reasons { font-size: 14px; line-height: 1.7; margin-top: 12px; }
.preset-reasons summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; text-decoration: underline; text-underline-offset: 3px; }
.preset-reasons p { margin: 4px 0; }
.preset-reasons ul { margin: 8px 0; padding-left: 22px; }
.preset-utility { margin: 10px 0 0; }
.preset-missing { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px; margin-top: 18px; border: 1px solid #e1b572; border-radius: 10px; background: #fff8e8; color: #70401a; }
.preset-missing p { margin: 6px 0 0; font-size: 14px; line-height: 1.7; }
.preset-missing .button { flex-shrink: 0; }
.preset-context-note { margin: 0 0 18px; padding: 14px 16px; background: #f3f6fa; border-radius: 10px; color: #394d66; font-size: 15px; line-height: 1.7; }
@media (max-width: 1050px) {
 .preset-settings { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
 .preset-scope { grid-column: 1/-1; }
 .preset-card .pill { align-self: flex-start; }
}
@media (max-width: 680px) {
 .preset-smart-actions, .preset-calibration { grid-template-columns: repeat(2,minmax(0,1fr)); }
 .preset-smart, .preset-estimate-note { padding: 14px; }
 .preset-panel { padding: 18px; }
 .preset-heading { align-items: flex-start; }
 .preset-heading h2 { font-size: 19px; }
 .preset-cards { grid-template-columns: 1fr; }
 .preset-card { padding: 14px; gap: 5px; }
 .preset-card.is-selected { padding: 13px; }
 .preset-settings { grid-template-columns: 1fr; }
 .preset-missing { flex-direction: column; align-items: stretch; }
 .preset-heading>.pill { display: none; }
}
