/* Mobile only. The desktop stylesheet and its palette remain unchanged. */
@media (width < 1024px) {
  :root {
    --mobile-nav-height: 68px;
    --mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
  }
  html {
    scroll-padding-top: 90px;
    scroll-padding-bottom: calc(150px + var(--mobile-safe-bottom));
  }
  body {
    font-size: 16px;
    line-height: 1.65;
    -webkit-text-size-adjust: 100%;
  }
  header {
    height: auto;
    min-height: 72px;
    padding: 12px max(18px, env(safe-area-inset-left));
    gap: 12px;
    flex-wrap: nowrap;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  header .nav {
    display: none;
  }
  .brand {
    font-size: 22px;
    letter-spacing: 2px;
    min-height: 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-shrink: 0;
  }
  .brand small {
    font-size: 10px;
  }
  .mobile-header-actions[hidden] {
    display: flex;
    align-items: center;
    gap: 4px;
  }
  .mobile-header-actions a {
    padding: 8px 10px;
    text-decoration: none;
    font-size: 14px;
  }
  main {
    width: 100%;
    max-width: 720px;
    padding: 22px max(18px, env(safe-area-inset-left)) 32px;
  }
  main > *,
  .columns > *,
  .grid > *,
  .row > * {
    min-width: 0;
  }
  h1 {
    font-size: 34px;
    line-height: 1.25;
    letter-spacing: 0.5px;
    margin-bottom: 22px;
  }
  h2 {
    font-size: 24px;
    letter-spacing: 0;
  }
  h3 {
    font-size: 19px;
  }
  p,
  td,
  .rank span {
    overflow-wrap: anywhere;
  }
  .eyebrow {
    font-size: 12px;
    letter-spacing: 2px;
  }
  button,
  a.btn,
  input:not([type="checkbox"]),
  select {
    min-height: 44px;
  }
  a,
  summary {
    min-height: 44px;
    min-width: 44px;
  }
  main a:not(.btn),
  footer a {
    display: inline-flex;
    align-items: center;
    padding-block: 8px;
  }
  button,
  a.btn {
    min-width: 44px;
    border-radius: 14px;
    padding: 12px 18px;
    font-size: 16px;
    font-weight: 600;
    transition:
      transform 140ms ease,
      opacity 140ms ease;
  }
  button:active,
  a.btn:active,
  .mobile-bottom-nav a:active {
    transform: scale(0.97);
    opacity: 0.8;
  }
  button:disabled {
    transform: none;
  }
  .primary {
    min-height: 50px;
  }
  .row {
    flex-wrap: wrap;
    gap: 12px;
  }
  .grid,
  .columns,
  .stats,
  .admin-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  .panel,
  .card {
    border-radius: 22px;
  }
  .panel {
    padding: 20px;
    margin-bottom: 18px;
  }
  .section {
    margin: 30px 0;
  }
  .card img {
    height: auto;
    aspect-ratio: 4 / 3;
    display: block;
  }
  .card > a {
    display: block !important;
    padding: 0 !important;
  }
  .card article {
    padding: 20px;
  }
  .card h3 a {
    padding: 0;
  }
  .card .tagline {
    font-size: 14px;
    gap: 8px;
  }
  .card .row:last-child .btn {
    margin-left: auto;
  }
  .chips,
  .tabs {
    gap: 8px;
    margin: 16px 0;
  }
  .tabs button {
    flex: 1 1 130px;
  }
  .chip {
    font-size: 13px;
    padding: 5px 12px;
  }
  .hero {
    padding: 28px 22px;
    min-height: 330px;
    margin-bottom: 24px;
    border-radius: 24px;
  }
  .hero img {
    width: 100%;
  }
  .hero h1 {
    font-size: clamp(32px, 7vw, 42px);
    max-width: 430px;
    letter-spacing: 0.5px;
  }
  .hero .btn {
    margin-top: 6px;
  }
  .hero .eyebrow {
    font-size: 11px;
  }
  .announcement {
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 18px;
  }
  .gallery {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    overflow: visible;
  }
  .gallery img {
    max-width: 100%;
    width: 100%;
    max-height: 360px;
    aspect-ratio: 1;
    border-radius: 22px;
  }
  main[data-page="singer"] {
    padding-bottom: 90px;
  }
  main[data-page="singer"] .gallery img:not(:first-child) {
    max-height: 240px;
    aspect-ratio: 4 / 3;
  }
  .gift {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: 12px;
    text-align: left;
    padding: 16px;
    min-height: 76px;
  }
  .gift span {
    font-size: 16px;
  }
  .stat {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
  }
  .stat strong {
    font-size: 32px;
  }
  .stat span {
    font-size: 14px;
  }
  .stats {
    margin-bottom: 20px;
  }
  .warning {
    border-radius: 16px;
    padding: 16px;
    font-size: 14px;
  }
  .rank {
    gap: 12px;
    padding: 16px 0;
  }
  .rank span {
    flex: 1;
  }
  .rank strong {
    flex-shrink: 0;
  }
  label {
    font-size: 15px;
    gap: 8px;
  }
  input,
  select,
  textarea {
    font-size: 16px;
    border-radius: 13px;
    padding: 13px;
  }
  input[type="checkbox"] {
    width: 24px;
    height: 24px;
    margin: 10px;
  }
  label:has(input[type="checkbox"]) {
    min-height: 44px;
    align-items: center;
    grid-template-columns: 1fr auto;
  }
  form {
    gap: 18px;
  }
  form .error:empty {
    display: none;
  }
  form > button[type="submit"] {
    width: 100%;
    position: sticky;
    bottom: 0;
    z-index: 1;
  }
  .form-help {
    font-size: 14px;
  }
  dialog {
    width: calc(100% - 20px);
    max-width: 600px;
    max-height: calc(100dvh - 24px - var(--mobile-safe-bottom));
    border-radius: 26px;
    padding: 20px;
    overscroll-behavior: contain;
  }
  .close {
    width: 44px;
    height: 44px;
    margin: -6px -6px 8px 8px;
    border-radius: 50%;
  }
  .admin-nav {
    display: none;
  }
  .mobile-admin-select[hidden] {
    display: grid;
    margin-bottom: 22px;
  }
  .table-wrap {
    overflow: visible;
  }
  .table-wrap table,
  .table-wrap tbody {
    display: block;
    width: 100%;
  }
  .table-wrap thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .table-wrap tbody tr {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .table-wrap tbody tr:last-child {
    border-bottom: 0;
  }
  .table-wrap td {
    display: block;
    padding: 9px 0;
    border: 0;
    font-size: 15px;
  }
  .table-wrap td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 13px;
  }
  .table-wrap td > * {
    min-width: 0;
  }
  .table-wrap td button,
  .table-wrap td a {
    grid-column: 2;
    width: 100%;
    margin: 2px 0;
    font-size: 15px;
  }
  .table-wrap td[colspan] {
    display: block;
  }
  .table-wrap td[colspan]::before {
    content: none;
  }
  .table-wrap td details {
    grid-column: 2;
  }
  .table-wrap td summary {
    cursor: pointer;
    display: flex;
    align-items: center;
  }
  footer {
    padding: 24px 20px
      calc(var(--mobile-nav-height) + var(--mobile-safe-bottom) + 28px);
    font-size: 13px;
  }
  body:has(main[data-page="singer"]) footer {
    padding-bottom: calc(150px + var(--mobile-safe-bottom));
  }
  .mobile-bottom-nav[hidden] {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    height: calc(var(--mobile-nav-height) + var(--mobile-safe-bottom));
    padding: 6px max(8px, env(safe-area-inset-right))
      calc(6px + var(--mobile-safe-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: #100e1aee;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
  }
  .mobile-bottom-nav a {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    min-width: 44px;
    min-height: 50px;
    text-decoration: none;
    color: var(--muted);
    border-radius: 14px;
    transition: transform 140ms ease;
  }
  .mobile-bottom-nav svg {
    width: 23px;
    height: 23px;
  }
  .mobile-bottom-nav span {
    font-size: 12px;
    line-height: 1.4;
    font-weight: 500;
  }
  .mobile-bottom-nav [aria-current="page"] {
    color: var(--pink);
    background: var(--panel);
  }
  .mobile-bottom-nav [aria-current="page"] span {
    font-weight: 700;
  }
  .mobile-gift-action[hidden] {
    display: flex;
    position: fixed;
    left: 18px;
    right: 18px;
    bottom: calc(var(--mobile-nav-height) + var(--mobile-safe-bottom) + 10px);
    z-index: 25;
  }
  .mobile-gift-action button {
    width: 100%;
  }
  #toast {
    bottom: calc(var(--mobile-nav-height) + var(--mobile-safe-bottom) + 76px);
    width: max-content;
    max-width: calc(100% - 36px);
    border-radius: 16px;
    font-size: 15px;
  }
  @media (prefers-reduced-motion: reduce) {
    button,
    a.btn,
    .mobile-bottom-nav a {
      transition: none;
    }
  }
}
