.compact-selects,.mobile-menu { display: none; }

@media (max-width: 650px) {
  /* Mobile is a focused calculator screen; the full tables stay on desktop. */
  body { background: #eef5f1; }
  .announce { display: none; }
  .head { height: 55px; min-height: 55px; padding: 0 15px; flex-wrap: nowrap; gap: 10px; position: relative; }
  .head .logo { width: 112px; }
  .head nav,.head-back { display: none; }
  .mobile-menu { display: block; position: relative; margin-left: auto; align-self: center; }
  .mobile-menu summary { list-style: none; cursor: pointer; color: #9bf5da; font-size: 12px; font-weight: 800; border: 1px solid #396164; padding: 8px 12px; }
  .mobile-menu summary::-webkit-details-marker { display: none; }
  .mobile-menu>div { position: absolute; top: calc(100% + 9px); right: 0; z-index: 210; display: grid; width: min(290px,calc(100vw - 30px)); background: #0d2227; border: 1px solid #3b7069; box-shadow: 0 12px 32px #0006; }
  .mobile-menu>div a { padding: 12px 16px; font-size: 12px; font-weight: 700; border-bottom: 1px solid #254348; }
  .mobile-menu>div a:last-child { border-bottom: 0; }
  .mobile-menu>div a[aria-current] { color: #a8fae4; }
  .intro { display: none; }
  .workbench { min-height: calc(100svh - 145px); padding: 10px 12px 14px; }
  .workbench-head { align-items: center; gap: 6px; }
  .workbench-head .step { display: none; }
  .workbench-head h2 { margin: 0; font-size: 19px; letter-spacing: -.04em; }
  .workbench-head .text-button { max-width: none; flex: none; font-size: 9px; padding: 3px 0; }
  .shape-grid { display: none; }
  .compact-selects { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px; margin: 10px 0 11px; }
  .compact-selects label { display: block; color: #5e8177; font-size: 10px; font-weight: 800; }
  .compact-selects select { margin-top: 3px; }
  .workspace { display: flex; flex-direction: column; border: 0; box-shadow: none; }
  .inputs-col { padding: 0; }
  .field-section { padding: 0; margin: 0 0 9px; border: 0; }
  .field-section:last-child { margin-bottom: 0; }
  .field-section .section-heading,.material-pills,.field-section .hint,.shape-description,.density-label { display: none; }
  .fields-two { grid-template-columns: 1fr; gap: 6px; }
  .mode-section .fields-two { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  .fields-two label,.dimensions label { gap: 3px; font-size: 10px; line-height: 1.25; color: #59776d; }
  input,select { min-height: 38px; height: 38px; padding: 6px 8px; font-size: 16px; border-color: #b8d5c9; background: #f8fcf9; }
  .dimensions { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
  .dimensions label { font-size: 9px; line-height: 1.15; justify-content: end; }
  .dimensions input { margin-top: auto; }
  #shape-warning:empty { display: none; }
  #shape-warning { min-height: 0; font-size: 10px; margin: 5px 0 0; }
  .mode-section { margin-bottom: 9px; }
  .result-col { padding: 12px 16px; min-height: 102px; border: 1px solid #285354; }
  .result-header { font-size: 9px; line-height: 1.2; }
  .diagram,.result-shape,.result-stats,.result-actions,#action-status { display: none; }
  .result-main { padding: 9px 0 0; border: 0; }
  .result-main>span { font-size: 9px; margin-bottom: 2px; }
  .result-main strong { font-size: clamp(34px,10vw,48px); line-height: 1.05; }
  .result-main small { font-size: 15px; }
  .result-price { margin: 9px 0 0; padding: 10px 12px; }
  .result-price>span { font-size: 9px; }
  .result-price strong { font-size: clamp(27px,8vw,40px); }
  .result-price small { font-size: 13px; }
  .result-price p { margin-top: 5px; font-size: 9px; }
  .result-note { font-size: 9px; line-height: 1.25; margin-top: 5px; }
  .disclaimer,footer { display: none; }
}

@media (max-width: 650px) and (max-height: 710px) {
  .workbench { padding-top: 7px; }
  .workbench-head h2 { font-size: 17px; }
  .compact-selects { margin: 7px 0 7px; }
  .field-section { margin-bottom: 6px; }
  input,select { min-height: 34px; height: 34px; }
  .result-col { padding: 9px 14px; }
  .result-main strong { font-size: 34px; }
}

/* Mobile icon dropdown: visual cross-sections, native select retained as fallback. */
@media (max-width:650px){
 .compact-selects{position:relative;z-index:50;align-items:end}
 .compact-selects .shape-choice{min-width:0;position:relative}
 .compact-selects .shape-choice .field-caption{display:block;color:#5e8177;font-size:10px;font-weight:800;margin-bottom:3px}
 .compact-selects .shape-choice.enhanced>select{display:none}
 .compact-selects .shape-choice .shape-picker{position:relative}
 .shape-picker-trigger{display:flex;width:100%;height:38px;min-height:38px;align-items:center;gap:6px;padding:4px 7px;text-align:left;background:#f8fcf9;color:#213c34;border:1px solid #b8d5c9;font-family:inherit;cursor:pointer}
 .shape-picker-icon{width:28px;height:24px;flex:0 0 28px;color:#368b77;display:grid;place-items:center}
 .shape-picker-icon svg{display:block;width:28px;height:24px}
 .shape-picker-name{font-size:12px;line-height:1.2;font-weight:800;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;min-width:0;flex:1}
 .shape-picker-chevron{margin-left:auto;flex:none;font-size:19px;font-weight:800;line-height:1;color:#27443d}
 .shape-picker-list{position:absolute;top:calc(100% + 4px);left:0;width:min(310px,calc(100vw - 26px));max-height:min(72svh,560px);overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;background:#fff;border:1px solid #9ec8b8;box-shadow:0 16px 35px #06261b35;z-index:160;padding:3px}
 .shape-picker-list[hidden]{display:none}
 .shape-picker-option{display:flex;align-items:center;gap:12px;background:#fff;color:#284138;border:0;border-bottom:1px solid #e5eee8;text-align:left;width:100%;min-height:44px;padding:7px 12px;font-family:inherit;font-size:13px;font-weight:750;cursor:pointer}
 .shape-picker-option:last-child{border-bottom:0}
 .shape-picker-option:hover,.shape-picker-option:focus,.shape-picker-option[aria-selected=true]{background:#e9f7f0;outline:none}
 .shape-picker-option[aria-selected=true]{color:#146e55}
 .tolerance-label{display:flex!important}
 .result-tolerance{margin:4px 0 0;padding:6px 0 3px}
 .result-tolerance>span{font-size:9px}
 .result-tolerance>div strong{font-size:clamp(23px,7vw,34px)}
 .result-tolerance>div small{font-size:12px}
}

/* Mobile: full-width grade selector, then tolerance and reference density side by side. */
@media (max-width:650px){
 .fields-two.material-fields{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
 .material-fields .grade-field{grid-column:1/-1}
 .material-fields .reference-density-label{display:flex}
}

/* Pair theoretical and tolerance-adjusted mass in one horizontal result row. */
.result-mass-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:16px;margin-top:16px}
.result-mass-row>.result-main,
.result-mass-row>.result-tolerance{min-width:0;margin:0;padding:12px 0 15px;border-top:0;border-bottom:1px solid #2b5555}
.result-mass-row>.result-tolerance{border-left:1px solid #2b5555;padding-left:16px}
.result-mass-row .result-main>span,
.result-mass-row .result-tolerance>span{font-size:10px;line-height:1.35;min-height:27px;display:block;margin:0 0 8px;color:#98c7b9}
.result-mass-row .result-tolerance>span small{display:inline;font-size:10px;white-space:nowrap}
.result-mass-row .mass-number{display:flex;align-items:baseline;gap:5px;min-width:0}
.result-mass-row .mass-number strong{font-size:clamp(22px,2.7vw,37px);letter-spacing:-.045em;line-height:1.1;font-weight:800;min-width:0;overflow-wrap:anywhere}
.result-mass-row .mass-number small{font-size:12px;line-height:1.1;font-weight:800;padding:0;flex-shrink:0}
@media (max-width:650px){
 .result-mass-row{column-gap:10px;margin-top:4px}
 .result-mass-row>.result-main,.result-mass-row>.result-tolerance{padding:8px 0 9px}
 .result-mass-row>.result-tolerance{padding-left:10px}
 .result-mass-row .result-main>span,.result-mass-row .result-tolerance>span{font-size:9px;line-height:1.25;min-height:23px;margin-bottom:4px}
 .result-mass-row .result-tolerance>span small{font-size:9px}
 .result-mass-row .mass-number{gap:3px}
 .result-mass-row .mass-number strong{font-size:clamp(19px,6.3vw,27px);line-height:1.12}
 .result-mass-row .mass-number small{font-size:11px}
}

