/*!
 * BENKO CHESS COPYRIGHT NOTICE
 * © 2023–2026 Petar Benković / Benko Chess. All rights reserved.
 * This notice applies to original Benko Chess code in this file.
 * Third-party components, where present, retain their respective licences and notices.
 */
:root {
  --navy-950:#071625;
  --navy-900:#0b2239;
  --navy-800:#102f4f;
  --navy-700:#173f66;
  --blue-500:#2f78ba;
  --gold-500:#d8ad63;
  --gold-300:#f0d4a3;
  --cream:#f8f4ec;
  --paper:#fffdf9;
  --ink:#1c2936;
  --muted:#6f7d8b;
  --line:#dbe2e8;
  --panel:#ffffff;
  --danger:#b94444;
  --success:#27916c;
  --shadow:0 14px 38px rgba(23,48,76,.12);
}
*{box-sizing:border-box}
html,body{height:100%;min-height:100%}
body{margin:0;font-family:"Segoe UI",Inter,Arial,sans-serif;background:#edf1f4;color:var(--ink);overflow:hidden}
button,input,textarea,select{font:inherit}
button{cursor:pointer}
.app-shell{height:100vh;min-height:0;display:flex;flex-direction:column;min-width:1180px;overflow:hidden}
.topbar{height:74px;background:linear-gradient(135deg,var(--navy-950),var(--navy-800));color:white;display:flex;align-items:center;justify-content:space-between;padding:0 22px;box-shadow:0 3px 14px rgba(2,18,32,.3);z-index:5}
.brand-block{display:flex;align-items:center;gap:12px}.brand-mark{width:45px;height:45px;filter:drop-shadow(0 4px 8px rgba(0,0,0,.25))}.brand-mark img{display:block;width:100%;height:100%}.brand-block h1{font-size:20px;line-height:1.1;margin:0;font-weight:720;letter-spacing:.1px}.brand-subline{font-size:11px;color:#c4d1dc;margin-top:4px;letter-spacing:.35px}
.top-actions{display:flex;align-items:center;gap:8px}.btn,.icon-btn,.square-btn,.tool-btn,.format-card,.wide-action{border:1px solid transparent;border-radius:8px;background:white;color:var(--ink);transition:.16s ease}.btn{height:36px;padding:0 14px;font-weight:650;font-size:13px}.btn:hover,.icon-btn:hover,.square-btn:hover,.tool-btn:hover,.format-card:hover,.wide-action:hover{transform:translateY(-1px);box-shadow:0 5px 13px rgba(12,38,62,.13)}.btn.ghost{color:#e9f0f5;background:rgba(255,255,255,.08);border-color:rgba(255,255,255,.15)}.btn.ghost:hover{background:rgba(255,255,255,.16)}.btn.primary{background:var(--gold-500);color:#182838;border-color:#e5c58c}.btn.export{background:#f7fbff;color:#0f3558}.btn.small{height:32px;padding:0 10px;font-size:12px;border-color:var(--line);background:#f9fbfc}.btn.primary-lite{color:#0f4f7d;background:#e9f3fb;border-color:#bcd5e8}.btn.danger{background:var(--danger);color:white}.btn.large{height:44px}.btn.full-width,.full-width{width:100%}.icon-btn{width:36px;height:36px;background:rgba(255,255,255,.09);color:white;border-color:rgba(255,255,255,.14);font-size:21px}.icon-btn:disabled,.btn:disabled{opacity:.4;cursor:not-allowed;transform:none;box-shadow:none}
.project-strip{height:38px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 22px;color:var(--muted);font-size:12px}.project-name-wrap{display:flex;align-items:center;gap:8px}.status-dot{width:8px;height:8px;border-radius:50%;background:#d1a03f}.status-dot.saved{background:var(--success)}.project-name-input{width:265px;border:none;background:transparent;font-weight:700;color:#23394d;outline:none;padding:3px 2px}.project-name-input:focus{background:#eef5fa;border-radius:4px}.project-meta{display:flex;gap:8px;align-items:center}.divider{color:#b6c0c8}
.workspace{flex:1;min-height:0;display:grid;grid-template-columns:276px minmax(520px,1fr) 338px;gap:12px;padding:12px;overflow:hidden}.panel{background:var(--panel);border:1px solid #dce3e8;border-radius:12px;box-shadow:0 4px 13px rgba(23,48,76,.07)}.left-panel,.right-panel{min-height:0;overflow:hidden}.left-panel{display:flex;flex-direction:column}.panel-section{padding:15px;border-bottom:1px solid #e6ebef}.panel-section:last-child{border-bottom:none}.section-heading-row{display:flex;align-items:flex-start;justify-content:space-between}.eyebrow{font-size:9px;color:#82909e;letter-spacing:1.4px;font-weight:800}.panel h2,.board-card h2{font-size:16px;margin:3px 0 10px;color:#1c344a}.mini-actions{display:flex;gap:5px}.square-btn{width:29px;height:29px;border-color:var(--line);background:#f8fafb;color:#24425e}.pgn-import-btn{width:38px;font-size:10px;font-weight:800}.danger-lite{color:#9b3b3b}.diagrams-section{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}.diagram-list{flex:1 1 auto;min-height:0;overflow:auto;padding-right:3px}.diagram-item{display:grid;grid-template-columns:54px 1fr;gap:9px;padding:8px;border:1px solid transparent;border-radius:9px;cursor:pointer;margin-bottom:5px}.diagram-item:hover{background:#f4f7f9}.diagram-item.active{background:#eaf3fa;border-color:#a8c8df}.diagram-thumb{width:54px;height:54px;border:1px solid #bdc9d2;border-radius:5px;overflow:hidden;background:white}.diagram-thumb svg{display:block;width:100%;height:100%}.diagram-info{min-width:0}.diagram-title{font-weight:700;font-size:12px;color:#243b50;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:5px}.diagram-subtitle{font-size:10px;color:#82909e;margin-top:4px}.pieces-section{flex:0 0 auto}.pieces-section h2{margin-bottom:7px}.piece-color-label{font-size:10px;color:#657584;font-weight:700;margin:8px 0 5px}.dark-label{margin-top:10px}.piece-palette{display:grid;grid-template-columns:repeat(3,1fr);gap:7px}.piece-btn{height:38px;border:1px solid #d6dee5;border-radius:7px;background:#f9fbfc;display:flex;align-items:center;justify-content:center}.piece-btn:hover{background:#edf5fa}.piece-btn.selected{background:#dceefa;border-color:#63a0cc;box-shadow:0 0 0 2px rgba(69,137,187,.14)}.piece-btn svg{width:26px;height:29px}.piece-actions{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin-top:12px}.hint{font-size:10px;color:#8793a0;line-height:1.4;margin:9px 0 0}
.center-stage{min-width:0;min-height:0;display:flex;flex-direction:column;gap:10px;overflow:hidden}.tool-ribbon{height:54px;flex:0 0 auto;display:flex;align-items:center;padding:7px 10px;justify-content:space-between;gap:8px}.tool-group{display:flex;align-items:center;gap:5px;min-width:0}.tool-label{font-size:10px;font-weight:800;color:#8795a1;margin-right:2px;text-transform:uppercase}.tool-btn{height:36px;padding:0 9px;border-color:transparent;background:#f5f7f9;color:#355069;font-size:15px;display:flex;align-items:center;gap:5px;flex:0 0 auto}.tool-btn span{font-size:11px;font-weight:650}.tool-btn.active{background:#dfeff9;color:#0e5685;border-color:#9cc4df}.compact-group{padding-left:8px;border-left:1px solid #e1e6ea;flex:0 0 auto}.color-swatch{width:22px;height:22px;border-radius:50%;border:3px solid white;box-shadow:0 0 0 1px #c9d1d8;flex:0 0 auto}.color-swatch.selected{box-shadow:0 0 0 2px #26465f}.color-swatch[data-color=green]{background:#36a56d}.color-swatch[data-color=red]{background:#e14f4f}.color-swatch[data-color=blue]{background:#3187d7}.color-swatch[data-color=yellow]{background:#e5b829}.right-tools{margin-left:auto;flex:0 0 auto}.board-card{flex:1 1 auto;min-height:0;padding:13px 18px 10px;display:flex;flex-direction:column;overflow:hidden}.board-title-row{height:47px;flex:0 0 auto;display:flex;align-items:flex-start;justify-content:space-between;gap:10px}.board-title-row h2{margin:2px 0}.board-status-actions{display:flex;align-items:center;gap:8px;flex:0 0 auto}.mode-switch{height:30px;display:flex;align-items:center;border:1px solid #dce3e8;border-radius:999px;background:#f9fbfc;padding:2px}.mode-btn{height:24px;border:0;border-radius:999px;background:transparent;color:#667789;padding:0 10px;font-size:11px;font-weight:800}.mode-btn.active{background:#173f66;color:white;box-shadow:0 2px 7px rgba(23,63,102,.18)}.turn-badge{font-size:11px;font-weight:700;color:#42596d;border:1px solid #dce3e8;border-radius:20px;padding:6px 10px;background:#f9fbfc;display:flex;align-items:center;gap:6px}.turn-disc{width:12px;height:12px;border-radius:50%;display:inline-block;border:1px solid #30475b}.turn-disc.white{background:#fff}.turn-disc.black{background:#172c3d}.board-shell{flex:1 1 auto;min-height:0;display:flex;align-items:center;justify-content:center;padding:3px;overflow:hidden}.chess-board{height:min(100%,660px);max-width:100%;aspect-ratio:1/1;display:block;touch-action:none;user-select:none;filter:drop-shadow(0 10px 17px rgba(20,39,57,.22))}
.chess-board.move-tool .board-square{cursor:pointer}.chess-board.move-tool .board-square.occupied{cursor:grab}.chess-board.move-tool.is-dragging-piece,.chess-board.move-tool.is-dragging-piece .board-square{cursor:grabbing!important}.board-shell.no-shadow .chess-board{filter:none}.board-footer{height:25px;flex:0 0 auto;padding-top:6px;display:flex;justify-content:space-between;color:#85919d;font-size:9.5px}
.right-panel{display:flex;flex-direction:column}.tabs{height:44px;display:grid;grid-template-columns:repeat(4,1fr);border-bottom:1px solid #dfe5ea}.tab-btn{border:0;background:transparent;font-weight:700;font-size:11px;color:#71808e;position:relative}.tab-btn.active{color:#154f79}.tab-btn.active:after{content:"";position:absolute;left:14px;right:14px;bottom:0;height:3px;background:var(--gold-500);border-radius:3px 3px 0 0}.tab-panel{display:none;overflow:auto;flex:1}.tab-panel.active{display:block}.settings-section{padding:15px;border-bottom:1px solid #e6ebef}.settings-section:last-child{border-bottom:0}.field-label{display:block;font-size:11px;font-weight:750;color:#475d70;margin-bottom:7px}.fen-input,.comment-input,.full-input,select,input[type=number]{width:100%;border:1px solid #ced8e0;border-radius:7px;background:#fbfcfd;color:#253b4e;padding:8px;outline:none}.fen-input{resize:vertical;font-family:Consolas,"Courier New",monospace;font-size:10.5px;line-height:1.4}.comment-input{resize:vertical;line-height:1.45}.fen-input:focus,.comment-input:focus,.full-input:focus,select:focus,input:focus{border-color:#5d9aca;box-shadow:0 0 0 3px rgba(64,139,192,.12)}.button-row{display:flex;gap:7px;margin-top:8px}.field-message{font-size:10px;margin-top:6px;min-height:13px;color:#789}.field-message.error{color:#ba4141}.field-message.success{color:#25815f}.grid-two{display:grid;grid-template-columns:1fr 1fr;gap:10px}.field-stack{display:flex;flex-direction:column;gap:6px;font-size:11px;font-weight:700;color:#4c6173}.check-grid{display:grid;grid-template-columns:1fr 1fr;gap:9px;font-size:11px;color:#53687a}.check-grid label{display:flex;align-items:center;gap:5px}.stack-actions{display:flex;flex-direction:column;gap:7px}.wide-action{display:flex;align-items:center;gap:10px;text-align:left;padding:9px;border-color:#dce3e8;background:#fafcfd}.wide-action>span{width:29px;height:29px;border-radius:7px;background:#e8f2f8;color:#21618d;display:flex;align-items:center;justify-content:center;font-size:18px}.wide-action b{font-size:11px;display:block}.wide-action small,.switch-row small{font-size:9.5px;color:#87939e;display:block;margin-top:2px}.full-select{width:100%}.theme-preview{display:grid;grid-template-columns:repeat(5,1fr);height:48px;margin-top:9px;border-radius:7px;overflow:hidden;border:1px solid #d3dbe1;background-size:100% 100%;background-position:center}.theme-preview span:nth-child(odd){background:var(--light)}.theme-preview span:nth-child(even){background:var(--dark)}.theme-preview.texture{display:block}.option-list{padding-top:4px;padding-bottom:4px}.switch-row{display:flex;align-items:center;justify-content:space-between;padding:10px 0;border-bottom:1px solid #edf0f3}.switch-row:last-child{border-bottom:0}.switch-row b{font-size:11px}.switch-row input{width:36px;height:19px;accent-color:#2e769f}.settings-section input[type=range]{width:100%;accent-color:#2d7ca8}.format-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:7px}.format-card{padding:10px 4px;border-color:#d7dfe6;background:#fafcfd;text-align:center}.format-card b{font-size:12px;display:block}.format-card small{font-size:8.5px;color:#84929d}.format-card.selected{background:#e7f2f9;border-color:#75a9cc;color:#10537e}.right-panel .full-width{margin-top:8px}
.app-footer{height:30px;background:#0b2239;color:#b8c7d3;display:flex;align-items:center;justify-content:space-between;padding:0 18px;font-size:9.5px}.app-footer button{border:0;background:transparent;color:#d9e5ed;padding:0;cursor:pointer}.toast-container{position:fixed;right:18px;bottom:43px;z-index:30;display:flex;flex-direction:column;gap:8px}.toast{background:#102d46;color:#fff;padding:10px 14px;border-radius:8px;font-size:12px;box-shadow:0 9px 24px rgba(0,0,0,.22);animation:toastIn .2s ease}.toast.error{background:#8f3434}.toast.success{background:#1e7155}@keyframes toastIn{from{transform:translateY(8px);opacity:0}to{transform:none;opacity:1}}
.modal{border:0;border-radius:13px;padding:0;box-shadow:0 25px 70px rgba(5,22,37,.35);max-width:390px}.modal::backdrop{background:rgba(7,22,37,.55);backdrop-filter:blur(2px)}.modal form{padding:24px}.modal h3{margin:0 0 9px;color:#173b59}.modal p{font-size:13px;color:#627484;line-height:1.5}.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:20px}.promotion-modal{max-width:430px}.promotion-choices{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-top:16px}.promotion-choice{height:74px;border:1px solid #cad8e2;border-radius:12px;background:#f7fbfd;display:flex;align-items:center;justify-content:center;cursor:pointer}.promotion-choice:hover,.promotion-choice:focus-visible{background:#e8f3fa;border-color:#7db0d2;box-shadow:0 0 0 3px rgba(49,126,170,.14);outline:none}.promotion-choice svg{width:58px;height:58px}.about-modal{text-align:center}.about-logo{width:64px;height:64px;margin:0 auto 10px;filter:drop-shadow(0 7px 14px rgba(16,47,79,.22))}.about-logo img{display:block;width:100%;height:100%}.about-credit{font-size:11px!important;color:#82909c!important}
.pieces-section{padding:11px 14px}.pieces-section h2{font-size:15px;margin:2px 0 6px}.piece-color-label{font-size:9.5px;margin:5px 0 4px}.dark-label{margin-top:7px}.piece-palette{grid-template-columns:repeat(6,1fr);gap:4px}.piece-btn{height:31px;border-radius:6px}.piece-btn svg{width:21px;height:23px}.piece-actions{gap:6px;margin-top:8px}.piece-actions .btn.small{height:31px;padding:0 7px;font-size:11px}.hint{font-size:9px;line-height:1.25;margin-top:7px}.diagrams-section{min-height:170px}.diagram-item{grid-template-columns:48px 1fr;padding:6px;gap:8px;margin-bottom:4px}.diagram-thumb{width:48px;height:48px}.diagram-title{font-size:11px;margin-top:3px}.diagram-subtitle{font-size:9px;margin-top:3px}
@media(max-width:1450px){.tool-btn span{display:none}.tool-btn{width:36px;justify-content:center;padding:0}.right-tools .tool-btn{width:38px}}
@media(max-width:1250px){.workspace{grid-template-columns:252px minmax(500px,1fr) 310px;gap:8px;padding:8px}.topbar{padding:0 14px}.brand-subline{display:none}.piece-btn{height:36px}.right-panel .settings-section{padding:12px}.chess-board{height:min(100%,620px)}}
@media print{body{overflow:visible;background:white}.topbar,.project-strip,.left-panel,.right-panel,.tool-ribbon,.board-footer,.app-footer{display:none!important}.app-shell,.workspace,.center-stage,.board-card{height:auto;display:block;padding:0;border:0;box-shadow:none}.workspace{display:block}.board-title-row{display:none}.board-shell{height:auto}.chess-board{width:180mm;height:180mm;margin:auto;filter:none}}

/* ===== BENKO CHESS DIAGRAM BUILDER – USKLAĐEN HEADER 2026 =====
   Svetliji app header koji prati plavu paletu Diagram Builder-a i izgled
   Benko Chess Program-a. Originalni Benko Chess logo koristi se iz icon.svg. */
.topbar{
  height:68px;
  margin:10px 12px 0;
  padding:0 18px;
  background:linear-gradient(180deg,#eef7fc 0%,#dcecf7 100%);
  color:#173f66;
  border:1px solid #b8cfdf;
  border-bottom:0;
  border-radius:18px 18px 0 0;
  box-shadow:0 7px 18px rgba(35,76,111,.10);
}
.brand-block{gap:12px}
.brand-mark{
  width:46px;
  height:46px;
  filter:none;
  flex:0 0 46px;
}
.brand-block h1{
  color:#173f66;
  font-size:20px;
  font-weight:760;
  letter-spacing:.05px;
}
.brand-subline{
  color:#6b8192;
  font-size:10.5px;
}
.top-actions{gap:8px}
.topbar .btn.ghost{
  color:#173f66;
  background:rgba(255,255,255,.72);
  border-color:#bfd3e2;
}
.topbar .btn.ghost:hover{
  color:#0f3558;
  background:#ffffff;
  border-color:#9ebfd5;
}
.topbar .icon-btn{
  color:#315a78;
  background:rgba(255,255,255,.55);
  border-color:#c4d6e3;
}
.topbar .icon-btn:hover{
  color:#173f66;
  background:#ffffff;
  border-color:#9ebfd5;
}
.topbar .btn.primary{
  background:linear-gradient(135deg,#e2ad3c,#f2cf78);
  color:#3f2e12;
  border-color:#d5a33b;
}
.topbar .btn.export{
  background:#ffffff;
  color:#173f66;
  border-color:#bfd3e2;
}
.project-strip{
  height:36px;
  margin:0 12px;
  padding:0 18px;
  background:#f8fbfd;
  border:1px solid #b8cfdf;
  border-top:1px solid rgba(184,207,223,.72);
  border-radius:0 0 14px 14px;
  color:#6f8393;
  box-shadow:0 5px 14px rgba(35,76,111,.06);
}
.project-name-input{color:#173f66}

@media(max-width:1250px){
  .topbar{margin:8px 8px 0;padding:0 12px;border-radius:15px 15px 0 0}
  .project-strip{margin:0 8px;padding:0 12px;border-radius:0 0 12px 12px}
}


/* ===== BENKO CHESS DIAGRAM BUILDER – SR/EN + FULL SCREEN 2026 ===== */
.topbar-controls{display:flex;align-items:center;gap:14px;min-width:0}
.lang-switch{height:34px;display:inline-flex;align-items:center;justify-content:center;gap:7px;padding:0 10px;border-left:1px solid #b8cfdf;color:#6f8393;flex:0 0 auto}
.lang-btn{border:0;background:transparent;color:#8a9aa7;font-size:12px;font-weight:850;padding:5px 2px;cursor:pointer;line-height:1;position:relative}
.lang-btn.active{color:#145b8c}.lang-btn.active::after{content:"";position:absolute;left:1px;right:1px;bottom:0;height:2px;background:#145b8c;border-radius:2px}.lang-btn:hover{color:#173f66}.lang-divider{color:#b4a58f;font-weight:700}
.fullscreen-btn{display:inline-flex;align-items:center;gap:7px;color:#173f66;background:rgba(255,255,255,.72);border-color:#bfd3e2;white-space:nowrap}.fullscreen-btn:hover{background:#fff;border-color:#9ebfd5}.fullscreen-glyph{font-size:16px;line-height:1}
.fullscreen-exit-btn{display:none;position:fixed;top:14px;right:14px;z-index:2147483647;width:44px;height:44px;border:1px solid rgba(255,255,255,.58);border-radius:50%;background:rgba(10,42,68,.9);color:#fff;font-size:30px;line-height:40px;align-items:center;justify-content:center;box-shadow:0 8px 25px rgba(0,0,0,.25);cursor:pointer;backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}
body.db-fullscreen-active .fullscreen-exit-btn{display:flex}body.db-fullscreen-active .topbar{margin-top:0;border-radius:0}body.db-fullscreen-active .project-strip{border-radius:0}body.db-fullscreen-active .app-shell{height:100vh}
@media(max-width:1450px){.fullscreen-btn #fullscreenBtnText{display:none}.fullscreen-btn{width:38px;padding:0;justify-content:center}.topbar-controls{gap:8px}.lang-switch{padding:0 7px}}
@media(max-width:1250px){.lang-switch{border-left:0}.topbar-controls{gap:6px}}


/* BENKO DIAGRAM BUILDER MOBILE WORKSPACE v1 */
.mobile-workspace-tabs{display:none}

@media(max-width:900px){
  html,body{width:100%;max-width:100%;height:100%;overflow:hidden}
  body{background:#edf1f4}
  .app-shell{width:100%;min-width:0;height:100dvh;min-height:0;overflow:hidden}

  .topbar{
    height:auto;min-height:0;flex:0 0 auto;display:flex;flex-direction:column;
    align-items:stretch;justify-content:flex-start;gap:6px;padding:7px 8px 6px;
  }
  .brand-block{gap:8px;min-width:0}
  .brand-mark{width:32px;height:32px;flex:0 0 32px}
  .brand-block h1{font-size:15px;line-height:1.08;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .brand-subline{display:none}
  .topbar-controls{display:flex;flex-direction:column;align-items:stretch;gap:6px;min-width:0}
  .lang-switch{position:absolute;top:10px;right:10px;height:28px;padding:0 7px;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.16);border-radius:999px}
  .top-actions{width:100%;display:flex;gap:6px;overflow-x:auto;overflow-y:hidden;padding:1px 0 2px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  .top-actions::-webkit-scrollbar{display:none}
  .top-actions .btn,.top-actions .icon-btn{height:36px;min-height:36px;flex:0 0 auto}
  .top-actions .btn{padding:0 10px;font-size:12px}
  .top-actions .icon-btn{width:38px}
  .fullscreen-btn{width:auto!important;padding:0 10px!important}
  .fullscreen-btn #fullscreenBtnText{display:inline!important}

  .project-strip{height:34px;min-height:34px;flex:0 0 34px;padding:0 8px;font-size:10px;gap:8px}
  .project-name-wrap{min-width:0;flex:1;gap:5px}
  .project-name-input{width:100%;min-width:70px;font-size:11px}
  #saveStatusText{display:none}
  .project-meta{flex:0 0 auto;gap:5px}
  .project-meta .divider,#boardStatusText{display:none}

  .mobile-workspace-tabs{
    display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px;
    flex:0 0 49px;height:49px;padding:5px 6px;background:#f7f9fb;border-bottom:1px solid #d7e0e6;
    position:relative;z-index:4;
  }
  .mobile-workspace-tab{
    min-width:0;border:1px solid #d4dde5;border-radius:9px;background:#fff;color:#526a7d;
    display:flex;align-items:center;justify-content:center;gap:4px;padding:0 4px;font-size:16px;
    touch-action:manipulation;-webkit-tap-highlight-color:transparent;
  }
  .mobile-workspace-tab b{font-size:10.5px;line-height:1;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .mobile-workspace-tab.active{background:#173f66;color:#fff;border-color:#173f66;box-shadow:0 3px 8px rgba(23,63,102,.18)}

  .workspace{flex:1;min-height:0;width:100%;display:block;padding:6px;overflow:hidden}
  .center-stage,.left-panel,.right-panel{display:none!important;width:100%;height:100%;min-width:0;min-height:0;max-width:none}
  .app-shell.mobile-view-board .center-stage{display:flex!important}
  .app-shell.mobile-view-diagrams .left-panel,
  .app-shell.mobile-view-pieces .left-panel{display:flex!important}
  .app-shell.mobile-view-settings .right-panel{display:flex!important}

  /* Left panel has two logical mobile screens. */
  .app-shell.mobile-view-diagrams .left-panel .diagrams-section{display:flex!important;flex:1 1 auto;height:100%;border-bottom:0}
  .app-shell.mobile-view-diagrams .left-panel .pieces-section{display:none!important}
  .app-shell.mobile-view-pieces .left-panel .diagrams-section{display:none!important}
  .app-shell.mobile-view-pieces .left-panel .pieces-section{display:block!important;height:100%;overflow:auto;border-bottom:0}
  .left-panel,.right-panel{overflow:hidden;border-radius:10px}
  .panel-section,.settings-section{padding:12px}
  .diagram-list{padding-right:1px}
  .diagram-item{grid-template-columns:62px minmax(0,1fr);padding:9px}
  .diagram-thumb{width:62px;height:62px}
  .diagram-title{font-size:13px}
  .piece-palette{grid-template-columns:repeat(6,minmax(0,1fr));gap:7px}
  .piece-btn{height:48px;min-width:0}
  .piece-btn svg{width:31px;height:34px}
  .piece-actions{grid-template-columns:1fr 1fr}
  .piece-actions .btn{min-height:42px;height:auto;padding:6px}

  /* Board stays the primary mobile workspace. */
  .center-stage{gap:6px;overflow:hidden}
  .tool-ribbon{height:48px;min-height:48px;padding:5px 6px;gap:5px;overflow-x:auto;overflow-y:hidden;justify-content:flex-start;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  .tool-ribbon::-webkit-scrollbar{display:none}
  .tool-group{gap:4px;flex:0 0 auto}
  .tool-label,.tool-btn span{display:none!important}
  .tool-btn{width:38px;height:38px;padding:0;justify-content:center;font-size:17px}
  .compact-group{padding-left:6px}
  .color-swatch{width:21px;height:21px}
  .right-tools{margin-left:0}

  .board-card{padding:7px 6px 6px;border-radius:10px;overflow:hidden}
  .board-title-row{height:auto;min-height:42px;align-items:center;gap:6px;margin-bottom:3px}
  .board-title-row .eyebrow{display:none}
  .board-title-row h2{font-size:14px;margin:0;max-width:110px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .board-status-actions{gap:5px;min-width:0;margin-left:auto}
  .mode-switch{height:28px}
  .mode-btn{height:22px;padding:0 7px;font-size:10px}
  .turn-badge{padding:5px 7px;font-size:9.5px;white-space:nowrap}
  .turn-disc{width:10px;height:10px}
  .board-shell{width:100%;min-height:0;padding:1px;align-items:flex-start}
  .chess-board{width:100%;height:auto;max-width:100%;max-height:100%;aspect-ratio:1/1;touch-action:none;filter:drop-shadow(0 6px 10px rgba(20,39,57,.18))}
  .board-footer{height:20px;padding-top:4px;font-size:9px}
  .board-footer span:last-child{display:none}

  /* Settings occupy the available screen and retain the existing four tabs. */
  .right-panel .tabs{height:43px;min-height:43px;flex:0 0 43px}
  .tab-btn{font-size:11px}
  .tab-panel{min-height:0;-webkit-overflow-scrolling:touch}
  .button-row{flex-wrap:wrap}
  .button-row .btn{min-height:38px;height:auto}
  .grid-two{grid-template-columns:1fr 1fr}
  .format-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  input,textarea,select{font-size:16px}

  .app-footer{display:none}

  .modal{width:calc(100% - 20px);max-width:calc(100% - 20px);max-height:88dvh}
}

@media(max-width:390px){
  .mobile-workspace-tab{gap:2px;padding:0 2px}
  .mobile-workspace-tab b{font-size:9.5px}
  .brand-block h1{font-size:14px;max-width:235px}
  .top-actions .btn{padding:0 8px;font-size:11px}
  .board-title-row h2{max-width:80px}
  .turn-badge{font-size:9px;padding:5px}
  .piece-palette{grid-template-columns:repeat(3,1fr)}
}

/* ===== BENKO CHESS DIAGRAM BUILDER v2.1 – MOBILE / FULLSCREEN POLISH ===== */
@media(max-width:900px){
  .topbar{position:relative;}

  /* Naslov ostaje čist; SR/EN i fullscreen su uvek dostupni gore desno. */
  .brand-block{padding-right:132px;}
  .brand-block h1{max-width:100%;}
  .lang-switch{
    top:9px;
    right:53px;
    height:30px;
    padding:0 7px;
    background:rgba(255,255,255,.62);
    border:1px solid #bfd3e2;
    color:#6f8393;
  }
  .fullscreen-btn{
    position:absolute!important;
    top:7px!important;
    right:8px!important;
    z-index:8!important;
    width:38px!important;
    min-width:38px!important;
    height:34px!important;
    min-height:34px!important;
    padding:0!important;
    justify-content:center!important;
    border-radius:10px!important;
    background:rgba(255,255,255,.78)!important;
    border-color:#bfd3e2!important;
  }
  .fullscreen-btn #fullscreenBtnText{display:none!important;}

  /* Red komandi uvek počinje od "Novi". Fullscreen više ne zauzima mesto u scroll redu. */
  .top-actions{
    width:100%;
    max-width:100%;
    padding:1px 0 3px;
    scroll-padding-left:0;
    overscroll-behavior-x:contain;
  }
  .top-actions > :first-child{margin-left:0!important;}

  /* Board kartica više ne raste do dna ekrana i ne pravi veliki beli prazan prostor. */
  .app-shell.mobile-view-board .workspace{
    overflow-y:auto;
    overflow-x:hidden;
    -webkit-overflow-scrolling:touch;
  }
  .app-shell.mobile-view-board .center-stage{
    height:auto!important;
    min-height:100%!important;
    overflow:visible!important;
    align-self:flex-start;
  }
  .app-shell.mobile-view-board .board-card{
    flex:0 0 auto!important;
    min-height:0!important;
    height:auto!important;
  }
  .app-shell.mobile-view-board .board-shell{
    flex:0 0 auto!important;
    height:auto!important;
    min-height:0!important;
  }
  .app-shell.mobile-view-board .chess-board{
    width:100%!important;
    height:auto!important;
    max-height:none!important;
  }

  body.db-fullscreen-active .app-shell{
    height:100vh;
    height:100dvh;
  }
}

@media(max-width:430px){
  .brand-block{padding-right:126px;}
  .brand-block h1{font-size:14px;}
  .lang-switch{right:49px;padding:0 6px;gap:5px;}
  .fullscreen-btn{right:6px!important;width:36px!important;min-width:36px!important;}
}

@media(max-width:360px){
  .brand-block{padding-right:118px;}
  .brand-block h1{font-size:13px;}
  .top-actions .btn{padding:0 7px;font-size:10.5px;}
}


/* ===== BENKO CHESS DIAGRAM BUILDER v2.2 – MOBILE HEADER + SCROLLABLE TOOL RIBBON ===== */
@media(max-width:900px){
  /* Brand must never enter the language/fullscreen control area. */
  .brand-block{min-width:0!important;}
  .brand-block > div:last-child{min-width:0;flex:1 1 auto;}
  .brand-block h1{min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;}

  /* The second command line is intentionally a horizontal ribbon. */
  .tool-ribbon{
    position:relative;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    touch-action:pan-x;
    overscroll-behavior-x:contain;
    scroll-behavior:smooth;
    -webkit-overflow-scrolling:touch;
    cursor:grab;
    padding-right:14px!important;
  }
  .tool-ribbon.is-dragging{cursor:grabbing;user-select:none;}
  .tool-ribbon .tool-group,
  .tool-ribbon .tool-btn,
  .tool-ribbon .color-swatch{touch-action:pan-x;}
  .tool-ribbon.can-scroll-right{box-shadow:inset -18px 0 14px -16px rgba(23,63,102,.72),0 4px 13px rgba(23,48,76,.07);}
  .tool-ribbon.can-scroll-left{box-shadow:inset 18px 0 14px -16px rgba(23,63,102,.72),0 4px 13px rgba(23,48,76,.07);}
  .tool-ribbon.can-scroll-left.can-scroll-right{box-shadow:inset 18px 0 14px -16px rgba(23,63,102,.72),inset -18px 0 14px -16px rgba(23,63,102,.72),0 4px 13px rgba(23,48,76,.07);}
}

/* On phone widths the full brand becomes two clean lines instead of colliding with SR/EN. */
@media(max-width:520px){
  .brand-block{padding-right:126px!important;align-items:center;}
  .brand-block h1{
    font-size:13.5px!important;
    line-height:1.08!important;
    white-space:normal!important;
    overflow:visible!important;
    text-overflow:clip!important;
  }
  .brand-title-main,.brand-title-product{display:block;white-space:nowrap;}
}

@media(max-width:360px){
  .brand-block{padding-right:118px!important;}
  .brand-block h1{font-size:12.5px!important;}
}

/* v2.3: u fullscreen režimu isto dugme postaje jasno X dugme za izlazak. */
body.db-fullscreen-active .fullscreen-btn .fullscreen-glyph{
  font-size:24px!important;
  font-weight:700!important;
  line-height:1!important;
  transform:translateY(-1px);
}

/* ===== BENKO CHESS DIAGRAM BUILDER v2.4 – UNIFIED BENKO CHESS COLORS =====
   Topla krem/bež osnova usklađena sa Benko Chess Programom i sajtom.
   Plava šahovska tabla i funkcionalne boje alata ostaju nepromenjene. */
:root{
  --bc-unified-blue:#08245c;
  --bc-unified-blue-2:#174a80;
  --bc-unified-gold:#d99a23;
  --bc-unified-bg:#f2e5d2;
  --bc-unified-paper:#fffdf8;
  --bc-unified-panel:#f8efe1;
  --bc-unified-line:#ddc9a7;
  --bc-unified-text:#342a22;
  --bc-unified-muted:#74695c;
}

html,body{
  background:linear-gradient(135deg,#f8f1e7 0%,#ecddc7 52%,#f7efe3 100%)!important;
  color:var(--bc-unified-text);
}

.topbar{
  background:linear-gradient(145deg,#f2e5d2 0%,#fbf6ed 48%,#ead8be 100%)!important;
  color:var(--bc-unified-blue)!important;
  border-color:#d4b47f!important;
  box-shadow:0 8px 20px rgba(76,51,29,.08)!important;
}
.brand-block h1{color:var(--bc-unified-blue)!important;}
.brand-subline{color:#846b4e!important;}

.topbar .btn.ghost,
.topbar .icon-btn,
.fullscreen-btn{
  color:#5b3f27!important;
  background:rgba(255,253,248,.80)!important;
  border-color:#d8c09b!important;
}
.topbar .btn.ghost:hover,
.topbar .icon-btn:hover,
.fullscreen-btn:hover{
  color:var(--bc-unified-blue)!important;
  background:#fffdf8!important;
  border-color:#c7a267!important;
}
.topbar .btn.primary{
  background:linear-gradient(135deg,#dda52f,#f6d98d)!important;
  color:#3a2818!important;
  border-color:#c98c1f!important;
}
.topbar .btn.export{
  background:#fffdf8!important;
  color:var(--bc-unified-blue)!important;
  border-color:#d8c09b!important;
}

.lang-switch{
  border-color:#d8c09b!important;
  color:#846b4e!important;
  background:rgba(255,253,248,.74)!important;
}
.lang-btn{color:#846b4e!important;}
.lang-btn.active{color:var(--bc-unified-blue-2)!important;}
.lang-btn.active::after{background:var(--bc-unified-blue-2)!important;}
.lang-btn:hover{color:var(--bc-unified-blue)!important;}
.lang-divider{color:#b39773!important;}

.project-strip{
  background:linear-gradient(180deg,#fffdf8 0%,#faf2e5 100%)!important;
  border-color:var(--bc-unified-line)!important;
  color:var(--bc-unified-muted)!important;
  box-shadow:0 5px 14px rgba(76,51,29,.05)!important;
}
.project-name-input{color:#5b3f27!important;}
.project-name-input:focus{background:#f7ead5!important;}
.divider{color:#b8a58c!important;}

.workspace{background:transparent!important;}
.panel,
.board-card,
.tool-ribbon{
  background:linear-gradient(180deg,#fffdf8 0%,#f8efe1 100%)!important;
  border-color:var(--bc-unified-line)!important;
  box-shadow:0 8px 20px rgba(76,51,29,.07)!important;
}
.panel-section,
.settings-section,
.tabs{border-color:#eadbc3!important;}
.panel h2,.board-card h2{color:#5b3f27!important;}
.eyebrow,.tool-label,.hint,.diagram-subtitle,.board-footer{color:#8b7a67!important;}

.square-btn,
.tool-btn,
.piece-btn,
.mode-switch,
.turn-badge,
.btn.small,
.format-card,
.fen-input,.comment-input,.full-input,select,input[type=number]{
  background:#fffdf9!important;
  border-color:#ddc9a7!important;
  color:#5b3f27!important;
}
.square-btn:hover,
.tool-btn:hover,
.piece-btn:hover,
.btn.small:hover,
.format-card:hover{background:#f8ead3!important;border-color:#c7a267!important;}

/* Aktivni alati mogu zadržati blagi plavi naglasak radi funkcionalne čitljivosti. */
.tool-btn.active,
.piece-btn.selected,
.format-card.selected{
  background:#edf3fb!important;
  color:var(--bc-unified-blue)!important;
  border-color:#9fb7db!important;
}
.mode-btn.active,
.mobile-workspace-tab.active{
  background:var(--bc-unified-blue)!important;
  color:#fff!important;
  border-color:var(--bc-unified-blue)!important;
}
.tab-btn.active{color:var(--bc-unified-blue)!important;}
.tab-btn.active:after{background:var(--bc-unified-gold)!important;}

.diagram-item:hover{background:#fbf3e7!important;}
.diagram-item.active{background:#f6e6c7!important;border-color:#d4b47f!important;}
.diagram-thumb{border-color:#d8c6a8!important;background:#fffdf9!important;}
.diagram-title{color:#5b3f27!important;}
.piece-color-label,.field-label,.field-stack,.check-grid{color:#6e5a45!important;}

.app-footer{
  background:#5b3f27!important;
  color:#eadbc3!important;
}
.app-footer button{color:#fff7e9!important;}

@media(max-width:900px){
  body{background:linear-gradient(135deg,#f8f1e7 0%,#ecddc7 52%,#f7efe3 100%)!important;}
  .mobile-workspace-tabs{
    background:#f2e5d2!important;
    border-bottom-color:#d6bb91!important;
  }
  .mobile-workspace-tab{
    background:#fffdf8!important;
    border-color:#ddc9a7!important;
    color:#5b3f27!important;
  }
  .mobile-workspace-tab.active{
    background:var(--bc-unified-blue)!important;
    border-color:var(--bc-unified-blue)!important;
    color:#fff!important;
  }
  .lang-switch{
    background:rgba(255,253,248,.88)!important;
    border-color:#d8c09b!important;
  }
  .fullscreen-btn{
    background:rgba(255,253,248,.92)!important;
    border-color:#d8c09b!important;
  }
  .tool-ribbon.can-scroll-right{box-shadow:inset -18px 0 14px -16px rgba(91,63,39,.60),0 8px 20px rgba(76,51,29,.07)!important;}
  .tool-ribbon.can-scroll-left{box-shadow:inset 18px 0 14px -16px rgba(91,63,39,.60),0 8px 20px rgba(76,51,29,.07)!important;}
  .tool-ribbon.can-scroll-left.can-scroll-right{box-shadow:inset 18px 0 14px -16px rgba(91,63,39,.60),inset -18px 0 14px -16px rgba(91,63,39,.60),0 8px 20px rgba(76,51,29,.07)!important;}
}

/* ===== BENKO CHESS DIAGRAM BUILDER v2.5 – FINAL COLOR CLEANUP =====
   Uklanja preostale svetloplave UI površine van same šahovske table.
   Zadržavaju se plava tabla i stvarne boje alata (zelena/crvena/plava/žuta). */

/* Brze radnje u desnom panelu */
.wide-action{
  background:linear-gradient(180deg,#fffdf9 0%,#fbf2e5 100%)!important;
  border-color:#ddc9a7!important;
  color:#5b3f27!important;
  box-shadow:none!important;
}
.wide-action:hover{
  background:#f8ead3!important;
  border-color:#c7a267!important;
}
.wide-action>span{
  background:#f6e6c7!important;
  color:var(--bc-unified-blue)!important;
  border:1px solid #dfc89f!important;
}
.wide-action small,
.switch-row small,
.format-card small{
  color:#8b7a67!important;
}

/* Aktivna/selektovana stanja koriste toplu Benko Chess zlatno-krem nijansu,
   umesto ostataka stare svetloplave teme. */
.tool-btn.active,
.piece-btn.selected,
.format-card.selected,
.btn.primary-lite{
  background:#f6e6c7!important;
  color:var(--bc-unified-blue)!important;
  border-color:#c7a267!important;
  box-shadow:0 0 0 2px rgba(217,154,35,.10)!important;
}

/* Fokus i kontrole desnog panela */
.fen-input:focus,
.comment-input:focus,
.full-input:focus,
select:focus,
input:focus{
  border-color:#c7a267!important;
  box-shadow:0 0 0 3px rgba(217,154,35,.13)!important;
}
.switch-row{border-bottom-color:#eadbc3!important;}
.right-panel input[type="checkbox"],
.right-panel input[type="radio"]{
  accent-color:var(--bc-unified-blue)!important;
}
.settings-section input[type="range"]{
  accent-color:var(--bc-unified-gold)!important;
}

/* Modali i promocija – ista topla paleta kada se otvore. */
.modal{
  background:#fffdf8!important;
  color:var(--bc-unified-text)!important;
}
.modal form{background:#fffdf8!important;}
.modal h3{color:var(--bc-unified-blue)!important;}
.modal p,.about-credit{color:#7d6e5d!important;}
.promotion-choice{
  background:#fffdf9!important;
  border-color:#ddc9a7!important;
}
.promotion-choice:hover,
.promotion-choice:focus-visible{
  background:#f8ead3!important;
  border-color:#c7a267!important;
  box-shadow:0 0 0 3px rgba(217,154,35,.13)!important;
}

/* Još nekoliko neutralnih UI linija koje su ostale iz plave teme. */
.compact-group{border-left-color:#eadbc3!important;}
.theme-preview{border-color:#ddc9a7!important;}
.field-message{color:#8b7a67!important;}

/* Site language controls the embedded app; standalone app keeps SR | EN. */
html.site-language-controlled .lang-switch{display:none!important}


/* ===== BENKO CHESS DIAGRAM BUILDER v2.6.2 – MOBILE ONE-LINE BRAND =====
   Na ugrađenoj SR/EN stranici jezički prekidač kontroliše sajt i skriven je,
   pa taj prostor koristimo da naziv aplikacije ostane u jednom redu. */
@media(max-width:520px){
  html.site-language-controlled .brand-block{
    padding-right:48px!important;
  }
  html.site-language-controlled .brand-block > div:last-child{
    min-width:0!important;
    flex:1 1 auto!important;
  }
  html.site-language-controlled .brand-block h1{
    max-width:none!important;
    font-size:14px!important;
    line-height:1.08!important;
    white-space:nowrap!important;
    overflow:visible!important;
    text-overflow:clip!important;
  }
  html.site-language-controlled .brand-title-main,
  html.site-language-controlled .brand-title-product{
    display:inline!important;
    white-space:nowrap!important;
  }
}
@media(max-width:360px){
  html.site-language-controlled .brand-block{
    padding-right:46px!important;
  }
  html.site-language-controlled .brand-block h1{
    font-size:13px!important;
  }
}


/* ===== BC UNIFIED UNIFIED BC APP SHELL =====
   The external 60px BC toolbar replaces the old internal topbar.
   Everything below it keeps the ORIGINAL Diagram Builder geometry. */
.topbar{display:none!important}
.fullscreen-exit-btn{display:none!important}


/* ===== BC INTEGRATED TEST v2.1 - PROJECT STRIP FINAL SHAPE =====
   "Moj projekat · Sačuvano · 1 dijagram · Beli je na potezu"
   je samostalna unutrašnja kartica:
   - zaobljena sa SVE četiri strane
   - odvojena od spoljne ivice tela aplikacije
   - bez lepljenja uz gornju liniju kalupa
*/
.project-strip{
  height:36px!important;
  min-height:36px!important;
  flex:0 0 36px!important;
  margin:8px 12px 0!important;
  padding:0 18px!important;
  border:1px solid var(--bc-unified-line)!important;
  border-radius:14px!important;
  background:linear-gradient(180deg,#fffdf8 0%,#faf2e5 100%)!important;
  box-shadow:
    0 5px 14px rgba(76,51,29,.05),
    inset 0 1px 0 rgba(255,255,255,.70)!important;
  overflow:hidden;
}

@media(max-width:1250px){
  .project-strip{
    margin:8px 8px 0!important;
    padding:0 12px!important;
    border-radius:12px!important;
  }
}

@media(max-width:760px){
  .project-strip{
    height:34px!important;
    min-height:34px!important;
    flex-basis:34px!important;
    margin:7px 7px 0!important;
    padding:0 9px!important;
    border-radius:11px!important;
  }
}

/* ===== BENKO CHESS DIAGRAM BUILDER v2.7 – MOBILE PROFESSIONAL POLISH =====
   Mobile-only refinement. Desktop geometry remains unchanged.
   Goals:
   - compact project strip and workspace navigation
   - all board tools visible without horizontal scrolling
   - full active-diagram title without ellipsis
   - clear two-line board header
   - compact pieces/diagram/settings workspaces
*/
@media(max-width:900px){
  .project-strip{
    height:32px!important;
    min-height:32px!important;
    flex:0 0 32px!important;
    margin:6px 6px 0!important;
    padding:0 10px!important;
    border-radius:11px!important;
  }
  .project-name-wrap{gap:6px!important;min-width:0!important;}
  .status-dot{width:8px!important;height:8px!important;flex:0 0 8px!important;}
  .project-name-input{
    min-width:0!important;
    width:100%!important;
    padding:2px 0!important;
    font-size:12px!important;
    font-weight:750!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  #saveStatusText,#boardStatusText,.project-meta .divider{display:none!important;}
  .project-meta{flex:0 0 auto!important;gap:0!important;}
  #diagramCounter{font-size:11px!important;white-space:nowrap!important;}

  .mobile-workspace-tabs{
    height:52px!important;
    min-height:52px!important;
    flex:0 0 52px!important;
    gap:6px!important;
    padding:6px!important;
    background:transparent!important;
    border-bottom:0!important;
  }
  .mobile-workspace-tab{
    gap:5px!important;
    border-radius:11px!important;
    box-shadow:0 3px 10px rgba(76,51,29,.05)!important;
  }
  .mobile-workspace-tab > span{font-size:16px!important;line-height:1!important;}
  .mobile-workspace-tab b{font-size:10.5px!important;letter-spacing:-.01em!important;}

  .workspace{padding:7px!important;}
  .left-panel,.right-panel,.board-card,.tool-ribbon{border-radius:13px!important;}

  /* Two stable rows: drawing tools / colors + board actions. */
  .tool-ribbon{
    height:auto!important;
    min-height:88px!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    grid-template-areas:
      "tools tools"
      "colors actions"!important;
    align-items:center!important;
    gap:6px 8px!important;
    padding:7px 8px!important;
    overflow:visible!important;
    cursor:default!important;
  }
  .tool-ribbon::before,.tool-ribbon::after{display:none!important;}
  .tool-ribbon > .tool-group:first-child{
    grid-area:tools!important;
    width:100%!important;
    display:grid!important;
    grid-template-columns:repeat(7,minmax(0,1fr))!important;
    gap:5px!important;
  }
  .tool-ribbon > .compact-group{
    grid-area:colors!important;
    width:max-content!important;
    padding:0 4px 0 1px!important;
    border-left:0!important;
    gap:7px!important;
  }
  .tool-ribbon > .right-tools{
    grid-area:actions!important;
    display:flex!important;
    justify-content:flex-end!important;
    gap:5px!important;
    margin-left:0!important;
  }
  .tool-ribbon .tool-label,.tool-ribbon .tool-btn span{display:none!important;}
  .tool-ribbon .tool-btn{
    width:100%!important;
    min-width:0!important;
    height:38px!important;
    padding:0!important;
    justify-content:center!important;
    border:1px solid #ddc9a7!important;
    border-radius:9px!important;
    font-size:17px!important;
  }
  .tool-ribbon .right-tools .tool-btn{width:40px!important;min-width:40px!important;}
  .tool-ribbon .color-swatch{width:23px!important;height:23px!important;}
  .tool-ribbon.can-scroll-left,
  .tool-ribbon.can-scroll-right,
  .tool-ribbon.can-scroll-left.can-scroll-right{box-shadow:0 8px 20px rgba(76,51,29,.07)!important;}

  .board-card{padding:8px 7px 7px!important;}
  .board-title-row{
    height:auto!important;
    min-height:0!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    gap:6px!important;
    align-items:stretch!important;
    margin-bottom:6px!important;
  }
  .board-title-row > div:first-child{min-width:0!important;}
  .board-title-row .eyebrow{display:none!important;}
  .board-title-row h2{
    max-width:none!important;
    margin:0 2px!important;
    font-size:16px!important;
    line-height:1.2!important;
    white-space:normal!important;
    overflow:visible!important;
    text-overflow:clip!important;
    overflow-wrap:anywhere!important;
  }
  .board-status-actions{
    width:100%!important;
    min-width:0!important;
    margin-left:0!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:7px!important;
  }
  .mode-switch{flex:0 0 auto!important;}
  .mode-btn{padding:0 10px!important;font-size:10.5px!important;}
  .turn-badge{
    min-width:0!important;
    max-width:55%!important;
    font-size:10px!important;
    padding:5px 8px!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }
  .board-shell{padding:1px!important;}
  .board-footer{height:19px!important;padding-top:4px!important;font-size:9px!important;}

  /* Keep all piece choices on one compact row per color on phone/tablet. */
  .piece-palette{grid-template-columns:repeat(6,minmax(0,1fr))!important;gap:6px!important;}
  .piece-btn{height:46px!important;min-width:0!important;}
  .piece-btn svg{width:29px!important;height:32px!important;}
  .piece-actions{gap:8px!important;margin-top:11px!important;}
  .piece-actions .btn{min-height:42px!important;}

  /* Diagrams are touch-friendly while staying compact. */
  .diagrams-section,.pieces-section{padding:13px!important;}
  .diagram-item{grid-template-columns:60px minmax(0,1fr)!important;gap:10px!important;padding:9px!important;border-radius:11px!important;}
  .diagram-thumb{width:60px!important;height:60px!important;}
  .diagram-title{font-size:13px!important;margin-top:4px!important;}
  .diagram-subtitle{font-size:10px!important;}

  /* Settings tabs remain visible while their active panel scrolls. */
  .right-panel{display:flex!important;flex-direction:column!important;}
  .right-panel .tabs{
    position:relative!important;
    z-index:3!important;
    height:46px!important;
    min-height:46px!important;
    flex:0 0 46px!important;
    background:#fffdf8!important;
  }
  .tab-btn{font-size:10.5px!important;}
  .tab-panel{overscroll-behavior:contain!important;}
  .settings-section{padding:13px!important;}
}

@media(max-width:430px){
  .mobile-workspace-tabs{gap:4px!important;padding:5px!important;}
  .mobile-workspace-tab{gap:3px!important;padding:0 3px!important;}
  .mobile-workspace-tab b{font-size:9.8px!important;}
  .tool-ribbon{min-height:84px!important;padding:6px!important;gap:5px 7px!important;}
  .tool-ribbon > .tool-group:first-child{gap:4px!important;}
  .tool-ribbon .tool-btn{height:36px!important;font-size:16px!important;}
  .tool-ribbon .right-tools .tool-btn{width:38px!important;min-width:38px!important;}
  .tool-ribbon .color-swatch{width:21px!important;height:21px!important;}
  .board-title-row h2{font-size:15px!important;}
  .turn-badge{max-width:52%!important;font-size:9.5px!important;}
  .piece-palette{gap:5px!important;}
  .piece-btn{height:43px!important;}
  .piece-btn svg{width:27px!important;height:30px!important;}
}

@media(max-width:360px){
  .mobile-workspace-tab > span{font-size:14px!important;}
  .mobile-workspace-tab b{font-size:9px!important;}
  .tool-ribbon .tool-btn{height:34px!important;font-size:15px!important;}
  .tool-ribbon .right-tools .tool-btn{width:36px!important;min-width:36px!important;}
  .mode-btn{padding:0 8px!important;font-size:10px!important;}
  .turn-badge{max-width:50%!important;font-size:9px!important;padding:5px 6px!important;}
}
