/**
 * New game sheet — docked under controls (desktop) / bottom sheet (mobile).
 * Clean forge panel; no emoji dependency (ASCII close only).
 */

#chess-newgame-sheet.chess-newgame-sheet,
.chess-newgame-sheet {
  position: fixed !important;
  inset: auto !important;
  z-index: 12560 !important;
  display: none !important;
  align-items: stretch;
  justify-content: flex-start;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  pointer-events: none;
}

#chess-newgame-sheet.chess-newgame-sheet.is-open,
.chess-newgame-sheet.is-open {
  display: block !important;
  pointer-events: none;
}

#chess-newgame-sheet .chess-newgame-panel,
.chess-newgame-panel {
  pointer-events: auto;
  width: min(300px, calc(100vw - 16px));
  max-height: min(74vh, 560px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(
    165deg,
    rgba(8, 22, 14, 0.98) 0%,
    rgba(4, 14, 10, 0.99) 100%
  ) !important;
  border: 1px solid rgba(0, 255, 136, 0.32) !important;
  border-radius: 14px !important;
  padding: 0.7rem 0.75rem 0.85rem !important;
  color: #e4f5ea;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.4) inset,
    0 16px 48px rgba(0, 0, 0, 0.55),
    0 0 28px rgba(0, 255, 120, 0.06) !important;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 0.8rem;
}

/* Mobile bottom sheet */
body.m-body-chess #chess-newgame-sheet .chess-newgame-panel.is-mobile-sheet,
body.m-body-battle #chess-newgame-sheet .chess-newgame-panel.is-mobile-sheet,
.chess-newgame-panel.is-mobile-sheet {
  width: 100% !important;
  max-width: 100vw !important;
  max-height: min(84dvh, 680px) !important;
  border-radius: 18px 18px 0 0 !important;
  border-bottom: none !important;
  padding: 0.85rem 1rem max(1.15rem, env(safe-area-inset-bottom)) !important;
  font-size: 0.88rem !important;
  box-shadow: 0 -20px 56px rgba(0, 0, 0, 0.72) !important;
}

body.m-body-chess #chess-newgame-sheet .chess-newgame-panel.is-mobile-sheet .btn-zoom,
body.m-body-battle #chess-newgame-sheet .chess-newgame-panel.is-mobile-sheet .btn-zoom,
.chess-newgame-panel.is-mobile-sheet .btn-zoom {
  min-height: 44px !important;
  font-size: 0.82rem !important;
  border-radius: 10px !important;
}

body.m-body-chess #chess-newgame-sheet .chess-newgame-panel.is-mobile-sheet .chess-time-pick,
.chess-newgame-panel.is-mobile-sheet .chess-time-pick {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.4rem !important;
}

body.m-body-chess #chess-newgame-backdrop.is-on,
body.m-body-battle #chess-newgame-backdrop.is-on {
  z-index: 12550 !important;
  background: rgba(0, 4, 2, 0.62) !important;
  backdrop-filter: blur(3px);
}

.chess-newgame-backdrop.is-on {
  position: fixed !important;
  inset: 0 !important;
  z-index: 12550 !important;
  display: block !important;
  background: rgba(0, 4, 2, 0.45) !important;
}

.chess-newgame-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(0, 255, 136, 0.12);
}

.chess-newgame-head-text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.chess-newgame-kicker {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(0, 255, 136, 0.55);
}

.chess-newgame-head strong {
  font-size: 1rem;
  letter-spacing: 0.04em;
  font-weight: 800;
  color: #3dffa0;
  text-shadow: 0 0 18px rgba(0, 255, 136, 0.2);
}

.chess-newgame-close {
  appearance: none;
  border: 1px solid rgba(0, 255, 136, 0.22);
  background: rgba(0, 18, 12, 0.85);
  color: #b8d4c0;
  border-radius: 8px;
  width: 2rem;
  height: 2rem;
  min-height: 2rem;
  padding: 0;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}

.chess-newgame-close:hover {
  border-color: rgba(0, 255, 136, 0.5);
  color: #fff;
  background: rgba(0, 255, 136, 0.1);
}

.chess-newgame-tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
  padding: 3px;
  border-radius: 10px;
  background: rgba(0, 10, 6, 0.65);
  border: 1px solid rgba(0, 40, 24, 0.8);
}

.chess-newgame-tab {
  flex: 1 1 0;
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #8aa894;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0.3rem 0.4rem;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.chess-newgame-tab.is-on {
  border-color: rgba(0, 255, 136, 0.4);
  color: #3dffa0;
  background: rgba(0, 255, 136, 0.1);
  box-shadow: 0 0 12px rgba(0, 255, 120, 0.08);
}

.chess-newgame-pane .tiny-label {
  display: block;
  margin: 0.45rem 0 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(180, 220, 190, 0.7);
}

.chess-color-pick,
.chess-time-pick,
.chess-ai-elo-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chess-newgame-panel .btn-zoom {
  border-radius: 8px;
  border: 1px solid rgba(0, 255, 136, 0.18);
  background: rgba(0, 16, 10, 0.9);
  color: #c8e8d0;
}

.chess-newgame-panel .btn-zoom.is-active,
.chess-newgame-panel .btn-zoom.is-color-pick.is-active,
.chess-newgame-panel .btn-zoom.is-tc.is-active,
.chess-newgame-panel .btn-zoom.is-elo-preset.is-active {
  border-color: rgba(0, 255, 136, 0.55);
  color: #e8fff0;
  background: rgba(0, 255, 136, 0.14);
  box-shadow: 0 0 0 1px rgba(0, 255, 136, 0.12) inset;
}

.chess-newgame-panel .is-primary-ctrl {
  width: 100%;
  margin-top: 0.55rem;
  min-height: 42px;
  border-radius: 10px !important;
  border: none !important;
  background: linear-gradient(180deg, #2a9a4a, #1a7034) !important;
  color: #fff !important;
  font-weight: 800 !important;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 16px rgba(0, 120, 40, 0.35);
}

.chess-newgame-panel .is-primary-ctrl:hover {
  filter: brightness(1.06);
}

.chess-engine-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.35rem 0;
}

.chess-engine-row input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
  accent-color: #00ff88;
}

.chess-engine-meta,
.chess-ai-elo-val {
  flex: 0 0 auto;
  min-width: 2.4rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #3dffa0;
}

.chess-engine-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.45rem 0;
  font-size: 0.78rem;
  color: #b0cfc0;
  cursor: pointer;
}

.chess-net-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0;
}

.chess-net-input {
  flex: 1 1 8rem;
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid rgba(0, 255, 136, 0.22);
  background: rgba(0, 12, 8, 0.9);
  color: #e4f5ea;
  padding: 0.35rem 0.55rem;
  font: inherit;
}

.chess-net-code-line {
  margin-top: 0.45rem;
  font-size: 0.75rem;
  color: #9ab8a4;
}

.chess-net-code-line strong {
  color: #3dffa0;
  letter-spacing: 0.08em;
}

.chess-actions {
  margin-top: 0.35rem;
}

/* Champion side-lock: other color is not free (still clickable for switch/create) */
.chess-color-pick .is-color-pick.is-side-blocked {
  opacity: 0.45;
  border-style: dashed !important;
  border-color: rgba(255, 180, 80, 0.45) !important;
  color: #c8b090 !important;
  background: rgba(40, 28, 8, 0.55) !important;
  box-shadow: none !important;
}
.chess-color-pick .is-color-pick.is-side-blocked:hover {
  opacity: 0.75;
  border-color: rgba(255, 200, 100, 0.7) !important;
}
