/* Phone-first navigation and expedition layout. Kept separate so touch layout is easy to tune. */
@media (max-width: 560px) {
  .shell {
    display: block;
    min-height: 100vh;
  }

  .rail {
    position: fixed;
    z-index: 30;
    inset: auto 0 0;
    width: auto;
    height: calc(68px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    padding: 5px 8px env(safe-area-inset-bottom, 0px);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    gap: 4px;
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  .brand-mark,
  .rail-spacer {
    display: none;
  }

  .rail-button {
    width: 100%;
    min-width: 0;
    min-height: 52px;
    padding: 4px 2px;
    justify-content: center;
    gap: 3px;
    border-radius: 8px;
    font-size: 10px;
    letter-spacing: 0;
  }

  .rail-button svg {
    width: 20px;
    height: 20px;
  }

  .main-shell {
    width: 100%;
    min-height: 100vh;
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }

  .topbar {
    height: 62px;
    margin: 0 12px;
    gap: 8px;
  }

  .wordmark {
    font-size: 18px;
    letter-spacing: 2px;
  }

  .wordmark span {
    margin-left: 6px;
    font-size: 10px;
    letter-spacing: 1px;
  }

  .top-actions {
    flex-shrink: 0;
    gap: 8px;
  }

  .icon-button {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
  }

  #main {
    padding: 18px 12px 20px;
  }

  .section-heading {
    margin-bottom: 8px;
  }

  .home-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .expedition-panel {
    order: -1;
    padding: 18px;
  }

  .expedition-panel .panel-intro {
    display: none;
  }

  .expedition-panel .fine-line {
    margin: 12px 0;
  }

  .journey-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin: 12px 0;
  }

  .journey-list li {
    flex-direction: column;
    align-items: center;
    gap: 5px;
    text-align: center;
  }

  .journey-list small {
    display: none;
  }

  .step-seal {
    width: 28px;
    height: 28px;
    margin: 2px;
  }

  .journey-list b {
    font-size: 10px;
  }

  .start-button {
    min-height: 54px;
  }

  .battle-art {
    height: 160px;
  }

  .arena-header {
    padding: 8px 10px 0;
    gap: 10px;
  }

  .arena-bottom {
    padding: 6px 10px;
  }

  .enemy-intent-detail {
    display: none;
  }

  .spell-row {
    margin: 6px 0 10px;
  }

  .battle-panel {
    padding: 14px;
  }

  .footer {
    padding: 14px 12px;
  }
}

@media (max-width: 380px) {
  .topbar {
    margin-inline: 10px;
  }

  .wordmark span,
  .wallet-label {
    display: none;
  }

  .top-actions {
    gap: 6px;
  }

  .icon-button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .battle-art {
    height: 145px;
  }
}
