/* Tier Constructor — visão limpa, tela cheia com banco de equipes e prévia do PNG.
 * No celular o board é fluido e o banco vira uma bandeja fixa acima da navegação.
 * No modo tela cheia as equipes continuam disponíveis na bandeja inferior.
 */
.tier-board-quick-bar{
  display:flex;align-items:center;justify-content:space-between;gap:9px;
  margin:0 0 10px;padding:2px 0 8px;border-bottom:1px solid #2a3b55;
}
.tier-board-quick-bar>span{font-size:11px;font-weight:850;letter-spacing:.085em;color:#9ebbd7}
#tierFocusEnterBtn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  border:1px solid #326783;border-radius:9px;padding:9px 13px;
  font-size:12px;font-weight:850;color:#c7f1ff;background:#0e2b40;min-height:38px;
}
#tierFocusEnterBtn:hover,#tierFocusEnterBtn:focus-visible{background:#154762;border-color:#1abce7}
#tierFocusExitBtn[hidden]{display:none!important}
#tierFocusExitBtn{display:none}
.tier-row .row-name[contenteditable="true"]{cursor:text;caret-color:#0f1727;touch-action:manipulation}
.tier-row .row-name[contenteditable="true"]:focus{
  background:rgba(255,255,255,.28);
  border-radius:5px;outline:2px solid #112334;outline-offset:3px;
}
.tier-row .row-name[contenteditable="true"]:empty::before{content:"Nome da faixa";opacity:.55}
.tier-clean-mode .row-name[contenteditable="true"]{cursor:text}

@media(max-width:960px){
  /* Ajuste só visual: o PNG continua usando boardWidth, imageSize e fontes do projeto. */
  .tier-constructor-app .tier-board-panel .tier-export{
    width:100%!important;max-width:100%!important;min-width:0!important;
    margin:0!important;
  }
  .tier-constructor-app .tier-board-panel .tier-board{
    width:100%;min-width:0;overflow:hidden;
  }
  .tier-constructor-app .tier-board-panel{overflow-x:hidden}
}
@media(max-width:760px){
  .tier-constructor-app{padding:7px!important}
  .tier-constructor-app .workspace{padding-bottom:170px}
  .tier-constructor-app .tier-editor-layout{gap:0}
  .tier-constructor-app .tier-workspace-controls{padding:7px 9px;gap:6px}
  .tier-constructor-app .tier-layout-help{font-size:11px}
  .tier-constructor-app .tier-board-panel{
    border-radius:10px;padding:6px 5px 8px!important;
    background:#0b1220;
  }
  .tier-board-quick-bar{padding:5px 5px 9px;margin-bottom:5px}
  .tier-board-quick-bar>span{font-size:10px}
  #tierFocusEnterBtn{padding:7px 10px;min-height:35px;font-size:11px}
  .tier-constructor-app{
    --label-width:clamp(90px,27vw,125px)!important;
    --image-size:clamp(48px,14.6vw,62px)!important;
    --image-gap:5px!important;
    --row-min-height:84px!important;
  }
  .tier-constructor-app .tier-board-panel .tier-row{
    grid-template-columns:var(--label-width) minmax(0,1fr)!important;
    min-height:84px!important;height:auto!important;
  }
  .tier-constructor-app .tier-board-panel .tier-row>.row-label{
    position:relative!important;left:auto!important;
    padding:8px 5px!important;
    font-size:clamp(12px,3.7vw,17px)!important;
    align-items:center!important;text-align:center!important;
  }
  .tier-constructor-app .tier-board-panel .row-name{
    font-size:clamp(12px,3.7vw,17px)!important;
    line-height:1.14!important;
    min-height:0!important;max-width:100%;
    padding:3px 0!important;
  }
  .tier-constructor-app .tier-board-panel .tier-row>.dropzone{
    min-height:84px!important;
    padding:7px!important;gap:5px!important;
    align-content:center;align-items:center;
    justify-content:flex-start;
  }
  .tier-constructor-app .tier-board-panel .tier-row .image-card{
    flex:0 0 var(--image-size)!important;
    width:var(--image-size)!important;
    height:var(--image-size)!important;
    max-width:var(--image-size)!important;
    border-radius:5px;
    box-shadow:none;
  }
  .tier-constructor-app .tier-board-panel .tier-row .image-card.has-nameplate{
    height:calc(var(--image-size) + var(--nameplate-height,28px))!important;
    max-height:none!important;
  }
  .tier-constructor-app .tier-board-panel .tier-row .image-card.has-nameplate>img{
    width:100%;height:var(--image-size);min-height:var(--image-size);flex-basis:var(--image-size);
  }
  .tier-constructor-app .tier-board-panel .row-tools,
  .tier-constructor-app .tier-board-panel .row-delete-button,
  .tier-constructor-app .tier-board-panel .row-color{display:none!important}
  .tier-constructor-app .tier-board-panel .tier-row .image-card .card-actions{
    top:0;right:0;opacity:0;
  }
  .tier-constructor-app .tier-board-panel .tier-row .image-card:focus-within .card-actions,
  .tier-constructor-app .tier-board-panel .tier-row .image-card.touch-selected .card-actions{opacity:1}
  .tier-constructor-app .tier-board-panel .image-rank-badge{font-size:9px!important;padding:2px 3px}
  .tier-constructor-app .tier-board-panel .tier-image-nameplate{font-size:10px!important}
  /* Bandeja de equipes, como nos tier makers mobile: sempre perto da mão. */
  .tier-constructor-app .tier-editor-layout .tier-bank-panel,
  .tier-constructor-app .tier-editor-layout[data-bank-layout="bottom"] .tier-bank-panel{
    position:fixed!important;
    top:auto!important;
    left:0!important;right:0!important;
    bottom:calc(70px + env(safe-area-inset-bottom,0px))!important;
    z-index:120!important;
    order:2;width:100%!important;
    padding:7px 10px 6px!important;
    max-height:min(36dvh,260px)!important;
    overflow:auto;
    border:1px solid #36516f;border-bottom:0;
    border-radius:14px 14px 0 0!important;
    background:rgba(9,18,32,.98)!important;
    box-shadow:0 -6px 24px #0009!important;
  }
  .tier-constructor-app .tier-bank-panel .bank-title{
    flex-wrap:nowrap;gap:8px;margin:0 2px 4px!important;
  }
  .tier-constructor-app .tier-bank-panel .bank-title h2{
    font-size:12px!important;line-height:1.2;
  }
  .tier-constructor-app .tier-bank-panel .count{font-size:10px}
  .tier-constructor-app .tier-editor-layout .tier-bank-panel #imageBank{
    height:69px!important;min-height:69px!important;max-height:69px!important;
    gap:7px!important;padding:6px!important;
    background:#0b1525;
  }
  .tier-constructor-app .tier-editor-layout #imageBank .image-card,
  .tier-constructor-app .tier-editor-layout[data-bank-layout="bottom"] #imageBank .image-card{
    flex:0 0 55px!important;width:55px!important;height:55px!important;
    max-width:55px!important;min-width:55px!important;
  }
  .tier-constructor-app .tier-bank-panel .trash-panel{margin-top:4px}
  .tier-constructor-app .tier-bank-panel .trash-panel>summary{
    font-size:10px;padding:4px 8px;
  }
  .tier-constructor-app .tier-bank-panel .trash-panel .archived-bank{max-height:110px;overflow:auto}
  .tier-constructor-app .tier-editor-layout .tier-board-panel{order:1;width:100%}
}
@media(max-width:360px){
  .tier-constructor-app{--label-width:86px!important;--image-size:46px!important}
  .tier-constructor-app .tier-board-panel .tier-row>.row-label{font-size:12px!important}
  .tier-constructor-app .tier-board-panel .row-name{font-size:12px!important}
  .tier-constructor-app .tier-board-panel .tier-row>.dropzone{padding:5px!important;gap:4px!important}
}
/* Imersivo: funciona também no iPhone, sem depender da API Fullscreen. */
body.tier-focus-mode{overflow:hidden!important}
body.tier-focus-mode .tier-constructor-app .tier-board-panel{
  position:fixed!important;inset:0!important;
  top:0!important;left:0!important;right:0!important;bottom:0!important;
  width:100vw!important;height:100dvh!important;
  min-width:0!important;max-width:none!important;
  z-index:2147483000!important;
  padding:calc(52px + env(safe-area-inset-top,0px)) 0
    calc(12px + env(safe-area-inset-bottom,0px))!important;
  border:0!important;border-radius:0!important;
  background:#080e17!important;
  box-shadow:none!important;
  display:block!important;
  overflow-x:hidden!important;overflow-y:auto!important;
  overscroll-behavior:contain;
}
body.tier-focus-mode .tier-board-panel .tier-board-quick-bar{display:none!important}
body.tier-focus-mode .tier-board-panel #tierFocusExitBtn:not([hidden]){
  position:fixed;display:inline-flex;align-items:center;justify-content:center;
  top:calc(8px + env(safe-area-inset-top,0px));right:12px;
  z-index:2147483001;
  border:1px solid #52718b;
  border-radius:8px;background:#14263a;color:#e4f4ff;
  min-height:37px;padding:7px 12px;font-size:12px;font-weight:850;
}
body.tier-focus-mode .tier-board-panel .tier-export{
  width:min(100%,var(--board-width))!important;
  max-width:100%!important;
  min-width:0!important;
  margin:0 auto!important;
}
body.tier-focus-mode .tier-board-panel #tierCaption{display:none!important}
body.tier-focus-mode .tier-board-panel #tierBoard{margin:0!important}
body.tier-focus-mode .tier-constructor-app .tier-board-panel .row-tools,
body.tier-focus-mode .tier-constructor-app .tier-board-panel .row-color,
body.tier-focus-mode .tier-constructor-app .tier-board-panel .row-delete-button,
body.tier-focus-mode .tier-constructor-app .tier-board-panel .image-card .card-actions{display:none!important}
/* Keep the actual bank/drop targets, so touch and drag/drop retain their handlers. */
body.tier-focus-mode .tier-constructor-app .tier-editor-layout .tier-bank-panel{
  display:flex!important;position:fixed!important;
  left:0!important;right:0!important;top:auto!important;bottom:0!important;
  width:100%!important;max-height:142px!important;
  padding:7px 12px calc(7px + env(safe-area-inset-bottom,0px))!important;
  z-index:2147483002!important;border-radius:12px 12px 0 0!important;
  background:#0c172a!important;box-shadow:0 -6px 24px #0009;
}
body.tier-focus-mode .tier-bank-panel .bank-title{margin:0 0 5px!important}
body.tier-focus-mode .tier-bank-panel .bank-title h2{font-size:12px!important}
body.tier-focus-mode .tier-bank-panel #imageBank{
  display:flex!important;flex-direction:row!important;flex-wrap:nowrap!important;
  overflow-x:auto!important;overflow-y:hidden!important;align-items:center!important;
  height:74px!important;min-height:74px!important;max-height:74px!important;gap:8px!important;padding:6px!important;
}
body.tier-focus-mode .tier-bank-panel #imageBank .image-card{
  flex:0 0 58px!important;width:58px!important;height:58px!important;min-width:58px!important;max-width:58px!important;
}
body.tier-focus-mode .tier-bank-panel .trash-panel,
body.tier-focus-mode .tier-bank-panel .mobile-drag-tip{display:none!important}
body.tier-focus-mode .tier-constructor-app .tier-board-panel{
  padding-bottom:calc(158px + env(safe-area-inset-bottom,0px))!important;
}
#tierFocusPreviewBtn{display:none}
body.tier-focus-mode #tierFocusPreviewBtn{
  display:block;position:fixed;top:calc(8px + env(safe-area-inset-top,0px));left:10px;
  z-index:2147483001;border:1px solid #52718b;background:#14263a;color:#e4f4ff;
  border-radius:8px;padding:7px 10px;min-height:37px;font-size:12px;
}
@media(max-width:960px){
 body.tier-focus-mode .tier-board-panel .tier-export{width:100%!important}
}
@media(max-width:760px){
 body.tier-focus-mode .tier-constructor-app .tier-board-panel{
  padding-top:calc(49px + env(safe-area-inset-top,0px))!important;
  padding-bottom:calc(158px + env(safe-area-inset-bottom,0px))!important;
 }
 body.tier-focus-mode .tier-constructor-app .tier-board-panel .tier-row>.row-label{
  position:relative!important;left:auto!important;
 }
}

