/* Layout: full-viewport, unscrollable main area */
html, body { background: transparent !important; }
.practice-body {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: transparent !important;
}
.practice-header, .practice-footer {
  background: rgba(0,0,0,0.02);
}
.practice-layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 320px 1fr 360px;
  grid-template-rows: 1fr;
  min-height: 0;
  background: transparent;
}
.panel {
  background: #fff;
  border-right: 1px solid rgba(0,0,0,.075);
}
.panel-right {
  border-right: 0;
  border-left: 1px solid rgba(0,0,0,.075);
  background: #fff;
}
.panel-right > .p-3 {
  min-height: 0;
}
.panel-right .d-flex.flex-column {
  min-height: 0;
}
.board-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  background: transparent !important;
}
/* Keep board area minimal, but do NOT blank out eval rail visuals */
.board-center .board-frame,
.board-center .board-frame * { background: transparent !important; box-shadow: none !important; }
.board-wrap { position: relative; display: flex; align-items: stretch; gap: 0; padding-right: clamp(17.5px, 4.85vw, 46.5px); }
.board-frame {
  width: min(88vmin, 720px);
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: transparent;
  box-shadow: none;
}

/* Strong overrides against global ../styles.css which defines .board-frame/.board-iframe later */
.practice-body .board-frame {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.practice-body .board-iframe {
  background: transparent !important;
  border: 0 !important;
}
.eval-rail {
  width: clamp(17.5px, 4.85vw, 46.5px);
  border-radius: 0;
  border: 1px solid #dee2e6; /* bootstrap border color */
  background:
    linear-gradient(to bottom, rgba(255,255,255,.6), rgba(255,255,255,.1)) ,
    linear-gradient(to bottom, #ffffff 0%, #f8f9fa 50%, #e9ecef 100%) !important;
  position: absolute;
  right: 0; top: 50%; bottom: auto;
  transform: translateY(-50%);
  box-shadow: 0 4px 12px rgba(15, 23, 42, .15), inset 0 1px 2px rgba(0,0,0,.06);
  z-index: 2;
  pointer-events: none;
}
.eval-rail::after {
  content: '';
  position: absolute;
  left: 20%; right: 20%; top: 50%;
  height: 2px;
  margin-top: -1px;
  background: linear-gradient(to right, rgba(33,37,41,.15), rgba(13,110,253,.25), rgba(33,37,41,.15));
  border-radius: 1px;
}
.eval-rail .eval-rail-fill{
  position: absolute; left: 0; bottom: 0; width: 100%;
  background:
    linear-gradient(to bottom, rgba(255,255,255,.25), rgba(255,255,255,0)) ,
    linear-gradient(to bottom, var(--primary-blue, #0d6efd), #0b5ed7) !important;
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
  transition: height .18s ease;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}

.eval-rail-badge {
  position: absolute;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: clamp(6px, 1.4vw, 12px);
  line-height: 1;
  font-weight: 700;
  color: rgba(15, 23, 42, .85);
  pointer-events: none;
  z-index: 3;
  text-shadow: 0 1px 1px rgba(255,255,255,.85);
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  transition: color .2s ease, text-shadow .2s ease;
}
.board-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  display: block;
}
.moves-list {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.4;
  flex: 1 1 0;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
}
.moves-list .ply { padding: 2px 6px; border-radius: .25rem; display: inline-block; margin: 0 4px 4px 0; }
.moves-list .ply.current { background: #e7f1ff; color: #0d6efd; border: 1px solid #cfe2ff; }
.moves-list .ply.done { background: #eaf7ea; color: #137b13; border: 1px solid #cfe9cf; }
.moves-list .ply.game { background: #e8f0ff; color: #0b5ed7; border: 1px solid #c7d7ff; }

#statusArea { min-height: 1.5rem; }

.eval-bar { position: relative; width: 16px; height: 120px; border-radius: 8px; overflow: hidden; background: linear-gradient(#fff,#eee); border: 1px solid rgba(0,0,0,.1); display: inline-block; vertical-align: middle; margin-right: 8px; }
.eval-bar .eval-fill { position: absolute; left: 0; bottom: 0; width: 100%; background: linear-gradient(#7bd17b,#2fa42f); transition: height .2s ease; }
.eval-score { display: inline-block; font-weight: 700; color: #0b5ed7; }

.pgn-row {
  display: grid;
  grid-template-columns: 48px 1fr 1fr;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: .25rem;
}
.pgn-row .move-no {
  font-weight: 700;
  color: #6c757d;
  text-align: right;
}
.pgn-row .ply {
  display: inline-block;
  min-height: 1.4em;
}

.practice-header .navbar-brand {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: .2px;
  color: var(--black);
  text-decoration: none;
}
.practice-header .navbar-brand:hover {
  color: var(--black);
}
.practice-header .navbar-brand .brand-mark {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 8px;
  background: var(--primary-blue);
}
.practice-header .header-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary-blue);
  background: #fff;
  border: 1px solid rgba(13,110,253,.35);
  border-radius: 999px;
  text-decoration: none;
  transition: color .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.practice-header .header-nav-link:hover {
  color: var(--primary-blue-dark);
  background: rgba(13,110,253,.08);
  border-color: rgba(13,110,253,.55);
  box-shadow: 0 4px 10px rgba(13,110,253,.15);
}
.practice-header .header-nav-link:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 3px;
  text-decoration: none;
}

.practice-header .container{
  max-width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}

.practice-footer .footer-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary-blue);
  text-decoration: none;
}
.practice-footer .footer-nav-link::after {
  content: '\2192';
  font-size: 0.95rem;
}
.practice-footer .footer-nav-link:hover {
  color: var(--primary-blue-dark);
}
.practice-footer .footer-nav-link:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 3px;
  border-radius: 8px;
  padding: 2px 4px;
}

/* Lean footer: small vertical padding and constrained width */
.practice-footer .container{
  padding-top: 6px !important;
  padding-bottom: 6px !important;
  max-width: 520px;
}

@media (max-width: 1100px) {
  .practice-layout {
    grid-template-columns: 280px 1fr 300px;
  }
}
@media (max-width: 900px) {
  /* Allow natural page scrolling on small screens */
  html, body {
    height: auto;
    overflow: auto;
  }
  .practice-body {
    height: auto;
    overflow: visible;
  }

  /* Stack layout vertically: opening menu (collapsible), board, then moves panel */
  .practice-layout {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .panel, .panel-right {
    border: 0;
  }
  .panel-left, .panel-right {
    border-bottom: 1px solid rgba(0,0,0,.075);
  }

  .board-center {
    padding-inline: 1rem;
    padding-bottom: 0.25rem;
  }

  .board-wrap {
    justify-content: center;
    padding-right: 0;
    flex-direction: column;
    align-items: center;
  }

  .eval-rail {
    /* Hide vertical eval bar on mobile; we show only numeric text instead */
    display: none !important;
  }

  /* Moves panel: full-width block stacked under the board */
  .panel-right {
    padding-inline: 1rem;
    padding-bottom: 1.25rem;
    background: transparent;
  }

  .panel-right > .p-3 {
    min-height: auto;
    height: auto;
    padding-top: 0.5rem;
  }

  .moves-list {
    /* On very small phones give at least ~160px, scale up to ~40vh, cap around 380px */
    min-height: clamp(160px, 40vh, 380px);
    max-height: min(60vh, 440px);
  }

  #evalText {
    font-size: 0.8rem;
    line-height: 1.2;
    margin-top: 0.25rem;
    text-align: center;
  }
}
