#workspace-tabs {
  display: none;
}
@media (max-width: 1024px) {
  :root {
    --topbar-h: 76px;
    --dock-h: 154px;
  }
  body[data-screen="game"] {
    overflow: hidden;
  }
  .app {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    box-sizing: border-box;
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
      env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .main {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: 34px 34px;
    gap: 2px 4px;
    padding: 2px 4px;
    min-height: 0;
  }
  .topbar .brand-button {
    display: none;
  }
  .topbar #readouts {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
    gap: 3px;
    overflow: hidden;
  }
  #readouts > .readout {
    width: auto;
    min-width: 0;
    max-width: none;
    padding: 2px;
    gap: 2px;
    justify-content: center;
  }
  #readouts > .readout > .ico {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
  }
  #readouts > .readout > .value {
    min-width: 0;
    font-size: 12px;
  }
  #readouts > .readout > .label {
    display: none;
  }
  .topbar #spawn-bonuses {
    grid-column: 1;
    grid-row: 2;
    max-width: 104px;
    overflow-x: auto;
  }
  .topbar #top-actions {
    grid-column: 2;
    grid-row: 2;
    max-width: 100%;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    justify-content: flex-end;
    margin: 0;
  }
  #top-actions .btn.icon-only,
  #top-actions .pane-toggles .btn.icon-only {
    width: 28px;
    min-width: 28px;
    height: 28px;
    padding: 2px;
  }
  #stage-head .stage-head {
    display: flex;
    flex-wrap: nowrap !important;
    padding: 3px 5px;
    gap: 3px;
  }
  #stage-head .stage-head .phase {
    flex: 1 1 auto;
    min-width: 0;
  }
  #stage-head .stage-controls {
    flex: 0 0 auto;
    flex-wrap: nowrap !important;
    gap: 2px;
    margin: 0;
  }
  #stage-head .stage-controls .btn {
    min-height: 28px;
    padding: 0 5px;
  }
  #stage-head .phase-label {
    font-size: 10px;
  }
  .bottom-workspace {
    position: relative;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 30px minmax(0, 1fr);
  }
  #workspace-tabs {
    display: flex;
    grid-row: 1;
    gap: 4px;
    padding: 2px 6px;
  }
  #workspace-tabs button {
    flex: 1;
    min-width: 0;
    color: #dce8ff;
    background: #253047;
    border: 1px solid #66748d;
    border-radius: 5px;
    font: inherit;
    font-size: 12px;
  }
  #workspace-tabs button[aria-pressed="true"] {
    color: #fff;
    background: #435a80;
    border-color: #a4caff;
  }
  .bottom-workspace #dock {
    grid-row: 2;
    grid-column: 1;
    grid-template-columns: minmax(0, 1fr) 76px;
    padding: 3px 5px !important;
    gap: 5px !important;
  }
  #dock > .bench-section {
    grid-template-columns: 32px minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr);
  }
  #dock .bench-grid {
    grid-column: 2;
    grid-row: 1;
    grid-template-columns: repeat(5, minmax(40px, 1fr));
    grid-template-rows: none;
    grid-auto-rows: 48px;
    overflow-y: auto;
    overflow-x: hidden;
    align-content: start;
  }
  #dock .bench-label {
    grid-row: 1;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(3, 1fr);
    overflow-y: auto;
  }
  #dock .bench-label > .btn {
    min-height: 28px;
  }
  #reserve-bench.reserve-bench {
    grid-column: 2;
    grid-row: 1;
    display: none;
    min-height: 0;
  }
  #reserve-bench .reserve-slots {
    grid-template-columns: repeat(5, minmax(40px, 1fr));
    grid-template-rows: repeat(2, 44px);
    overflow-y: auto;
    overflow-x: hidden;
  }
  .bottom-workspace #inventory-window {
    display: none;
    position: absolute !important;
    top: 30px;
    bottom: 0;
    left: 4px;
    right: 86px;
    width: auto;
    min-height: 0;
    border: 0;
  }
  .bottom-workspace #inventory-window .inventory-grid {
    height: 100%;
    flex: 1 1 0;
    min-height: 0;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    grid-auto-rows: 44px;
    overflow-y: auto;
    padding: 0 36px 0 0;
  }
  .bottom-workspace #inventory-window .inventory-item,
  .bottom-workspace #inventory-window .owned-item-button {
    height: 44px;
  }
  .bottom-workspace[data-pane="reserve"] #dock .bench-grid {
    display: none;
  }
  .bottom-workspace[data-pane="reserve"] #reserve-bench {
    display: grid;
  }
  .bottom-workspace[data-pane="items"] #dock > .bench-section {
    visibility: hidden;
  }
  .bottom-workspace[data-pane="items"] #inventory-window {
    display: block;
  }
}
@media (max-width: 1024px) and (max-height: 500px) {
  :root {
    --topbar-h: 38px;
    --dock-h: 100px;
  }
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 32px;
  }
  .topbar #readouts {
    grid-column: 1;
    grid-row: 1;
  }
  .topbar #spawn-bonuses {
    display: none;
  }
  .topbar #top-actions {
    grid-column: 2;
    grid-row: 1;
    max-width: 300px;
  }
  #dock .bench-grid {
    grid-template-columns: repeat(10, minmax(44px, 1fr));
  }
}
@media (max-width: 1024px) {
  #readouts > .readout {
    display: flex;
  }
  .topbar #top-actions {
    justify-content: flex-start;
  }
  .topbar #spawn-bonuses {
    max-height: 30px;
    padding: 2px;
  }
  .topbar .spawn-bonus {
    width: 28px;
    min-width: 28px;
    height: 28px;
  }
  #dock .bench-grid,
  #reserve-bench .reserve-slots {
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  }
  #reserve-bench .reserve-slots {
    grid-template-rows: none;
    grid-auto-rows: 44px;
    min-height: 0;
  }
}
@media (max-width: 600px) {
  #stage-head .start-combat {
    font-size: 11px !important;
    padding-inline: 4px !important;
  }
  #stage-head .start-combat .ico {
    display: none;
  }
  #stage-head .stage-controls .btn.icon-only {
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
  }
  #stage-head .segment .btn {
    width: 24px;
    min-width: 24px;
    padding-inline: 2px;
  }
}
@media (min-width: 601px) and (max-width: 1024px) and (max-height: 500px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }
  .topbar #spawn-bonuses {
    display: flex;
    grid-column: 2;
    grid-row: 1;
    max-width: 100px;
  }
  .topbar #top-actions {
    grid-column: 3;
    grid-row: 1;
  }
}

@media (max-width: 1024px) {
  :root:has(.bottom-workspace[data-pane="field"]) {
    --dock-h: 34px;
  }
  .bottom-workspace[data-pane="field"] #dock {
    display: none;
  }
}