/* Same canvas pipeline as export/copy/share. Preview is generated only on demand. */
.tier-board-quick-bar>span{margin-right:auto}
#previewTierBtn{font-size:12px;padding:8px 10px;min-height:35px}
#tierPreviewDialog{
  width:min(960px,96vw);max-width:96vw;max-height:94dvh;padding:0;
  border:1px solid #36516f;border-radius:14px;background:#0c1424;color:#e4f4ff;
}
#tierPreviewDialog[open]{display:flex;flex-direction:column;overflow:hidden}
#tierPreviewDialog::backdrop{background:#020611df}
#tierPreviewDialog .modal-header,#tierPreviewDialog .modal-actions{flex:none;padding:12px 16px;margin:0;background:#101c30}
#tierPreviewDialog .modal-header h2{font-size:17px}
.tier-preview-body{overflow-y:auto;min-height:0;padding:14px 16px}
.tier-preview-body label{display:block;font-size:12px;margin-bottom:6px;color:#b5cce4}
#tierExportFormat{width:100%;padding:11px;border:1px solid #36516f;border-radius:8px;background:#101c30;color:#fff}
.tier-preview-help,#tierPreviewStatus{font-size:12px;line-height:1.5;color:#adc5de;margin:10px 0}
.tier-preview-stage{display:flex;align-items:center;justify-content:center;min-height:120px;padding:10px;border-radius:10px;background:#050a12}
#tierPreviewImage{display:block;width:auto;height:auto;max-width:100%;max-height:52dvh;object-fit:contain;box-shadow:0 4px 24px #0008}
#tierPreviewImage[hidden]{display:none}
body.tier-constructor-page #cff-global-chat{display:none!important}
@media(max-width:600px){
  #tierPreviewDialog{max-height:96dvh;width:96vw}
  #tierPreviewDialog .modal-header,#tierPreviewDialog .modal-actions,.tier-preview-body{padding:10px}
  #tierPreviewDialog .modal-actions{display:flex;flex-wrap:wrap;gap:8px}
  #tierPreviewDialog .modal-actions button{flex:1;min-width:120px}
  .tier-board-quick-bar{gap:5px;flex-wrap:wrap}
  .tier-board-quick-bar>span{flex:1 1 100%}
}

.tier-focus-move-tip{display:none}
body.tier-focus-mode .tier-focus-move-tip{display:block;font-size:11px;color:#a8bfd5}
body.tier-focus-mode .tier-bank-panel .bank-title{flex-wrap:wrap!important}

/* Touch Events preserve native scrolling until a short hold starts dragging. */
#tierEditorLayout .image-card,#tierEditorLayout .image-card img{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}
.tier-touch-ghost{
 position:fixed;left:0;top:0;width:68px;z-index:2147483100;
 pointer-events:none!important;display:flex;flex-direction:column;align-items:center;
 padding:5px;border:2px solid #8ca1ff;border-radius:10px;background:#14233aeF;
 box-shadow:0 8px 24px #0009;will-change:transform;
}
.tier-touch-ghost img{width:54px;height:54px;object-fit:contain;pointer-events:none}
.tier-touch-ghost span{font:700 9px/1.2 Inter,Arial,sans-serif;color:#fff;text-align:center;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#tierEditorLayout .tier-touch-source{opacity:.28!important}
#tierEditorLayout .tier-touch-target{outline:3px solid #8ca1ff!important;outline-offset:-3px;background:rgba(110,124,255,.22)!important}
#tierEditorLayout .tier-touch-before{box-shadow:inset 4px 0 #b0baff!important}
body.tier-touch-dragging,body.tier-touch-dragging #tierEditorLayout{cursor:grabbing;-webkit-user-select:none;user-select:none}


/* Desktop focus mode: viewport-sized tier, read-only controls, full-width logo tray (2026-11-05). */
body.tier-focus-mode #tierFocusPreviewBtn,
body.tier-focus-mode .tier-constructor-app .tier-bank-panel .image-card .card-actions{
  display:none!important;
}
@media(min-width:961px){
  body.tier-focus-mode{
    --tier-focus-tray-height:clamp(120px,16dvh,154px);
  }
  body.tier-focus-mode .tier-constructor-app .tier-board-panel{
    padding:54px clamp(14px,1.3vw,28px)
      calc(var(--tier-focus-tray-height) + 12px)!important;
  }
  body.tier-focus-mode .tier-board-panel .tier-export{
    width:100%!important;
    max-width:none!important;
    min-width:0!important;
    margin:0 auto!important;
  }
  body.tier-focus-mode .tier-board-panel .tier-board{
    --label-width:clamp(170px,12.5vw,230px);
    display:grid;
    grid-auto-rows:minmax(118px,1fr);
    min-height:calc(100dvh - 66px - var(--tier-focus-tray-height))!important;
    border-radius:5px;
  }
  body.tier-focus-mode .tier-board-panel .tier-row{
    min-height:0!important;
  }
  body.tier-focus-mode .tier-board-panel .tier-row>.row-label{
    padding:12px clamp(12px,1.1vw,22px)!important;
  }
  body.tier-focus-mode .tier-board-panel .tier-row>.dropzone{
    min-height:0!important;
    align-content:center;
    align-items:center;
    padding:12px!important;
  }
  body.tier-focus-mode .tier-constructor-app .tier-editor-layout .tier-bank-panel{
    height:var(--tier-focus-tray-height)!important;
    max-height:var(--tier-focus-tray-height)!important;
    min-height:0!important;
    padding:9px 14px 8px!important;
    border-radius:12px 12px 0 0!important;
  }
  body.tier-focus-mode .tier-bank-panel .bank-title{
    flex-wrap:nowrap!important;
    min-height:18px;
    margin:0 0 5px!important;
  }
  body.tier-focus-mode .tier-bank-panel #imageBank{
    flex:1 1 auto;
    min-height:0!important;
    max-height:none!important;
    height:auto!important;
    padding:5px 8px!important;
  }
  body.tier-focus-mode .tier-bank-panel #imageBank .image-card{
    flex:0 0 clamp(62px,8.5dvh,82px)!important;
    width:clamp(62px,8.5dvh,82px)!important;
    height:clamp(62px,8.5dvh,82px)!important;
    min-width:clamp(62px,8.5dvh,82px)!important;
    max-width:clamp(62px,8.5dvh,82px)!important;
  }
}

/* Tier settings cleanup and optional per-row image caps — 2026-11-06 */
/* Configuration gear lives alongside the full-screen action, not in the main toolbar. */
.tier-board-quick-bar #settingsBtn.tier-board-settings-btn{
  appearance:none;display:inline-flex;align-items:center;justify-content:center;
  flex:0 0 38px;width:38px;height:38px;min-height:38px;
  padding:0;border:1px solid #326783;border-radius:9px;
  color:#c7f1ff;background:#0e2b40;font-size:21px;line-height:1;
}
.tier-board-quick-bar #settingsBtn.tier-board-settings-btn:hover,
.tier-board-quick-bar #settingsBtn.tier-board-settings-btn:focus-visible{
  border-color:#1abce7;background:#154762;outline-offset:2px;
}
/* Editable rows keep their per-row limit in snapshots, JSON, and shared links. */
#rowManager .tier-row-limit-setting{
  display:grid;grid-template-columns:minmax(0,1fr) 76px;align-items:center;
  gap:3px 12px;width:100%;min-width:0;padding:9px 0 1px;
  border-top:1px solid #ffffff19;
}
#rowManager .tier-row-limit-setting>span{
  grid-column:1;font-size:12px;font-weight:850;color:#e1eafb;
}
#rowManager .tier-row-limit-setting>small{
  grid-column:1;grid-row:2;line-height:1.35;color:#9daac0;font-size:11px;
}
#rowManager .tier-row-limit-setting>input{
  grid-column:2;grid-row:1/3;width:76px;min-width:0;min-height:39px;
  border:1px solid #3a516e;border-radius:8px;padding:7px 9px;
  color:#f0f8ff;background:#101c30;font-size:15px;text-align:center;
}
#settingsDialog.settings-drawer[open]{
  display:flex;flex-direction:column;overflow:hidden;height:100dvh;
  max-height:100dvh;
}
#settingsDialog.settings-drawer .modal-header{
  position:relative;top:0;z-index:5;display:flex;flex:0 0 auto;
  justify-content:space-between;align-items:center;gap:10px;
  background:#111c2d;border-bottom:1px solid #36516f;
  padding:12px 16px;min-height:62px;
}
#settingsDialog.settings-drawer .modal-header h2{
  margin:0;min-width:0;line-height:1.2;font-size:19px;
}
#settingsDialog.settings-drawer #closeSettingsBtn{
  position:relative;display:inline-flex;align-items:center;justify-content:center;
  margin-left:auto;flex:0 0 44px;width:44px;height:44px;
  border:1px solid #486582;border-radius:10px;background:#192c42;
  color:#f7fbff;font-size:21px;cursor:pointer;
}
#settingsDialog.settings-drawer .modal-body{
  flex:1 1 auto;min-height:0;max-height:none!important;
  overflow-y:auto;overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}
