:root {
  --bg-1: #060912;
  --bg-2: #0a1220;
  --bg-3: #050811;
  --text: #ffffff;
  --text-dim: rgba(255,255,255,0.65);
  --text-faint: rgba(255,255,255,0.42);
  --glass: rgba(255,255,255,0.05);
  --glass-strong: rgba(255,255,255,0.10);
  --glass-border: rgba(255,255,255,0.10);
  --home: #2a9bff;
  --away: #ff4d4d;
  --accent: #2ecc71;
  --r-lg: 5px;
  --r-md: 4px;
  --r-sm: 3px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 600px at 15% 0%, rgba(46,204,113,0.05), transparent 60%),
    radial-gradient(900px 600px at 85% 100%, rgba(42,155,255,0.05), transparent 60%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2), var(--bg-3));
  background-attachment: fixed;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
}

#app {
  width: 100%;
  height: 100vh; /* fallback */
  height: 100dvh;
  display: flex; flex-direction: column;
}

button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; padding: 0; }
svg { display: block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px;
  border-radius: 5px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  color: var(--text);
  font-weight: 600; font-size: 14px;
  transition: background 0.2s ease, transform 0.12s ease;
}
.btn:hover { background: rgba(255,255,255,0.14); }
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: rgba(255,255,255,0.95);
  color: #0a1322;
  border-color: transparent;
}
.btn-primary:hover { background: white; }

.btn-icon {
  width: 36px; height: 36px; border-radius: 4px;
  background: var(--glass); border: 1px solid var(--glass-border);
  display: inline-grid; place-items: center; color: var(--text);
  transition: background 0.2s ease;
}
.btn-icon:hover { background: var(--glass-strong); }

/* === Dashboard === */
.dashboard { width: 100%; height: 100%; overflow-y: auto; padding: 28px clamp(14px, 4vw, 40px); }
.dashboard-header { margin-bottom: 22px; }
.brand-text h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.4px; }
.brand-text p { margin: 2px 0 0; color: var(--text-dim); font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }

.card-tile {
  border-radius: var(--r-lg);
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--glass-border);
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
  cursor: pointer; position: relative;
  transition: transform 0.15s ease, background 0.2s ease;
}
.card-tile:hover { transform: translateY(-2px); background: var(--glass-strong); }
.card-thumb {
  aspect-ratio: 100 / 65;
  border-radius: var(--r-md);
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #1ea64a, #0f5b27);
}
.card-thumb svg { width: 100%; height: 100%; display: block; }

