.unit-panel button {
  width: 100%;
  margin-top: 5px;
  padding: 6px 8px;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(#ff7248, #d93832);
  box-shadow: 0 3px 0 #912521;
  font-size: 12px;
}

.unit-panel button:disabled {
  color: #57717f;
  background: #d7e4e8;
  box-shadow: 0 3px 0 #9bb1b8;
}

@media (max-width: 700px), (max-height: 500px) {
  .unit-panel button {
    display: inline-block;
    width: auto;
    margin: 0 0 0 4px;
    padding: 4px 7px;
    font-size: 10px;
  }
}

/* Portrait mobile layout: preserve the original landscape physics field while
   presenting the whole game in a full-height vertical interface. */
@media (orientation: portrait) {
  html, body {
    min-height: 100%;
    min-height: 100dvh;
    background: #087cc1 url("images/underwater.png") center / cover no-repeat;
  }

  body.portrait-ui::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    background: linear-gradient(180deg, rgba(7, 55, 95, .16), rgba(0, 33, 65, .38));
    pointer-events: none;
  }

  body.portrait-ui #stage { z-index: 1; }
  body.portrait-ui #GameCanvas {
    position: absolute !important;
    border-block: 3px solid rgba(255, 255, 255, .7);
    box-shadow: 0 10px 28px rgba(0, 24, 48, .38);
  }
  body.portrait-ui #orientation { display: none !important; }

  body.portrait-ui .unit-panel {
    top: 50%;
    width: calc(100vw - 34px);
    max-width: 380px;
    padding: 18px 16px 20px;
    transform: translate(-50%, -50%);
    border-radius: 24px;
  }
  body.portrait-ui .unit-panel label {
    display: block;
    margin-bottom: 10px;
    font-size: 17px;
  }
  body.portrait-ui .unit-panel select {
    display: block;
    width: 100%;
    max-width: none;
    padding: 12px;
    font-size: 16px;
  }
  body.portrait-ui .unit-panel button {
    display: block;
    width: 100%;
    margin: 12px 0 0;
    padding: 13px 12px;
    border-radius: 14px;
    font-size: 15px;
  }

  body.portrait-ui .vocab-hud {
    top: max(8px, env(safe-area-inset-top));
    flex-direction: column;
    gap: 5px;
    width: calc(100vw - 16px);
    padding: 7px 8px;
    border-width: 2px;
    border-radius: 18px;
  }
  body.portrait-ui .hud-stats {
    width: 100%;
    justify-content: center;
    gap: 5px;
  }
  body.portrait-ui .hud-stats span {
    flex: 1;
    padding: 6px 4px;
    font-size: 11px;
    text-align: center;
  }
  body.portrait-ui .hud-prompt {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }
  body.portrait-ui .hud-prompt strong {
    display: block;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body.portrait-ui #speakButton {
    flex: none;
    padding: 7px 9px;
    font-size: 11px;
  }
  body.portrait-ui .feedback {
    top: max(94px, calc(env(safe-area-inset-top) + 86px));
    width: calc(100vw - 28px);
    font-size: 13px;
  }
  body.portrait-ui .fish-vocab-badge {
    min-width: 40px;
    min-height: 40px;
    border-width: 3px;
  }
  body.portrait-ui .word-burst {
    top: 55%;
    width: min(250px, 86vw);
  }
  body.portrait-ui .result-card {
    width: calc(100vw - 28px);
    max-height: calc(100dvh - 28px);
    padding: 18px;
  }
}