#settingsDialog.settings-drawer .modal-actions{
  flex:0 0 auto;border-top:1px solid #2d3d52;background:#15171c;
}
@media(max-width:760px){
  /* Tier is a focused editor: the global dock returns on other site pages. */
  body.tier-constructor-page .cff-bottom-navigation{display:none!important}
  body.tier-constructor-page{padding-bottom:0!important}
  /* The fixed image tray must never cover the open settings. */
  body.tier-constructor-page.settings-open #tierBankPanel,
  body.tier-constructor-page.settings-open .tier-bank-panel{display:none!important}
  body.tier-constructor-page.settings-open .tier-constructor-app .workspace{padding-bottom:16px}
  #settingsDialog.settings-drawer{
    inset:0 0 0 auto;top:0;right:0;left:auto;bottom:0;
    width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;
    border-radius:0;
  }
  #settingsDialog.settings-drawer .modal-header{
    position:sticky;top:0;z-index:10;
    min-height:calc(60px + env(safe-area-inset-top,0px));
    padding:calc(9px + env(safe-area-inset-top,0px)) 12px 9px;
  }
  #settingsDialog.settings-drawer .modal-body{
    padding-bottom:calc(22px + env(safe-area-inset-bottom,0px));
  }
  .tier-board-quick-bar #settingsBtn.tier-board-settings-btn{
    height:35px;min-height:35px;flex-basis:35px;width:35px;font-size:19px;
  }
  #rowManager .tier-row-limit-setting{grid-template-columns:minmax(0,1fr) 68px}
  #rowManager .tier-row-limit-setting>input{width:68px}
}