.card-menu-btn {
  position: absolute; top: 6px; right: 6px;
  width: 28px; height: 28px; border-radius: 4px;
  background: rgba(0,0,0,0.55); color: white;
  display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,0.14);
}
.card-lock {
  position: absolute; top: 6px; left: 6px;
  width: 26px; height: 26px; border-radius: 4px;
  background: rgba(0,0,0,0.55); color: white;
  display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,0.14);
}
.card-title {
  font-size: 14px; font-weight: 700; padding: 0 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.new-tile {
  border-radius: var(--r-lg);
  border: 1.5px dashed rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; min-height: 192px;
  color: rgba(255,255,255,0.78); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.new-tile:hover { background: rgba(255,255,255,0.08); color: white; border-color: rgba(255,255,255,0.36); }
.new-tile .plus-icon { color: var(--text-dim); }

/* === Editor === */
.editor {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%; gap: 8px; padding: 8px;
}

.editor-header {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  border-radius: var(--r-lg);
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--glass-border);
}
.editor-header h2 {
  margin: 0; font-size: 14px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.editor-header h2 .edit-pencil { color: var(--text-faint); opacity: 0.7; }
.editor-header .spacer { flex: 1; min-width: 4px; }

.editor-stage {
  display: grid;
  grid-template-columns: 200px 1fr 200px;
  gap: 8px; min-height: 0;
}
.editor[data-board-mode="solo"] .editor-stage {
  grid-template-columns: 220px 1fr;
}

.field-stage {
  display: flex; align-items: center; justify-content: center;
  min-height: 0; min-width: 0;
}
.field-wrap {
  position: relative;
  aspect-ratio: 1050 / 680;
  width: 100%;
  max-height: 100%;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow: 0 14px 34px rgba(0,0,0,0.45);
}
.field-svg, .strokes-host > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.strokes-host > svg { pointer-events: none; }
.field-wrap[data-mode="draw"] .strokes-host > svg { pointer-events: auto; }
.players-layer { position: absolute; inset: 0; }

/* === PLAYER — escudo flutuante === */
.player {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  touch-action: none; cursor: grab;
  transition: transform 0.12s ease;
}
.player[data-dragging="true"] { cursor: grabbing; z-index: 20; transition: none; }
.player .badge {
  width: 38px; height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.7)) drop-shadow(0 0 6px rgba(0,0,0,0.35));
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.player[data-dragging="true"] .badge { transform: scale(1.16); }
.player .badge.fallback {
  display: grid; place-items: center;
  color: white; font-weight: 800; font-size: 16px;
  border-radius: 4px;
  background: var(--home);
  border: 2px solid rgba(255,255,255,0.85);
}
.player .badge.fallback[data-team="away"] { background: var(--away); }
.player .label {
  font-size: 10px; font-weight: 700;
  padding: 2px 7px;
  background: rgba(0,0,0,0.78);
  border-radius: 4px;
  white-space: nowrap; max-width: 110px;
  overflow: hidden; text-overflow: ellipsis;
  letter-spacing: 0.1px;
}

/* === Bench === */
.bench {
  border-radius: var(--r-lg);
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--glass-border);
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
  overflow: hidden; min-height: 0; min-width: 0;
}
.bench-header { display: flex; align-items: center; gap: 6px; }
.bench-header .team-name {
  display: flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.team-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px; border-radius: 5px;
  background: rgba(255,255,255,0.06);
  font-weight: 600; font-size: 11px;
}
.chip-name { white-space: nowrap; }
.chip-badge {
  width: 16px; height: 16px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

.bench-list {
  flex: 1; overflow-y: auto; padding-right: 3px;
  display: flex; flex-direction: column; gap: 3px;
}
.bench-list::-webkit-scrollbar { width: 5px; height: 5px; }
.bench-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.10); border-radius: 3px; }

.bench-section-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 9px; font-weight: 700; letter-spacing: 0.7px;
  text-transform: uppercase; color: var(--text-faint);
  padding: 8px 2px 3px;
}
.bench-section-title:not(:first-child) {
  border-top: 1px solid rgba(255,255,255,0.05);
  margin-top: 4px;
}
.bench-section-title .count {
  font-weight: 700; color: var(--text-dim);
  background: rgba(255,255,255,0.06);
  padding: 0 6px; border-radius: 5px; font-size: 9px;
}
.bench-empty {
  color: var(--text-faint); font-size: 10px;
  padding: 4px 6px; font-style: italic;
}

