/* Battle Reports use the existing Narrative layout and shared controls. */
.battle-page .battle-field-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.battle-page .battle-field-grid label{display:flex;flex-direction:column;gap:6px}
.battle-page .battle-field-grid input,.battle-page .battle-field-grid textarea{width:100%}
.battle-page .battle-detail-meta{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:20px 0}
.battle-page .battle-detail-meta>div{border:1px solid var(--border-color,#55442e);border-radius:8px;padding:12px;white-space:pre-wrap}
.battle-page .battle-detail-meta strong{display:block;margin-bottom:5px;color:var(--gold,#d6aa65)}
.battle-page .battle-detail-cover{width:100%;max-height:450px;object-fit:cover;border-radius:12px;margin:16px 0}
.battle-page .battle-detail-actions{display:flex;gap:10px;flex-wrap:wrap;margin:15px 0}
.battle-page .battle-detail-article{padding:20px}
.battle-page .battle-detail-article .narrative-body-display img{max-width:100%;height:auto}
.battle-page .battle-tag-field{margin-top:14px}
.battle-page .battle-list-footer{display:flex;gap:12px;align-items:center;margin-top:auto}
.battle-page .battle-list-card{cursor:pointer}
.battle-page .battle-list-card:focus-visible{outline:2px solid var(--gold,#d6aa65)}
@media(max-width:700px){.battle-page .battle-field-grid,.battle-page .battle-detail-meta{grid-template-columns:1fr}}

/* Match the fixed-navbar clearance used by Gallery and Narrative. */
body:has(:is(#view-battle-reports, #view-battle-report, #view-battle-report-editor):not([hidden])) .main-content {
  padding-top: 105px;
  padding-bottom: 64px;
  min-height: 100dvh;
}
body:has(:is(#view-battle-reports, #view-battle-report, #view-battle-report-editor):not([hidden])) .footer {
  display: none;
}

/* Match the existing Collections/Narrative filter cards. */
#view-battle-reports .narrative-list-toolbar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:0 0 12px}
#view-battle-reports .narrative-list-toolbar .collection-toolbar-control{display:flex;flex-direction:column;gap:10px;min-width:0;padding:14px 16px 15px;border:1px solid #705637;border-radius:12px;background:#302920}
#view-battle-reports .narrative-list-toolbar .collection-toolbar-control:hover{border-color:#b58d4a}
#view-battle-reports .narrative-list-toolbar .collection-toolbar-control:focus-within{border-color:#d6a853;box-shadow:0 0 0 2px rgba(214,168,83,.16)}
#view-battle-reports .narrative-list-toolbar label{display:flex;align-items:center;gap:8px;color:#d9aa5b;font-size:.76rem;font-weight:750;letter-spacing:.05em}
#view-battle-reports .narrative-list-toolbar label i{font-size:1.03rem;width:19px;text-align:center}
#view-battle-reports .narrative-list-toolbar .collection-select-wrap{position:relative;min-width:0}
#view-battle-reports .narrative-list-toolbar select{display:block;width:100%;min-height:42px;appearance:none;padding:10px 36px 10px 12px;border:1px solid #65543f;border-radius:8px;background:#1d1a17;color:#f5eee4;font:inherit;cursor:pointer}
#view-battle-reports .narrative-list-toolbar select:hover{border-color:#c49a53}
#view-battle-reports .narrative-list-toolbar select:focus-visible{outline:2px solid #d8ac61;outline-offset:2px}
#view-battle-reports .narrative-list-toolbar .collection-select-chevron{position:absolute;right:13px;top:50%;transform:translateY(-50%);pointer-events:none;color:#d9aa5b}
@media(max-width:640px){#view-battle-reports .narrative-list-toolbar{grid-template-columns:1fr}}

/* Battle Reports editor: match the full-width shared Add topics control.
   The picker itself is generated by content-tags.js, as on other features. */
#view-battle-report-editor .narrative-form {
  max-width: 1100px;
  width: 100%;
}
#view-battle-report-editor .w360-universal-tags {
  width: 100%;
  min-width: 0;
  margin: 0;
}
#view-battle-report-editor .w360-tags-toggle {
  width: 100%;
  box-sizing: border-box;
}
#view-battle-report-editor .w360-tags-search {
  width: 100%;
  box-sizing: border-box;
}

/* Game-system-neutral player / round report editor */
.battle-structure{display:grid;gap:14px;padding:18px;margin:12px 0}
.battle-structure-actions,.battle-round-header{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.battle-player-list,.battle-round-list{display:grid;gap:12px}
.battle-person-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(180px,1fr) auto;gap:10px;align-items:center}
.battle-person-row input,.battle-round-header input{min-width:0;width:100%;padding:10px;border:1px solid #65543f;border-radius:8px;background:#1d1a17;color:#f5eee4}
.battle-round-card{border:1px solid #705637;border-radius:12px;padding:15px;background:#302920;display:grid;gap:14px}
.battle-round-header input{flex:1;min-width:160px}
.battle-player-entry{display:grid;gap:7px}
.battle-player-entry strong{color:var(--gold,#d6aa65)}
.battle-round-rich{min-height:125px;padding:12px;background:#1d1a17;border:1px solid #65543f;border-radius:8px}
.battle-view-round{border-top:1px solid #705637;margin-top:20px;padding-top:18px}
.battle-view-round h3{color:var(--gold,#d6aa65);margin:15px 0 8px}
.battle-view-entry img{max-width:100%;height:auto}
@media(max-width:700px){.battle-person-row{grid-template-columns:1fr}.battle-round-header input{flex-basis:100%}}

/* Optional member linking in the participant editor */
.battle-member-link{min-width:180px;flex:1;position:relative}
.battle-member-link input{width:100%;box-sizing:border-box}
.battle-member-results:not(:empty){background:#302920;border:1px solid #705637;border-radius:8px;margin-top:4px;max-height:200px;overflow:auto;position:absolute;left:0;right:0;z-index:15}
.battle-member-choice{display:block;width:100%;padding:10px 12px;border:0;background:transparent;color:#f5eee4;text-align:left;cursor:pointer}
.battle-member-choice:hover,.battle-member-choice:focus{background:#45341f}
.battle-member-no-results{padding:10px 12px;color:#b5a58c}
.battle-linked-status{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.battle-linked-status a,.battle-view-round h3 a{color:var(--gold,#d6aa65)}

/* Existing tag suggestions with free-text fallback. */
.battle-force-picker{position:relative;min-width:180px}
.battle-force-picker input{width:100%;box-sizing:border-box}
.battle-field-suggestions:not(:empty){display:flex;flex-direction:column;background:#302920;border:1px solid #705637;border-radius:8px;position:relative;z-index:12;margin-top:4px;max-height:220px;overflow-y:auto}
.battle-field-choice{background:transparent;color:#f5eee4;border:0;text-align:left;padding:9px 12px;cursor:pointer}
.battle-field-choice:hover,.battle-field-choice:focus{background:#45341f}

/* One player-name field handles member lookup and manual names. */
.battle-player-name{min-width:0;flex:1}
.battle-player-name>input{width:100%;box-sizing:border-box}
.battle-player-name .battle-member-results:not(:empty){z-index:30}
.battle-player-name .battle-linked-status:empty{display:none}
.battle-player-name .battle-linked-status{margin-top:5px;gap:8px;font-size:.78rem}
.battle-linked-indicator{color:var(--gold,#d6aa65)}
.battle-unlink{border:0;background:transparent;color:#e6d7c0;text-decoration:underline;cursor:pointer;padding:0;font:inherit}

/* Player name, faction, and compact Remove button: three columns only. */
#view-battle-report-editor .battle-person-row{
 display:grid;
 grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;
 align-items:start;
 gap:12px;
}
#view-battle-report-editor .battle-person-row > .battle-player-name,
#view-battle-report-editor .battle-person-row > .battle-force-picker{min-width:0;width:100%;}
#view-battle-report-editor .battle-person-row > .btn{width:auto;min-width:100px;align-self:start;white-space:nowrap;}
/* Suggestions overlay the next row, rather than stretching the grid. */
#view-battle-report-editor .battle-force-picker{position:relative;}
#view-battle-report-editor .battle-field-suggestions:not(:empty){
 position:absolute;left:0;right:0;top:100%;z-index:35;
 margin-top:4px;max-height:220px;overflow-y:auto;
 box-shadow:0 12px 22px #0009;
}
#view-battle-report-editor .battle-player-name .battle-member-results:not(:empty){z-index:36;}
@media(max-width:700px){
 #view-battle-report-editor .battle-person-row{grid-template-columns:minmax(0,1fr) auto;}
 #view-battle-report-editor .battle-person-row > .battle-player-name{grid-column:1;grid-row:1;}
 #view-battle-report-editor .battle-person-row > .battle-force-picker{grid-column:1;grid-row:2;}
 #view-battle-report-editor .battle-person-row > .btn{grid-column:2;grid-row:1;}
}


/* Battle Reports landing cards: Narrative card markup is shared, but Narrative's
   CSS is scoped to #view-narrative. Apply the matching layout here. */
#view-battle-reports #battle-list.narrative-grid{
 display:grid;grid-template-columns:minmax(0,1fr);gap:14px;margin-top:14px;
}
#view-battle-reports #battle-list .battle-list-card{
 position:relative;display:grid;grid-template-columns:minmax(220px,31%) minmax(0,1fr);
 align-items:stretch;min-width:0;min-height:210px;
 border:1px solid #574a39;border-radius:14px;background:#292520;
 color:#f5eee4;overflow:visible;cursor:pointer;
 transition:border-color .15s,transform .15s;
}
#view-battle-reports #battle-list .battle-list-card:hover{border-color:#bd9450;transform:translateY(-2px)}
#view-battle-reports #battle-list .battle-list-card:focus-visible{outline:2px solid #d6a853;outline-offset:3px}
#view-battle-reports #battle-list .narrative-feed-cover{
 grid-column:1;grid-row:1;display:grid;place-items:center;min-height:210px;
 background:linear-gradient(135deg,#33291d,#1c1a17);
 border-radius:14px 0 0 14px;overflow:hidden;
}
#view-battle-reports #battle-list .narrative-feed-cover i{font-size:2.1rem;color:#d5a451}
#view-battle-reports #battle-list .narrative-feed-cover-image{display:block;width:100%;height:100%;object-fit:cover}
#view-battle-reports #battle-list .narrative-feed-body{
 grid-column:2;grid-row:1;display:flex;flex-direction:column;gap:12px;
 min-width:0;padding:22px 24px;overflow-wrap:anywhere;
}
#view-battle-reports #battle-list .narrative-feed-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
#view-battle-reports #battle-list .narrative-feed-title{margin:0;font-size:1.22rem;line-height:1.3;color:#f7f1e7;overflow-wrap:anywhere}
#view-battle-reports #battle-list .narrative-feed-description{
 margin:0;color:#bbb1a4;font-size:.87rem;line-height:1.45;
 display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;
}
#view-battle-reports #battle-list .small-muted{margin:0;color:#c7b9a5}
#view-battle-reports #battle-list .battle-list-footer{display:flex;align-items:center;gap:10px;margin-top:auto}
#view-battle-reports #battle-list .narrative-feed-privacy{
 display:inline-flex;align-items:center;gap:6px;border:1px solid #806438;
 border-radius:99px;background:#3b3021;color:#e0b264;
 padding:5px 9px;font-size:.76rem;font-weight:700;
}
#view-battle-reports #battle-list .w360-content-tags{max-width:100%;min-width:0}
@media(max-width:680px){
 #view-battle-reports #battle-list .battle-list-card{grid-template-columns:minmax(0,1fr)}
 #view-battle-reports #battle-list .narrative-feed-cover{
  grid-column:1;grid-row:1;height:140px;min-height:140px;border-radius:14px 14px 0 0;
 }
 #view-battle-reports #battle-list .narrative-feed-body{grid-column:1;grid-row:2;padding:16px}
}

/* Same owner-only visibility control as Gallery/Collections, top right on report cards. */
#view-battle-reports #battle-list .battle-list-card{position:relative}
#view-battle-reports #battle-list .battle-visibility-toggle{
 position:absolute;top:12px;right:12px;z-index:6;
 display:inline-flex;align-items:center;justify-content:center;
 min-width:32px;min-height:32px;padding:5px 9px;
 border:1px solid #806334;border-radius:8px;
 background:#292621;color:#dda83e;cursor:pointer;
}
#view-battle-reports #battle-list .battle-visibility-toggle:hover,
#view-battle-reports #battle-list .battle-visibility-toggle:focus-visible{background:#403424;outline-offset:2px}
#view-battle-reports #battle-list .battle-visibility-toggle:disabled{opacity:.55;cursor:wait}

/* Finished Battle Report: structured reading view, aligned with 360v8 cards. */
#view-battle-report .battle-detail-article{padding:clamp(18px,3vw,34px);max-width:1100px;margin:0 auto;border:1px solid #55442e;border-radius:16px;background:#292520}
#view-battle-report .battle-report-header{display:flex;justify-content:space-between;align-items:flex-start;gap:20px;margin-bottom:22px}
#view-battle-report .battle-report-title-block{min-width:0}
#view-battle-report .battle-report-title-block h1{font-size:clamp(1.5rem,2.4vw,2.15rem);line-height:1.2;margin:0 0 8px;font-family:inherit;color:#f5eee4}
#view-battle-report .battle-report-subtitle{margin:0;color:#c6b8a4;font-size:.93rem}
#view-battle-report .battle-detail-visibility{display:inline-flex;align-items:center;gap:8px;flex-shrink:0;border:1px solid #806334;border-radius:9px;padding:9px 12px;background:#302920;color:#dda83e;font:inherit;font-size:.85rem;cursor:pointer}
#view-battle-report .battle-detail-visibility:hover{background:#45341f}
#view-battle-report .battle-detail-visibility:disabled{opacity:.6;cursor:wait}
#view-battle-report .battle-detail-cover{margin:0 0 22px;width:100%;max-height:400px;object-fit:cover;border-radius:12px}
#view-battle-report .battle-detail-meta{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:0 0 20px}
#view-battle-report .battle-fact{display:flex;flex-direction:column;gap:5px;border:1px solid #55442e;border-radius:10px;padding:12px 14px;background:#211d19;min-width:0;white-space:normal}
#view-battle-report .battle-fact-label{font-size:.74rem;text-transform:uppercase;letter-spacing:.05em;color:#d6aa65;font-weight:700}
#view-battle-report .battle-fact-value{font-size:.94rem;color:#f5eee4;overflow-wrap:anywhere}
#view-battle-report .battle-participant-summary{display:grid;gap:6px;font-size:.94rem}
#view-battle-report .battle-participant-summary a{color:#d6aa65}
#view-battle-report .battle-participant-force{color:#c4b9aa}
#view-battle-report .battle-detail-actions{display:flex;flex-wrap:wrap;gap:9px;margin:0 0 24px;padding-bottom:20px;border-bottom:1px solid #55442e}
#view-battle-report .battle-delete-action{margin-left:auto}
#view-battle-report .battle-report-content{display:grid;gap:24px}
#view-battle-report .battle-report-section{min-width:0}
#view-battle-report .battle-report-section>h2{font-family:inherit;font-size:1.2rem;line-height:1.3;margin:0 0 13px;color:#f5eee4;padding-bottom:10px;border-bottom:1px solid #66513a}
#view-battle-report .battle-round-players{display:grid;gap:12px}
#view-battle-report .battle-player-entry{border:1px solid #514637;border-radius:11px;background:#211d19;padding:16px 18px;min-width:0}
#view-battle-report .battle-player-entry h3{font-family:inherit;font-size:1rem;margin:0 0 10px;color:#f2e9da}
#view-battle-report .battle-player-entry h3 a{color:#d6aa65;text-decoration:none}
#view-battle-report .battle-player-entry h3 a:hover{text-decoration:underline}
#view-battle-report .battle-entry-force{font-weight:400;color:#c6b8a4}
#view-battle-report .narrative-body-display{overflow-wrap:anywhere;line-height:1.65}
#view-battle-report .battle-view-entry p:last-child{margin-bottom:0}
#view-battle-report .battle-detail-tags{margin-top:25px;padding-top:16px;border-top:1px solid #55442e}
@media(max-width:700px){#view-battle-report .battle-detail-meta{grid-template-columns:1fr}#view-battle-report .battle-report-header{gap:12px}#view-battle-report .battle-detail-visibility span{display:none}#view-battle-report .battle-delete-action{margin-left:0}}

/* Standalone, clearly separated panels on the Battle Report detail view. */
#view-battle-report .battle-detail-layout{display:grid;gap:18px;max-width:1120px;margin:0 auto}
#view-battle-report .battle-detail-panel{min-width:0;padding:22px 26px;background:#292521;border:1px solid #5b4934;border-radius:14px;box-sizing:border-box}
#view-battle-report .battle-detail-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:20px}
#view-battle-report .battle-report-title-block h1{font-size:clamp(1.45rem,2.5vw,2rem);line-height:1.2;margin:0 0 8px}
#view-battle-report .battle-report-subtitle{margin:0;color:#c9bca8}
#view-battle-report .battle-panel-heading{font-size:1.12rem;line-height:1.4;margin:0 0 18px;color:#f4eee4;font-weight:700}
#view-battle-report .battle-detail-facts .battle-detail-meta{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:0}
#view-battle-report .battle-detail-facts .battle-detail-meta>div{min-width:0;border:1px solid #58452e;border-radius:9px;padding:12px 14px;background:#211d19;display:flex;flex-direction:column;gap:6px}
#view-battle-report .battle-detail-facts .battle-detail-meta>div strong,
#view-battle-report .battle-detail-facts .battle-fact-label{font-size:.75rem;text-transform:uppercase;letter-spacing:.045em;color:#d8a44c}
#view-battle-report .battle-participant-summary{display:grid;gap:8px}
#view-battle-report .battle-participant-summary a,
#view-battle-report .battle-round-players a{color:#d8a44c}
#view-battle-report .battle-report-content{display:grid;gap:16px;margin:0}
#view-battle-report .battle-report-section{margin:0;padding:16px;border:1px solid #594832;border-radius:10px;background:#211d19}
#view-battle-report .battle-report-section>h3{margin:0 0 14px;font-size:1.04rem;color:#f5eee4}
#view-battle-report .battle-view-round{border:1px solid #594832;margin:0;padding:16px}
#view-battle-report .battle-round-players{display:grid;gap:12px}
#view-battle-report .battle-round-players .battle-player-entry{display:block;margin:0;padding:14px;border:1px solid #5a4835;border-radius:9px;background:#292521}
#view-battle-report .battle-round-players .battle-player-entry h4{margin:0 0 10px;color:#d8a44c;font-size:.95rem}
#view-battle-report .battle-round-players .battle-view-entry{margin:0;min-height:0}
#view-battle-report .battle-round-players .battle-view-entry p:last-child{margin-bottom:0}
#view-battle-report .battle-detail-tag-panel .battle-detail-tags{margin:0;padding:0;border:0;background:transparent}
#view-battle-report .battle-detail-cover{max-width:100%;border-radius:12px}
@media(max-width:700px){
 #view-battle-report .battle-detail-panel{padding:16px}
 #view-battle-report .battle-detail-facts .battle-detail-meta{grid-template-columns:1fr}
 #view-battle-report .battle-detail-heading{gap:10px}
}

/* Per-turn scoring */
.battle-score-field{display:flex;align-items:center;gap:.65rem;flex-wrap:wrap;margin:.6rem 0;color:inherit;font-size:.9rem}
.battle-score-field input{width:110px;max-width:100%;padding:.4rem .6rem;border:1px solid var(--bs-border-color,#756b5b);border-radius:.4rem;background:transparent;color:inherit}
.battle-score-badge{font-size:.85rem;font-weight:400;opacity:.8;margin-left:.5rem}
.battle-score-total{padding:.35rem 0}

/* Compact round heading: round name, per-player scores and round actions */
.battle-round-header{display:flex;align-items:end;gap:10px;flex-wrap:wrap}
.battle-round-header>input{flex:1 1 160px;min-width:120px;width:auto}
.battle-round-score-row{display:flex;flex:2 1 260px;gap:10px;flex-wrap:wrap;align-items:end}
.battle-round-score{display:flex;flex:1 1 100px;min-width:100px;flex-direction:column;align-items:stretch;gap:5px;margin:0}
.battle-round-score span{font-size:.8rem;line-height:1.25;color:var(--gold,#d6aa65)}
.battle-round-score input{width:100%;max-width:none;min-width:0;box-sizing:border-box;padding:10px;background:#1d1a17;border:1px solid #65543f;border-radius:8px;color:#f5eee4}
.battle-round-controls{display:flex;gap:10px;align-items:center}
@media(max-width:700px){.battle-round-header>input{flex:1 1 100%}.battle-round-score-row{flex:1 1 100%}.battle-round-controls{margin-left:auto}}