/* 2026-11-07: accordions + anchored settings actions and bottom image tray */
/* Every option starts collapsed; editing a category expands only that category. */
#settingsDialog.settings-drawer .tier-settings-accordion{
  display:block!important;padding:0!important;
  border:1px solid #2c405c;border-radius:12px;background:#101721;
  overflow:hidden;
}
#settingsDialog.settings-drawer .tier-settings-accordion-title{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  list-style:none;cursor:pointer;user-select:none;
  min-height:54px;padding:14px 15px;
  color:#f1f6ff;font-size:14px;font-weight:850;line-height:1.3;
}
#settingsDialog.settings-drawer .tier-settings-accordion-title::-webkit-details-marker{display:none}
#settingsDialog.settings-drawer .tier-settings-accordion-title:focus-visible{
  outline:2px solid #00c8ff;outline-offset:-3px
}
#settingsDialog.settings-drawer .tier-settings-accordion-chevron{
  display:inline-flex;align-items:center;justify-content:center;
  font-size:22px;font-weight:500;color:#8daeca;transition:transform .16s ease
}
#settingsDialog.settings-drawer .tier-settings-accordion[open] .tier-settings-accordion-chevron{
  transform:rotate(180deg)
}
#settingsDialog.settings-drawer .tier-settings-accordion[open]>.tier-settings-accordion-title{
  border-bottom:1px solid #283b53;background:#142137;color:#f8fbff
}
#settingsDialog.settings-drawer .tier-settings-accordion:not([open])>:not(summary){
  display:none!important
}
#settingsDialog.settings-drawer .tier-settings-accordion[open]>:not(summary){
  margin:12px 13px
}
#settingsDialog.settings-drawer .tier-layout-reset-row{
  display:flex;justify-content:flex-end;padding-top:10px;border-top:1px solid #29374b
}
/* Fixed dialog structure: header and footer never belong to the scroll container. */
#settingsDialog.settings-drawer[open]{
  position:fixed!important;z-index:2147483007!important;
  inset:0 0 0 auto!important;
  display:flex!important;flex-direction:column!important;
  width:min(480px,100vw);max-width:100vw;
  height:100dvh!important;max-height:100dvh!important;
  margin:0!important;overflow:hidden!important;
  overscroll-behavior:contain
}
#settingsDialog.settings-drawer .tier-settings-sticky-header{
  position:relative!important;top:auto!important;
  flex:0 0 auto;z-index:4;min-width:0
}
#settingsDialog.settings-drawer .tier-settings-header-actions{
  display:flex;align-items:center;justify-content:flex-end;gap:8px;
  margin-left:auto;flex:0 0 auto
}
#settingsDialog.settings-drawer .tier-settings-save{
  display:inline-flex;align-items:center;justify-content:center;
  min-height:43px;padding:8px 13px;border:1px solid #3691ba;
  border-radius:8px;background:#114660;color:#fff;
  font-size:13px;font-weight:850;cursor:pointer
}
#settingsDialog.settings-drawer .modal-body{
  display:block!important;flex:1 1 0!important;
  min-height:0!important;max-height:none!important;
  overflow-x:hidden!important;overflow-y:auto!important;
  -webkit-overflow-scrolling:touch;overscroll-behavior-y:contain;
  padding:13px!important
}
#settingsDialog.settings-drawer .modal-actions.tier-settings-footer{
  display:flex;flex:0 0 auto;align-items:center;gap:10px;
  margin:0!important;padding:11px 13px calc(11px + env(safe-area-inset-bottom,0px))!important;
  background:#101c2c;border-top:1px solid #33516e;z-index:4
}
#settingsDialog.settings-drawer .tier-settings-footer button{
  flex:1 1 0;min-height:43px;min-width:0;
  padding:8px 10px;font-size:12px;font-weight:850
}
#settingsDialog.settings-drawer #closeSettingsBtn{
  display:inline-flex!important;flex:0 0 43px!important;
  width:43px!important;height:43px!important;min-width:43px!important;
  margin:0!important;border-radius:9px
}
@media(max-width:760px){
  body.tier-constructor-page.settings-open{overflow:hidden!important}
  /* The tier toolbar/dock must not sit above the iPhone's settings overlay. */
  body.tier-constructor-page.settings-open .cff-public-topbar,
  body.tier-constructor-page.settings-open .cff-mobile-header{
    visibility:hidden!important
  }
  #settingsDialog.settings-drawer[open]{
    top:0!important;bottom:0!important;left:0!important;right:0!important;
    width:100vw!important;max-width:100vw!important;min-height:100dvh!important;
    border:0!important;border-radius:0!important;
    background:#0d1420!important
  }
  #settingsDialog.settings-drawer::backdrop{
    background:#040911dd!important
  }
  #settingsDialog.settings-drawer .tier-settings-sticky-header{
    padding:calc(10px + env(safe-area-inset-top,0px)) 12px 10px!important;
    min-height:calc(62px + env(safe-area-inset-top,0px))!important;
    background:#0f1c30!important;box-shadow:0 2px 15px #0007
  }
  #settingsDialog.settings-drawer .tier-settings-sticky-header h2{font-size:18px}
  #settingsDialog.settings-drawer .modal-body{padding:11px!important}
  #settingsDialog.settings-drawer .tier-settings-footer{
    padding-bottom:calc(12px + env(safe-area-inset-bottom,0px))!important
  }
  #settingsDialog.settings-drawer .settings-grid{gap:10px}
  /* No extra 70px reserved for the old navigation dock. */
  body.tier-constructor-page:not(.tier-focus-mode) .tier-constructor-app .tier-editor-layout .tier-bank-panel,
  body.tier-constructor-page:not(.tier-focus-mode) .tier-constructor-app .tier-editor-layout[data-bank-layout="bottom"] .tier-bank-panel{
    display:flex!important;flex-direction:column!important;
    position:fixed!important;top:auto!important;
    left:0!important;right:0!important;bottom:0!important;
    z-index:2147481000!important;order:2!important;
    width:100vw!important;min-height:0!important;
    max-height:min(190px,32dvh)!important;
    padding:8px 10px calc(8px + env(safe-area-inset-bottom,0px))!important;
    margin:0!important;border-radius:13px 13px 0 0!important;
    overflow-x:hidden!important;overflow-y:auto!important
  }
  body.tier-constructor-page.settings-open .tier-constructor-app #tierBankPanel{
    display:none!important
  }
  body.tier-constructor-page:not(.tier-focus-mode) .tier-constructor-app .workspace{
    padding-bottom:calc(190px + env(safe-area-inset-bottom,0px))!important
  }
  /* Keep the photo rail usable for sideways swipes. */
  body.tier-constructor-page .tier-constructor-app #imageBank{
    overflow-x:auto!important;overflow-y:hidden!important;
    touch-action:pan-x;
  }
}