.bench-row {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 7px; border-radius: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  touch-action: none;
}
.bench-row[data-draggable="true"] { cursor: grab; }
.bench-row[data-draggable="true"]:hover { background: rgba(255,255,255,0.08); }
.bench-row[data-status="out"] { opacity: 0.55; }
.bench-row .bench-num {
  width: 22px; height: 22px; border-radius: 4px;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 800; color: white;
  background: var(--home);
  flex: 0 0 22px;
}
.bench-row.away .bench-num { background: var(--away); }
.bench-row .bench-badge {
  width: 22px; height: 22px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
  flex: 0 0 22px;
  pointer-events: none;
}
.bench-row .bench-name {
  font-size: 11px; font-weight: 600;
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bench-row .bench-pos {
  font-size: 8px; color: var(--text-dim);
  background: rgba(255,255,255,0.06);
  padding: 1px 4px; border-radius: 3px;
  font-weight: 700; letter-spacing: 0.3px;
  flex: 0 0 auto;
}
.bench-move {
  width: 22px; height: 22px; border-radius: 4px;
  display: grid; place-items: center;
  color: var(--text-dim);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  transition: all 0.2s ease;
  flex: 0 0 22px;
}
.bench-move:hover { color: white; background: rgba(255,255,255,0.10); }

/* === Toolbar (neutra) === */
.toolbar {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 10px;
  border-radius: 5px;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
}
.toolbar-wrap { display: flex; justify-content: center; }

.mode-pill { display: inline-flex; padding: 2px; border-radius: 5px; background: rgba(255,255,255,0.04); gap: 2px; }
.mode-btn {
  width: 38px; height: 32px; border-radius: 5px;
  display: grid; place-items: center;
  color: rgba(255,255,255,0.50);
  transition: all 0.2s ease;
}
.mode-btn.active { color: white; background: rgba(255,255,255,0.12); }

.tool-divider { width: 1px; height: 20px; background: rgba(255,255,255,0.10); }

.color-swatch, .arrow-toggle, .tool-btn {
  width: 34px; height: 34px; border-radius: 4px;
  display: grid; place-items: center;
  background: transparent;
  color: var(--text);
  transition: background 0.2s ease;
}
.color-swatch:hover, .arrow-toggle:hover, .tool-btn:hover { background: rgba(255,255,255,0.10); }
.color-dot {
  width: 20px; height: 20px; border-radius: 4px;
  border: 1.5px solid rgba(255,255,255,0.6);
  display: inline-block;
}
.arrow-toggle.active { background: rgba(255,255,255,0.14); }
/* Neutral — sem cores semânticas */
.tool-btn[data-tint] { color: var(--text); }
.disabled { opacity: 0.32; pointer-events: none; }

/* === FAB & Drawer (mobile/tablet portrait) === */
.fab {
  display: none;
  position: fixed;
  bottom: 16px; right: 16px;
  width: 56px; height: 56px; border-radius: 4px;
  background: rgba(255,255,255,0.95);
  color: #0a1322;
  display: none;
  align-items: center; justify-content: center;
  box-shadow: 0 14px 32px rgba(0,0,0,0.55);
  z-index: 40;
}
.drawer-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(5,8,16,0.55);
  z-index: 38;
}
.drawer {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0;
  max-height: 70vh;
  background: linear-gradient(180deg, #0e1730, #0a1322);
  border-top: 1px solid var(--glass-border);
  border-radius: 5px 5px 0 0;
  box-shadow: 0 -16px 40px rgba(0,0,0,0.5);
  z-index: 39;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 8px 14px 16px;
  overflow-y: auto;
}
.drawer-handle {
  width: 40px; height: 4px;
  background: rgba(255,255,255,0.22);
  border-radius: 2px;
  margin: 4px auto 10px;
}

/* === Modal === */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(5,8,16,0.72);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center;
  z-index: 100; padding: 16px;
}
.modal {
  width: min(560px, 100%); max-height: 86vh; overflow-y: auto;
  background: linear-gradient(180deg, #101a2c, #0a1322);
  border-radius: 5px;
  border: 1px solid var(--glass-border);
  padding: 22px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
.modal h3 { margin: 0 0 16px; font-size: 18px; }
.modal .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.modal label { font-size: 11px; font-weight: 700; color: var(--text-dim); letter-spacing: 0.4px; text-transform: uppercase; }
.modal .hint { color: var(--text-faint); font-size: 11px; margin-top: 4px; }
.modal input, .modal select {
  width: 100%; padding: 11px 13px;
  background: rgba(255,255,255,0.04); color: white;
  border-radius: 4px; border: 1px solid var(--glass-border);
  font-size: 14px;
}
.modal input:focus, .modal select:focus { outline: 2px solid rgba(255,255,255,0.50); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Combo tiles (badge selectors) */
.combo-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.combo-tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 8px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--glass-border);
  border-radius: 5px;
  color: var(--text-dim);
  transition: all 0.2s ease;
}
.combo-tile:hover { background: rgba(255,255,255,0.06); color: white; }
.combo-tile.active {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.32);
  color: white;
}
.combo-badges {
  display: flex; gap: 4px; align-items: center; justify-content: center;
  height: 44px;
}
.combo-badges img {
  width: 36px; height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5));
}
.combo-badges.single img { width: 44px; height: 44px; }
.combo-tile span { font-size: 12px; font-weight: 600; }

