/* Lobby als Filztisch. Gilt nur, solange der Startbildschirm aktiv ist. */

body:has(#screen-home.active) {
  background: #68804a url('../assets/table/felt.webp?v=20261018c') left top / 380px 380px repeat;
  color: #f4ecd8;
  min-height: 100dvh;
  overflow-x: clip;
}
body:has(#screen-home.active) #bg-aurora { display: none; }
body:has(#screen-home.active) #app {
  max-width: none;
  width: min(760px, calc(100vw - 24px));
  margin: 0 auto;
  min-height: calc(100dvh - var(--ng-nav-h, 56px) - 42px);
  padding: 8px 0 calc(12px + var(--safe-bottom) + var(--ng-legal-footer-h, 2rem));
  display: flex;
  align-items: center;
  justify-content: center;
}
body:has(#screen-home.active) .topbar {
  background: rgba(62, 78, 40, .42);
  border-bottom-color: rgba(244, 236, 216, .16);
}
body:has(#screen-home.active) .topbar .icon-btn {
  background: transparent;
  border-color: transparent;
  color: #f4ecd8;
}
body:has(#screen-home.active) .ng-legal-footer {
  background: rgba(48, 62, 32, .55);
  border-top-color: rgba(244, 236, 216, .16);
}

#screen-home.active { display: flex; flex-direction: column; min-height: 0; }
#screen-home .table-home {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  width: 100%;
  max-width: 100%;
  min-height: 0;
}
/* Schmale Ansicht: wie auf dem Tisch verteilt, nicht in einer Reihe. */
#screen-home .props {
  display: grid;
  grid-template-columns: auto auto auto;
  justify-content: center;
  align-items: start;
  column-gap: 12px;
  row-gap: 0;
  width: 100%;
  max-width: 100%;
}
@media (max-width: 899px) {
  #screen-home .prop[data-nav="deck"] {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
    margin-top: 0;
  }
  #screen-home .prop[data-nav="collection"] {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
  }
  #screen-home .prop[data-nav="stats"] {
    grid-column: 3;
    grid-row: 1;
    align-self: start;
  }
  #screen-home .prop[data-nav="shop"] {
    grid-column: 3;
    grid-row: 2;
    align-self: start;
    margin-top: 8px;
  }
}
#screen-home .prop {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  box-shadow: none;
  display: block;
  line-height: 0;
  max-width: 100%;
}
#screen-home .prop[data-nav="deck"] { order: 1; width: min(76px, 22vw); min-width: 0; }
#screen-home .prop[data-nav="deck"] picture { display: block; width: 100%; }
#screen-home .prop[data-nav="collection"] { order: 2; }
#screen-home .prop[data-nav="stats"] { order: 3; }
#screen-home .prop[data-nav="shop"] { order: 4; }
#screen-home .prop img {
  width: 78px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 7px 5px rgba(24, 18, 8, .38));
}
/* Almanach hochkant: Rücken links, Cover zum Betrachter. Keine Drehung. */
#screen-home .prop[data-nav="collection"] img {
  width: min(136px, 38vw);
  height: auto;
  transform: none;
}
#screen-home .prop[data-nav="deck"] img {
  width: 100%;
  height: auto;
}
#screen-home .prop[data-nav="stats"] {
  line-height: normal;
}
#screen-home .stats-slip {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  row-gap: 2px;
  width: min(96px, 28vw);
  box-sizing: border-box;
  padding: 6px 5px 5px 4px;
  color: #2c2416;
  font-family: "Patrick Hand", cursive;
  font-weight: 400;
  line-height: 1.05;
  text-align: left;
  background: #f4e6c4;
  border-radius: 1px 8px 2px 1px;
  box-shadow:
    0 7px 5px rgba(24, 18, 8, .32),
    inset 0 0 0 1px rgba(255, 248, 230, .55);
  position: relative;
  overflow: hidden;
  pointer-events: none;
}
#screen-home .stats-slip::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 9px;
  height: 9px;
  background: linear-gradient(225deg, rgba(104, 128, 74, .0) 49%, #e4d3a6 50%);
  box-shadow: -1px 1px 0 rgba(90, 60, 20, .14);
  border-bottom-left-radius: 1px;
}
#screen-home .stats-slip-title {
  display: block;
  font-size: 8px;
  line-height: 1.2;
  margin: 0 0 2px;
}
#screen-home .stats-slip-main { min-width: 0; }
#screen-home .stats-slip-side {
  min-width: 0;
  margin-top: 1px;
  padding: 2px 1px 0 0;
  text-align: left;
  border-top: 1px dashed rgba(90, 60, 20, .28);
}
#screen-home .stats-slip-meta {
  display: block;
  font-size: 7.5px;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
}
#screen-home .slip-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) minmax(0, 1fr) 8px;
  justify-content: start;
  align-items: center;
  column-gap: 3px;
  font-size: 8px;
  line-height: 1.35;
  white-space: nowrap;
  min-width: 0;
}
#screen-home .slip-name { min-width: max-content; }
#screen-home .slip-win,
#screen-home .slip-loss {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}
#screen-home .slip-win { color: #1a8f84; }
#screen-home .slip-loss { color: #d4534a; }
#screen-home .slip-track {
  display: flex;
  height: 4px;
  border-radius: 1px;
  background: rgba(80, 55, 25, .1);
  overflow: hidden;
}
#screen-home .slip-winbar,
#screen-home .slip-lossbar { display: block; height: 100%; }
#screen-home .slip-winbar { background: #2a9d8f; }
#screen-home .slip-lossbar { background: #e07a6a; }
#screen-home .prop[data-nav="shop"] img {
  width: min(68px, 22vw);
  height: auto;
}
#screen-home .table-play {
  display: grid;
  gap: 8px;
  justify-items: center;
  width: max-content;
  max-width: 100%;
  align-self: center;
}
#screen-home .mode-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
}
#screen-home .home-diff {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}
#screen-home .mode-stack { display: grid; gap: 6px; justify-items: center; }
#screen-home .mode-grid,
#screen-home .tournament-grid {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 6px;
}
#screen-home .mode-card,
#screen-home .tournament-chip,
#screen-home .diff-pill,
#screen-home .table-play-btn {
  appearance: none;
  border: 0;
  border-radius: 0;
  color: #4a2e14;
  font-family: 'Baloo 2', system-ui, sans-serif;
  font-weight: 800;
  cursor: pointer;
  background: url('../assets/table/wood.webp?v=20261018c') center / 100% 100% no-repeat;
  box-shadow: none;
  filter: drop-shadow(0 6px 4px rgba(24, 16, 8, .32));
}
#screen-home .mode-card,
#screen-home .tournament-chip,
#screen-home .table-play-btn {
  aspect-ratio: 884 / 580;
  width: 78px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  font-size: .64rem;
  padding: 0 4px;
}
#screen-home .mode-card small,
#screen-home .tournament-chip small {
  display: block;
  font-family: Nunito, system-ui, sans-serif;
  font-size: .56rem;
  font-weight: 800;
  line-height: 1;
  opacity: .75;
  text-align: center;
}
#screen-home .mode-card:active,
#screen-home .tournament-chip:active,
#screen-home .diff-pill:active,
#screen-home .table-play-btn:active { transform: none; }
#screen-home .tournament-chip.is-locked,
#screen-home .tournament-chip:disabled {
  cursor: default;
  filter: grayscale(.4) opacity(.72);
}
#screen-home .mode-card.active,
#screen-home .diff-pill.active {
  background: url('../assets/table/wood.webp?v=20261018c') center / 100% 100% no-repeat;
  color: #3a2410;
  border: 0;
  filter: brightness(.86) drop-shadow(0 3px 2px rgba(24, 16, 8, .35));
}
#screen-home .diff-pill {
  width: 86px;
  min-height: 48px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 4px 6px;
  font-family: Nunito, system-ui, sans-serif;
  font-size: .68rem;
  line-height: 1.05;
}
#screen-home .diff-name { font-weight: 800; }
#screen-home .diff-reward { font-size: .58rem; opacity: .85; color: inherit; }
#screen-home .diff-pill .nashcoin { color: #6a3e12; }
#screen-home .table-play-btn { width: 128px; font-size: .92rem; }
#screen-home .diff-hint {
  margin: 0;
  max-width: 240px;
  text-align: center;
  color: #f4ecd8;
  font-size: .72rem;
  text-shadow: 0 1px 1px rgba(24, 16, 8, .35);
}
#screen-home .paper {
  align-self: center;
  width: min(calc(100% - 8px), 420px);
  min-height: 0;
  max-height: min(52dvh, 560px);
  overflow: auto;
  color: #3d2b16;
  padding: 16px 16px 14px 22px;
  background-color: #f6efd4;
  background-image:
    linear-gradient(#e7b2b2, #e7b2b2),
    repeating-linear-gradient(#f6efd4, #f6efd4 25px, rgba(120, 146, 176, .28) 26px);
  background-size: 2px 100%, 100% 26px;
  background-position: 14px 0, 0 34px;
  background-repeat: no-repeat, repeat;
  border-radius: 2px 2px 3px 2px;
  box-shadow: 1px 2px 0 rgba(255,255,255,.45) inset, 0 12px 16px rgba(40, 24, 8, .28);
  transform: rotate(-1.5deg);
  position: relative;
  font-family: "Patrick Hand", cursive;
  user-select: none;
}
#screen-home .paper::after { content: none; }
#screen-home .paper h2 {
  margin: 0 0 8px;
  font-family: "Patrick Hand", cursive;
  font-size: 1.55rem;
  font-weight: 400;
  line-height: 1;
  color: #3d2b16;
}
#screen-home .rooms-online { color: rgba(61, 43, 22, .7); font-weight: 400; }
#screen-home .join-row { display: flex; gap: 8px; align-items: center; }
#screen-home .join-row input {
  flex: 1;
  min-width: 0;
  border: 0;
  border-bottom: 1.5px solid rgba(61, 43, 22, .35);
  border-radius: 0;
  background: transparent;
  padding: 4px 2px;
  font-family: inherit;
  font-size: 1.2rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #3d2b16;
  outline: none;
  box-shadow: none;
  user-select: text;
}
#screen-home .join-row input:focus { outline: none; box-shadow: none; }
#screen-home .join-row input::placeholder { color: rgba(61, 43, 22, .45); letter-spacing: 0; text-transform: none; }
#screen-home .join-row button,
#screen-home .paper .room-row .btn {
  border: 1.5px solid #6d4420;
  border-radius: 999px;
  background: transparent;
  color: #6d4420;
  font-family: inherit;
  font-weight: 400;
  font-size: 1.05rem;
  padding: 2px 10px;
  box-shadow: none;
  cursor: pointer;
}
#screen-home .paper .rooms-list { gap: 2px; }
#screen-home .paper .rooms-list > .muted,
#screen-home .paper .room-host { color: rgba(61, 43, 22, .62); }
#screen-home .paper .room-row {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 3px 0;
  color: #3d2b16;
  font-size: 1.15rem;
  gap: 6px;
}
#screen-home .paper .pill {
  background: transparent;
  border: 0;
  color: #6d4420;
  border-radius: 0;
  padding: 0;
  font-family: inherit;
  font-weight: 400;
  font-size: 1.05rem;
}
#screen-home .paper .room-vis { color: #6d4420; }