/* Mundial 2026: dedicated player photo gallery tab */
.tier-constructor-app #tierAssetTypeButtons.tier-library-tabs{
  display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;
  min-width:0;width:100%
}
.tier-constructor-app #tierAssetTypeButtons.tier-library-tabs button{
  min-width:0;padding:9px 5px;font-size:clamp(10px,1vw,12px);
  line-height:1.2;white-space:nowrap
}
@media(max-width:760px){
  .tier-constructor-app #tierAssetTypeButtons.tier-library-tabs button{
    padding:10px 3px;font-size:11px
  }
}

/* Tier Constructor: permanent visible actions for archived images (2026-11-07) */
.tier-constructor-app #archivedBank.trash-dropzone{
  display:grid!important;
  grid-template-columns:repeat(auto-fill,minmax(min(100%,230px),1fr))!important;
  align-items:start;
  align-content:start;
  gap:8px!important;
  padding:9px!important;
  min-width:0;
}
.tier-constructor-app #archivedBank .tier-archived-item{
  display:grid;
  grid-template-columns:60px minmax(0,1fr);
  grid-template-rows:auto auto;
  align-items:center;
  gap:5px 9px;
  width:100%;
  min-width:0;
  padding:8px;
  box-sizing:border-box;
  border:1px solid #314563;
  border-radius:10px;
  background:#101b2c;
}
.tier-constructor-app #archivedBank .tier-archived-image{
  grid-column:1;
  grid-row:1 / 3;
  display:block;
  width:60px;
  height:68px;
  max-width:100%;
  object-fit:contain;
  object-position:center;
  pointer-events:none;
}
.tier-constructor-app #archivedBank .tier-archived-name{
  grid-column:2;
  grid-row:1;
  color:#eff5ff;
  font-size:12px;
  font-weight:800;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.tier-constructor-app #archivedBank .tier-archived-actions{
  grid-column:2;
  grid-row:2;
  display:flex!important;
  flex-wrap:wrap;
  align-items:center;
  gap:5px;
  width:100%;
  opacity:1!important;
  position:static!important;
}
.tier-constructor-app #archivedBank .tier-archived-actions button{
  display:inline-flex!important;
  align-items:center;
  justify-content:center;
  flex:1 1 75px;
  min-width:0;
  min-height:36px;
  width:auto!important;
  height:auto!important;
  padding:7px 8px!important;
  border-radius:7px!important;
  font-size:11px;
  font-weight:800;
  line-height:1.2;
  font-family:inherit;
  white-space:nowrap;
  cursor:pointer;
  opacity:1!important;
  transform:none!important;
}
.tier-constructor-app #archivedBank .tier-archived-actions .restore-image{
  background:#174766!important;
  color:#d1f5ff!important;
  border:1px solid #276b91!important;
}
.tier-constructor-app #archivedBank .tier-archived-actions .delete-forever-image{
  background:#4e1923!important;
  color:#ffe4e6!important;
  border:1px solid #983447!important;
}
.tier-constructor-app #archivedBank .tier-archived-actions button:focus-visible{
  outline:2px solid #f3cb63;
  outline-offset:2px;
}
@media(max-width:760px){
  .tier-constructor-app .tier-bank-panel .trash-panel .archived-bank{
    max-height:min(34dvh,190px)!important;
    min-height:0!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
  }
  .tier-constructor-app #archivedBank.trash-dropzone{
    grid-template-columns:minmax(0,1fr)!important;
  }
  .tier-constructor-app #archivedBank .tier-archived-item{
    grid-template-columns:53px minmax(0,1fr);
    padding:7px;
  }
  .tier-constructor-app #archivedBank .tier-archived-image{
    width:53px;
    height:67px;
  }
  .tier-constructor-app #archivedBank .tier-archived-actions button{
    min-height:38px;
  }
}

