/* The same field console, sized in CSS pixels instead of shrunk canvas pixels. */
#field-viewport { display: contents; }
.touch-controls { display: none; }
html[data-mobile] .desktop-controls { display: none; }
html[data-mobile] .touch-controls { display: inline; font-size: 14px; line-height: 1.5; }
.phone-hud, .phone-notice { display: none; }
.phone-panel[hidden], .phone-hud[hidden], .phone-notice[hidden] { display: none !important; }
html[data-mobile] {
  --phone-head: 104px;
  --phone-foot: 154px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  background: var(--front-field);
}
html[data-mobile] body { height: 100dvh; overscroll-behavior: none; background: var(--front-field); }
html[data-mobile] #field-viewport {
  display: block; position: fixed; overflow: hidden;
  inset: calc(var(--safe-top) + var(--phone-head)) var(--safe-right) calc(var(--safe-bottom) + var(--phone-foot)) var(--safe-left);
}
html[data-mobile] #c {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  max-width: none; max-height: none; box-shadow: none;
}
.phone-hud {
  box-sizing: border-box; position: fixed; z-index: 5;
  top: 0; left: 0; right: 0; padding: calc(var(--safe-top) + 8px) calc(var(--safe-right) + 12px) 7px calc(var(--safe-left) + 12px);
  color: var(--front-cream); background: var(--front-housing-deep);
  border-bottom: 1px solid var(--steel-edge, var(--front-housing));
  font: 600 14px/1.15 var(--front-font);
}
html[data-mobile] .phone-hud { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 5px 12px; }
.phone-order { display: flex; align-items: center; gap: 10px; min-width: 0; }
.phone-order b { font-size: 23px; color: var(--front-coral); white-space: nowrap; font-variant-numeric: tabular-nums; }
.phone-order span { display: grid; gap: 3px; min-width: 0; }
.phone-order small { font-size: 12px; letter-spacing: .045em; }
.phone-order strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-actions { display: flex; gap: 6px; }
.phone-actions button, .phone-panel button {
  min-width: 44px; min-height: 44px; padding: 9px 12px; border: 1px solid var(--steel-edge, var(--front-ink));
  border-radius: 4px; color: var(--front-cream); background: var(--front-housing);
  font: 650 14px/1.2 var(--front-font); cursor: pointer; touch-action: manipulation;
}
.phone-meters { grid-column: 1/-1; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 5px 12px; align-items: center; }
.phone-integrity { display: flex; align-items: center; gap: 8px; }
.phone-integrity span { min-width: 70px; font-variant-numeric: tabular-nums; font-size: 13px; }
.phone-integrity progress { flex: 1; width: 40px; height: 7px; }
.phone-wallet { font-size: 13px; white-space: nowrap; color: var(--front-coral); }
.phone-xp { grid-column: 1/-1; display: flex; gap: 8px; align-items: center; font-size: 12px; }
.phone-xp progress { flex: 1; width: 30px; height: 3px; }
.phone-hud progress { border: 0; appearance: none; background: var(--front-field); color: var(--front-teal-deep); border-radius: 0; }
.phone-hud progress::-webkit-progress-bar { background: var(--front-field); }
.phone-hud progress::-webkit-progress-value { background: var(--front-teal-deep); }
.phone-hud progress::-moz-progress-bar { background: var(--front-teal-deep); }
.phone-hud.is-low .phone-integrity { color: var(--front-coral); }
.phone-hud.is-low .phone-integrity progress::-webkit-progress-value { background: var(--front-coral); }
.phone-hud.is-low .phone-integrity progress::-moz-progress-bar { background: var(--front-coral); }
.phone-notice {
  position: fixed; z-index: 4; top: calc(var(--safe-top) + var(--phone-head) + 10px);
  left: calc(var(--safe-left) + 12px); right: calc(var(--safe-right) + 12px);
  max-width: 460px; margin: 0 auto; padding: 9px 12px;
  background: var(--front-housing-deep); color: var(--front-cream);
  border-left: 3px solid var(--front-coral); pointer-events: none;
  font: 600 14px/1.4 var(--front-font);
}
html[data-mobile] .phone-notice { display: block; }
html[data-mobile] .field-touch {
  display: flex; box-sizing: border-box; height: calc(var(--phone-foot) + var(--safe-bottom));
  inset: auto 0 0; padding: 14px calc(var(--safe-right) + 24px) calc(var(--safe-bottom) + 16px) calc(var(--safe-left) + 24px);
  align-items: center; background: var(--front-housing-deep); border-top: 1px solid var(--steel-edge, var(--front-ink));
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
html[data-mobile] .field-stick { flex-shrink: 0; width: 116px; height: 116px; }
html[data-mobile] .field-stick span { font-size: 11px; letter-spacing: .08em; }
html[data-mobile] .field-touch-actions [data-touch-dash] {
  display: grid; align-content: center; gap: 5px; width: 94px; min-height: 94px; border-radius: 50%;
  background: var(--front-housing); color: var(--front-cream); font-size: 18px;
  box-shadow: 0 0 0 5px var(--front-field);
}
.field-touch-actions [data-touch-dash] small { font-size: 12px; font-weight: 550; }
.field-touch-actions [data-touch-dash][aria-disabled="true"] { opacity: .65; }
.field-touch-actions [data-touch-dash]:active { filter: brightness(1.3); }
.phone-touch-help { color: var(--front-rubber); text-align: center; font: 500 12px/1.5 var(--front-font); }
.phone-panel {
  inset: var(--safe-top, 0px) var(--safe-right, 0px) var(--safe-bottom, 0px) var(--safe-left, 0px);
  box-sizing: border-box; width: min(920px, calc(100vw - var(--safe-left, 0px) - var(--safe-right, 0px) - 20px));
  max-width: none; max-height: calc(100dvh - var(--safe-top, 0px) - var(--safe-bottom, 0px) - 20px);
  margin: auto; padding: 0; overflow: hidden; border: 1px solid var(--steel-edge, var(--front-ink));
  border-radius: 5px; background: var(--front-field); color: var(--front-cream); font: 16px/1.4 var(--front-font);
}
.phone-panel[open] { display: flex; flex-direction: column; }
.phone-panel::backdrop { background: #061016e0; }
.phone-panel-head { padding: 14px 16px 12px; flex-shrink: 0; background: var(--front-housing-deep); }
.phone-panel-head > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.phone-panel h1 { margin: 0; font-size: 28px; line-height: 1.1; font-weight: 650; }
.phone-panel h2 { margin: 16px 0 10px; font-size: 20px; font-weight: 650; }
.phone-panel h3 { margin: 0; font-size: 19px; line-height: 1.2; font-weight: 650; }
.phone-panel p { margin: 6px 0 0; }
.phone-panel .front-kicker { font-size: 12px; color: var(--front-coral); margin: 0 0 7px; }
.phone-panel-body { overflow: auto; overscroll-behavior: contain; min-height: 0; padding: 14px; }
.phone-panel-footer { padding: 10px 14px; display: flex; gap: 10px; flex-shrink: 0; border-top: 1px solid var(--steel-edge, var(--front-ink)); background: var(--front-housing-deep); }
.phone-panel-footer button { flex: 1; min-height: 48px; }
.phone-panel button.primary { color: var(--front-field); background: var(--front-coral); border-color: var(--front-coral); }
.phone-panel button:disabled { opacity: .5; cursor: default; }
.phone-panel button:focus-visible { outline: 2px solid var(--front-coral); outline-offset: 2px; }
.phone-panel-tabs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; margin-top: 10px; }
.phone-panel-tabs button { flex: 1; padding-inline: 6px; }
.phone-panel-tabs [aria-pressed="true"] { border-color: var(--front-teal-deep); color: var(--front-teal-deep); }
.phone-cards { display: grid; gap: 12px; }
.phone-card { padding: 14px; border: 1px solid var(--steel-edge, var(--front-housing)); border-radius: 4px; background: var(--front-housing-deep); }
.phone-card-title { display: flex; gap: 12px; align-items: center; }
.phone-card-title img { width: 64px; height: 64px; object-fit: contain; flex-shrink: 0; }
.phone-card small { font-size: 12px; color: var(--front-rubber); }
.phone-card .benefit { color: var(--front-teal-deep); }
.phone-card .cost { color: var(--front-coral); }
.phone-card-actions { display: flex; gap: 8px; margin-top: 12px; }
.phone-card-actions button { flex: 1; }
.phone-card.is-sold { opacity: .65; }
.phone-stats { display: grid; grid-template-columns: 1fr auto; gap: 0 14px; margin: 0; }
.phone-stats dt, .phone-stats dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--steel-edge, var(--front-housing)); }
.phone-stats dd { text-align: right; color: var(--front-teal-deep); font-variant-numeric: tabular-nums; }
.phone-stats small { display: block; color: var(--front-rubber); font-size: 12px; }
html[data-mobile] .front-end { padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left); box-sizing: border-box; }
html[data-mobile] .front-end .front-nav button { min-height: 44px; }
html[data-mobile] .front-topbar { top: var(--safe-top); }
html[data-mobile] :is(.field-pause,.field-workbench) { inset: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left); }
html[data-mobile] .field-pause { max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 20px); }
html[data-mobile] .field-mixer input[type="range"] { min-height: 44px; }
html[data-mobile] .field-check { min-height: 44px; }
html[data-mobile] .field-workbench { max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 20px); width: calc(100vw - var(--safe-left) - var(--safe-right) - 20px); }
html[data-mobile] .workbench-head-side button { min-height: 44px; font-size: 12px; }
html[data-mobile] .workbench-footer small, html[data-mobile] .draft-shortcuts,
html[data-mobile] .workbench-card-top kbd { display: none; }
html[data-mobile] .workbench-footer button { font-size: 14px; }
@media (min-width: 620px) {
  .phone-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (orientation: landscape) {
  html[data-mobile] { --phone-head: 66px; --phone-foot: 0px; }
  html[data-mobile] .phone-hud { grid-template-columns: minmax(160px,1fr) minmax(220px,1.5fr) auto; align-items: center; }
  .phone-hud .phone-meters { grid-column: 2; grid-row: 1; }
  .phone-hud .phone-actions { grid-column: 3; grid-row: 1; }
  html[data-mobile] .field-touch {
    height: auto; padding: 0 calc(var(--safe-right) + 20px) calc(var(--safe-bottom) + 14px) calc(var(--safe-left) + 20px);
    background: transparent; border: 0; align-items: end;
  }
  .phone-touch-help { display: none; }
  html[data-mobile] .phone-notice { max-width: 360px; }
  .phone-panel-head { padding-block: 9px; }
  .phone-panel-head .front-kicker { margin-bottom: 3px; }
  .phone-panel h1 { font-size: 24px; }
  .phone-panel-tabs { margin-top: 5px; grid-template-columns: repeat(6,minmax(0,1fr)); }
  .phone-panel-footer { padding-block: 8px; }
}
@media (max-width: 360px) {
  .phone-touch-help { display: none; }
  html[data-mobile] .field-touch { padding-inline: 16px; }
  html[data-mobile] .phone-hud { padding-inline: 10px; gap: 5px 6px; }
  .phone-actions button { padding-inline: 8px; }
  .phone-order { gap: 6px; }
  .phone-panel-footer { flex-wrap: wrap; }
}
