/* Zusätzliche Verdichtung für die Bedienung auf kleinen Bildschirmen. */
.event-grand-total { display: table-row; }

@media (max-width: 700px) {
  .event-grand-total { display: table-row; }

  .account-actions {
    flex-direction: column;
    align-items: flex-end;
    gap: .2rem;
  }

  .account-actions .header-profile {
    display: inline-flex;
  }

  .account-actions .header-avatar {
    width: 2rem;
    height: 2rem;
  }
  /* Formulare bleiben gut antippbar, verbrauchen aber zwischen den Feldern weniger Raum. */
  .scan-form > .grid,
  .scan-form > .team-matchup,
  .scan-form > label,
  .user-edit-section,
  .login-form label {
    margin-top: .4rem;
    margin-bottom: .4rem;
  }

  .scan-form > h2,
  .user-edit-section h2 {
    margin-top: .8rem;
    margin-bottom: .45rem;
  }

  .scan-upload-options {
    margin: .6rem 0;
  }

  .scan-upload-options label {
    margin: .4rem 0;
  }

  .scan-preview > h2,
  .new-scan-preview > h2 {
    margin: .7rem 0 .4rem;
  }

  /* Zwei zusammengehörige Aktionen passen nebeneinander; eine einzelne bleibt groß. */
  .scan-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem;
  }

  .scan-actions > * {
    min-width: 0;
    width: 100%;
    white-space: normal;
  }

  .scan-actions > :only-child {
    grid-column: 1 / -1;
  }

  .new-scan-preview img,
  .scan-preview > img,
  .managed-scan {
    margin-left: auto;
    margin-right: auto;
  }

  /* Zeitangaben sind am Seitenende schnell erfassbar und umbrechen sauber. */
  .game-timestamps {
    display: grid;
    gap: .3rem;
    margin: .65rem 0 0;
    padding: .6rem .7rem;
    font-size: .82rem;
    line-height: 1.4;
  }

  /* Bearbeitungstabellen werden auf dem Handy vollständig in der Kartenbreite angezeigt. */
  .scan-form .table,
  .game-editor .table {
    overflow: hidden;
    max-width: 100%;
  }

  .scan-form .table .stats,
  .game-editor .table .stats {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    table-layout: fixed;
    font-size: .78rem;
  }

  .scan-form .table .stats th,
  .scan-form .table .stats td,
  .game-editor .table .stats th,
  .game-editor .table .stats td {
    padding: .42rem .3rem;
  }

  .scan-form .table .stats th:first-child,
  .scan-form .table .stats td:first-child,
  .game-editor .table .stats th:first-child,
  .game-editor .table .stats td:first-child {
    min-width: 0;
  }

  /* Auf sehr schmalen Geräten bleibt die öffentliche Ergebnistabelle lesbar. */
  .game-results th,
  .game-results td {
    font-size: .92rem;
  }
}

@media (max-width: 380px) {
  .scan-actions {
    grid-template-columns: 1fr;
  }

  .scan-actions > :only-child {
    grid-column: auto;
  }

  .game-results th,
  .game-results td {
    font-size: .86rem;
  }

  .game-results th:first-child,
  .game-results td:first-child {
    padding-left: .25rem;
    padding-right: .15rem;
  }
}

@media (max-width: 700px) {
  .scan-form .stats th:first-child,
  .scan-form .stats td:first-child,
  .game-editor .stats th:first-child,
  .game-editor .stats td:first-child {
    width: 29%;
  }

  .scan-form .stats th:nth-child(n+2):nth-child(-n+6),
  .scan-form .stats td:nth-child(n+2):nth-child(-n+6),
  .game-editor .stats th:nth-child(n+2):nth-child(-n+6),
  .game-editor .stats td:nth-child(n+2):nth-child(-n+6) {
    width: 11%;
  }

  .scan-form .stats th:last-child,
  .scan-form .stats td:last-child,
  .game-editor .stats th:last-child,
  .game-editor .stats td:last-child {
    width: 16%;
    border-left: 2px solid #b8cfbd;
    padding-left: .3rem;
  }

  .scan-form .stats tbody td:nth-child(n+2):nth-child(-n+6) input,
  .game-editor .stats tbody td:nth-child(n+2):nth-child(-n+6) input {
    width: calc(100% - .2rem);
    min-width: 0 !important;
    max-width: calc(100% - .2rem);
    margin-left: 0;
    margin-right: .2rem;
  }

  .scan-form .stats tfoot th,
  .scan-form .stats tfoot td,
  .game-editor .stats tfoot th,
  .game-editor .stats tfoot td {
    background: #e5f2e7;
    font-weight: 700;
  }

  .editor-actions button,
  .editor-actions .delete-form button {
    min-height: 40px !important;
    height: 40px !important;
    max-height: 40px;
    padding-top: .3rem;
    padding-bottom: .3rem;
    align-self: start;
  }

  .editor-actions,
  .editor-actions .delete-form {
    align-items: start;
  }

  .editor-actions > button,
  .editor-actions > form {
    flex: 0 0 auto !important;
  }

  .editor-actions .delete-form {
    min-height: 40px;
    height: 40px;
  }

  .scan-form .stats th:last-child,
  .scan-form .stats td:last-child,
  .game-editor .stats th:last-child,
  .game-editor .stats td:last-child {
    padding-left: .45rem;
    padding-right: .4rem;
  }
}