@media (min-width: 900px) {
  body:has(#screen-home.active) #app {
    width: min(1100px, calc(100vw - 32px));
  }
  /* props lösen sich auf, die Knöpfe sitzen direkt im Tischraster. */
  #screen-home .props { display: contents; }
  #screen-home .table-home {
    display: grid;
    width: max-content;
    max-width: 100%;
    margin-inline: auto;
    /* Stapel | Filz | Buch | Filz | Statistik/Münzen */
    grid-template-columns: max-content 100px 184px 28px 156px;
    grid-template-rows: auto auto 44px auto;
    column-gap: 0;
    row-gap: 6px;
    align-items: start;
    justify-items: center;
    justify-content: center;
  }
  #screen-home .prop[data-nav="deck"] {
    grid-column: 1;
    grid-row: 1 / span 3;
    justify-self: start;
    align-self: start;
    width: 250px;
    margin-top: 0;
    margin-left: 0;
  }
  #screen-home .prop[data-nav="collection"] {
    grid-column: 3;
    grid-row: 1 / span 2;
    justify-self: center;
    align-self: end;
  }
  #screen-home .prop[data-nav="stats"] {
    grid-column: 5;
    grid-row: 1;
    justify-self: center;
    align-self: start;
    position: relative;
    z-index: 1;
  }
  #screen-home .prop[data-nav="shop"] {
    grid-column: 5;
    grid-row: 2;
    justify-self: center;
    align-self: start;
    margin-top: 6px;
    position: relative;
    z-index: 2;
  }
  #screen-home .table-play {
    grid-column: 1;
    grid-row: 4;
    justify-self: start;
    align-self: start;
  }
  #screen-home .paper {
    grid-column: 3 / span 3;
    grid-row: 4;
    width: 100%;
    max-width: none;
    max-height: min(64dvh, 560px);
    justify-self: stretch;
    align-self: start;
  }
  #screen-home .prop[data-nav="deck"] img { width: 100%; height: auto; }
  #screen-home .prop[data-nav="collection"] img { width: 172px; height: auto; }
  #screen-home .stats-slip { width: 150px; padding: 8px 8px 7px 7px; row-gap: 3px; }
  #screen-home .stats-slip::after { width: 12px; height: 12px; }
  #screen-home .stats-slip-title { font-size: 13px; margin-bottom: 3px; }
  #screen-home .stats-slip-meta { font-size: 11px; }
  #screen-home .slip-row { font-size: 10px; line-height: 1.35; column-gap: 4px; grid-template-columns: max-content minmax(0, 1fr) minmax(0, 1fr) 12px; }
  #screen-home .slip-track { height: 5px; }
  #screen-home .prop[data-nav="shop"] img { width: 92px; height: auto; }
}

