/* Collection and public-history surfaces share the existing game palette. */
.deck-view-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 12px 0; }
.deck-view-switch { display: inline-flex; flex: 0 0 auto; border: 1px solid #927d55; border-radius: 4px; overflow: hidden; }
.deck-view-switch button { min-height: 40px; min-width: 88px; padding: 8px 12px; border: 0; border-radius: 0; color: #dfd8c7; background: #172a23; font: inherit; cursor: pointer; }
.deck-view-switch button[aria-pressed="true"] { color: #fff1c5; background: #3d4637; box-shadow: inset 0 -3px #cbb374; }
.deck-view-switch button:focus-visible { outline: 2px solid #f2d895; outline-offset: -3px; }
.deck-view-toolbar output { color: #d2c4a5; font-size: 13px; }
.deck-view-empty { grid-column: 1 / -1; text-align: center; padding: 24px; color: #c3cabb; }
#libraryFilters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(5, minmax(100px, auto)) 44px;
  gap: 10px;
  align-items: end;
  padding: 14px 0;
  border-block: 1px solid #506357;
}
#libraryFilters label { display: grid; gap: 5px; min-width: 0; color: #d2dbd3; font-size: 12px; }
#libraryFilters input, #libraryFilters select {
  width: 100%; min-width: 0; height: 42px; padding: 8px;
  border: 1px solid #66756b; border-radius: 4px; color: #f0f1e7; background: #14291f; font: inherit; font-size: 14px;
}
.collection-icon {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  padding: 10px; flex: 0 0 44px; border: 1px solid #7d866d; border-radius: 4px;
  background: #20382b; color: #ece4c3;
}
.collection-icon svg { width: 22px; height: 22px; }
.collection-icon:disabled { opacity: .4; }
.collection-icon:focus-visible, #libraryFilters :focus-visible, .library-card:focus-visible,
#battleJournal button:focus-visible, #libraryTerms summary:focus-visible { outline: 2px solid #d4bd73; outline-offset: 3px; }
#libraryResultCount { display: block; margin: 12px 0; color: #c9d6cc; font-size: 14px; font-variant-numeric: tabular-nums; }
#libraryTerms { margin: 0 0 16px; border-bottom: 1px solid #506357; }
#libraryTerms summary { cursor: pointer; padding: 12px 0; color: #e4d59e; font-size: 14px; }
#libraryTerms .skill-library { margin-top: 10px; }
#libraryOverlay.library-gallery-mode :is(#libraryFilters, #libraryResultCount, #libraryTerms) { display: none; }
#libraryOverlay .library-header { flex-wrap: wrap; }
#libraryOverlay .library-tabs { flex-wrap: wrap; }
#libraryOverlay .library-series-intro { border: 0; border-radius: 0; background: transparent; box-shadow: none; padding-inline: 0; }
.log-panel .journal-heading { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.log-panel .journal-heading h2 { margin: 0; }
.log-panel #openJournal { width: 30px; height: 30px; flex-basis: 30px; padding: 5px; }
#battleJournal {
  width: min(920px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  padding: 20px; border: 1px solid #af9960; border-radius: 8px;
  color: #f0eddf; background: #15291f; box-shadow: 0 18px 70px #0009;
}
#battleJournal::backdrop { background: #050c09c9; }
#battleJournal header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#battleJournal h2 { margin: 0; font-size: 22px; }
.journal-tabs { display: flex; gap: 8px; margin: 16px 0 10px; flex-wrap: wrap; }
.journal-tabs button { min-height: 42px; padding: 8px 14px; border-radius: 4px; background: #20382b; color: #d7dfd6; border-bottom: 2px solid transparent; }
.journal-tabs [aria-pressed="true"] { color: #f3df9f; border-color: #d4bd73; }
#journalSummary { display: block; min-height: 24px; color: #b9cbbb; font-size: 13px; }
#journalContent { max-height: calc(100dvh - 230px); overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.journal-events { margin: 0; padding: 0 0 0 36px; }
.journal-events li { padding: 12px 8px; border-bottom: 1px solid #405448; font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
.journal-events li::marker { color: #a7bfcb; font-variant-numeric: tabular-nums; }
.journal-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; align-items: start; }
.journal-cards .card { width: 100%; min-width: 0; height: auto; }
.journal-empty { color: #b9cbbb; padding: 30px 0; grid-column: 1 / -1; }
.battle-layout .topbar { gap: 8px; }
.battle-layout #openBattleInfo { width: 32px; height: 32px; flex-basis: 32px; padding: 5px; }
.battle-info-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
.battle-info-table :is(th, td) { padding: 8px 10px; border-bottom: 1px solid #43564b; overflow-wrap: anywhere; }
.battle-info-table th { font-weight: 500; color: #c8d4c9; text-align: left; }
.battle-info-table td, .battle-info-table thead th:not(:first-child) { text-align: center; font-variant-numeric: tabular-nums; }
.battle-info-table thead th { position: sticky; top: 0; z-index: 1; background: #20382b; color: #f0dfac; }
.battle-info-table thead th[data-side="player"] { border-top: 2px solid #9abed4; }
.battle-info-table thead th[data-side="enemy"] { border-top: 2px solid #d39eaa; }
.battle-count-link { min-height: 36px; min-width: 56px; padding: 4px 10px; background: transparent; color: #d8e8ef; text-decoration: underline; text-underline-offset: 4px; border-radius: 4px; }
.battle-count-link:hover { background: #344d40; }
.battle-info-progress, .battle-info-fields { padding-block: 14px; border-bottom: 1px solid #43564b; }
#battleJournal :is(.battle-info-progress, .battle-info-fields) h3 { font-size: 16px; margin: 0 0 8px; }
.battle-info-progress p, .battle-background-source { margin: 0; font-size: 14px; line-height: 1.7; color: #cdd8d4; }
.battle-info-field { display: flex; width: 100%; align-items: center; gap: 14px; padding: 12px 0; margin-top: 10px; border-bottom: 1px solid #43564b; border-radius: 0; background: transparent; text-align: left; color: #eee5c9; }
.battle-info-field img { width: 64px; height: 86px; flex: 0 0 64px; object-fit: contain; }
.battle-info-field img[hidden] { display: none; }
.battle-info-field span { min-width: 0; overflow-wrap: anywhere; }
.battle-info-field :is(strong, small) { display: block; line-height: 1.5; }
.battle-info-field small { color: #bbcccb; margin-top: 6px; }
button.remaining-card-art { border: 0; border-radius: 0; padding: 0; width: 100%; color: inherit; font: inherit; cursor: pointer; }
button.remaining-card-art:focus-visible { outline: 2px solid #d4bd73; outline-offset: -2px; }
@media (max-width: 850px) {
  #libraryFilters { grid-template-columns: repeat(3, minmax(0, 1fr)) 44px; }
  #libraryFilters .library-search { grid-column: 1 / -1; }
  #libraryFilters label:nth-of-type(5) { grid-column: 1; }
  #libraryFilterReset { grid-column: 4; grid-row: 3; }
}
@media (max-width: 540px) {
  #libraryOverlay:not(.library-gallery-mode) { padding: 8px; }
  #libraryOverlay:not(.library-gallery-mode) .library-panel { width: 100%; max-height: calc(100dvh - 16px); padding: 16px; }
  #libraryOverlay:not(.library-gallery-mode) .library-header { flex-direction: row; align-items: center; gap: 8px; padding-bottom: 8px; margin-bottom: 8px; }
  #libraryOverlay:not(.library-gallery-mode) .library-header h2 { font-size: 22px; }
  #libraryOverlay:not(.library-gallery-mode) .library-header .eyebrow { display: none; }
  #libraryOverlay:not(.library-gallery-mode) .library-view-switch { order: 3; flex-basis: 100%; }
  #libraryOverlay:not(.library-gallery-mode) .library-view-switch button { flex: 1; }
  #libraryOverlay .library-tab { padding-inline: 10px; font-size: 14px; }
  #libraryOverlay .library-series-intro { margin-bottom: 8px; padding-block: 8px; }
  #libraryOverlay .library-series-intro p { font-size: 13px; font-weight: 400; }
  #libraryFilters { grid-template-columns: repeat(2, minmax(0, 1fr)) 44px; }
  #libraryFilters .library-search { grid-column: 1 / -1; }
  #libraryFilters label:nth-of-type(2) { grid-column: 1; }
  #libraryFilters label:nth-of-type(4) { grid-column: 1; }
  #libraryFilters label:nth-of-type(5) { grid-column: 2; }
  #libraryFilters label:nth-of-type(6) { grid-column: 1 / 3; }
  #libraryFilterReset { grid-column: 3; grid-row: 4; }
  #libraryOverlay .library-view-switch { margin-left: 0; }
  #battleJournal { padding: 14px; }
  #battleJournal h2 { font-size: 20px; }
  .journal-tabs { gap: 4px; }
  .journal-tabs button { padding-inline: 10px; }
  .battle-info-table :is(th, td) { padding: 8px 5px; }
  .battle-info-table { font-size: 13px; }
}
