/* Responsive layouts. Mobile remains the untouched base stylesheet. */

.nav-items {
  display: contents;
}

.nav-settings-button {
  display: none;
}

@media (min-width: 640px) and (min-height: 500px) and (orientation: portrait) {
  #app-root {
    width: 100%;
    max-width: 960px;
    padding-bottom: calc(112px + var(--safe-bottom));
  }

  .bottom-nav {
    width: 100%;
    max-width: 960px;
  }

  .quick-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .reward-gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (min-width: 760px) and (min-height: 500px) and (orientation: landscape) {
  #app-root {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    grid-template-rows: auto minmax(calc(100dvh - 64px), 1fr);
    width: 100%;
    max-width: none;
    min-height: 100dvh;
    margin: 0;
    padding-bottom: 0;
    box-shadow: none;
  }

  .app-header {
    grid-column: 1 / -1;
    grid-row: 1;
    padding-inline: 24px;
  }

  .view-container.active {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    padding: 20px 24px 48px;
  }

  .bottom-nav {
    position: sticky;
    top: 64px;
    bottom: auto;
    left: auto;
    grid-column: 1;
    grid-row: 2;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    width: 84px;
    max-width: none;
    height: calc(100dvh - 64px);
    padding: 10px 6px var(--safe-bottom);
    overflow: hidden;
    transform: none;
    border-top: 0;
    border-right: 1px solid var(--border-light);
    box-shadow: 2px 0 16px rgba(0, 33, 74, 0.06);
  }

  .nav-items {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    padding-bottom: 62px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .nav-settings-button {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    border-top: 1px solid var(--border-light);
  }

  .bottom-nav > .nav-settings-button {
    position: absolute;
    right: 6px;
    bottom: var(--safe-bottom);
    left: 6px;
    width: auto;
  }

  .nav-item {
    flex: 0 0 auto;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    min-height: 58px;
    width: 100%;
    padding: 7px 2px;
    gap: 4px;
  }

  .nav-item .nav-label {
    max-width: 100%;
    font-size: 9px;
    line-height: 1.1;
    text-align: center;
    overflow-wrap: anywhere;
  }

  .nav-item.active::after {
    top: 8px;
    left: 0;
    width: 3px;
    height: calc(100% - 16px);
    border-radius: 0 4px 4px 0;
  }

  .quick-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .reward-gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (min-width: 1200px) and (min-height: 600px) {
  #app-root {
    grid-template-columns: 220px minmax(0, 1fr);
    width: 100%;
    max-width: 1920px;
    margin-inline: auto;
  }

  .bottom-nav {
    align-items: stretch;
    width: 220px;
    padding: 16px 12px var(--safe-bottom);
  }

  .nav-items {
    padding-bottom: 50px;
  }

  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    min-height: 46px;
    padding: 10px 14px;
    gap: 12px;
  }

  .nav-settings-button {
    justify-content: flex-start;
    min-height: 46px;
    padding: 10px 14px;
    gap: 12px;
  }

  .bottom-nav > .nav-settings-button {
    right: 12px;
    left: 12px;
  }

  .nav-item .nav-label {
    max-width: none;
    font-size: 12px;
    text-align: left;
    overflow-wrap: normal;
  }

  .nav-item.active::after {
    top: 8px;
    left: 0;
    width: 3px;
    height: calc(100% - 16px);
  }

  .view-container.active {
    justify-self: center;
    max-width: 1600px;
    padding: 24px clamp(24px, 3vw, 56px) 56px;
  }

  .quick-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    padding-inline: clamp(24px, 3vw, 56px);
  }

  .reward-gallery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
  }
}
