
:root{
  --bca-blue:#08245c;
  --bca-blue-2:#123f73;
  --bca-gold:#d99a23;
  --bca-cream:#f6eddf;
  --bca-paper:#fffaf1;
  --bca-line:#d7b06e;
  --bca-line-soft:#dfc394;
  --bca-text:#563f2c;
  --bca-toolbar-h:60px;
  --bca-radius:18px;
  --bca-gap:10px;
  --bca-top-gap:34px;
}
*{box-sizing:border-box}

/* Page position follows the existing Benko Chess app pages. */
.bc-integrated-shell{
  width:min(1535px,calc(100% - 36px));
  max-width:1535px;
  margin:var(--bca-top-gap) auto 0;
}

/* NEW standard title/tool card - compact 60px. */
.bc-unified-toolbar{
  height:var(--bca-toolbar-h);
  min-height:var(--bca-toolbar-h);
  display:grid;
  grid-template-columns:minmax(290px,auto) minmax(0,1fr) auto;
  align-items:center;
  gap:16px;
  padding:6px 14px;
  background:linear-gradient(180deg,#f8efe1 0%,#efe1ca 100%);
  border:1px solid var(--bca-line-soft);
  border-bottom-color:var(--bca-gold);
  border-radius:var(--bca-radius);
  box-shadow:0 8px 20px rgba(69,43,12,.08);
}
.bc-unified-brand{display:flex;align-items:center;gap:10px;min-width:0}
.bc-unified-logo{width:36px;height:36px;flex:0 0 36px;display:block}
.bc-unified-title{
  color:var(--bca-blue);
  font:900 20px/1.1 "Segoe UI",Arial,sans-serif;
  letter-spacing:-.2px;
  white-space:nowrap;
}
.bc-unified-center{
  min-width:0;
  text-align:center;
  color:#69543f;
  font:800 14px/1.2 "Segoe UI",Arial,sans-serif;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.bc-unified-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:nowrap;
}
.bc-unified-action-strip{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  min-width:0;
}
.bc-unified-btn{
  min-height:36px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:7px 12px;
  border:1px solid #d7b982;
  border-radius:10px;
  background:#fffaf2;
  color:#523b29;
  font:800 13.5px/1 "Segoe UI",Arial,sans-serif;
  cursor:pointer;
  text-decoration:none;
}
.bc-unified-btn:hover{background:#fff3df;border-color:var(--bca-gold)}
.bc-unified-btn.primary{
  background:linear-gradient(180deg,#f2c55a,#e8ad31);
  border-color:#cc8c13;color:#3f2a18;
}
.bc-unified-btn.icon{
  width:36px;min-width:36px;padding:0;
}
.bc-unified-btn svg{
  width:17px;height:17px;display:block;
  fill:none;stroke:currentColor;stroke-width:1.8;
  stroke-linecap:round;stroke-linejoin:round;
}
.bc-context-pill{
  display:inline-flex;align-items:center;justify-content:center;
  min-height:34px;min-width:188px;padding:6px 15px;
  border:1px solid #d8c09b;border-radius:999px;
  background:rgba(255,253,248,.82);color:#6a4b2b;
  font-size:12px;font-weight:900;letter-spacing:.055em;text-transform:uppercase;
}
.bc-professional{
  color:#765b3d;font-size:12px;font-weight:900;
  letter-spacing:.08em;text-transform:uppercase;white-space:nowrap;
}

/* ONE body shell around the program. No second outer frame inside test copies. */
.bc-program-body{
  width:100%;
  margin-top:var(--bca-gap);
  overflow:hidden;
  border:1px solid var(--bca-line);
  border-radius:var(--bca-radius);
  background:#f2e5d2;
  box-shadow:0 10px 24px rgba(69,43,12,.08);
}
.bc-app-frame{display:block;width:100%;border:0;background:transparent}

/* Preserve the ORIGINAL viewport geometry of each source page. */
.bc-program-body[data-app="program"] .bc-app-frame{height:760px;overflow:hidden}
.bc-program-body[data-app="diagram"]{
  height:calc(100vh - 150px);
  min-height:720px;
  background:#f2e5d2;
}
.bc-program-body[data-app="diagram"] .bc-app-frame{height:100%;min-width:1180px;background:#f2e5d2}
.bc-program-body[data-app="pgn"] .bc-app-frame{height:620px;background:#f6eddf;overflow:hidden}
.bc-program-body[data-app="tournament"] .bc-app-frame{height:980px;background:#f8f1e6}

/* Tournament note retained from the original SR page. */
.tm-use-note{
  margin:16px 0 0;padding:12px 16px;
  border:1px solid rgba(10,48,102,.12);border-radius:15px;
  background:#fffdf8;color:#44546d;font-size:13px;line-height:1.45;
  text-align:center
}
.tm-use-note span{display:block}
.tm-use-note strong{color:#0a3066}
.tm-use-note a{color:#0a4f98;font-weight:700;text-decoration:none}
.tm-use-note a:hover{text-decoration:underline}

/* Full screen = the SAME single outer toolbar + body shell. */
body.bc-unified-fs-fallback{overflow:hidden!important}
.bc-integrated-shell:fullscreen::backdrop,
.bc-integrated-shell.is-fullscreen::backdrop{
  background:linear-gradient(180deg,#f8f1e7,#efe1cf)!important;
}
.bc-integrated-shell:fullscreen,
.bc-integrated-shell.is-fullscreen{
  position:fixed!important;
  inset:0!important;
  z-index:2147483000!important;
  width:100%!important;
  max-width:none!important;
  height:100vh!important;height:100dvh!important;
  margin:0!important;
  padding:8px!important;
  background:linear-gradient(180deg,#f8f1e7,#efe1cf)!important;
  display:flex!important;
  flex-direction:column!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
}
.bc-integrated-shell.is-fullscreen .bc-unified-toolbar{flex:0 0 var(--bca-toolbar-h)}
.bc-integrated-shell.is-fullscreen .bc-program-body{
  flex:1 1 auto!important;
  min-height:0!important;
  height:auto!important;
  margin-top:var(--bca-gap)!important;
}
.bc-integrated-shell.is-fullscreen .bc-program-body .bc-app-frame{
  width:100%!important;height:100%!important;min-height:0!important;max-height:none!important;
}
.bc-integrated-shell.is-fullscreen .bc-program-body[data-app="tournament"]{
  flex:0 0 auto!important;
  min-height:0!important;
}
.bc-integrated-shell.is-fullscreen .bc-program-body[data-app="tournament"] .bc-app-frame{
  height:980px!important;
}
.bc-integrated-shell.is-fullscreen .tm-use-note{display:none!important}

.bc-footer{margin-top:44px!important}

@media(max-width:900px){
  .bc-integrated-shell{width:calc(100% - 28px);margin-top:24px}
  .bc-program-body[data-app="diagram"]{height:calc(100dvh - 96px);min-height:640px}
  .bc-program-body[data-app="diagram"] .bc-app-frame{min-width:0}
  .bc-program-body[data-app="pgn"] .bc-app-frame{height:650px}
  .bc-program-body[data-app="tournament"] .bc-app-frame{height:960px}
  .bc-professional{display:none}
}
@media(max-width:760px){
  :root{--bca-toolbar-h:58px;--bca-radius:15px;--bca-gap:8px}
  .bc-unified-toolbar{
    height:auto;min-height:var(--bca-toolbar-h);
    grid-template-columns:minmax(0,1fr) auto;
    gap:8px;padding:6px 9px;
  }
  .bc-unified-center{grid-column:1/-1;grid-row:2;padding-bottom:1px}
  .bc-unified-logo{width:34px;height:34px;flex-basis:34px}
  .bc-unified-title{font-size:18px}
  .bc-unified-actions{gap:5px}
  .bc-unified-action-strip{gap:5px}
  .bc-unified-btn{min-height:34px;padding:6px 9px;font-size:12px}
  .bc-unified-btn.icon{width:34px;min-width:34px}
  .bc-context-pill{min-height:31px;min-width:150px;font-size:11px}
  .bc-integrated-shell:has(.bc-unified-action-strip) .bc-unified-toolbar{
    grid-template-columns:minmax(0,1fr) auto;
    grid-template-rows:auto auto auto;
    overflow:visible;
  }
  .bc-integrated-shell:has(.bc-unified-action-strip) .bc-unified-brand{
    grid-column:1;
    grid-row:1;
    min-width:0;
  }
  .bc-integrated-shell:has(.bc-unified-action-strip) .bc-unified-actions{
    display:grid;
    grid-column:1/-1;
    grid-row:1/3;
    grid-template-columns:minmax(0,1fr) auto;
    grid-template-rows:auto auto;
    align-items:center;
    gap:8px;
    min-width:0;
  }
  .bc-integrated-shell:has(.bc-unified-action-strip) .bc-unified-action-strip{
    grid-column:1/-1;
    grid-row:2;
    justify-content:safe center;
    overflow-x:auto;
    overflow-y:hidden;
    padding-bottom:2px;
    scrollbar-width:thin;
  }
  .bc-integrated-shell:has(.bc-unified-action-strip) .bc-unified-action-strip > .bc-unified-btn{
    flex:0 0 auto;
  }
  .bc-integrated-shell:has(.bc-unified-action-strip) .bc-unified-actions > [data-bc-fullscreen]{
    grid-column:2;
    grid-row:1;
    justify-self:end;
  }
  .bc-integrated-shell:has(.bc-unified-action-strip) .bc-unified-center{
    grid-column:1/-1;
    grid-row:3;
  }
  .bc-integrated-shell.is-fullscreen:has(.bc-unified-action-strip) .bc-unified-toolbar{
    flex:0 0 auto;
    height:auto;
    min-height:var(--bca-toolbar-h);
  }
}
@media(max-width:560px){
  .bc-integrated-shell{width:calc(100% - 20px);margin-top:20px}
  .bc-program-body[data-app="diagram"]{height:calc(100dvh - 80px);min-height:620px}
  .bc-program-body[data-app="pgn"] .bc-app-frame{height:720px}
  .bc-program-body[data-app="tournament"] .bc-app-frame{height:900px}
  .tm-use-note{margin:14px 0 0;padding:14px 15px;border-radius:14px;font-size:13px}
  .bc-footer{margin-top:28px!important}
}


/* ===== BC INTEGRATED TEST v2.7 - TOURNAMENT HEADER HIERARCHY ===== */
.bc-tm-header{
  display:inline-flex;
  align-items:baseline;
  justify-content:center;
  gap:7px;
  min-width:0;
  max-width:100%;
  white-space:nowrap;
}
.bc-tm-title{
  color:#5d432c;
  font-size:15px;
  font-weight:900;
  letter-spacing:-.01em;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:min(420px,42vw);
}
.bc-tm-sep{
  color:#b08a5c;
  font-size:12px;
  font-weight:700;
}
.bc-tm-meta{
  color:#7a6958;
  font-size:12.5px;
  font-weight:650;
  letter-spacing:0;
}
@media(max-width:900px){
  .bc-tm-title{font-size:14px;max-width:34vw}
  .bc-tm-meta{font-size:12px}
}
@media(max-width:760px){
  .bc-tm-header{gap:5px}
  .bc-tm-title{font-size:13px;max-width:48vw}
  .bc-tm-meta{font-size:11.5px}
}