/* === Action sheet — substituição interativa === */
.action-sheet {
  width: min(440px, 100%); max-height: 86vh; overflow-y: auto;
  background: linear-gradient(180deg, #101a2c, #0a1322);
  border-radius: 5px;
  border: 1px solid var(--glass-border);
  padding: 18px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
.sheet-header {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 12px;
}
.sheet-badge {
  width: 30px; height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.sheet-title { flex: 1; min-width: 0; }
.sheet-title h4 { margin: 0; font-size: 16px; font-weight: 700; }
.sheet-sub { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.sheet-status { font-size: 10px; color: var(--text-dim); font-weight: 600; }
.sheet-close {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  color: var(--text-dim);
  border-radius: 4px;
}
.sheet-close:hover { background: rgba(255,255,255,0.06); color: white; }
.sheet-section { margin-bottom: 12px; }
.sheet-section h5 {
  margin: 0 0 6px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--text-faint);
}
.swap-list {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 40vh; overflow-y: auto;
  padding-right: 3px;
}
.swap-candidate {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  color: var(--text); text-align: left;
  transition: background 0.2s ease;
}
.swap-candidate:hover { background: rgba(255,255,255,0.10); }
.swap-candidate img {
  width: 22px; height: 22px;
  object-fit: contain;
  flex: 0 0 22px;
}
.swap-candidate .num {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.10);
  border-radius: 4px;
  font-size: 11px; font-weight: 700;
  flex: 0 0 22px;
}
.swap-candidate .cand-name {
  flex: 1; min-width: 0;
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cand-pos {
  font-size: 9px; font-weight: 700; letter-spacing: 0.3px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.08);
  padding: 1px 5px; border-radius: 3px;
  flex: 0 0 auto;
}
.sheet-actions { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.action-btn {
  display: block; width: 100%;
  padding: 11px 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px; font-weight: 600;
  text-align: center;
  transition: background 0.2s ease;
}
.action-btn:hover { background: rgba(255,255,255,0.12); }
.action-btn.primary { background: rgba(255,255,255,0.18); }
.sheet-empty {
  color: var(--text-faint); font-size: 12px;
  padding: 10px; text-align: center; font-style: italic;
}

.menu-popover {
  position: absolute; top: 38px; right: 6px;
  min-width: 160px;
  border-radius: 5px;
  background: rgba(15,22,38,0.96);
  border: 1px solid var(--glass-border);
  padding: 4px;
  box-shadow: 0 14px 32px rgba(0,0,0,0.5);
  z-index: 50;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.menu-popover button {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  padding: 8px 9px; border-radius: 4px;
  font-size: 13px; color: white;
}
.menu-popover button:hover { background: rgba(255,255,255,0.07); }
.menu-popover button[data-danger="true"] { color: #ff6b6b; }

/* ============ RESPONSIVE ============ */

/* Telas médias */
@media (max-width: 1100px) {
  .editor-stage { grid-template-columns: 170px 1fr 170px; }
  .editor[data-board-mode="solo"] .editor-stage { grid-template-columns: 200px 1fr; }
}

/* === MOBILE / TABLET PORTRAIT — layout flutuante ===
   tablet portrait: orientation: portrait até 1100px
   phone: até 700px (qualquer orientation) */
@media (orientation: portrait) and (max-width: 1100px), (max-width: 700px) {
  .editor { padding: 0; gap: 0; }
  .editor-header {
    position: fixed; top: 8px; left: 8px; right: 8px;
    z-index: 36;
    padding: 7px 12px;
    border-radius: 5px;
  }
  .editor-header h2 { font-size: 13px; }
  .team-chip .chip-name { display: none; }
  .team-chip { padding: 2px 5px; }
  .editor-stage,
  .editor[data-board-mode="solo"] .editor-stage {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    padding: 0;
    height: 100%;
    min-height: 0;
  }
  /* Esconde bancos no layout principal — vão pro drawer */
  .editor-stage > .bench { display: none; }
  .field-stage {
    padding: 52px 8px 80px;
    width: 100%;
    height: 100%;
    min-height: 0;
  }
  /* Campo VERTICAL no mobile — width-bound (mais confiável em iOS) */
  .field-wrap {
    aspect-ratio: 680 / 1050;
    width: 100%;
    height: auto;
    max-height: 100%;
    min-height: 0;
    border-radius: 5px;
  }
  /* Toolbar floating bottom */
  .toolbar-wrap {
    position: fixed; bottom: 14px; left: 0; right: 0;
    z-index: 30; pointer-events: none;
  }
  .toolbar { pointer-events: auto; box-shadow: 0 14px 36px rgba(0,0,0,0.55); }
  /* FAB ativo */
  .fab { display: grid; }
  /* Drawer drawer */
  .drawer { display: block; }
  .editor[data-drawer-open="true"] .drawer { transform: translateY(0); }
  .editor[data-drawer-open="true"] .drawer-backdrop { display: block; }
  /* Drawer renderiza os benches */
  .drawer-content { display: contents; }
  .editor[data-drawer-open="true"] .editor-stage > .bench {
    display: flex;
    position: fixed;
    left: 0; right: 0;
    z-index: 40;
    border-radius: 5px 5px 0 0;
    border-top: 1px solid var(--glass-border);
    background: linear-gradient(180deg, #0e1730, #0a1322);
    backdrop-filter: none; -webkit-backdrop-filter: none;
    padding: 14px;
  }
  .editor[data-drawer-open="true"] .editor-stage > .bench[data-side="home"] {
    bottom: 0;
    max-height: 50vh;
  }
  .editor[data-drawer-open="true"] .editor-stage > .bench[data-side="away"] {
    bottom: 0;
    max-height: 50vh;
  }
  /* Dois benches em modo duel: side by side */
  .editor[data-drawer-open="true"][data-board-mode="duel"] .editor-stage > .bench[data-side="home"] {
    right: 50%;
  }
  .editor[data-drawer-open="true"][data-board-mode="duel"] .editor-stage > .bench[data-side="away"] {
    left: 50%;
  }
}

/* Phone portrait — ainda mais compacto */
@media (max-width: 520px) {
  .editor-header { padding: 6px 10px; gap: 6px; }
  .editor-header h2 { font-size: 12px; }
  .player .badge { width: 32px; height: 32px; }
  .player .label { font-size: 9px; padding: 1px 5px; }
  .toolbar { gap: 4px; padding: 5px 8px; }
  .tool-btn, .arrow-toggle, .color-swatch { width: 32px; height: 32px; }
  .mode-btn { width: 34px; height: 28px; }
  .tool-divider { height: 18px; }
  .fab { width: 50px; height: 50px; bottom: 78px; right: 12px; }
  /* Em phone portrait drawer ocupa full width pros 2 benches */
  .editor[data-drawer-open="true"][data-board-mode="duel"] .editor-stage > .bench[data-side="home"] {
    right: 50%; max-height: 50vh;
  }
  .editor[data-drawer-open="true"][data-board-mode="duel"] .editor-stage > .bench[data-side="away"] {
    left: 50%; max-height: 50vh;
  }
  .dashboard { padding: 18px 14px; }
  .brand-text h1 { font-size: 20px; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .combo-tiles { grid-template-columns: 1fr; }
}

/* Telas grandes */
@media (min-width: 1400px) {
  .editor-stage { grid-template-columns: 240px 1fr 240px; }
  .editor[data-board-mode="solo"] .editor-stage { grid-template-columns: 280px 1fr; }
}