/* Expanded mobile archive tray leaves room for the restore/delete buttons. */
@media(max-width:760px){
  body.tier-constructor-page:not(.tier-focus-mode):not(.settings-open) .tier-constructor-app .tier-editor-layout .tier-bank-panel:has(#trashPanel[open]),
  body.tier-constructor-page:not(.tier-focus-mode):not(.settings-open) .tier-constructor-app .tier-editor-layout[data-bank-layout="bottom"] .tier-bank-panel:has(#trashPanel[open]){
    max-height:min(52dvh,380px)!important;
  }
  .tier-constructor-app #trashPanel[open] #archivedBank{
    max-height:min(31dvh,250px)!important;
    overscroll-behavior-y:contain;
  }
}

/* FFWS Global Finals role preset nameplate choice dialog — 2026-11-07 */
#tierPresetNamesDialog.tier-preset-names-dialog{
  width:min(440px,calc(100vw - 28px));
  max-width:calc(100vw - 28px);
  max-height:min(85dvh,580px);
  padding:0;
  border:1px solid #375572;
  border-radius:16px;
  background:#0d182a;
  color:#f7fbff;
  box-shadow:0 22px 65px rgba(0,0,0,.7);
  overflow-y:auto;
}
#tierPresetNamesDialog.tier-preset-names-dialog::backdrop{
  background:rgba(2,7,16,.80);
  backdrop-filter:blur(4px);
}
#tierPresetNamesDialog.tier-preset-names-dialog form{
  display:flex;
  flex-direction:column;
  gap:14px;
  padding:22px;
  margin:0;
}
.tier-preset-names-header{
  display:grid;
  gap:9px;
}
.tier-preset-names-kicker{
  color:#59c9fb;
  font-size:10px;
  font-weight:900;
  letter-spacing:.13em;
}
#tierPresetNamesDialog .tier-preset-names-header h2{
  margin:0;
  font-size:clamp(20px,5vw,25px);
  line-height:1.12;
  font-weight:900;
  color:#fff;
}
#tierPresetNamesDialog .tier-preset-names-header p{
  margin:0;
  color:#b3c5d9;
  font-size:13px;
  line-height:1.5;
}
.tier-preset-names-preview{
  display:flex;
  align-items:center;
  gap:11px;
  padding:11px;
  border:1px solid #304a66;
  border-radius:11px;
  background:#111f33;
}
.tier-preset-names-placeholder{
  flex:0 0 60px;
  display:grid;
  place-items:center;
  width:60px;
  height:69px;
  border-radius:8px;
  background:linear-gradient(145deg,#24405d,#0c1728);
  color:#9ccae7;
  font-size:10px;
  font-weight:900;
  letter-spacing:.08em;
}
.tier-preset-names-preview>div{
  display:grid;
  gap:6px;
  min-width:0;
}
.tier-preset-names-preview strong{
  color:#f9fcff;
  font-size:15px;
  font-weight:900;
}
.tier-preset-names-preview small{
  color:#9fb6cc;
  font-size:12px;
}
#tierPresetNamesDialog .tier-preset-names-actions{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:9px;
}
#tierPresetNamesDialog .tier-preset-names-actions button{
  min-height:44px;
  min-width:0;
  padding:9px 12px;
  border:1px solid #34516d;
  border-radius:9px;
  background:#18283b;
  color:#f3f8ff;
  font-size:12px;
  font-weight:850;
  line-height:1.3;
  cursor:pointer;
}
#tierPresetNamesDialog .tier-preset-names-actions button.primary{
  background:#10648e;
  border-color:#198bbd;
  color:#fff;
}
#tierPresetNamesDialog .tier-preset-names-actions .tier-preset-names-cancel{
  grid-column:1/-1;
  color:#9eb1c9;
  background:transparent;
}
@media(max-width:480px){
  #tierPresetNamesDialog.tier-preset-names-dialog form{
    padding:16px;
  }
  #tierPresetNamesDialog .tier-preset-names-actions button{
    padding:9px 6px;
    font-size:11px;
  }
}
