/* Fenton Chess Parlour — consolidated, Joomla-scoped stylesheet.
   Candidate only: review before replacing the live board.css. */
.parlour, .parlour *, .parlour *::before, .parlour *::after { box-sizing: border-box; }
.parlour { max-width: 1150px; margin: auto; padding: 24px; background: transparent; color: #efb943; font-family: Arial, sans-serif; }
.parlour h1 { margin-bottom: 4px; color: #efb943; }
.parlour h2 { font-size: 1.2rem; color: #efb943; }
.parlour .subtitle { color: #c5c5c5; }

/* Two-column layout */
.parlour .layout { display: grid; grid-template-columns: minmax(0, 600px) minmax(260px, 1fr); gap: 25px; align-items: start; }
.parlour .layout > section:first-child { min-width: 0; }
.parlour .layout > .panel { min-width: 0; display: flex; flex-direction: column; gap: 16px; }

/* Board and evaluation bar */
.parlour .board-with-evaluation { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 8px; align-items: stretch; }
.parlour .board { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr)); width: 100%; height: auto; aspect-ratio: 1 / 1; overflow: hidden; border: 3px solid #efb943; }
.parlour .board .square { display: flex; align-items: center; justify-content: center; position: relative; width: 100%; height: 100%; min-width: 0; min-height: 0; aspect-ratio: 1 / 1; border: 0; padding: 0; line-height: 1; font-size: clamp(22px, 5vw, 58px); font-family: "DejaVu Sans", "Segoe UI Symbol", sans-serif; cursor: pointer; }
.parlour .board .light { background: #EEEED2; }
.parlour .board .dark { background: #769656; }
.parlour .board .square span { font-size: clamp(20px, 5vw, 54px); line-height: 1; pointer-events: none; }
.parlour .board .square.selected { outline: 4px solid #01ff00; outline-offset: -4px; }
.parlour .board .square.legal::after { content: ""; position: absolute; width: 22%; aspect-ratio: 1; border-radius: 50%; background: rgba(20,120,20,.45); pointer-events: none; }
.parlour .piece-white { color: #fff; text-shadow: 0 2px 2px #111, 1px 0 #111, -1px 0 #111; }
.parlour .piece-black { color: #171717; text-shadow: 0 1px 1px #eee; }
.parlour .evaluation-bar { position: relative; overflow: hidden; border: 2px solid #efb943; border-radius: 4px; background: #202020; min-height: 0; }
.parlour .evaluation-white { position: absolute; bottom: 0; left: 0; width: 100%; height: 50%; background: #eee; transition: height .25s ease; }
.parlour .evaluation-label { position: absolute; z-index: 1; top: 6px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: bold; color: #efb943; text-shadow: 0 1px 3px #000, 0 -1px 3px #000; writing-mode: vertical-rl; }

/* Panels and content */
.parlour .panel { background: rgba(37,37,37,.60); border: 1px solid #efb943; border-radius: 8px; padding: 18px; }
.parlour .engine-panel, .parlour .parlour-section, .parlour .game-review { background: rgba(25,25,25,.80); border: 1px solid #efb943; border-radius: 6px; padding: 14px; min-width: 0; }
.parlour .engine-panel { display: flex; flex-direction: column; margin-bottom: 0; }
.parlour .game-review { margin-top: 18px; border-top: 1px solid #efb943; padding-top: 14px; }
.parlour .engine-panel h2, .parlour .parlour-section h2, .parlour .game-review h2 { margin-top: 0; }
.parlour .moves { min-height: 160px; max-height: 280px; overflow: auto; padding: 10px; background: rgba(17,17,17,.80); line-height: 2; }
.parlour .moves-section .moves { min-height: 120px; max-height: 220px; }
.parlour .move { background: transparent; border: 0; color: #efb943; padding: 4px 6px; cursor: pointer; }
.parlour .move.active { color: #01ff00; text-decoration: underline; }
.parlour textarea { width: 100%; min-width: 0; background: rgba(17,17,17,.80); color: #efb943; border: 1px solid #777; padding: 10px; resize: vertical; }
.parlour #status, .parlour #message { min-height: 1.5em; }

/* Buttons: purple, gold, black border and four-way text shadow */
.parlour .controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.parlour .controls button { background: #9461fb; color: #efb943; border: 2px solid #000; border-radius: 4px; padding: 9px 13px; cursor: pointer; opacity: 1 !important; text-shadow: -1px -1px 1px #000, 1px -1px 1px #000, -1px 1px 1px #000, 1px 1px 1px #000 !important; }
.parlour .controls button:hover:not(:disabled) { background: #7650c8; }
.parlour .controls button:disabled { opacity: 1 !important; background: #9461fb; color: #efb943; cursor: not-allowed; }
.parlour .board-controls { align-items: center; justify-content: center; gap: 5px; margin: 12px 0; }
.parlour .board-controls button { padding: 8px 9px; font-size: 12px; white-space: nowrap; }
.parlour .board-controls .control-gap { flex: 0 0 12px; }
.parlour .board-controls button:is(#first,#previous,#next,#last) { background: #9461fb; color: #efb943; border: 2px solid #000; border-radius: 4px; box-shadow: none; font-size: 1rem; font-weight: bold; padding: 9px 13px; line-height: inherit; }
.parlour .board-controls button:is(#first,#previous,#next,#last):hover:not(:disabled) { background: #7650c8; color: #efb943; }
.parlour .parlour-section .controls, .parlour .game-review .controls { margin-bottom: 8px; }

/* Stockfish */
.parlour .engine-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; margin-bottom: 15px; }
.parlour .engine-toggle input { width: 18px; height: 18px; accent-color: #9461fb; }
.parlour .engine-results { display: grid; gap: 10px; color: #eee; overflow-wrap: anywhere; }
.parlour .engine-results > div:last-child { min-height: 8em; }
.parlour #engine-evaluation { color: #01ff00; font-size: 1.5rem; font-weight: bold; }
.parlour #engine-bestmove { color: #efb943; font-weight: bold; }
.parlour #engine-variation { color: #c8a7ff; line-height: 1.6; overflow-wrap: anywhere; }
.parlour .engine-depth-control { display: flex; flex-direction: column; align-items: stretch; gap: 8px; width: 100%; margin: 16px 0 0; color: #efb943; }
.parlour .engine-panel .engine-depth-control select { display: block; width: 100%; min-width: 0; box-sizing: border-box; background: #111; color: #9461fb; border: 1px solid #efb943; border-radius: 4px; padding: 5px 12px; font: inherit; cursor: pointer; }
.parlour .engine-panel .engine-depth-control select:focus { outline: 2px solid #9461fb; outline-offset: 2px; }

/* Game review */
.parlour #review-progress { color: #c8a7ff; font-size: .9rem; }
.parlour #review-results { display: grid; gap: 5px; max-height: 420px; overflow-y: auto; scrollbar-width: thin; }
.parlour .review-summary { border: 1px solid #efb943; border-radius: 4px; padding: 8px 12px; margin-bottom: 8px; }
.parlour .review-summary p { margin: 6px 0; }
.parlour .review-move { display: block; width: 100%; text-align: left; padding: 9px; background: #171717; color: #eee; border: 1px solid #555; border-radius: 4px; cursor: pointer; }
.parlour .review-move:hover { border-color: #9461fb; }
.parlour .review-move.good { color: #01ff00; }
.parlour .review-move.inaccuracy { color: #efb943; }
.parlour .review-move.mistake { color: #ff974a; }
.parlour .review-move.blunder { color: #ff5555; }

/* Responsive */
@media (max-width: 800px) {
  .parlour .layout { grid-template-columns: 1fr; }
  .parlour { padding: 12px; }
}
@media (max-width: 480px) {
  .parlour .board-with-evaluation { grid-template-columns: 20px minmax(0, 1fr); gap: 5px; }
  .parlour .evaluation-label { font-size: 9px; }
  .parlour .board-controls { gap: 4px; }
  .parlour .board-controls button { padding: 7px 6px; font-size: 11px; }
  .parlour .board-controls .control-gap { flex-basis: 6px; }
}

/* Cburnett SVG chess pieces */
.parlour .chess-piece {
    display: block;
    width: 85%;
    height: 85%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}

/* Pointer-based chess piece dragging */
.parlour .board .square {
    touch-action: pinch-zoom;
}

.dragging-piece {
    position: fixed;
    width: 60px;
    height: 60px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10000;
}

.parlour .board .square.drag-target {
    box-shadow: inset 0 0 0 4px #EFB943;
}
