.run {
  height: 100%;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 10px calc(8px + env(safe-area-inset-bottom, 0px));
}

.run-hud, .hud-meters, .goal-strip, .pad, .tools {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.run-hud { justify-content: space-between; }
.run-hud h2 {
  font-size: clamp(1.05rem, 4vw, 1.4rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46vw;
}
.hud-meters { flex: 0 1 auto; justify-content: flex-end; }
.meter { display: grid; justify-items: end; gap: 2px; color: var(--muted); font-size: 0.72rem; }
.meter strong { color: var(--text); font-family: var(--display); font-size: 1rem; }
.pips { display: flex; gap: 3px; }
.pip {
  width: 10px;
  height: 13px;
  border-radius: 50% 50% 46% 46%;
  background: #3a342c;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}
.pip.full { background: radial-gradient(circle at 35% 30%, #fff, #ffe7a3 40%, #e0b15a); }

.goal-strip {
  justify-content: space-between;
  color: var(--highlight);
  font-size: 0.78rem;
  gap: 6px;
}
.goal-strip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.distance {
  flex: 1 1 80px;
  height: 8px;
  border-radius: 999px;
  background: #0e1117;
  overflow: hidden;
  border: 1px solid rgba(255, 197, 49, 0.35);
}
.distance-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--secondary)); }
.hint-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.board-wrap {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  border-radius: 22px;
  overflow: hidden;
  border: 2px solid rgba(255, 197, 49, 0.4);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
  touch-action: none;
}
.board-wrap.flash { box-shadow: inset 0 0 0 4px var(--danger); }
.run-canvas {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  touch-action: none;
}

.run-controls { display: grid; gap: 6px; min-width: 0; }
.pad { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pad-btn, .tool-btn {
  min-width: 0;
  border-radius: 16px;
  padding: 0.55rem 0.2rem 0.4rem;
  color: #2a120c;
  background: linear-gradient(180deg, #ffd7ad, #ff5a32);
  box-shadow: 0 4px 0 #8c140f, inset 0 1px 0 rgba(255, 255, 255, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.pad-btn span, .tool-btn span { font-family: var(--display); font-size: 0.72rem; }
.pad-brace, .tool-btn {
  color: var(--text);
  background: linear-gradient(180deg, #3a4152, #222733);
  box-shadow: 0 4px 0 #0c0e13;
}
.pad-brace.held { background: linear-gradient(180deg, #ffe7a3, #ffc531); color: #3a2504; }
.pad-jump { background: linear-gradient(180deg, #fff1b8, #ffc531); color: #3a2504; box-shadow: 0 4px 0 #8a5a08; }
.tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }

.locked-run { margin: 16px; display: grid; gap: 8px; }

@media (max-height: 640px) {
  .hint-line { display: none; }
  .run-hud h2 { font-size: 1rem; }
}

@media (max-width: 350px) {
  .goal-strip span:first-child { display: none; }
  .pad-btn span { display: none; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .run {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, 190px);
    grid-template-rows: auto auto minmax(0, 1fr);
    column-gap: 8px;
  }
  .run-hud { grid-column: 1; grid-row: 1; }
  .goal-strip { grid-column: 1; grid-row: 2; }
  .hint-line { display: none; }
  .board-wrap { grid-column: 1; grid-row: 3; }
  .run-controls { grid-column: 2; grid-row: 1 / span 3; align-content: end; }
  .pad { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
