/* krampusvideos.at: Handy-Anpassung für hPage
   Teil 1 wirkt nur am Handy hochkant (bis 600 px Breite).
   Teil 2 wirkt in der ganzen mobilen Ansicht von hPage.
   Am PC bleibt alles unverändert. */

/* ===== Teil 1: Videos ===== */
@media (max-width: 600px) {

  /* Bilder nicht breiter als der Bildschirm */
  .hpage_content img {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Einzelne Videos außerhalb von Tabellen: volle Breite, 16:9 */
  .hpage_content iframe[src*="youtube"] {
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9 !important;
  }

  /* Videotabellen auf volle Breite */
  .hpage_content table:has(iframe[src*="youtube"]) {
    width: 100% !important;
    margin: 0 !important;
  }

  /* Tabelle in eine Spalte umbauen */
  .hpage_content table:has(iframe[src*="youtube"]) tbody {
    display: flex !important;
    flex-direction: column !important;
  }
  .hpage_content table:has(iframe[src*="youtube"]) tr {
    display: contents !important;
  }
  .hpage_content table:has(iframe[src*="youtube"]) td {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
  }
  .hpage_content table:has(iframe[src*="youtube"]) td:not(:has(iframe)) {
    padding-top: 18px !important;
  }

  /* Video volle Breite im Format 16:9, damit YouTube den Vollbild-Button zeigt */
  .hpage_content table:has(iframe[src*="youtube"]) iframe {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9 !important;
  }

  /* Reihenfolge: jede Überschrift direkt über ihrem Video (bis 3 Spalten, 40 Zeilen) */
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(1) > td:nth-child(1) { order: 0; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(1) > td:nth-child(2) { order: 2; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(1) > td:nth-child(3) { order: 4; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(2) > td:nth-child(1) { order: 1; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(2) > td:nth-child(2) { order: 3; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(2) > td:nth-child(3) { order: 5; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(3) > td:nth-child(1) { order: 6; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(3) > td:nth-child(2) { order: 8; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(3) > td:nth-child(3) { order: 10; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(4) > td:nth-child(1) { order: 7; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(4) > td:nth-child(2) { order: 9; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(4) > td:nth-child(3) { order: 11; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(5) > td:nth-child(1) { order: 12; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(5) > td:nth-child(2) { order: 14; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(5) > td:nth-child(3) { order: 16; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(6) > td:nth-child(1) { order: 13; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(6) > td:nth-child(2) { order: 15; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(6) > td:nth-child(3) { order: 17; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(7) > td:nth-child(1) { order: 18; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(7) > td:nth-child(2) { order: 20; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(7) > td:nth-child(3) { order: 22; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(8) > td:nth-child(1) { order: 19; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(8) > td:nth-child(2) { order: 21; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(8) > td:nth-child(3) { order: 23; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(9) > td:nth-child(1) { order: 24; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(9) > td:nth-child(2) { order: 26; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(9) > td:nth-child(3) { order: 28; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(10) > td:nth-child(1) { order: 25; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(10) > td:nth-child(2) { order: 27; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(10) > td:nth-child(3) { order: 29; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(11) > td:nth-child(1) { order: 30; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(11) > td:nth-child(2) { order: 32; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(11) > td:nth-child(3) { order: 34; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(12) > td:nth-child(1) { order: 31; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(12) > td:nth-child(2) { order: 33; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(12) > td:nth-child(3) { order: 35; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(13) > td:nth-child(1) { order: 36; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(13) > td:nth-child(2) { order: 38; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(13) > td:nth-child(3) { order: 40; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(14) > td:nth-child(1) { order: 37; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(14) > td:nth-child(2) { order: 39; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(14) > td:nth-child(3) { order: 41; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(15) > td:nth-child(1) { order: 42; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(15) > td:nth-child(2) { order: 44; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(15) > td:nth-child(3) { order: 46; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(16) > td:nth-child(1) { order: 43; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(16) > td:nth-child(2) { order: 45; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(16) > td:nth-child(3) { order: 47; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(17) > td:nth-child(1) { order: 48; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(17) > td:nth-child(2) { order: 50; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(17) > td:nth-child(3) { order: 52; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(18) > td:nth-child(1) { order: 49; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(18) > td:nth-child(2) { order: 51; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(18) > td:nth-child(3) { order: 53; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(19) > td:nth-child(1) { order: 54; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(19) > td:nth-child(2) { order: 56; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(19) > td:nth-child(3) { order: 58; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(20) > td:nth-child(1) { order: 55; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(20) > td:nth-child(2) { order: 57; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(20) > td:nth-child(3) { order: 59; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(21) > td:nth-child(1) { order: 60; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(21) > td:nth-child(2) { order: 62; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(21) > td:nth-child(3) { order: 64; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(22) > td:nth-child(1) { order: 61; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(22) > td:nth-child(2) { order: 63; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(22) > td:nth-child(3) { order: 65; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(23) > td:nth-child(1) { order: 66; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(23) > td:nth-child(2) { order: 68; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(23) > td:nth-child(3) { order: 70; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(24) > td:nth-child(1) { order: 67; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(24) > td:nth-child(2) { order: 69; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(24) > td:nth-child(3) { order: 71; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(25) > td:nth-child(1) { order: 72; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(25) > td:nth-child(2) { order: 74; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(25) > td:nth-child(3) { order: 76; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(26) > td:nth-child(1) { order: 73; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(26) > td:nth-child(2) { order: 75; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(26) > td:nth-child(3) { order: 77; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(27) > td:nth-child(1) { order: 78; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(27) > td:nth-child(2) { order: 80; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(27) > td:nth-child(3) { order: 82; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(28) > td:nth-child(1) { order: 79; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(28) > td:nth-child(2) { order: 81; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(28) > td:nth-child(3) { order: 83; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(29) > td:nth-child(1) { order: 84; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(29) > td:nth-child(2) { order: 86; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(29) > td:nth-child(3) { order: 88; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(30) > td:nth-child(1) { order: 85; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(30) > td:nth-child(2) { order: 87; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(30) > td:nth-child(3) { order: 89; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(31) > td:nth-child(1) { order: 90; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(31) > td:nth-child(2) { order: 92; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(31) > td:nth-child(3) { order: 94; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(32) > td:nth-child(1) { order: 91; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(32) > td:nth-child(2) { order: 93; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(32) > td:nth-child(3) { order: 95; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(33) > td:nth-child(1) { order: 96; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(33) > td:nth-child(2) { order: 98; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(33) > td:nth-child(3) { order: 100; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(34) > td:nth-child(1) { order: 97; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(34) > td:nth-child(2) { order: 99; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(34) > td:nth-child(3) { order: 101; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(35) > td:nth-child(1) { order: 102; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(35) > td:nth-child(2) { order: 104; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(35) > td:nth-child(3) { order: 106; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(36) > td:nth-child(1) { order: 103; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(36) > td:nth-child(2) { order: 105; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(36) > td:nth-child(3) { order: 107; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(37) > td:nth-child(1) { order: 108; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(37) > td:nth-child(2) { order: 110; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(37) > td:nth-child(3) { order: 112; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(38) > td:nth-child(1) { order: 109; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(38) > td:nth-child(2) { order: 111; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(38) > td:nth-child(3) { order: 113; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(39) > td:nth-child(1) { order: 114; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(39) > td:nth-child(2) { order: 116; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(39) > td:nth-child(3) { order: 118; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(40) > td:nth-child(1) { order: 115; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(40) > td:nth-child(2) { order: 117; }
  .hpage_content table:has(iframe[src*="youtube"]) tr:nth-child(40) > td:nth-child(3) { order: 119; }
}

/* ===== Teil 2: Tabellen ohne Videos (z. B. Passenlisten) ===== */
@media (max-width: 1099px) and (hover: none), (max-width: 1023px) {

  /* Kein kleines Scrollfenster mehr: Tabelle in voller Länge anzeigen */
  .hpage_content table:not(:has(iframe)) {
    display: table !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* Lange zweispaltige Listen: schmale linke Spalte, "Update!" direkt vor dem Namen */
  .hpage_content table:not(:has(iframe)):has(tr:nth-child(10)) tr:has(> td:nth-child(2):last-child) {
    display: flex !important;
    align-items: baseline !important;
    gap: 6px !important;
  }
  .hpage_content table:not(:has(iframe)):has(tr:nth-child(10)) tr:has(> td:nth-child(2):last-child) > td:first-child {
    flex: 0 0 auto !important;
    width: auto !important;
    white-space: nowrap !important;
  }
  .hpage_content table:not(:has(iframe)):has(tr:nth-child(10)) tr:has(> td:nth-child(2):last-child) > td:last-child {
    flex: 1 1 auto !important;
    width: auto !important;
  }

  /* Tabellen mit drei Spalten (z. B. Links): Spalten teilen sich die Breite */
  .hpage_content table:not(:has(iframe)):has(td:nth-child(3)) {
    table-layout: fixed !important;
  }
  .hpage_content table:not(:has(iframe)) img {
    max-width: 100% !important;
    height: auto !important;
  }
}