/* Barracks (ui/barracks.js): team list, team editor, armoury, team chooser; plus the little flag buttons the other
 * screens carry. Same cartoon look as style.css (reuses .bar .cols .col .card .btn .seg .swatch .tname .wname .hint). */
#ui.barracks { justify-content: flex-start; align-items: stretch; padding: calc(var(--st) + 0.6rem) calc(var(--sr) + 0.8rem) calc(var(--sb) + 0.6rem) calc(var(--sl) + 0.8rem); box-sizing: border-box; background: linear-gradient(rgba(30, 14, 50, 0.35), rgba(30, 14, 50, 0.55)); }
.bk-cols { gap: 0.8rem; }
.bk-list { flex: 0 0 min(19rem, 36%); }
.bk-edit { flex: 1; min-width: 0; }
#stage.sq .bk-cols { flex-direction: column; }
#stage.sq .bk-list { flex: none; max-height: 34%; }
.bk-tools { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.4rem; }
.bk-tools .btn { flex: 1 1 auto; }
.bk-msg { margin: 0.2rem 0 0.4rem; font-weight: 600; opacity: 1; color: var(--green2); }
.bk-msg.bad { color: #b3261e; }
.bk-h { font-family: "Lilita One", sans-serif; font-weight: 400; font-size: 1rem; margin: 0.5rem 0 0.3rem; opacity: 0.75; letter-spacing: 0.03em; }
.bk-h small { font-family: "Fredoka", sans-serif; font-weight: 600; opacity: 0.7; }
.bk-row { display: flex; align-items: center; gap: 0.5rem; width: 100%; box-sizing: border-box; min-height: 2.75rem; margin-bottom: 0.35rem; padding: 0.25rem 0.55rem; text-align: left;
  border: 0.16rem solid var(--ink); border-left: 0.6rem solid var(--tc); border-radius: 0.8rem; background: #fff; box-shadow: 0 0.18rem 0 rgba(43, 15, 28, 0.25); color: var(--ink); }
.bk-row.on { background: linear-gradient(#fff2f8, #ffd0e2); box-shadow: 0 0.18rem 0 var(--ink); }
.bk-row .bk-name { flex: 1; min-width: 0; font-family: "Lilita One", sans-serif; font-size: 1.05rem; color: var(--tcd); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-row small { font-weight: 600; opacity: 0.7; white-space: nowrap; font-size: 0.72rem; }
.bk-flag { width: 1.7rem; height: auto; flex: none; image-rendering: auto; }
.bk-flag.big { width: 2.9rem; }
.flagbtn { flex: none; width: 2.6rem; height: 2.75rem; padding: 0; border: 0.16rem solid var(--ink); border-radius: 0.7rem; background: #fff; box-shadow: 0 0.18rem 0 var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.flagbtn img { width: 1.6rem; height: auto; }

/* editor */
.bk-top { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.bk-tname { flex: 1; min-width: 0; font-size: 1.25rem; height: 2.9rem; }
.bk-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.2rem; }
.bk-secs { display: grid; grid-template-columns: repeat(auto-fit, minmax(14.5rem, 1fr)); gap: 0.6rem; margin-top: 0.5rem; }
.bk-sec { border: 0.16rem solid var(--ink); border-radius: 0.9rem; background: #fff; padding: 0.45rem 0.6rem 0.6rem; box-shadow: 0 0.18rem 0 rgba(43, 15, 28, 0.2); min-width: 0; }
.bk-sec.wide { grid-column: 1 / -1; }
.bk-sec h3 { margin: 0 0 0.35rem; font-family: "Lilita One", sans-serif; font-weight: 400; font-size: 1.05rem; letter-spacing: 0.02em; }
.bk-sec .hint { margin: 0.4rem 0 0; }
.bk-sec select { height: 2.5rem; border: 0.14rem solid var(--ink); border-radius: 0.7rem; padding: 0 0.5rem; background: #fff; font-family: "Lilita One", sans-serif !important; font-size: 0.98rem; box-shadow: 0 0.14rem 0 var(--ink); margin-left: 0.4rem; vertical-align: middle; max-width: 100%; }
.bk-sec .seg button { font-size: 0.9rem; }
.bk-worms { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.35rem; margin-bottom: 0.4rem; }
#stage.sq .bk-worms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bk-sec .dice { min-height: 2.75rem; }
.bk-sec .swatches { justify-content: flex-start; }
.bk-sec .swatch:disabled { opacity: 0.6; }
.bk-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.4rem; }
.chip { min-height: 2.75rem; padding: 0.2em 0.8em; border: 0.14rem solid var(--ink); border-radius: 999px; background: #fff; font-family: "Lilita One", sans-serif; font-size: 0.92rem; color: var(--ink); box-shadow: 0 0.14rem 0 var(--ink); }
.chip.on { background: linear-gradient(#ffd0e0, #ff7aa8); color: #fff; text-shadow: var(--outline); }
.chip:disabled { opacity: 0.55; }
.bk-grid { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.bk-pick { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem; min-width: 2.75rem; min-height: 2.75rem; padding: 0.2rem 0.3rem; border: 0.16rem solid var(--ink); border-radius: 0.7rem; background: var(--cream); color: var(--ink); box-shadow: 0 0.14rem 0 var(--ink); }
.bk-pick.on { background: linear-gradient(#fff2f8, #ffc2da); outline: 0.2rem solid var(--pink); outline-offset: 0.05rem; }
.bk-pick:disabled { opacity: 0.7; }
.bk-pick.on:disabled { opacity: 1; }
.bk-pick small { font-size: 0.66rem; font-weight: 700; line-height: 1.05; max-width: 4.8rem; text-align: center; }
.bk-pick img { display: block; }
.bk-grid.sw .bk-pick img { width: 1.9rem; height: 1.9rem; }
.bk-grid.sw .bk-pick { min-width: 4.4rem; }
.bk-grid.gr .bk-pick img { width: 2.3rem; height: 2.3rem; }
.bk-grid.fl .bk-pick img { width: 2.1rem; height: auto; }
.bk-grid.ft .bk-pick img { width: 3.2rem; height: 3.2rem; border-radius: 0.3rem; }
.bk-arm .bk-armoury-line { font-size: 1.05rem; font-weight: 700; }
.bk-arm .hint { margin-top: 0.1rem; margin-bottom: 0.4rem; }

/* modal layer (armoury, chooser) */
.bk-modal { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(20, 8, 30, 0.55); backdrop-filter: blur(3px); padding: calc(var(--st) + 0.5rem) calc(var(--sr) + 0.5rem) calc(var(--sb) + 0.5rem) calc(var(--sl) + 0.5rem); box-sizing: border-box; }
.bk-chooser { display: flex; flex-direction: column; overflow: hidden; }
.bk-chooser .picker-list { max-height: 60vh; }
.bk-armoury { width: min(50rem, 100%); display: flex; flex-direction: column; box-sizing: border-box; overflow: hidden; max-height: 100%; }
.bk-arm-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.bk-arm-head h2 { margin: 0; }
.bk-budget { display: flex; align-items: center; gap: 0.6rem; flex: 1 1 12rem; max-width: 22rem; }
.bk-bar { flex: 1; height: 1.1rem; border: 0.16rem solid var(--ink); border-radius: 1rem; background: #fff; overflow: hidden; }
.bk-bar i { display: block; height: 100%; width: 0; background: linear-gradient(#b8f59a, #3cb22a); transition: width 0.12s; }
.bk-left { font-family: "Lilita One", sans-serif; font-weight: 400; min-width: 4.5rem; text-align: right; }
.bk-arm-hint { margin: 0.2rem 0 0.4rem; }
.bk-items { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-auto-flow: column; grid-template-rows: repeat(23, auto); grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.3rem 0.8rem; align-content: start; scrollbar-width: thin; padding-right: 0.2rem; }
#stage.sq .bk-items { grid-auto-flow: row; grid-template-rows: none; grid-template-columns: minmax(0, 1fr); }
.bk-item { display: flex; align-items: center; gap: 0.4rem; min-height: 2.9rem; padding: 0.1rem 0.3rem; border-radius: 0.6rem; border: 0.12rem solid transparent; }
.bk-item.has { background: #fff3c8; border-color: rgba(43, 15, 28, 0.35); }
.bk-item img { width: 1.9rem; height: 1.9rem; flex: none; }
.bk-item .nm { flex: 1; min-width: 0; font-weight: 700; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-item .pr { font-weight: 600; opacity: 0.7; white-space: nowrap; font-size: 0.76rem; }
.bk-item .ct { min-width: 1.6rem; text-align: center; font-family: "Lilita One", sans-serif; font-weight: 400; font-size: 1.1rem; }
.bk-item .btn.tiny { padding: 0 0.5rem; }
.bk-armoury .actions { margin-top: 0.6rem; }

/* flag in other screens */
.team .flagimg { width: 1.6rem; height: auto; flex: none; }
.sp-change { margin-left: 0.4rem; }
#stage.short .bk-secs { grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr)); }
#stage.short .bk-flag.big { width: 2.3rem; }
.menu-pair { display: flex; gap: 0.6rem; justify-content: center; }
.menu-pair .btn.mid { flex: 1; min-width: 0; }
.flagimg.big { width: 2.4rem; vertical-align: -0.35rem; }
.summary .flagimg { vertical-align: -0.2rem; }
