/* Almanach, Decks, Shop, Statistik, Warteraum, Match und Dialoge auf dem Filztisch. */

body:has(.screen.active) {
  background: #68804a url('../assets/table/felt.webp?v=20261018c') left top / 380px 380px repeat;
  color: #f4ecd8;
}
body:has(.screen.active) #bg-aurora { display: none; }
body:has(.screen.active) .topbar {
  background: rgba(62, 78, 40, .42);
  border-bottom-color: rgba(244, 236, 216, .16);
}
body:has(.screen.active) .topbar .icon-btn {
  background: transparent;
  border-color: transparent;
  color: #f4ecd8;
}
body:has(.screen.active) .ng-legal-footer {
  background: rgba(48, 62, 32, .55);
  border-top-color: rgba(244, 236, 216, .16);
}

.screen.active:not(#screen-home):not(.match-screen) {
  color: #3d2b16;
  background-color: #f6efd4;
  border-radius: 2px 12px 3px 2px;
  box-shadow: 0 14px 18px rgba(40, 24, 8, .28);
  padding: 8px 14px 18px;
}
.screen.active:not(#screen-home):not(.match-screen) h2,
.screen.active:not(#screen-home):not(.match-screen) h3,
.overlay-panel h2,
.tutorial-card h2 {
  font-family: "Patrick Hand", cursive;
  font-weight: 400;
  color: #3d2b16;
}
.screen.active:not(#screen-home):not(.match-screen) .muted,
.screen.active:not(#screen-home):not(.match-screen) .screen-sub,
.screen.active:not(#screen-home):not(.match-screen) .series-meta,
.screen.active:not(#screen-home):not(.match-screen) .almanac-rarity-intro,
.screen.active:not(#screen-home):not(.match-screen) .element-entry-desc,
.screen.active:not(#screen-home):not(.match-screen) .rarity-entry-desc,
.screen.active:not(#screen-home):not(.match-screen) .seat-team,
.screen.active:not(#screen-home):not(.match-screen) .seat-status,
.screen.active:not(#screen-home):not(.match-screen) .room-code-k,
.screen.active:not(#screen-home):not(.match-screen) .stats-bar-row.stats-sub .stats-bar-label,
.screen.active:not(#screen-home):not(.match-screen) .event-progress-label,
.overlay-panel .muted,
.tutorial-card .tutorial-progress,
.tutorial-card .tutorial-text {
  color: rgba(61, 43, 22, .72);
}

body:has(.match-screen.active) .hand-swap,
body:has(.match-screen.active) .result-chip,
body:has(.match-screen.active) .match-log-bar .btn {
  appearance: none;
  border: 0;
  border-radius: 0;
  color: #4a2e14;
  background: url('../assets/table/wood.webp?v=20261018c') center / 100% 100% no-repeat;
  box-shadow: none;
  filter: drop-shadow(0 4px 3px rgba(24, 16, 8, .32));
}
.screen.active:not(#screen-home) .back-btn,
.screen.active:not(#screen-home) .btn-primary,
.screen.active:not(#screen-home) .deck-kind-tab,
.screen.active:not(#screen-home) .stats-tab,
#screen-room .diff-pill,
body:has(.screen.active) .overlay-panel .btn,
body:has(.screen.active) .tutorial-actions .btn,
.screen.active:not(#screen-home) .ready-toggle-ui {
  appearance: none;
  font-family: "Patrick Hand", cursive;
  font-weight: 400;
  color: #3d2b16;
  background: transparent;
  border: 2px dotted #c47a62;
  border-radius: 14px;
  box-shadow: none;
  filter: none;
}
.screen.active:not(#screen-home) .back-btn {
  min-width: 92px;
  height: auto;
  min-height: 36px;
  padding: 2px 14px;
  font-size: 1.15rem;
  line-height: 1.1;
}
.screen.active:not(#screen-home) .btn-primary,
body:has(.screen.active) .overlay-panel > .btn,
body:has(.screen.active) .overlay-actions .btn,
body:has(.screen.active) .tutorial-actions .btn {
  min-height: 35px;
}
.screen.active:not(#screen-home) .deck-kind-tab.active,
.screen.active:not(#screen-home) .stats-tab.active,
#screen-room .diff-pill.active,
#screen-room .ready-toggle input:checked + .ready-toggle-ui {
  background: #8a453440;
  color: #2a1c0c;
  border-color: #8a4534;
  box-shadow: none;
  filter: none;
}
.screen.active:not(#screen-home) .btn-danger,
body:has(.screen.active) .overlay-panel .btn-danger {
  color: #8a2a22;
}
.screen.active:not(#screen-home) .almanac-tabs,
.screen.active:not(#screen-home) .deck-kind-tabs,
.screen.active:not(#screen-home) .stats-tabs {
  background: none;
  border: 0;
  padding: 0;
  gap: 8px;
}

.screen.active:not(#screen-home):not(.match-screen) .stats-bars,
.screen.active:not(#screen-home):not(.match-screen) .room-code-line,
.screen.active:not(#screen-home):not(.match-screen) .seat,
.screen.active:not(#screen-home):not(.match-screen) .deck-current,
.screen.active:not(#screen-home):not(.match-screen) .element-entry,
.screen.active:not(#screen-home):not(.match-screen) .mode-entry,
.screen.active:not(#screen-home):not(.match-screen) .rarity-entry,
.screen.active:not(#screen-home):not(.match-screen) .daily-shop-slot,
.screen.active:not(#screen-home):not(.match-screen) .daily-shop-bundle,
.screen.active:not(#screen-home):not(.match-screen) .series-toolbar,
.screen.active:not(#screen-home):not(.match-screen) .event-progress,
#screen-deck .deck-builder,
.screen.active:not(#screen-home):not(.match-screen) .settings-row {
  background: rgb(from var(--rarity-color) r g b / 30%);
  border-color: rgba(61, 43, 22, .16);
  color: inherit;
}
/* Einzigartig ist der Logo-Regenbogen, nicht das lila Fallback. */
.screen.active:not(#screen-home):not(.match-screen) .rarity-entry.is-unique {
  background: linear-gradient(100deg,
    rgb(255 215 107 / 55%),
    rgb(255 143 143 / 48%),
    rgb(123 92 255 / 42%),
    rgb(56 214 198 / 50%));
  background-clip: padding-box;
  border-color: rgba(61, 43, 22, .16);
  box-shadow: none;
  overflow: hidden;
}
#screen-deck .deck-current {
  background: rgba(255, 255, 255, .45);
  border-color: rgba(109, 68, 32, .28);
}
.screen.active:not(#screen-home) .deck-slot {
  border-color: rgba(61, 43, 22, .28);
  background: rgba(255, 255, 255, .28);
}
.screen.active:not(#screen-home) .deck-slot-empty { color: rgba(61, 43, 22, .45); }
.screen.active:not(#screen-home) .deck-progress { background: rgba(61, 43, 22, .12); }
.screen.active:not(#screen-home) .deck-progress-fill { background: #8a5a12; }
.screen.active:not(#screen-home) .pill {
  background: transparent;
  border: 1px solid rgba(109, 68, 32, .45);
  color: #6d4420;
}
.screen.active:not(#screen-home) .series-label { color: rgba(61, 43, 22, .62); }
.screen.active:not(#screen-home):not(.match-screen) .room-code,
.screen.active:not(#screen-home):not(.match-screen) .event-progress-title,
.screen.active:not(#screen-home):not(.match-screen) .join-row input,
body:has(.screen.active) .info-desc,
body:has(.screen.active) .odds-label {
  color: #3d2b16;
}
.screen.active:not(#screen-home) .series-select,
body:has(.screen.active) .settings-select {
  background-color: rgba(255, 255, 255, .55);
  color: #3d2b16;
  border-color: rgba(61, 43, 22, .28);
}
.screen.active:not(#screen-home) .daily-shop-price,
.screen.active:not(#screen-home) .pack-price,
.screen.active:not(#screen-home) .daily-shop-slot .nashcoin {
  color: #8a5a12;
}
.screen.active:not(#screen-home) .daily-shop-archive {
  background: #6d4420;
  color: #f6efd4;
  border: 0;
}
.screen.active:not(#screen-home) .daily-shop-done {
  color: #6d4420;
  background: rgba(109, 68, 32, .12);
}
.screen.active:not(#screen-home) .stats-bar-track { background: rgba(61, 43, 22, .12); }
.screen.active:not(#screen-home) .stats-bar-row.stats-total { border-top-color: rgba(61, 43, 22, .16); }
.screen.active:not(#screen-home) .diff-box {
  border-color: rgba(61, 43, 22, .2);
}
.screen.active:not(#screen-home) .diff-box legend {
  color: #6d4420;
  background: #f6efd4;
}

body:has(.match-screen.active) .match-top {
  background: rgba(246, 239, 212, .88);
  border-color: rgba(61, 43, 22, .16);
  color: #3d2b16;
}
body:has(.match-screen.active) .turn-indicator {
  color: #3d2b16;
  background: transparent;
}
body:has(.match-screen.active) .board-wrap,
body:has(.match-screen.active) .board {
  overflow: visible;
}
body:has(.match-screen.active) .cell {
  background: rgba(255, 248, 220, .16);
  border-color: rgba(48, 36, 16, .32);
  border-radius: 16px;
  overflow: visible;
}
body:has(.match-screen.active) .match-log { color: #f4ecd8; text-shadow: 0 1px 1px rgba(24, 16, 8, .35); }

body:has(.screen.active) .overlay { background: rgba(32, 42, 22, .46); }
body:has(.screen.active) .overlay-panel,
body:has(.screen.active) .tutorial-card,
body:has(.screen.active) .result-panel {
  background: #f6efd4;
  color: #3d2b16;
  border: 0;
  border-radius: 2px 14px 3px 2px;
  box-shadow: 0 16px 24px rgba(40, 24, 8, .35);
}
body:has(.screen.active) .settings-row {
  background: rgba(255, 255, 255, .34);
  border-color: rgba(61, 43, 22, .16);
}
body:has(.screen.active) .result-sheet {
  background: linear-gradient(180deg, transparent, rgba(32, 42, 22, .55) 42%);
}
body:has(.screen.active) .toast {
  background: #f6efd4;
  color: #3d2b16;
  border: 0;
  border-radius: 2px 10px 2px 2px;
}
body:has(.screen.active) .tutorial-spot {
  box-shadow: 0 0 0 9999px rgba(32, 42, 22, .55);
  outline-color: #f4ecd8;
}

/* Almanach: aufgeschlagenes Buch, Block, Bund, Register. */
#screen-collection.screen.active:not(#screen-home) {
  background: transparent;
  box-shadow: none;
  padding: 10px 0 20px;
  overflow: visible;
}
#screen-collection .almanac-book {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  align-items: stretch;
  min-width: 0;
  margin: 16px 0 42px;
}
#screen-collection .almanac-book::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 0;
  right: 22px;
  top: -14px;
  bottom: -36px;
  border-radius: 3px 2px 7px 3px;
  background:
    linear-gradient(90deg, #2a2218 0 8px, rgba(244, 228, 196, .28) 8px 9px, #6a5340 9px 13px, #4a3b2c 13px 100%);
  box-shadow: 0 10px 16px rgba(24, 16, 8, .32);
  pointer-events: none;
}
#screen-collection .almanac-page {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 300px;
  margin: 8px 0 0 16px;
  color: #3d2b16;
  background: #f6efd4;
  border-radius: 1px 2px 2px 1px;
  box-shadow:
    5px 5px 0 #f3e7c6,
    6px 6px 0 #b89a70,
    11px 11px 0 #f7f1dc,
    12px 12px 0 #a88b62,
    17px 17px 0 #efe4c4,
    18px 18px 0 #8d7048,
    22px 22px 0 #4a3b2c;
  padding: 8px 14px 16px 30px;
}
#screen-collection .almanac-page::before {
  content: "";
  position: absolute;
  z-index: 2;
  left: 0;
  top: 0;
  bottom: 0;
  width: 22px;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, transparent 0 8px, rgba(62, 36, 14, .7) 8px 9px) 7px 4px / 2px calc(100% - 8px) no-repeat,
    linear-gradient(90deg, rgba(24, 14, 6, .62) 0, rgba(70, 46, 22, .3) 6px, rgba(255, 248, 230, .7) 10px, rgba(40, 24, 8, .22) 15px, transparent 22px);
}
#screen-collection.screen.active:not(#screen-home) .almanac-tabs {
  position: relative;
  z-index: 3;
  align-self: start;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  width: 34px;
  margin: 58px 0 0;
  padding: 0 0 0 20px;
  background: none;
  border: 0;
  border-radius: 0;
}
#screen-collection .almanac-tab {
  flex: none;
  width: 17px;
  min-height: 0;
  margin: 0;
  padding: 11px 0;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: "Patrick Hand", cursive;
  font-weight: 400;
  font-size: 1.02rem;
  line-height: 1;
  letter-spacing: .01em;
  color: #5c4630;
  background: #ddcba8;
  border: 1px solid rgba(74, 48, 18, .28);
  border-left: 0;
  border-radius: 0 6px 6px 0;
  box-shadow: 1px 2px 0 rgba(40, 24, 8, .16);
  filter: none;
  cursor: pointer;
}
#screen-collection .almanac-tab.active {
  z-index: 4;
  width: 28px;
  color: #3d2b16;
  background: #f6efd4;
  border-color: rgba(74, 48, 18, .2);
  box-shadow: 2px 2px 0 rgba(40, 24, 8, .12);
  filter: none;
}
#screen-stats .stats-tabs {
  display: flex;
  gap: 8px;
  margin: 2px 0 14px;
}
#screen-stats .stats-tab {
  flex: 1;
  min-height: 36px;
  padding: 4px 8px;
  font-size: 1.05rem;
  line-height: 1.1;
  cursor: pointer;
}
#screen-stats .event-progress,
#screen-collection .series-toolbar,
#screen-collection .mode-entry {
  border: 1px solid rgba(61, 43, 22, .16);
  border-radius: 16px;
  padding: 12px 14px;
}
#screen-collection .mode-entry h3 { margin: 0 0 4px; font-size: 1.2rem; }
#screen-collection .mode-entry p { margin: 0; font-size: .92rem; line-height: 1.45; }
#screen-collection .mode-entry p + p { margin-top: 8px; }
#screen-collection .music-modes { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 10px; }
#screen-collection .music-mode {
  flex: 1 1 30%;
  min-height: 36px;
  padding: 6px 10px;
  font-family: "Patrick Hand", cursive;
  font-size: 1.08rem;
  font-weight: 400;
  color: #5c4630;
  background: rgba(255, 255, 255, .28);
  border: 1px solid rgba(61, 43, 22, .16);
  border-radius: 12px;
  cursor: pointer;
}
#screen-collection .music-mode.active {
  color: #f6efd4;
  background: #6b4a2c;
  border-color: #4a3018;
}
#screen-collection .music-tracks { display: grid; gap: 8px; }
#screen-collection .music-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  font-family: "Patrick Hand", cursive;
  font-size: 1.2rem;
  font-weight: 400;
  color: #3d2b16;
  background: rgba(255, 255, 255, .28);
  border: 1px solid rgba(61, 43, 22, .16);
  border-radius: 16px;
  box-shadow: none;
  cursor: pointer;
}
#screen-collection .music-track.active {
  background: #f6efd4;
  border-color: #6b4a2c;
  box-shadow: inset 0 0 0 1px #6b4a2c;
}
#screen-collection .music-track.is-locked { opacity: .72; }
#screen-collection .music-track-state { font-size: .95rem; opacity: .75; }
#screen-collection .element-entry,
#screen-collection .mode-entry,
#screen-collection .rarity-entry {
  background: rgba(255, 255, 255, .28);
}

/* Schmale Ansicht: Buch bleibt in der Breite, Register liegen oben. */
@media (max-width: 700px) {
  #screen-collection.screen.active:not(#screen-home) {
    padding: 4px 0 12px;
  }
  #screen-collection .almanac-book {
    display: block;
    width: 100%;
    margin: 0;
    padding-top: 28px;
  }
  #screen-collection .almanac-book::before {
    top: 0;
    bottom: 0;
    right: 0;
    background:
      linear-gradient(90deg, #2a2218 0 6px, rgba(244, 228, 196, .28) 6px 7px, #6a5340 7px 10px, #4a3b2c 10px 100%);
  }
  #screen-collection .almanac-page {
    margin: 0 12px 16px 8px;
    padding: 6px 8px 12px 14px;
    min-height: 0;
    box-shadow:
      3px 3px 0 #f3e7c6,
      4px 4px 0 #b89a70,
      7px 7px 0 #efe4c4,
      8px 8px 0 #8d7048;
  }
  #screen-collection .almanac-page::before {
    width: 10px;
    background: linear-gradient(90deg, rgba(24, 14, 6, .5) 0, rgba(255, 248, 230, .45) 4px, transparent 10px);
  }
  #screen-collection.screen.active:not(#screen-home) .almanac-tabs {
    position: absolute;
    z-index: 0;
    top: 0;
    left: 14px;
    right: 15px;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 4px;
    width: auto;
    margin: 0;
    padding: 0;
	height: 28px;
  }
  #screen-collection .almanac-tab {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    width: auto;
    height: 20px;
    padding: 0 5px;
    font-size: .76rem;
    line-height: 20px;
    border: 1px solid rgba(74, 48, 18, .28);
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
  }
  #screen-collection .almanac-tab.active {
    width: auto;
    height: 26px;
    line-height: 26px;
    margin-bottom: -2px;
    background: #f6efd4;
  }
}

.tournament-board { margin: 0 0 14px; }
.tournament-board h4 { margin: 0 0 6px; font-size: 1rem; }
.tournament-standings { list-style: none; margin: 0; padding: 0; }
.tournament-standings li,
.tournament-you {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto auto;
  gap: 8px;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px solid rgba(61, 43, 22, .12);
}
.tournament-you { margin-top: 6px; font-weight: 800; }
.tournament-points { font-variant-numeric: tabular-nums; }
.tournament-time { opacity: .75; font-size: .85rem; }