/* Kurzes Desktop-Fenster: gleiche Plätze, kleinere Gegenstände. */
@media (min-width: 900px) and (max-height: 640px) {
  #screen-home .table-home {
    grid-template-columns: max-content 56px 128px 16px 112px;
    grid-template-rows: auto auto 16px auto;
  }
  #screen-home .prop[data-nav="deck"] { width: 168px; margin-top: 0; }
  #screen-home .prop[data-nav="collection"] img { width: 118px; }
  #screen-home .stats-slip { width: 112px; padding: 5px 5px 4px 4px; row-gap: 2px; }
  #screen-home .stats-slip-title { font-size: 9px; }
  #screen-home .stats-slip-meta { font-size: 8px; }
  #screen-home .slip-row { font-size: 8px; line-height: 1.3; grid-template-columns: max-content minmax(0, 1fr) minmax(0, 1fr) 8px; }
  #screen-home .prop[data-nav="shop"] img { width: 68px; }
  #screen-home .prop[data-nav="shop"] { margin-top: 4px; }
  #screen-home .paper { padding: 10px 10px 8px 18px; }
  #screen-home .paper h2 { font-size: 1.25rem; }
}

/* Vertikaler Flip um die waagerechte Achse (rotateX): oben und unten
   tauschen. Der Schatten bleibt am Knopf und zeigt weiter nach unten.
   Aktiv = Walnuss. Nur Modus-Karten und die drei Schwierigkeits-Chips. */
