/* =====================================================================
   LAYOUT – Anordnung der großen Bereiche (Kopf, Ressourcen, Mitte, Log)
   ===================================================================== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: var(--fs-md); line-height: 1.4;
}

#app { display: grid; height: 100vh;
  grid-template-columns: var(--sidebar-width) 1fr var(--log-width);
  grid-template-rows: auto 1fr;
  grid-template-areas: "head head head" "res main log"; }

#header { grid-area: head; }
#resources { grid-area: res; overflow-y: auto; }
#main { grid-area: main; overflow-y: auto; display: flex; flex-direction: column; min-width: 0; }
#log { grid-area: log; overflow-y: auto; }

#tabs { position: sticky; top: 0; z-index: 5; }
#tab-content { padding: var(--gap-lg); flex: 1; }

/* Tablet: Log unter die Mitte */
@media (max-width: 1150px) {
  #app { grid-template-columns: var(--sidebar-width) 1fr; grid-template-rows: auto 1fr 220px;
    grid-template-areas: "head head" "res main" "res log"; }
}
/* Handy: alles untereinander, Ressourcen einklappbar */
@media (max-width: 760px) {
  #app { display: flex; flex-direction: column; height: auto; min-height: 100vh; }
  #resources { max-height: 38vh; }
  #resources.collapsed { max-height: 44px; overflow: hidden; }
  #log { max-height: 30vh; }
  :root { --btn-width: 100%; }
  #header { gap: 6px 10px; padding: 8px 12px; }
  #header .game-title { font-size: 1.25rem; }
  #header .head-actions { margin-left: auto; }
  #header .head-info { order: 3; flex-basis: 100%; gap: 2px 12px; font-size: 12px; }
}

/* Rechtliches unten rechts – klein, aber immer erreichbar */
#legal { position: fixed; right: 0; bottom: 0; z-index: 50; font-size: 11px; padding: 3px 10px; background: var(--bg, #111); opacity: .8; border-top-left-radius: 6px; }
#legal a { color: var(--text-muted, inherit); text-decoration: none; }
#legal a:hover { opacity: 1; text-decoration: underline; }
@media (max-width: 760px) { #legal { position: static; text-align: center; padding: 8px 0 12px; } }
