*{box-sizing:border-box}
:root{
  --bg:#08111f;--panel:#101b2d;--panel2:#152238;--border:#2a3a54;
  --text:#f8fafc;--muted:#9fb0c7;--blue:#2563eb;--blue2:#1d4ed8;
  --green:#059669;--red:#dc2626;--yellow:#f59e0b;--purple:#7c3aed;
}
body{margin:0;background:linear-gradient(180deg,#08111f,#0b1323);color:var(--text);font-family:Inter,system-ui,Segoe UI,Arial,sans-serif}
button,input,select,textarea{font:inherit}
button{min-height:44px}
.app{max-width:1540px;margin:auto;padding:18px}
.appHeader{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-bottom:14px}
.appHeader h1{margin:0;font-size:28px;letter-spacing:-.02em}
.appHeader p{margin:4px 0 0;color:var(--muted)}
.statusPill{background:#14233a;border:1px solid var(--border);color:#cbd5e1;border-radius:999px;padding:8px 12px;font-size:13px;white-space:nowrap}

.playbar{display:flex;align-items:end;justify-content:space-between;gap:16px;padding:14px;background:var(--panel);border:1px solid var(--border);border-radius:16px}
.playNameWrap{flex:1;min-width:220px;max-width:460px}
.playNameWrap label{display:block;color:var(--muted);font-size:12px;font-weight:700;margin-bottom:6px;text-transform:uppercase;letter-spacing:.06em}
input,select,textarea{width:100%;background:#0a1424;color:#fff;border:1px solid #334763;border-radius:10px;padding:10px 11px;outline:none}
input:focus,select:focus,textarea:focus{border-color:#5b8cff;box-shadow:0 0 0 3px #2563eb33}
textarea{resize:vertical}
.primaryActions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.btn{border:1px solid #344761;background:#17263b;color:white;border-radius:11px;padding:10px 13px;font-weight:750;cursor:pointer;transition:.15s transform,.15s border-color,.15s background}
.btn:hover{border-color:#607898;background:#1c2e49}
.btn:active{transform:translateY(1px)}
.btn:focus-visible{outline:3px solid #60a5fa;outline-offset:2px}
.btn:disabled{opacity:.42;cursor:not-allowed}
.btn.active{background:var(--blue);border-color:#60a5fa}
.btnBig{min-height:48px;padding-inline:16px}
.btnPrimary{background:var(--blue);border-color:#3b82f6}
.btnPrimary:hover{background:var(--blue2)}
.btnSuccess{background:#047857;border-color:#10b981}
.btnSuccess:hover{background:#065f46}
.btnSecondary{background:#1b2a40}
.btnDanger{background:#7f1d1d;border-color:#b91c1c}
.offenseBtn{border-color:#315fbd}
.defenseBtn{border-color:#9f3636}

.quickHelp{display:flex;gap:8px;align-items:center;flex-wrap:wrap;color:#c4d1e0;font-size:13px;margin:10px 2px 0}
.quickHelp strong{color:#fff}

.editorToolbar{margin-top:12px;background:var(--panel);border:1px solid var(--border);border-radius:16px;padding:12px;display:flex;flex-direction:column;gap:10px}
.toolGroup{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.groupLabel{min-width:120px;color:var(--muted);font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:.06em}

.layout{display:grid;grid-template-columns:300px minmax(0,1fr);gap:14px;margin-top:14px}
.sidebar{min-width:0}
.panel{background:var(--panel);border:1px solid var(--border);border-radius:16px;padding:14px;margin-bottom:12px}
.panel h2{font-size:16px;margin:0 0 12px}
.panel label{display:flex;flex-direction:column;gap:6px;margin-bottom:11px;color:#d7e1ee;font-size:13px;font-weight:700}
.emptyState{color:var(--muted);font-size:14px;line-height:1.5}
.checkline{flex-direction:row!important;align-items:center!important;gap:9px!important;background:#0d1727;border:1px solid #293b55;border-radius:10px;padding:10px}
.checkline input{width:auto;min-width:18px;min-height:18px}
.sideActions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.compactPanel{padding-bottom:16px}
.panelTitleRow{display:flex;justify-content:space-between;align-items:center}
.panelTitleRow h2{margin-bottom:8px}
.panelTitleRow strong{font-size:13px;color:#bfdbfe}
.tipsPanel{display:grid;gap:8px}
.tip{display:grid;grid-template-columns:110px 1fr;gap:8px;align-items:center;color:#cbd5e1;font-size:12px}
kbd{background:#0a1424;border:1px solid #3a4b64;border-bottom-width:2px;border-radius:6px;padding:5px 7px;color:#fff;font-family:inherit;text-align:center}

.boardSection{min-width:0}
.boardTopbar{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:0 2px 8px}
.legend{display:flex;gap:14px;flex-wrap:wrap;color:var(--muted);font-size:12px}
.legend span{display:flex;align-items:center;gap:6px}
.legendDot{width:10px;height:10px;border-radius:50%;display:inline-block}
.offenseDot{background:#2563eb}.defenseDot{background:#dc2626}.contactDot{background:#f59e0b}
.boardHint{font-size:12px;color:var(--muted)}
.boardWrap{overflow-x:auto;border-radius:18px}
.board{position:relative;min-width:840px;width:100%;aspect-ratio:5/3;border:2px solid #b7f7ca;border-radius:18px;overflow:hidden;touch-action:none;user-select:none;background:repeating-linear-gradient(to bottom,#14532d 0,#14532d 84px,#166534 84px,#166534 88px)}
.board:before{content:"";position:absolute;inset:0;background:linear-gradient(to right,rgba(255,255,255,.07) 1px,transparent 1px) 0 0/10% 100%;pointer-events:none}
.board:focus-visible{outline:3px solid #60a5fa;outline-offset:3px}
.los{position:absolute;left:4%;right:4%;top:52%;height:3px;background:#fff;z-index:1;box-shadow:0 0 0 1px #ffffff22}
#paths{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:3}
#playersLayer{position:absolute;inset:0;z-index:5}
.player{position:absolute;width:58px;height:58px;margin-left:-29px;margin-top:-29px;border-radius:50%;display:grid;place-items:center;border:3px solid #fff;font-weight:900;box-shadow:0 5px 14px #0007;cursor:grab;transition:box-shadow .12s,outline .12s,transform .12s}
.player:hover{transform:scale(1.04)}
.player[data-side="offense"]{background:#2563eb}
.player[data-side="defense"]{background:#dc2626}
.player[data-type="QB"]{background:#7c3aed}
.player[data-type="RB"]{background:#059669}
.player.selected{outline:4px solid #fde047;outline-offset:3px}
.player.contact{outline:5px solid #f59e0b;outline-offset:3px;box-shadow:0 0 0 7px #f59e0b26,0 5px 14px #0007;transform:scale(1.02)}

dialog{width:min(760px,calc(100% - 30px));background:var(--panel);color:#fff;border:1px solid var(--border);border-radius:18px;padding:16px}
dialog::backdrop{background:#000b}
.dialogHead{display:flex;justify-content:space-between;align-items:start;gap:12px}
.dialogHead h2{margin:0}
.dialogHead p{margin:4px 0 0;color:var(--muted);font-size:13px}
.playItem{display:grid;grid-template-columns:1fr auto auto;gap:8px;align-items:center;border:1px solid var(--border);background:#0a1424;border-radius:12px;padding:12px;margin-top:10px}
.playItem small{color:var(--muted)}

@media(max-width:1050px){
  .playbar{align-items:stretch;flex-direction:column}
  .playNameWrap{max-width:none}
  .primaryActions{justify-content:flex-start}
}
@media(max-width:900px){
  .layout{grid-template-columns:1fr}
  .sidebar{order:2}
  .boardHint{display:none}
  .groupLabel{width:100%;min-width:0}
}
@media(max-width:560px){
  .app{padding:10px}
  .appHeader{align-items:flex-start}
  .appHeader h1{font-size:23px}
  .statusPill{display:none}
  .primaryActions{display:grid;grid-template-columns:1fr 1fr;width:100%}
  .primaryActions .btn{width:100%}
  .toolGroup .btn{flex:1 1 calc(50% - 8px)}
  .sideActions{grid-template-columns:1fr}
}
.primaryActionsLeft{justify-content:flex-start}
.playbar{display:grid;grid-template-columns:auto minmax(220px,1fr) auto;align-items:end}
.playNameWrap{max-width:none}
@media(max-width:1050px){
  .playbar{display:grid;grid-template-columns:1fr}
  .primaryActions,.primaryActionsLeft{justify-content:flex-start}
}

.playPreviewDialog{
  width:min(1180px,calc(100% - 28px));
  max-width:none;
  padding:14px;
  border-radius:18px;
  background:#0d1727;
  border:1px solid #334763;
}
.playPreviewDialog::backdrop{
  background:rgba(2,6,23,.78);
  backdrop-filter:blur(3px);
}
.playPreviewHeader{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  margin-bottom:12px;
}
.playPreviewHeader h2{margin:0;font-size:20px}
.playPreviewHeader p{margin:4px 0 0;color:var(--muted);font-size:13px}
.closePreviewBtn{
  min-width:46px;
  width:46px;
  height:46px;
  padding:0;
  font-size:20px;
  border-radius:50%;
}
.previewBoardWrap{
  overflow-x:auto;
  border-radius:16px;
}
.previewBoard{
  min-width:820px;
  width:100%;
  aspect-ratio:5/3;
  border-radius:16px;
}
#previewPaths{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  pointer-events:none;
  z-index:3;
}
#previewPlayersLayer{
  position:absolute;
  inset:0;
  z-index:5;
}
.previewBoard .player{
  cursor:default;
}
.previewBoard .player:hover{
  transform:none;
}
.previewFooter{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-top:12px;
}
#previewStatus{color:var(--muted);font-size:13px}
@media(max-width:700px){
  .playPreviewDialog{width:calc(100% - 14px);padding:10px}
  .previewFooter{align-items:stretch;flex-direction:column}
  #replayBtn{width:100%}
}

/* V2.9 — adaptación móvil */
.mobileHelp{display:none}

@media(max-width:700px){
  html{-webkit-text-size-adjust:100%}
  body{overflow-x:hidden}

  .app{
    padding:8px;
    max-width:100%;
  }

  .appHeader{
    margin-bottom:10px;
    align-items:flex-start;
  }

  .appHeader h1{font-size:22px}
  .appHeader p{font-size:12px}
  .statusPill{display:none}

  .playbar{
    display:grid;
    grid-template-columns:1fr;
    gap:9px;
    padding:10px;
    border-radius:13px;
  }

  .primaryActions,
  .primaryActionsLeft{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
    width:100%;
  }

  .primaryActions .btn,
  .primaryActionsLeft .btn{
    width:100%;
    min-height:48px;
    padding:9px 8px;
  }

  .playNameWrap{
    min-width:0;
    width:100%;
    order:2;
  }

  .primaryActionsLeft{order:1}
  .playbar>.primaryActions:not(.primaryActionsLeft){order:3}

  .quickHelp{
    margin:8px 2px 0;
    display:block;
    line-height:1.45;
    font-size:12px;
  }

  .desktopHelp{display:none}
  .mobileHelp{display:inline}

  .editorToolbar{
    padding:9px;
    border-radius:13px;
    gap:12px;
  }

  .toolGroup{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:7px;
    width:100%;
  }

  .groupLabel{
    grid-column:1/-1;
    width:auto;
    min-width:0;
    margin-bottom:-1px;
  }

  .toolGroup .btn{
    width:100%;
    min-width:0;
    min-height:46px;
    padding:8px 5px;
    font-size:12px;
    white-space:normal;
    line-height:1.15;
  }

  .layout{
    display:flex;
    flex-direction:column;
    gap:10px;
    margin-top:10px;
  }

  .boardSection{order:1}
  .sidebar{order:2}

  .boardTopbar{
    margin:0 2px 6px;
  }

  .boardHint{display:none}

  .legend{
    width:100%;
    gap:10px;
    font-size:11px;
  }

  .boardWrap{
    width:100%;
    overflow:visible;
    border-radius:14px;
  }

  .board{
    min-width:0 !important;
    width:100%;
    aspect-ratio:4 / 3;
    border-radius:14px;
  }

  .player{
    width:40px;
    height:40px;
    margin-left:-20px;
    margin-top:-20px;
    border-width:2px;
    font-size:10px;
    box-shadow:0 3px 8px #0007;
  }

  .player.selected{
    outline-width:3px;
    outline-offset:2px;
  }

  .player.contact{
    outline-width:3px;
    outline-offset:2px;
    box-shadow:0 0 0 4px #f59e0b26,0 3px 8px #0007;
  }

  .player:hover{transform:none}

  .panel{
    border-radius:13px;
    padding:12px;
    margin-bottom:9px;
  }

  .panel h2{font-size:15px}

  .sideActions{
    grid-template-columns:1fr 1fr;
  }

  .tipsPanel{
    display:none;
  }

  .tip{
    grid-template-columns:120px 1fr;
  }

  input,select,textarea{
    font-size:16px;
  }

  dialog{
    width:calc(100% - 12px);
    max-height:calc(100% - 12px);
    margin:auto;
    padding:10px;
    border-radius:14px;
  }

  .playPreviewDialog{
    width:calc(100% - 8px);
    padding:8px;
    border-radius:14px;
  }

  .playPreviewHeader{
    margin-bottom:8px;
    align-items:center;
  }

  .playPreviewHeader h2{font-size:17px}
  .playPreviewHeader p{font-size:11px}

  .closePreviewBtn{
    min-width:44px;
    width:44px;
    height:44px;
  }

  .previewBoardWrap{
    overflow:visible;
  }

  .previewBoard{
    min-width:0 !important;
    width:100%;
    aspect-ratio:4 / 3;
    border-radius:12px;
  }

  .previewFooter{
    margin-top:8px;
    gap:8px;
  }

  #replayBtn{min-height:46px}

  .playItem{
    grid-template-columns:1fr;
    gap:7px;
  }

  .playItem .btn{
    width:100%;
  }
}

@media(max-width:420px){
  .toolGroup{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .primaryActions,
  .primaryActionsLeft{
    grid-template-columns:1fr 1fr;
  }

  .player{
    width:36px;
    height:36px;
    margin-left:-18px;
    margin-top:-18px;
    font-size:9px;
  }

  .board{
    aspect-ratio:1.22 / 1;
  }

  .previewBoard{
    aspect-ratio:1.22 / 1;
  }

  .sideActions{
    grid-template-columns:1fr;
  }
}

/* V2.10 — móvil en horizontal */
@media (max-height: 520px) and (orientation: landscape) {
  body {
    overflow-x: hidden;
  }

  .app {
    max-width: 100%;
    padding: 6px;
  }

  .appHeader {
    margin-bottom: 6px;
    align-items: center;
  }

  .appHeader h1 {
    font-size: 18px;
  }

  .appHeader p,
  .statusPill,
  .quickHelp,
  .tipsPanel {
    display: none;
  }

  .playbar {
    display: grid;
    grid-template-columns: auto minmax(180px, 1fr) auto;
    gap: 6px;
    padding: 7px;
    align-items: end;
  }

  .primaryActions,
  .primaryActionsLeft {
    display: flex;
    gap: 6px;
    width: auto;
  }

  .primaryActions .btn,
  .primaryActionsLeft .btn {
    min-height: 40px;
    width: auto;
    padding: 7px 10px;
    font-size: 12px;
  }

  .playNameWrap {
    min-width: 0;
    max-width: none;
    order: initial;
  }

  .playNameWrap label {
    font-size: 10px;
    margin-bottom: 3px;
  }

  .playNameWrap input {
    height: 40px;
    padding: 7px 9px;
    font-size: 14px;
  }

  .editorToolbar {
    padding: 7px;
    gap: 7px;
    margin-top: 7px;
  }

  .toolGroup {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    width: 100%;
  }

  .groupLabel {
    width: auto;
    min-width: 90px;
    margin: 0;
    align-self: center;
    font-size: 10px;
  }

  .toolGroup .btn {
    flex: 0 0 auto;
    width: auto;
    min-height: 38px;
    padding: 6px 9px;
    font-size: 11px;
    white-space: nowrap;
  }

  .layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 8px;
    margin-top: 8px;
  }

  .sidebar {
    order: 1;
  }

  .boardSection {
    order: 2;
    min-width: 0;
  }

  .panel {
    padding: 9px;
    margin-bottom: 7px;
    border-radius: 11px;
  }

  .panel h2 {
    font-size: 13px;
    margin-bottom: 7px;
  }

  .panel label {
    margin-bottom: 7px;
    font-size: 11px;
  }

  .panel textarea {
    max-height: 55px;
  }

  .compactPanel {
    padding-bottom: 9px;
  }

  .boardTopbar {
    margin-bottom: 4px;
  }

  .legend {
    font-size: 10px;
    gap: 8px;
  }

  .boardHint {
    display: none;
  }

  .boardWrap {
    overflow: visible;
  }

  .board {
    min-width: 0 !important;
    width: 100%;
    aspect-ratio: 16 / 8.4;
    border-radius: 12px;
  }

  .player {
    width: 34px;
    height: 34px;
    margin-left: -17px;
    margin-top: -17px;
    font-size: 9px;
    border-width: 2px;
  }

  .player.selected,
  .player.contact {
    outline-width: 2px;
    outline-offset: 2px;
  }

  dialog.playPreviewDialog {
    width: calc(100% - 8px);
    max-height: calc(100% - 8px);
    padding: 6px;
  }

  .playPreviewHeader {
    margin-bottom: 5px;
  }

  .playPreviewHeader h2 {
    font-size: 15px;
  }

  .playPreviewHeader p {
    display: none;
  }

  .closePreviewBtn {
    min-width: 38px;
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  .previewBoard {
    min-width: 0 !important;
    width: 100%;
    aspect-ratio: 16 / 8.4;
  }

  .previewFooter {
    margin-top: 5px;
  }

  #replayBtn {
    min-height: 38px;
    padding: 7px 10px;
  }
}

/* Teléfonos muy estrechos en horizontal */
@media (max-height: 430px) and (orientation: landscape) {
  .layout {
    grid-template-columns: 185px minmax(0, 1fr);
  }

  .sidebar .panel:not(:first-child) {
    display: none;
  }

  .board {
    aspect-ratio: 16 / 7.6;
  }

  .previewBoard {
    aspect-ratio: 16 / 7.6;
  }

  .player {
    width: 30px;
    height: 30px;
    margin-left: -15px;
    margin-top: -15px;
    font-size: 8px;
  }
}


/* V3.0 — formaciones + WR + colisiones mejoradas */
.formationRow{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  padding-top:4px;
  border-top:1px solid var(--border);
}
.formationControl{
  min-width:0;
}
.formationControl>label{
  display:block;
  color:var(--muted);
  font-size:11px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.06em;
  margin-bottom:6px;
}
.formationSelectRow{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:8px;
}
.player[data-type="WR"]{
  background:#0284c7;
}
.player[data-type="WR"].contact{
  outline-color:#f59e0b;
}
@media(max-width:900px){
  .formationRow{grid-template-columns:1fr}
}
@media(max-width:700px){
  .formationSelectRow{
    grid-template-columns:1fr auto;
  }
  .formationSelectRow .btn{
    min-width:82px;
  }
}
@media(max-height:520px) and (orientation:landscape){
  .formationRow{
    grid-template-columns:1fr 1fr;
    gap:6px;
  }
  .formationControl>label{
    font-size:9px;
    margin-bottom:3px;
  }
  .formationSelectRow{
    gap:5px;
  }
  .formationSelectRow select{
    height:38px;
    padding:5px 7px;
    font-size:11px;
  }
  .formationSelectRow .btn{
    min-height:38px;
    padding:5px 8px;
    font-size:10px;
  }
}


/* V3.1 — campo más ancho + panel de jugador arriba */
.layout{
  grid-template-columns:220px minmax(0,1fr);
}

.selectedTopPanel{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px 12px;
  margin-bottom:10px;
}
.selectedTopHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.selectedTopHeader>div:first-child{
  display:flex;
  align-items:baseline;
  gap:8px;
}
.eyebrow{
  color:var(--muted);
  font-size:10px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.07em;
}
#selectedPlayerTitle{
  font-size:15px;
}
.selectedTopGrid{
  display:grid;
  grid-template-columns:100px 120px minmax(180px,1fr) auto 145px auto;
  gap:8px;
  align-items:end;
  margin-top:9px;
}
.selectedTopGrid label{
  display:flex;
  flex-direction:column;
  gap:4px;
  color:#d7e1ee;
  font-size:11px;
  font-weight:700;
  min-width:0;
}
.selectedTopGrid input,
.selectedTopGrid select{
  height:38px;
  padding:6px 8px;
}
.assignmentField{
  min-width:0;
}
.compactCheck{
  height:38px;
  margin:0!important;
  white-space:nowrap;
}
.selectedActions{
  display:flex;
  gap:6px;
}
.selectedActions .btn{
  min-height:38px;
  padding:6px 9px;
  font-size:11px;
}

/* Campo más parecido a una pizarra real: mucho más ancho en escritorio */
.board{
  aspect-ratio: 16 / 7.2;
  min-width: 980px;
}
.previewBoard{
  aspect-ratio: 16 / 7.2;
  min-width: 980px;
}

/* Más "yardas" visuales horizontales para aprovechar el ancho */
.board:before{
  background:
    linear-gradient(to right,rgba(255,255,255,.08) 1px,transparent 1px) 0 0/8.333% 100%;
}

@media(min-width:1200px){
  .layout{
    grid-template-columns:200px minmax(0,1fr);
  }
  .board{
    min-width:0;
    width:100%;
    aspect-ratio:16 / 6.7;
  }
  .previewBoard{
    min-width:0;
    width:100%;
    aspect-ratio:16 / 6.7;
  }
}

@media(max-width:1050px){
  .selectedTopGrid{
    grid-template-columns:90px 110px minmax(160px,1fr) auto 130px;
  }
  .selectedActions{
    grid-column:1/-1;
  }
}

@media(max-width:900px){
  .layout{
    grid-template-columns:1fr;
  }
  .selectedTopGrid{
    grid-template-columns:1fr 1fr;
  }
  .assignmentField{
    grid-column:1/-1;
  }
  .selectedActions{
    grid-column:1/-1;
  }
}

/* Móvil vertical: mantenemos el campo contenido */
@media(max-width:700px) and (orientation:portrait){
  .selectedTopPanel{
    padding:9px;
  }
  .selectedTopHeader{
    align-items:flex-start;
    flex-direction:column;
    gap:4px;
  }
  .selectedTopGrid{
    grid-template-columns:1fr 1fr;
  }
  .assignmentField{
    grid-column:1/-1;
  }
  .compactCheck{
    height:auto;
    min-height:42px;
  }
  .selectedActions{
    display:grid;
    grid-template-columns:1fr 1fr;
  }
  .board,
  .previewBoard{
    min-width:0!important;
    width:100%;
    aspect-ratio:1.22 / 1;
  }
}

/* Móvil horizontal: campo panorámico y panel superior compacto */
@media(max-height:520px) and (orientation:landscape){
  .layout{
    display:block;
  }
  .sidebar{
    display:none;
  }
  .selectedTopPanel{
    padding:6px 8px;
    margin-bottom:5px;
  }
  .selectedTopHeader{
    min-height:24px;
  }
  .selectedTopGrid{
    grid-template-columns:72px 88px minmax(150px,1fr) auto 110px auto;
    gap:5px;
    margin-top:5px;
  }
  .selectedTopGrid label{
    font-size:9px;
    gap:2px;
  }
  .selectedTopGrid input,
  .selectedTopGrid select{
    height:32px;
    padding:4px 6px;
    font-size:11px;
  }
  .compactCheck{
    height:32px;
    min-height:32px;
    padding:5px 7px;
    font-size:10px;
  }
  .selectedActions{
    grid-column:auto;
    gap:4px;
  }
  .selectedActions .btn{
    min-height:32px;
    padding:4px 7px;
    font-size:9px;
  }
  .board,
  .previewBoard{
    min-width:0!important;
    width:100%;
    aspect-ratio:16 / 6.2;
  }
}

@media(max-height:430px) and (orientation:landscape){
  .selectedTopHeader .emptyState{
    display:none;
  }
  .selectedTopGrid{
    grid-template-columns:64px 78px minmax(130px,1fr) auto 96px auto;
  }
  .board,
  .previewBoard{
    aspect-ratio:16 / 5.7;
  }
}


/* V3.2 — campo primero, mucho más espacio visual */
.layout{
  display:flex !important;
  flex-direction:column;
  gap:10px;
  margin-top:12px;
}

.boardSection{
  order:1;
  min-width:0;
}

.sidebar{
  order:2;
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}

.sidebar .panel{
  margin-bottom:0;
}

/* El campo manda */
.boardTopbar{
  margin:0 2px 8px;
}

.boardWrap{
  width:100%;
  overflow-x:visible;
}

.board{
  min-width:0 !important;
  width:100%;
  aspect-ratio: 21 / 7.6;
  border-radius:18px;
  border-width:2px;
}

.previewBoard{
  min-width:0 !important;
  width:100%;
  aspect-ratio: 21 / 7.6;
  border-radius:18px;
}

/* Más sensación de "campo real" */
.board:before{
  background:
    linear-gradient(to right,rgba(255,255,255,.10) 1px,transparent 1px) 0 0/8.333% 100%;
}

.los{
  top:56%;
}

/* Jugadores más pequeños respecto al campo, para que no se apilen */
.player{
  width:46px;
  height:46px;
  margin-left:-23px;
  margin-top:-23px;
  font-size:11px;
  border-width:2px;
  box-shadow:0 4px 12px #0007;
}

.player.selected{
  outline-width:3px;
}

.player.contact{
  outline-width:4px;
  box-shadow:0 0 0 6px #f59e0b26,0 4px 12px #0007;
}

.selectedTopPanel{
  border-radius:16px;
  padding:11px 12px;
}

.selectedTopGrid{
  grid-template-columns:96px 120px minmax(220px,1fr) auto 150px auto;
}

/* Mucho aire en escritorio */
@media(min-width:1280px){
  .app{
    max-width:1700px;
  }
  .board{
    aspect-ratio: 24 / 8.2;
  }
  .previewBoard{
    aspect-ratio: 24 / 8.2;
  }
  .player{
    width:44px;
    height:44px;
    margin-left:-22px;
    margin-top:-22px;
    font-size:10px;
  }
}

/* Tablets */
@media(max-width:1100px){
  .sidebar{
    grid-template-columns:1fr 1fr;
  }
  .board{
    aspect-ratio: 18 / 7.4;
  }
  .previewBoard{
    aspect-ratio: 18 / 7.4;
  }
}

/* Móvil vertical: el campo sigue primero, pero contenido */
@media(max-width:700px) and (orientation:portrait){
  .sidebar{
    grid-template-columns:1fr;
  }
  .board{
    aspect-ratio: 1.34 / 1;
  }
  .previewBoard{
    aspect-ratio: 1.34 / 1;
  }
  .player{
    width:38px;
    height:38px;
    margin-left:-19px;
    margin-top:-19px;
    font-size:9px;
  }
}

/* Móvil horizontal: campo enorme y paneles mínimos */
@media(max-height:520px) and (orientation:landscape){
  .layout{
    gap:6px;
    margin-top:6px;
  }
  .sidebar{
    display:none;
  }
  .boardTopbar{
    margin-bottom:4px;
  }
  .board{
    aspect-ratio: 23 / 7.2;
    border-radius:12px;
  }
  .previewBoard{
    aspect-ratio: 23 / 7.2;
    border-radius:12px;
  }
  .player{
    width:30px;
    height:30px;
    margin-left:-15px;
    margin-top:-15px;
    font-size:8px;
  }
}

@media(max-height:430px) and (orientation:landscape){
  .board{
    aspect-ratio: 24 / 6.8;
  }
  .previewBoard{
    aspect-ratio: 24 / 6.8;
  }
  .player{
    width:28px;
    height:28px;
    margin-left:-14px;
    margin-top:-14px;
    font-size:7px;
  }
}


/* V3.3 — estética sports analysis / HUD clean */
:root{
  --bg:#080b10;
  --panel:#11161d;
  --panel2:#171d25;
  --border:#2b333d;
  --text:#f5f7fa;
  --muted:#9aa5b1;
  --blue:#ff6a00;
  --blue2:#e85f00;
  --green:#13a56f;
  --red:#d94848;
  --yellow:#ffb020;
  --purple:#8156d9;
}

body{
  background:
    radial-gradient(circle at 20% -10%,rgba(255,106,0,.09),transparent 30%),
    linear-gradient(180deg,#080b10,#0b0f14 42%,#0a0e13);
}

.app{
  max-width:1780px;
  padding:16px 18px 22px;
}

.appHeader{
  padding:4px 2px 8px;
  border-bottom:1px solid #202832;
}

.brandBlock{min-width:0}
.brandLine{
  display:flex;
  align-items:center;
  gap:9px;
}
.brandMark{
  display:grid;
  place-items:center;
  width:30px;
  height:30px;
  border-radius:8px;
  background:#ff6a00;
  color:#fff;
  font-size:12px;
  box-shadow:0 4px 14px rgba(255,106,0,.22);
}
.versionTag{
  border:1px solid #39424d;
  border-radius:999px;
  color:#aeb8c3;
  padding:3px 7px;
  font-size:10px;
  font-weight:800;
  letter-spacing:.04em;
}
.appHeader h1{
  font-size:24px;
  font-weight:850;
  letter-spacing:-.03em;
}
.appHeader p{
  color:#7f8a96;
  font-size:12px;
}

.statusPill{
  background:#11171f;
  border-color:#303946;
}

.playbar,
.editorToolbar,
.panel,
.selectedTopPanel{
  background:linear-gradient(180deg,#121820,#10151c);
  border-color:#29313b;
  box-shadow:0 8px 22px rgba(0,0,0,.18);
}

.playbar{
  border-radius:12px;
  padding:10px;
}

.editorToolbar{
  border-radius:12px;
  padding:10px;
}

.btn{
  border-color:#333d49;
  background:#171e27;
  border-radius:8px;
  font-weight:760;
  box-shadow:none;
}
.btn:hover{
  background:#202833;
  border-color:#4a5664;
}
.btn.active,
.btnPrimary{
  background:#ff6a00;
  border-color:#ff812b;
}
.btnPrimary:hover{
  background:#e85f00;
}
.btnSuccess{
  background:#167653;
  border-color:#249b70;
}
.offenseBtn{
  border-color:#9f501a;
}
.defenseBtn{
  border-color:#8c3a3a;
}

input,select,textarea{
  background:#0b1016;
  border-color:#313b47;
  border-radius:7px;
}
input:focus,select:focus,textarea:focus{
  border-color:#ff7b1f;
  box-shadow:0 0 0 3px rgba(255,106,0,.14);
}

.quickHelp{
  color:#8e99a5;
}
.quickHelp strong{
  color:#dfe5eb;
}

.groupLabel,
.eyebrow{
  color:#788492;
}

.formationRow{
  border-top-color:#242c35;
}

.formationControl{
  background:#0d1218;
  border:1px solid #252e38;
  border-radius:10px;
  padding:9px;
}

.selectedTopPanel{
  border-left:3px solid #ff6a00;
}
#selectedPlayerTitle{
  color:#fff;
}

.boardSection{
  background:transparent;
}

.boardTopbar{
  padding:0 3px;
}

.board{
  border-color:#45694f;
  background:
    repeating-linear-gradient(
      to bottom,
      #154b2e 0,
      #154b2e 72px,
      #185635 72px,
      #185635 76px
    );
  box-shadow:
    inset 0 0 60px rgba(0,0,0,.12),
    0 10px 28px rgba(0,0,0,.22);
}

.board:before{
  background:
    linear-gradient(to right,rgba(255,255,255,.12) 1px,transparent 1px) 0 0/8.333% 100%;
}

.los{
  background:#ffd166;
  height:2px;
  box-shadow:0 0 0 1px rgba(255,209,102,.14);
}

.player{
  border-color:#f7f9fb;
  box-shadow:0 4px 10px rgba(0,0,0,.38);
  font-weight:900;
}
.player[data-side="offense"]{background:#f36b21}
.player[data-side="defense"]{background:#1f5fae}
.player[data-type="QB"]{background:#6d4acb}
.player[data-type="RB"]{background:#16845d}
.player[data-type="WR"]{background:#c44f1b}

.player.selected{
  outline-color:#ffd166;
}

.legendDot.offenseDot{background:#f36b21}
.legendDot.defenseDot{background:#1f5fae}
.legendDot.contactDot{background:#ffb020}

dialog{
  background:#10151c;
  border-color:#2e3742;
}

.playItem{
  background:#0c1117;
  border-color:#28313b;
}

@media(max-height:520px) and (orientation:landscape){
  .app{
    padding:5px 7px;
  }
  .appHeader{
    display:none;
  }
  .playbar{
    margin-top:0;
  }
}

/* V3.4 — preview ancho, espaciado y UI sobria */
body{background:#0b0f14}
.playbar,.editorToolbar,.panel,.selectedTopPanel{background:#11161d;box-shadow:none}
.board,.brandMark{box-shadow:none}
.btn{letter-spacing:0}

.board,.previewBoard{
  min-width:0!important;
  width:100%;
  aspect-ratio:24 / 8.4;
}
.playPreviewDialog{
  width:min(1600px,calc(100% - 24px));
  max-width:none;
  padding:12px 14px 10px;
}
.previewBoardWrap{width:100%;overflow:visible}
.player{
  width:42px;height:42px;margin-left:-21px;margin-top:-21px;font-size:10px;
}
.previewBoard .player{
  width:38px;height:38px;margin-left:-19px;margin-top:-19px;font-size:9px;
}
#paths polyline,#previewPaths polyline{stroke-width:3!important}
.playPreviewHeader{margin-bottom:7px}
.playPreviewHeader h2{font-size:18px}
.playPreviewHeader p{font-size:11px}
.previewFooter{margin-top:7px}

@media(min-width:1400px){
  .playPreviewDialog{width:min(1720px,calc(100% - 32px))}
  .board,.previewBoard{aspect-ratio:26 / 8.6}
}
@media(max-height:520px) and (orientation:landscape){
  .playPreviewDialog{width:calc(100% - 6px);padding:5px}
  .previewBoard{aspect-ratio:24 / 6.8}
  .previewBoard .player{
    width:26px;height:26px;margin-left:-13px;margin-top:-13px;font-size:7px
  }
}

/* V3.5 — mobile focus */
.mobileOnly{display:none}

@media(max-width:700px){
  body{
    padding-bottom:78px;
    background:#0b0f14;
  }

  .mobileOnly{display:flex}

  .app{
    padding:8px 8px 12px;
  }

  .appHeader{
    padding:2px 0 6px;
    margin-bottom:6px;
  }

  .brandLine{gap:7px}
  .brandMark{
    width:26px;height:26px;border-radius:6px;font-size:10px;
  }
  .appHeader h1{font-size:19px}
  .versionTag{font-size:9px}
  .appHeader p{display:none}

  /* El campo es el centro de la experiencia */
  .layout{
    display:flex!important;
    flex-direction:column;
    margin-top:6px;
    gap:7px;
  }

  .boardSection{order:1}
  .sidebar{display:none!important}

  .boardTopbar{
    margin:0 1px 5px;
  }
  .legend{
    font-size:10px;
    gap:8px;
  }
  .boardHint{display:none}

  .boardWrap{
    overflow-x:auto;
    overflow-y:hidden;
    border-radius:12px;
    -webkit-overflow-scrolling:touch;
    scroll-behavior:smooth;
  }

  .board{
    min-width:100%!important;
    width:100%;
    aspect-ratio:1.42 / 1;
    border-radius:12px;
  }

  .player{
    width:36px;height:36px;
    margin-left:-18px;margin-top:-18px;
    font-size:8px;
  }

  .selectedTopPanel{
    position:fixed;
    z-index:55;
    left:8px;
    right:8px;
    bottom:82px;
    margin:0;
    max-height:72vh;
    overflow:auto;
    border-radius:14px;
    padding:10px;
    background:#11161d;
    border:1px solid #313a45;
    border-left:3px solid #ff6a00;
    box-shadow:0 14px 45px rgba(0,0,0,.42);
    transform:translateY(calc(100% + 100px));
    opacity:0;
    pointer-events:none;
    transition:transform .18s ease,opacity .18s ease;
  }

  .selectedTopPanel.mobileSheetOpen{
    transform:translateY(0);
    opacity:1;
    pointer-events:auto;
  }

  .selectedTopHeader{
    position:relative;
    padding-right:38px;
    flex-direction:row;
    align-items:center;
  }

  .sheetClose{
    min-width:36px!important;
    width:36px!important;
    height:36px!important;
    min-height:36px!important;
    padding:0!important;
    border-radius:50%!important;
    display:grid!important;
    place-items:center;
    font-size:23px!important;
    line-height:1;
  }

  #closePlayerSheet{
    position:absolute;
    right:0;
    top:-2px;
  }

  .selectedTopGrid{
    grid-template-columns:1fr 1fr;
    gap:8px;
    margin-top:8px;
  }

  .assignmentField{grid-column:1/-1}
  .compactCheck{
    grid-column:1/-1;
    min-height:42px;
  }
  .selectedActions{
    grid-column:1/-1;
    display:grid;
    grid-template-columns:1fr 1fr;
  }

  .selectedTopGrid input,
  .selectedTopGrid select{
    min-height:44px;
    height:44px;
    font-size:16px;
  }

  /* Ocultamos el toolbar grande: el móvil usa navegación inferior */
  .playbar,
  .editorToolbar,
  .quickHelp{
    display:none!important;
  }

  .mobileBottomBar{
    position:fixed;
    z-index:60;
    left:0;right:0;bottom:0;
    height:72px;
    padding:7px 8px max(7px,env(safe-area-inset-bottom));
    background:rgba(10,14,19,.97);
    border-top:1px solid #29313b;
    display:grid;
    grid-template-columns:repeat(5,1fr);
    gap:4px;
    backdrop-filter:blur(10px);
  }

  .mobileNavBtn{
    appearance:none;
    border:0;
    background:transparent;
    color:#8f9aa6;
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    gap:3px;
    min-width:0;
    min-height:54px;
    padding:2px;
    font-size:10px;
    font-weight:750;
    border-radius:9px;
  }

  .mobileNavBtn .navIcon{
    font-size:20px;
    line-height:1;
  }

  .mobileNavBtn.active{
    color:#fff;
    background:#1a212a;
  }

  .mobileNavBtn.play{
    color:#fff;
    background:#f36b21;
  }

  .mobileDrawBar{
    position:fixed;
    z-index:59;
    left:8px;right:8px;
    bottom:78px;
    min-height:52px;
    background:#11161d;
    border:1px solid #36414d;
    border-radius:12px;
    padding:7px 8px;
    align-items:center;
    gap:7px;
    box-shadow:0 10px 30px rgba(0,0,0,.35);
  }

  .mobileDrawBar[hidden]{display:none!important}
  .mobileDrawBar span{
    flex:1;
    min-width:0;
    color:#dbe2e9;
    font-size:11px;
    font-weight:700;
  }
  .mobileAction{
    border:1px solid #394550;
    background:#171e27;
    color:#fff;
    border-radius:8px;
    min-height:38px;
    padding:6px 10px;
    font-weight:800;
    font-size:11px;
  }
  .mobileAction.primary{
    background:#f36b21;
    border-color:#f36b21;
  }

  .mobileBoardTools{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:5px;
    margin-bottom:5px;
  }
  .mobileBoardTools button{
    min-height:34px;
    height:34px;
    padding:0 10px;
    border-radius:7px;
    background:#141b23;
    color:#dbe2e9;
    border:1px solid #303a45;
    font-size:12px;
  }
  .mobileBoardTools span{
    min-width:44px;
    text-align:center;
    color:#9da9b5;
    font-size:11px;
  }

  /* Zoom simple: aumenta el ancho real del tablero para permitir scroll */
  .board.mobileZoom125{width:125%;min-width:125%!important}
  .board.mobileZoom150{width:150%;min-width:150%!important}

  /* Formaciones como bottom sheet */
  .mobileFormationDialog{
    width:calc(100% - 12px);
    max-width:none;
    margin:auto 6px 78px;
    border-radius:16px;
    padding:12px;
    background:#11161d;
    border:1px solid #313a45;
  }
  .mobileFormationDialog::backdrop{
    background:rgba(0,0,0,.58);
    backdrop-filter:blur(2px);
  }
  .mobileSheetHeader{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:12px;
  }
  .mobileSheetHeader h2{
    margin:0;
    font-size:18px;
  }
  .mobileSheetHeader p{
    margin:4px 0 0;
    color:#8f9aa6;
    font-size:11px;
  }
  .formationCards{
    display:grid;
    grid-template-columns:1fr;
    gap:10px;
    margin-top:12px;
  }
  .formationCards section{
    background:#0c1117;
    border:1px solid #29323d;
    border-radius:12px;
    padding:10px;
  }
  .formationCards h3{
    margin:0 0 8px;
    font-size:13px;
  }
  .formationCards select{
    min-height:46px;
    font-size:16px;
    margin-bottom:8px;
  }
  .formationCards .btn{
    width:100%;
    min-height:44px;
  }

  /* Play en móvil: prácticamente pantalla completa */
  .playPreviewDialog{
    width:100%;
    max-width:none;
    height:100%;
    max-height:none;
    margin:0;
    border:0;
    border-radius:0;
    padding:8px;
    background:#0b0f14;
  }
  .playPreviewDialog::backdrop{background:#0b0f14}
  .playPreviewHeader{
    min-height:46px;
    margin-bottom:6px;
    align-items:center;
  }
  .playPreviewHeader h2{font-size:16px}
  .playPreviewHeader p{display:none}
  .closePreviewBtn{
    width:42px;
    height:42px;
    min-width:42px;
    min-height:42px;
  }
  .previewBoardWrap{
    height:calc(100% - 112px);
    display:flex;
    align-items:center;
    overflow:auto;
  }
  .previewBoard{
    min-width:100%!important;
    width:100%;
    aspect-ratio:1.42 / 1;
  }
  .previewFooter{
    min-height:54px;
    margin-top:6px;
    display:grid;
    grid-template-columns:1fr auto;
    align-items:center;
  }
  #replayBtn{
    min-height:44px;
    min-width:100px;
  }
}

@media(max-height:520px) and (orientation:landscape){
  body{padding-bottom:62px}
  .mobileBottomBar{
    height:58px;
    grid-template-columns:repeat(5,1fr);
    padding:4px 7px;
  }
  .mobileNavBtn{
    min-height:48px;
    flex-direction:row;
    gap:6px;
    font-size:10px;
  }
  .mobileNavBtn .navIcon{font-size:16px}
  .mobileDrawBar{
    bottom:64px;
    min-height:44px;
    left:6px;right:6px;
  }

  .board{
    min-width:100%!important;
    width:100%;
    aspect-ratio:22 / 6.6;
  }
  .board.mobileZoom125{width:125%;min-width:125%!important}
  .board.mobileZoom150{width:150%;min-width:150%!important}

  .player{
    width:28px;height:28px;
    margin-left:-14px;margin-top:-14px;
    font-size:7px;
  }

  .selectedTopPanel{
    left:auto;
    right:6px;
    bottom:64px;
    width:min(390px,48vw);
    max-height:calc(100vh - 72px);
  }

  .selectedTopGrid{
    grid-template-columns:1fr 1fr;
  }

  .mobileFormationDialog{
    width:min(720px,calc(100% - 12px));
    margin:auto;
  }
  .formationCards{
    grid-template-columns:1fr 1fr;
  }

  .playPreviewDialog{
    padding:5px 6px;
  }
  .playPreviewHeader{
    min-height:36px;
    margin-bottom:3px;
  }
  .previewBoardWrap{
    height:calc(100% - 82px);
  }
  .previewBoard{
    min-width:100%!important;
    width:100%;
    aspect-ratio:22 / 6.6;
  }
  .previewBoard .player{
    width:26px;height:26px;
    margin-left:-13px;margin-top:-13px;
    font-size:7px;
  }
  .previewFooter{
    min-height:38px;
    margin-top:2px;
  }
}

/* V3.6 — LANDSCAPE FIRST
   El flujo principal de móvil está pensado para usar el teléfono girado. */

.previewControls{
  display:flex;
  align-items:center;
  gap:8px;
}
.previewSpeedLabel{
  display:flex;
  align-items:center;
  gap:6px;
  color:#9aa5b1;
  font-size:11px;
  font-weight:700;
}
.previewSpeedLabel select{
  width:76px;
  min-height:38px;
  padding:5px 7px;
  font-size:12px;
}

/* ---------- MÓVIL HORIZONTAL: EXPERIENCIA PRINCIPAL ---------- */
@media(max-height:600px) and (orientation:landscape){

  html,body{
    width:100%;
    min-height:100%;
    overflow-x:hidden;
  }

  body{
    padding-bottom:54px!important;
  }

  .app{
    max-width:none!important;
    width:100%;
    padding:4px 6px 6px!important;
  }

  /* Todo lo secundario fuera del camino */
  .appHeader,
  .playbar,
  .editorToolbar,
  .quickHelp,
  .sidebar,
  .boardTopbar{
    display:none!important;
  }

  .layout{
    display:block!important;
    margin:0!important;
    padding:0!important;
  }

  .boardSection{
    width:100%;
    min-width:0;
  }

  /* Barra mínima superior solo para zoom */
  .mobileBoardTools{
    height:34px;
    display:flex!important;
    align-items:center;
    justify-content:flex-end;
    gap:4px;
    margin:0 0 4px;
  }

  .mobileBoardTools button{
    height:30px;
    min-height:30px;
    padding:0 9px;
    font-size:10px;
    border-radius:6px;
  }

  .mobileBoardTools span{
    min-width:38px;
    font-size:9px;
  }

  /* Campo enorme y cómodo: prioridad absoluta */
  .boardWrap{
    width:100%;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    border-radius:10px;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
  }
  .boardWrap::-webkit-scrollbar{display:none}

  .board{
    width:100%!important;
    min-width:100%!important;
    aspect-ratio:23 / 7.25!important;
    border-radius:10px!important;
  }

  .board.mobileZoom125{
    width:125%!important;
    min-width:125%!important;
  }
  .board.mobileZoom150{
    width:150%!important;
    min-width:150%!important;
  }

  /* Piezas pequeñas y separadas visualmente */
  .player{
    width:27px!important;
    height:27px!important;
    margin-left:-13.5px!important;
    margin-top:-13.5px!important;
    font-size:6.5px!important;
    border-width:1.5px!important;
    box-shadow:0 2px 5px rgba(0,0,0,.38)!important;
  }
  .player.selected{
    outline-width:2px!important;
    outline-offset:1px!important;
  }
  .player.contact{
    outline-width:2px!important;
    outline-offset:1px!important;
  }

  /* Barra inferior: una sola fila, muy compacta */
  .mobileBottomBar{
    height:50px!important;
    padding:3px 6px!important;
    grid-template-columns:repeat(5,1fr)!important;
    gap:3px!important;
  }

  .mobileNavBtn{
    min-height:42px!important;
    flex-direction:row!important;
    gap:5px!important;
    padding:2px 4px!important;
    font-size:9px!important;
    border-radius:7px!important;
  }

  .mobileNavBtn .navIcon{
    font-size:14px!important;
  }

  /* Panel del jugador: lateral derecho, no tapa todo el campo */
  .selectedTopPanel{
    position:fixed!important;
    z-index:70!important;
    left:auto!important;
    right:5px!important;
    bottom:54px!important;
    width:min(360px,45vw)!important;
    max-height:calc(100vh - 60px)!important;
    overflow:auto!important;
    border-radius:10px!important;
    padding:7px!important;
    transform:translateX(calc(100% + 20px))!important;
    opacity:0!important;
    pointer-events:none!important;
    transition:transform .16s ease,opacity .16s ease!important;
  }

  .selectedTopPanel.mobileSheetOpen{
    transform:translateX(0)!important;
    opacity:1!important;
    pointer-events:auto!important;
  }

  .selectedTopHeader{
    min-height:28px!important;
    padding-right:34px!important;
  }

  #selectedPlayerTitle{font-size:12px!important}
  .eyebrow{font-size:8px!important}

  .selectedTopGrid{
    grid-template-columns:1fr 1fr!important;
    gap:5px!important;
    margin-top:5px!important;
  }

  .selectedTopGrid label{
    font-size:8px!important;
    gap:2px!important;
  }

  .selectedTopGrid input,
  .selectedTopGrid select{
    min-height:32px!important;
    height:32px!important;
    font-size:11px!important;
    padding:4px 6px!important;
  }

  .assignmentField,
  .compactCheck,
  .selectedActions{
    grid-column:1/-1!important;
  }

  .compactCheck{
    min-height:34px!important;
    height:auto!important;
    padding:5px 7px!important;
  }

  .selectedActions{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:5px!important;
  }

  .selectedActions .btn{
    min-height:32px!important;
    font-size:9px!important;
  }

  .sheetClose{
    width:30px!important;
    height:30px!important;
    min-width:30px!important;
    min-height:30px!important;
    font-size:18px!important;
  }

  /* Dibujar: barra estrecha, no tapa el campo */
  .mobileDrawBar{
    left:6px!important;
    right:auto!important;
    width:auto!important;
    min-width:330px!important;
    max-width:55vw!important;
    bottom:54px!important;
    min-height:42px!important;
    padding:5px 6px!important;
    border-radius:9px!important;
  }

  .mobileDrawBar span{
    font-size:9px!important;
  }

  .mobileAction{
    min-height:30px!important;
    padding:4px 8px!important;
    font-size:9px!important;
  }

  /* Formaciones: dos columnas compactas */
  .mobileFormationDialog{
    width:min(760px,calc(100% - 12px))!important;
    max-height:calc(100% - 16px)!important;
    margin:auto!important;
    padding:9px!important;
    border-radius:12px!important;
  }

  .mobileSheetHeader h2{font-size:15px!important}
  .mobileSheetHeader p{font-size:9px!important}
  .formationCards{
    grid-template-columns:1fr 1fr!important;
    gap:8px!important;
    margin-top:8px!important;
  }
  .formationCards section{
    padding:8px!important;
  }
  .formationCards h3{
    font-size:11px!important;
    margin-bottom:6px!important;
  }
  .formationCards select{
    min-height:36px!important;
    font-size:12px!important;
    margin-bottom:6px!important;
  }
  .formationCards .btn{
    min-height:34px!important;
    font-size:10px!important;
  }

  /* ---------- PLAY: LANDSCAPE FULLSCREEN ---------- */
  .playPreviewDialog{
    width:100%!important;
    height:100%!important;
    max-width:none!important;
    max-height:none!important;
    margin:0!important;
    padding:4px 6px!important;
    border:0!important;
    border-radius:0!important;
    background:#0b0f14!important;
  }

  .playPreviewHeader{
    height:36px!important;
    min-height:36px!important;
    margin:0 0 3px!important;
    padding:0!important;
    align-items:center!important;
  }

  .playPreviewHeader h2{
    font-size:13px!important;
  }
  .playPreviewHeader p{
    display:none!important;
  }

  .closePreviewBtn{
    width:32px!important;
    height:32px!important;
    min-width:32px!important;
    min-height:32px!important;
    font-size:16px!important;
  }

  .previewBoardWrap{
    width:100%!important;
    height:calc(100% - 78px)!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    overflow:hidden!important;
    border-radius:8px!important;
  }

  .previewBoard{
    width:100%!important;
    min-width:100%!important;
    max-height:100%!important;
    aspect-ratio:23 / 7.25!important;
    border-radius:8px!important;
  }

  .previewBoard .player{
    width:25px!important;
    height:25px!important;
    margin-left:-12.5px!important;
    margin-top:-12.5px!important;
    font-size:6px!important;
    border-width:1.4px!important;
  }

  .previewFooter{
    height:36px!important;
    min-height:36px!important;
    margin:3px 0 0!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:6px!important;
  }

  #previewStatus{
    font-size:9px!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }

  .previewControls{
    display:flex!important;
    align-items:center!important;
    gap:5px!important;
  }

  .previewSpeedLabel{
    font-size:8px!important;
    gap:4px!important;
  }

  .previewSpeedLabel select{
    min-height:30px!important;
    height:30px!important;
    width:62px!important;
    padding:3px 5px!important;
    font-size:10px!important;
  }

  #replayBtn{
    min-height:30px!important;
    height:30px!important;
    padding:3px 9px!important;
    font-size:9px!important;
  }
}

/* Teléfonos realmente bajos: aún más campo */
@media(max-height:430px) and (orientation:landscape){
  .mobileBoardTools{
    height:28px!important;
    margin-bottom:2px!important;
  }
  .mobileBoardTools button{
    height:26px!important;
    min-height:26px!important;
  }
  .board{
    aspect-ratio:24 / 6.7!important;
  }
  .previewBoard{
    aspect-ratio:24 / 6.7!important;
  }
  .player{
    width:25px!important;
    height:25px!important;
    margin-left:-12.5px!important;
    margin-top:-12.5px!important;
  }
  .previewBoard .player{
    width:23px!important;
    height:23px!important;
    margin-left:-11.5px!important;
    margin-top:-11.5px!important;
  }
}

/* ==========================================================
   V3.7 — TRAINING LANDSCAPE
   En móvil horizontal el modo por defecto es presentación.
   ========================================================== */

.trainingTopBar,
.trainingBottomBar,
.trainingPlaysDialog{
  display:none;
}

/* Editor nav now has six buttons when explicitly opened. */
@media(max-width:700px){
  .mobileBottomBar{
    grid-template-columns:repeat(6,1fr);
  }
}

/* Landscape is the primary mobile experience */
@media(max-height:600px) and (orientation:landscape){

  body.trainingMode{
    padding:0!important;
    overflow:hidden!important;
  }

  body.trainingMode .app{
    width:100%;
    height:100vh;
    padding:0!important;
    margin:0!important;
    max-width:none!important;
    display:block;
  }

  body.trainingMode .appHeader,
  body.trainingMode .playbar,
  body.trainingMode .quickHelp,
  body.trainingMode .editorToolbar,
  body.trainingMode .sidebar,
  body.trainingMode .selectedTopPanel,
  body.trainingMode .mobileBoardTools,
  body.trainingMode .boardTopbar,
  body.trainingMode .mobileBottomBar,
  body.trainingMode .mobileDrawBar{
    display:none!important;
  }

  body.trainingMode .layout{
    display:block!important;
    width:100%;
    height:100%;
    margin:0!important;
    padding:0!important;
  }

  body.trainingMode .boardSection{
    width:100%;
    height:100%;
    padding:44px 6px 58px;
    display:flex;
    align-items:center;
    justify-content:center;
    min-width:0;
  }

  body.trainingMode .boardWrap{
    width:100%;
    max-width:none;
    overflow:hidden!important;
    border-radius:10px;
  }

  body.trainingMode .board{
    width:100%!important;
    min-width:100%!important;
    aspect-ratio:23 / 7.45!important;
    border-radius:10px!important;
    border-width:1.5px!important;
  }

  body.trainingMode .player{
    width:28px!important;
    height:28px!important;
    margin-left:-14px!important;
    margin-top:-14px!important;
    font-size:7px!important;
    border-width:1.5px!important;
    cursor:default!important;
    pointer-events:none!important;
  }

  body.trainingMode #paths{
    pointer-events:none!important;
  }

  .trainingTopBar{
    position:fixed;
    z-index:90;
    top:0;
    left:0;
    right:0;
    height:40px;
    padding:5px 8px;
    display:flex!important;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    background:rgba(8,12,17,.96);
    border-bottom:1px solid #28303a;
    backdrop-filter:blur(8px);
  }

  .trainingIdentity{
    display:flex;
    align-items:center;
    gap:8px;
    min-width:0;
  }

  .trainingBadge{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:20px;
    padding:3px 6px;
    background:#f36b21;
    border-radius:5px;
    color:#fff;
    font-size:8px;
    line-height:1;
    font-weight:900;
    letter-spacing:.08em;
  }

  #trainingPlayName{
    max-width:55vw;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    font-size:13px;
    color:#f6f8fa;
  }

  .trainingTextBtn{
    min-height:30px;
    height:30px;
    padding:0 10px;
    border:1px solid #343e49;
    border-radius:7px;
    background:#141a22;
    color:#d7dee6;
    font-size:9px;
    font-weight:800;
  }

  .trainingBottomBar{
    position:fixed;
    z-index:90;
    left:0;
    right:0;
    bottom:0;
    height:54px;
    padding:4px 7px;
    background:rgba(8,12,17,.97);
    border-top:1px solid #28303a;
    display:grid!important;
    grid-template-columns:1fr 1fr 64px 1fr 1fr;
    align-items:center;
    gap:4px;
    backdrop-filter:blur(8px);
  }

  .trainingBtn{
    min-width:0;
    height:42px;
    border:0;
    border-radius:8px;
    background:transparent;
    color:#bdc6cf;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:5px;
    padding:0 5px;
    font-size:9px;
    font-weight:800;
  }

  .trainingBtn:active{
    background:#171e27;
  }

  .trainingIcon{
    font-size:18px;
    line-height:1;
  }

  .trainingPlayBtn{
    justify-self:center;
    width:50px;
    height:50px;
    min-height:50px;
    padding:0;
    border:0;
    border-radius:50%;
    background:#f36b21;
    color:white;
    font-size:18px;
    box-shadow:0 5px 18px rgba(243,107,33,.28);
  }

  .trainingPlayBtn:active{
    transform:scale(.96);
  }

  /* Editor mode is still available, but secondary. */
  body.landscapeEditMode .trainingTopBar,
  body.landscapeEditMode .trainingBottomBar{
    display:none!important;
  }

  body.landscapeEditMode .mobileBottomBar{
    display:grid!important;
    grid-template-columns:repeat(6,1fr)!important;
  }

  body.landscapeEditMode .boardSection{
    padding:0;
  }

  /* Saved plays training sheet */
  .trainingPlaysDialog{
    width:min(700px,calc(100% - 14px));
    max-width:none;
    max-height:calc(100% - 14px);
    margin:auto;
    padding:9px;
    border:1px solid #303944;
    border-radius:12px;
    background:#10151c;
    color:#fff;
  }

  .trainingPlaysDialog::backdrop{
    background:rgba(0,0,0,.7);
    backdrop-filter:blur(3px);
  }

  .trainingSheetHeader{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    margin-bottom:8px;
  }

  .trainingSheetHeader>div{
    display:flex;
    align-items:center;
    gap:8px;
  }

  .trainingSheetHeader h2{
    margin:0;
    font-size:15px;
  }

  .trainingPlaysList{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:7px;
    max-height:calc(100vh - 82px);
    overflow:auto;
  }

  .trainingPlayCard{
    min-width:0;
    min-height:54px;
    padding:8px 10px;
    border:1px solid #29323c;
    border-radius:9px;
    background:#0b1016;
    color:#fff;
    text-align:left;
  }

  .trainingPlayCard strong{
    display:block;
    font-size:11px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  .trainingPlayCard small{
    display:block;
    margin-top:3px;
    color:#8793a0;
    font-size:8px;
  }

  .trainingPlayCard.active{
    border-color:#f36b21;
    box-shadow:inset 3px 0 0 #f36b21;
  }

  /* Play popup becomes a clean training presentation */
  body.trainingMode .playPreviewDialog{
    width:100%!important;
    height:100%!important;
    max-width:none!important;
    max-height:none!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    border-radius:0!important;
    background:#090d12!important;
  }

  body.trainingMode .playPreviewHeader{
    height:38px!important;
    min-height:38px!important;
    margin:0!important;
    padding:4px 7px 3px 10px!important;
    background:#0b1016;
    border-bottom:1px solid #252d36;
  }

  body.trainingMode .playPreviewHeader h2{
    font-size:13px!important;
  }

  body.trainingMode .closePreviewBtn{
    width:30px!important;
    height:30px!important;
    min-width:30px!important;
    min-height:30px!important;
    border:0!important;
    background:#171e27!important;
  }

  body.trainingMode .previewBoardWrap{
    height:calc(100% - 78px)!important;
    width:100%!important;
    padding:4px 6px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    overflow:hidden!important;
  }

  body.trainingMode .previewBoard{
    width:100%!important;
    min-width:100%!important;
    max-height:100%!important;
    aspect-ratio:23 / 7.45!important;
    border-radius:9px!important;
  }

  body.trainingMode .previewBoard .player{
    width:27px!important;
    height:27px!important;
    margin-left:-13.5px!important;
    margin-top:-13.5px!important;
    font-size:6.5px!important;
  }

  body.trainingMode .previewFooter{
    height:40px!important;
    min-height:40px!important;
    margin:0!important;
    padding:3px 7px!important;
    background:#0b1016;
    border-top:1px solid #252d36;
  }

  body.trainingMode #previewStatus{
    font-size:9px!important;
  }

  body.trainingMode .previewSpeedLabel{
    font-size:8px!important;
  }

  body.trainingMode .previewSpeedLabel select,
  body.trainingMode #replayBtn{
    height:30px!important;
    min-height:30px!important;
  }
}

@media(max-height:430px) and (orientation:landscape){
  body.trainingMode .boardSection{
    padding-top:39px;
    padding-bottom:51px;
  }
  .trainingTopBar{
    height:36px;
  }
  .trainingBottomBar{
    height:48px;
  }
  .trainingPlayBtn{
    width:46px;
    height:46px;
    min-height:46px;
  }
  body.trainingMode .board{
    aspect-ratio:24 / 6.9!important;
  }
  body.trainingMode .previewBoard{
    aspect-ratio:24 / 6.9!important;
  }
}


/* =========================================================
   V3.8 MOBILE REWORK
   SOLO dispositivos táctiles. Desktop no se modifica.
   ========================================================= */

@media (pointer:coarse) and (max-width:1100px){
  html,body{
    overscroll-behavior:none;
  }

  .mobileOnly{display:flex}

  /* Portrait remains usable, but simple. */
  @media (orientation:portrait){
    body{
      padding-bottom:72px!important;
    }

    .app{
      padding:7px!important;
    }

    .playbar,
    .editorToolbar,
    .quickHelp,
    .sidebar{
      display:none!important;
    }

    .layout{
      display:block!important;
      margin-top:5px!important;
    }

    .mobileBoardTools{
      display:flex!important;
    }

    .board{
      width:100%!important;
      min-width:100%!important;
      aspect-ratio:1.36/1!important;
    }

    .player{
      width:34px!important;
      height:34px!important;
      margin-left:-17px!important;
      margin-top:-17px!important;
      font-size:8px!important;
    }

    .mobileBottomBar{
      display:grid!important;
      grid-template-columns:repeat(6,1fr)!important;
      height:66px!important;
    }

    .mobileNavBtn{
      min-height:52px!important;
      font-size:9px!important;
    }

    .trainingTopBar,
    .trainingBottomBar{
      display:none!important;
    }

    .playPreviewDialog{
      width:100%!important;
      height:100dvh!important;
      max-width:none!important;
      max-height:none!important;
      margin:0!important;
      border:0!important;
      border-radius:0!important;
    }

    .previewBoardWrap{
      height:calc(100dvh - 110px)!important;
    }
  }
}

/* LANDSCAPE = primary mobile mode */
@media (pointer:coarse) and (max-width:1100px) and (orientation:landscape){

  html,body{
    width:100%;
    height:100%;
    margin:0;
    overflow:hidden!important;
    background:#090d12!important;
  }

  body{
    min-height:100dvh;
    padding:0!important;
  }

  /* ---------- TRAINING VIEW ---------- */
  body.trainingMode .app{
    position:fixed;
    inset:0;
    width:100vw!important;
    height:100dvh!important;
    max-width:none!important;
    margin:0!important;
    padding:0!important;
  }

  body.trainingMode .appHeader,
  body.trainingMode .playbar,
  body.trainingMode .quickHelp,
  body.trainingMode .editorToolbar,
  body.trainingMode .sidebar,
  body.trainingMode .selectedTopPanel,
  body.trainingMode .mobileBoardTools,
  body.trainingMode .boardTopbar,
  body.trainingMode .mobileBottomBar,
  body.trainingMode .mobileDrawBar{
    display:none!important;
  }

  body.trainingMode .layout{
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    margin:0!important;
    padding:0!important;
    display:block!important;
  }

  body.trainingMode .boardSection{
    position:absolute;
    top:42px;
    left:0;
    right:0;
    bottom:56px;
    width:auto!important;
    height:auto!important;
    min-width:0!important;
    padding:4px 5px!important;
    margin:0!important;
    display:block!important;
  }

  body.trainingMode .boardWrap{
    width:100%!important;
    height:100%!important;
    margin:0!important;
    padding:0!important;
    overflow:hidden!important;
    border-radius:9px!important;
  }

  body.trainingMode .board{
    width:100%!important;
    min-width:100%!important;
    height:100%!important;
    min-height:0!important;
    aspect-ratio:auto!important;
    border-radius:9px!important;
    border-width:1px!important;
    touch-action:manipulation!important;
  }

  body.trainingMode .player{
    width:29px!important;
    height:29px!important;
    margin-left:-14.5px!important;
    margin-top:-14.5px!important;
    font-size:7px!important;
    border-width:1.5px!important;
    pointer-events:none!important;
    box-shadow:0 2px 5px rgba(0,0,0,.34)!important;
  }

  body.trainingMode #paths,
  body.trainingMode #pathSvg{
    pointer-events:none!important;
  }

  .trainingTopBar{
    position:fixed!important;
    z-index:110!important;
    top:0;
    left:0;
    right:0;
    height:42px!important;
    padding:5px 8px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    background:#0b1016!important;
    border-bottom:1px solid #242d36!important;
  }

  .trainingIdentity{
    min-width:0;
    flex:1;
  }

  .trainingBadge{
    flex:0 0 auto;
  }

  #trainingPlayName{
    max-width:42vw!important;
    font-size:12px!important;
  }

  .trainingTopActions{
    display:flex;
    align-items:center;
    gap:5px;
    flex:0 0 auto;
  }

  .trainingTextBtn{
    height:30px!important;
    min-height:30px!important;
    padding:0 8px!important;
    font-size:9px!important;
  }

  .trainingBottomBar{
    position:fixed!important;
    z-index:110!important;
    left:0;
    right:0;
    bottom:0;
    height:56px!important;
    padding:4px 7px calc(4px + env(safe-area-inset-bottom))!important;
    display:grid!important;
    grid-template-columns:1fr 1fr 62px 1fr 1fr!important;
    align-items:center!important;
    gap:4px!important;
    background:#0b1016!important;
    border-top:1px solid #242d36!important;
  }

  .trainingBtn{
    height:44px!important;
    min-height:44px!important;
    font-size:9px!important;
  }

  .trainingPlayBtn{
    width:50px!important;
    height:50px!important;
    min-height:50px!important;
    font-size:18px!important;
  }

  /* ---------- EDIT VIEW ---------- */
  body.landscapeEditMode{
    overflow:hidden!important;
  }

  body.landscapeEditMode .app{
    position:fixed;
    inset:0;
    width:100vw!important;
    height:100dvh!important;
    max-width:none!important;
    margin:0!important;
    padding:4px 5px 54px!important;
  }

  body.landscapeEditMode .appHeader,
  body.landscapeEditMode .playbar,
  body.landscapeEditMode .quickHelp,
  body.landscapeEditMode .editorToolbar,
  body.landscapeEditMode .sidebar,
  body.landscapeEditMode .boardTopbar,
  body.landscapeEditMode .trainingTopBar,
  body.landscapeEditMode .trainingBottomBar{
    display:none!important;
  }

  body.landscapeEditMode .layout{
    width:100%;
    height:100%;
    margin:0!important;
    display:block!important;
  }

  body.landscapeEditMode .boardSection{
    width:100%;
    height:100%;
    padding:0!important;
    margin:0!important;
    display:flex!important;
    flex-direction:column!important;
    min-width:0!important;
  }

  body.landscapeEditMode .mobileBoardTools{
    flex:0 0 34px;
    width:100%;
    height:34px!important;
    display:flex!important;
    align-items:center!important;
    gap:4px!important;
    margin:0 0 3px!important;
  }

  .mobileToolSpacer{
    flex:1;
  }

  .mobileTrainingQuickBtn{
    background:#f36b21!important;
    border-color:#f36b21!important;
    color:#fff!important;
    font-weight:850!important;
  }

  body.landscapeEditMode .boardWrap{
    flex:1 1 auto;
    min-height:0;
    width:100%;
    height:auto!important;
    overflow:auto hidden!important;
    border-radius:9px!important;
    scrollbar-width:none;
  }

  body.landscapeEditMode .boardWrap::-webkit-scrollbar{
    display:none;
  }

  body.landscapeEditMode .board{
    width:100%!important;
    min-width:100%!important;
    height:100%!important;
    min-height:0!important;
    aspect-ratio:auto!important;
    border-radius:9px!important;
    touch-action:none!important;
  }

  body.landscapeEditMode .board.mobileZoom125{
    width:125%!important;
    min-width:125%!important;
  }

  body.landscapeEditMode .board.mobileZoom150{
    width:150%!important;
    min-width:150%!important;
  }

  body.landscapeEditMode .player{
    width:29px!important;
    height:29px!important;
    margin-left:-14.5px!important;
    margin-top:-14.5px!important;
    font-size:7px!important;
    border-width:1.5px!important;
  }

  body.landscapeEditMode .mobileBottomBar{
    position:fixed!important;
    z-index:100!important;
    left:0;
    right:0;
    bottom:0;
    height:52px!important;
    padding:3px 5px calc(3px + env(safe-area-inset-bottom))!important;
    display:grid!important;
    grid-template-columns:repeat(6,1fr)!important;
    background:#0b1016!important;
    border-top:1px solid #242d36!important;
  }

  body.landscapeEditMode .mobileNavBtn{
    min-height:44px!important;
    height:44px!important;
    flex-direction:row!important;
    gap:4px!important;
    padding:2px!important;
    font-size:8px!important;
  }

  body.landscapeEditMode .mobileNavBtn .navIcon{
    font-size:13px!important;
  }

  body.landscapeEditMode .selectedTopPanel{
    position:fixed!important;
    z-index:120!important;
    top:5px!important;
    right:5px!important;
    bottom:57px!important;
    left:auto!important;
    width:min(350px,46vw)!important;
    max-height:none!important;
    overflow:auto!important;
    transform:translateX(calc(100% + 20px))!important;
    opacity:0!important;
    pointer-events:none!important;
    border-radius:10px!important;
    padding:7px!important;
  }

  body.landscapeEditMode .selectedTopPanel.mobileSheetOpen{
    transform:translateX(0)!important;
    opacity:1!important;
    pointer-events:auto!important;
  }

  body.landscapeEditMode .mobileDrawBar{
    z-index:121!important;
    left:6px!important;
    right:auto!important;
    bottom:58px!important;
    width:min(420px,58vw)!important;
    min-width:0!important;
    min-height:40px!important;
  }

  /* ---------- FULLSCREEN PLAY ---------- */
  .playPreviewDialog{
    width:100vw!important;
    height:100dvh!important;
    max-width:none!important;
    max-height:none!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    border-radius:0!important;
    background:#090d12!important;
  }

  .playPreviewDialog::backdrop{
    background:#090d12!important;
  }

  .playPreviewHeader{
    height:38px!important;
    min-height:38px!important;
    margin:0!important;
    padding:4px 7px 3px 10px!important;
    background:#0b1016!important;
    border-bottom:1px solid #242d36!important;
  }

  .playPreviewHeader h2{
    font-size:12px!important;
  }

  .previewBoardWrap{
    width:100%!important;
    height:calc(100dvh - 78px)!important;
    min-height:0!important;
    margin:0!important;
    padding:4px!important;
    overflow:hidden!important;
    display:block!important;
  }

  .previewBoard{
    width:100%!important;
    min-width:100%!important;
    height:100%!important;
    min-height:0!important;
    max-height:none!important;
    aspect-ratio:auto!important;
    border-radius:8px!important;
  }

  .previewBoard .player{
    width:28px!important;
    height:28px!important;
    margin-left:-14px!important;
    margin-top:-14px!important;
    font-size:7px!important;
    border-width:1.5px!important;
  }

  .previewFooter{
    height:40px!important;
    min-height:40px!important;
    margin:0!important;
    padding:3px 7px!important;
    background:#0b1016!important;
    border-top:1px solid #242d36!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
  }

  #previewStatus{
    font-size:9px!important;
  }

  .previewControls{
    gap:5px!important;
  }

  .previewSpeedLabel{
    font-size:8px!important;
  }

  .previewSpeedLabel select,
  #replayBtn{
    min-height:30px!important;
    height:30px!important;
    font-size:9px!important;
  }

  /* ---------- DIALOGS ---------- */
  .trainingPlaysDialog,
  .mobileFormationDialog{
    width:min(760px,calc(100vw - 12px))!important;
    max-width:none!important;
    max-height:calc(100dvh - 12px)!important;
    margin:auto!important;
    padding:9px!important;
    border-radius:12px!important;
  }

  .trainingPlaysList{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    max-height:calc(100dvh - 80px)!important;
  }

  .formationCards{
    grid-template-columns:1fr 1fr!important;
  }
}

/* Smaller landscape phones */
@media (pointer:coarse) and (max-width:900px) and (max-height:430px) and (orientation:landscape){
  body.trainingMode .boardSection{
    top:37px!important;
    bottom:49px!important;
  }

  .trainingTopBar{
    height:37px!important;
  }

  .trainingBottomBar{
    height:49px!important;
  }

  .trainingPlayBtn{
    width:44px!important;
    height:44px!important;
    min-height:44px!important;
  }

  body.trainingMode .player,
  body.landscapeEditMode .player,
  .previewBoard .player{
    width:25px!important;
    height:25px!important;
    margin-left:-12.5px!important;
    margin-top:-12.5px!important;
    font-size:6px!important;
  }
}