#screen-home .mode-card,
#screen-home .diff-pill {
  position: relative;
  background: transparent;
  color: #4a2e14;
  transform: none;
  filter: drop-shadow(0 6px 4px rgba(24, 16, 8, .32));
  overflow: visible;
}
#screen-home .mode-card:active,
#screen-home .diff-pill:active,
#screen-home .mode-card.active,
#screen-home .diff-pill.active,
#screen-home .mode-card.active:active,
#screen-home .diff-pill.active:active {
  background: transparent;
  color: #4a2e14;
  border: 0;
  transform: none;
  filter: drop-shadow(0 6px 4px rgba(24, 16, 8, .32));
}
#screen-home .mode-card .wood-face,
#screen-home .diff-pill .wood-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
  background: url('../assets/table/wood.webp?v=20261018c') center / 100% 100% no-repeat;
  transform: perspective(980px) rotateX(0deg);
  transform-origin: center center;
  transition: transform .48s ease-in-out, opacity 0s linear .24s;
}
#screen-home .diff-pill .wood-face {
  gap: 1px;
  padding: 4px 6px;
}
#screen-home .mode-card .wood-face { padding: 0 5px; }
#screen-home .mode-card .wood-front,
#screen-home .diff-pill .wood-front {
  opacity: 1;
  color: #4a2e14;
}
#screen-home .mode-card .wood-back,
#screen-home .diff-pill .wood-back {
  opacity: 0;
  transform: perspective(980px) rotateX(0deg) scaleY(-1);
  color: #fff6ea;
  background: url('../assets/table/wood-dark.webp?v=20261019d') center / 100% 100% no-repeat;
}
#screen-home .mode-card.active .wood-front,
#screen-home .diff-pill.active .wood-front {
  opacity: 0;
  transform: perspective(980px) rotateX(180deg);
}
#screen-home .mode-card.active .wood-back,
#screen-home .diff-pill.active .wood-back {
  opacity: 1;
  transform: perspective(980px) rotateX(180deg) scaleY(-1);
}
#screen-home .mode-card .wood-back small {
  opacity: 1;
  color: #fff6ea;
}
#screen-home .diff-pill .wood-back .diff-name { color: #fff8ef; }
#screen-home .diff-pill .wood-back .diff-reward {
  opacity: 1;
  color: #f4e6cc;
}
#screen-home .diff-pill .wood-back .nashcoin { color: #ffe7b0; }
