/* Mobile form and symbols step. The existing desktop stylesheet is unchanged. */
@media (max-width: 740px) {
  #dreamForm #hero-dream-input {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
  }

  #hero-dream-input > label {
    white-space: nowrap;
  }

  #hero-dream-input > #memoryLabel {
    max-width: 100%;
    text-align: left;
  }

  #flowScreen .mobile-compact-step .emotion-fieldset {
    margin-top: 0.9rem;
    padding-top: 0.85rem;
  }

  #flowScreen .mobile-compact-step .emotion-fieldset legend {
    margin-bottom: 0.65rem;
  }

  #flowScreen .mobile-compact-step #primaryFeelings {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  #flowScreen .mobile-compact-step #primaryFeelings label {
    min-width: 0;
    min-height: 46px;
    justify-content: flex-start;
    padding: 0.6rem 0.75rem;
    border-radius: 12px;
    text-align: left;
  }

  #flowScreen .mobile-compact-step #nuancedFeelings {
    gap: 0.4rem;
    margin-top: 0.5rem;
  }

  #flowScreen .mobile-compact-step #nuancedFeelings label {
    min-width: 0;
    min-height: 44px;
    padding: 0.55rem 0.7rem;
    font-size: 0.86rem;
  }

  #flowScreen .mobile-compact-step .feelings-disclosure {
    display: block;
    min-height: 44px;
    margin-top: 0.15rem;
    padding-block: 0.5rem;
  }

  #flowScreen .mobile-compact-step .feelings-disclosure::after {
    margin-left: 0.4rem;
    content: "+";
  }

  #flowScreen .mobile-compact-step .feelings-disclosure[aria-expanded="true"]::after {
    content: "−";
  }

  #flowScreen .mobile-compact-step .feeling-extra-actions {
    gap: 0.25rem 0.65rem;
    margin-top: 0.2rem;
  }

  #flowScreen .mobile-compact-step .selected-feelings-summary {
    margin-top: 0.5rem;
  }

  #flowScreen .mobile-compact-step .selected-feeling-chip button {
    min-width: 36px;
    min-height: 44px;
  }

  #flowScreen .mobile-compact-step .mobile-compact-detail {
    margin: 0.75rem 0 0;
    padding: 0;
    overflow: hidden;
    border-radius: 12px;
    background: #f6fafc;
  }

  #flowScreen .mobile-compact-detail-toggle {
    display: flex;
    width: 100%;
    min-height: 48px;
    gap: 0.35rem 0.6rem;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.75rem;
    border: 0;
    color: #173658;
    background: transparent;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 750;
    text-align: left;
  }

  #flowScreen .mobile-compact-detail-toggle::after {
    margin-left: auto;
    content: "+";
    font-size: 1.15rem;
  }

  #flowScreen .mobile-compact-detail-toggle[aria-expanded="true"]::after {
    content: "−";
  }

  #flowScreen .mobile-compact-detail-toggle small {
    color: #50677b;
    font-size: 0.72rem;
    font-weight: 500;
  }

  #flowScreen .mobile-compact-detail-toggle:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: -4px;
  }

  #flowScreen .mobile-compact-detail-panel {
    padding: 0 0.75rem 0.85rem;
  }

  #flowScreen .mobile-compact-detail-panel textarea,
  #flowScreen .mobile-compact-step #customFeelingInput {
    font-size: 16px;
    scroll-margin-bottom: calc(var(--mobile-compact-action-height, 96px) + 1rem);
  }

  #flowScreen .mobile-compact-detail-panel[hidden],
  #flowScreen .mobile-compact-detail-toggle small[hidden],
  .mobile-compact-inline-done[hidden],
  .mobile-compact-action[hidden] {
    display: none !important;
  }

  body.mobile-compact-symbols #flowScreen {
    padding-bottom: calc(var(--mobile-compact-action-height, 96px) + var(--mobile-compact-occluded-height, 0px) + 1rem);
  }

  .mobile-compact-action {
    position: fixed;
    z-index: 80;
    right: 0;
    bottom: var(--cc-banner-height, 0px);
    left: 0;
    padding: 0.65rem max(0.9rem, env(safe-area-inset-right)) max(0.6rem, env(safe-area-inset-bottom)) max(0.9rem, env(safe-area-inset-left));
    border-top: 1px solid #dce3ee;
    color: #173658;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -8px 24px rgba(7, 18, 49, 0.12);
    box-sizing: border-box;
  }

  .mobile-compact-action.has-visual-viewport {
    top: var(--mobile-compact-visible-top);
    right: auto;
    bottom: auto;
    left: var(--mobile-compact-visible-left, 0px);
    width: var(--mobile-compact-visible-width, 100%);
  }

  .mobile-compact-action.is-editing {
    padding-top: 0.5rem;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  }

  .mobile-compact-inline-done {
    min-width: 76px;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #9fb0c5;
    border-radius: 10px;
    color: #173658;
    background: #fff;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 750;
  }

  .mobile-compact-inline-done {
    display: block;
    margin: 0.4rem 0 0.35rem auto;
  }

  .mobile-compact-inline-done:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
  }

  .mobile-compact-action #showResultButton {
    display: block;
    width: 100%;
    max-width: 700px;
    min-height: 48px;
    margin: 0 auto;
    padding: 0.75rem 0.6rem;
    border-radius: 13px;
    font-size: 0.96rem;
    line-height: 1.3;
  }

  .mobile-compact-action-note {
    margin: 0.3rem 0 0;
    color: #55677a;
    font-size: 0.74rem;
    line-height: 1.3;
    text-align: center;
  }

  .mobile-compact-action.is-editing .mobile-compact-action-note {
    display: none;
  }

  body.modal-open .mobile-compact-action {
    visibility: hidden;
  }

  @media (forced-colors: active) {
    .mobile-compact-action {
      border-top: 1px solid CanvasText;
      color: CanvasText;
      background: Canvas;
    }
  }
}
