/* Responsive Umbrueche fuer das Seiten-Layout (schmale Screens, Hochformat,
   flaches Querformat). Bewusst als LETZTE Datei geladen, damit die
   Media-Regeln die Basis-Regeln wie bisher ueberstimmen. */

@media (max-width:1080px){
  .main-area{
    flex-direction:column;
    align-items:center;
  }
  .side{
    flex:auto;
    width:100%;
    flex-direction:row;
    flex-wrap:wrap;
    justify-content:center;
  }
  .left-side {
    order: 1;
  }
  #stage-wrapper {
    order: 2;
    width: 100%;
  }
  #stage {
    min-height: 50vh;
  }
  .right-side {
    order: 3;
  }
  .leaderboard{
    width:100%;
  }
  #hud{
    width:100%;
    flex-direction:row;
    flex-wrap:wrap;
    justify-content:center;
    margin-bottom:0;
  }
  .card{
    width:auto;
    flex:1 1 140px;
    max-width:180px;
  }
  #spectators{
    flex-direction:row;
    flex-wrap:wrap;
    justify-content:center;
  }
}

@media (max-width:720px), (max-height:520px){
  .tag{ display:none; }
  #hint{ display:none; }
  #turnBanner{ display:none !important; }
  /* Das Banner steht über der Bühne im Textfluss – hier nur kompakter, nicht umpositioniert. */
  #banner{ font-size:13px; padding:5px 12px; border-width:2px; margin-bottom:6px; }
}

@media (max-width:720px) and (orientation:portrait){
  body{ padding:8px 10px 10px; gap:8px; overflow-y:auto; }
  header{ margin:0; gap:8px; }
  h1{ font-size:18px; letter-spacing:1px; }

  .main-area{ flex-direction:column; align-items:stretch; gap:8px; }

  .left-side{ order:1; width:100%; flex:none; flex-direction:column; }
  .leaderboard{ width:100%; padding:8px 10px; max-height:30vh; overflow-y:auto; }
  .leaderboard .leg-title{ margin-bottom:5px; }
  #hud{ width:100%; flex-direction:column; flex-wrap:nowrap; justify-content:flex-start; gap:6px; margin:0; }
  .card{ width:100%; flex:none; max-width:none; padding:6px 9px; }

  #stage-wrapper{ order:2; width:100%; flex:none; }
  #stage{ flex:none; width:100%; aspect-ratio:900 / 720; min-height:0; border-radius:14px; }

  .right-side{ order:3; width:100%; flex:none; flex-direction:column; }
  #itemLegend{ width:100%; }
}

@media (max-height:520px) and (orientation:landscape){
  body{ padding:0; gap:0; }
  header{ position:absolute; top:6px; right:8px; width:auto; margin:0; z-index:30; }
  header h1{ display:none; }
  .hbtns{ margin:0; }

  .main-area{ position:relative; gap:0; max-width:none; }

  .left-side{
    position:absolute; top:6px; left:6px; z-index:20;
    width:170px; flex:none; flex-direction:column;
  }

  .right-side{
    position:absolute; top:48px; right:6px; z-index:20;
    width:190px; flex:none; flex-direction:column;
  }
  #itemLegend{
    width:100%; padding:7px 9px; font-size:11px; line-height:1.35;
    max-height:calc(100dvh - 56px); overflow-y:auto;
    background:rgba(12,18,28,.72); backdrop-filter:blur(6px);
  }
  #itemLegend .leg-title{ margin-bottom:5px; font-size:10px; }
  .leg-row{ gap:6px; margin-bottom:4px; }
  .leg-ico{ width:16px; font-size:12px; }
  .leaderboard{
    width:100%; padding:7px 9px; max-height:calc(100dvh - 12px); overflow-y:auto;
    background:rgba(12,18,28,.72); backdrop-filter:blur(6px);
  }
  .leaderboard .leg-title{ margin-bottom:5px; font-size:10px; }
  #hud{ width:100%; flex-direction:column; flex-wrap:nowrap; justify-content:flex-start; gap:6px; margin:0; }
  .card{ width:100%; flex:none; max-width:none; padding:5px 8px; }
  #spectators{ flex-direction:column; flex-wrap:nowrap; }

  #stage-wrapper{ order:0; width:100%; flex:1 1 auto; }
  #stage{ flex:1; width:100%; min-height:0; border-radius:0; border:none; }
}
