
/* v0.4.4 Cockpit layout — operational controls stay within reach */

/* Desktop: compact banner + board left / command top-right / pieces bottom-right */
@media (min-width: 761px){
  .app{
    width:min(1380px,100%)!important;
    padding:10px 14px 24px!important;
  }
  .hero{
    display:grid!important;
    grid-template-columns:minmax(320px,390px) minmax(0,1fr)!important;
    gap:12px!important;
    align-items:stretch!important;
    margin:0 0 10px!important;
  }
  .site-banner{
    margin:0!important;
    border-radius:16px!important;
    align-self:stretch!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
  }
  .site-banner img{
    width:100%!important;
    height:auto!important;
    object-fit:contain!important;
  }
  .site-titlebar{
    margin:0!important;
    min-height:0!important;
    padding:12px 16px!important;
    border-radius:16px!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    align-items:center!important;
    gap:10px!important;
  }
  .pirate-title-crest{width:48px!important;height:48px!important;min-width:48px!important}
  .pirate-title-crest span{font-size:24px!important}
  .site-kicker{font-size:9px!important;letter-spacing:.19em!important;margin-bottom:3px!important}
  .hero h1{font-size:clamp(20px,2vw,31px)!important;line-height:1.04!important;margin:0!important}
  .hero h1 small{font-size:.50em!important}
  .hero p{font-size:10px!important;margin:4px 0 0!important}
  .free-tag{font-size:9px!important;padding:6px 9px!important}

  #topGrid{
    display:grid!important;
    grid-template-columns:minmax(520px,1.18fr) minmax(350px,.82fr)!important;
    grid-template-rows:auto 1fr!important;
    grid-template-areas:
      "board control"
      "board pieces"!important;
    gap:10px!important;
    align-items:stretch!important;
  }
  #topGrid>.board-panel{grid-area:board!important;display:flex!important;flex-direction:column!important;min-width:0!important}
  #topGrid>#controlPanel{grid-area:control!important;min-width:0!important}
  #topGrid>#piecesPanel{grid-area:pieces!important;margin:0!important;min-width:0!important;align-self:stretch!important}

  .board-panel,.control-panel,#piecesPanel{padding:9px!important;border-radius:16px!important}
  .panel-cap{margin-bottom:6px!important;padding-bottom:6px!important}
  .panel-cap span{font-size:8px!important;letter-spacing:.16em!important}
  .panel-cap b{font-size:8px!important}
  .pirate-board-stage{padding:5px!important;border-radius:12px!important;flex:0 0 auto!important}
  .board-wrap{
    width:min(100%,calc(100vh - 285px),650px)!important;
    max-width:650px!important;
    margin:auto!important;
    padding:2px!important;
  }
  .drag-hint{font-size:9px!important;padding:6px 8px!important;margin-top:5px!important;line-height:1.3!important}
  .footer-actions{margin-top:5px!important;padding-top:5px!important}
  .footer-actions .btn{min-height:30px!important;padding:5px 8px!important;font-size:9px!important}
  .footer-actions .stats{font-size:10px!important}

  /* Right-top command panel */
  .control-panel{display:flex!important;flex-direction:column!important}
  .command-ornament{display:none!important}
  .controls{gap:7px!important;margin-bottom:5px!important}
  .field label{font-size:8px!important;margin-bottom:3px!important}
  .controls input{height:36px!important;padding:6px 8px!important;font-size:16px!important;border-radius:8px!important}
  #controlPanel .button-row{gap:5px!important;margin-top:5px!important}
  #controlPanel .btn{min-height:31px!important;padding:5px 7px!important;font-size:9px!important;border-radius:9px!important;flex:1 1 auto!important}
  #controlPanel #analyzeBtn,#controlPanel #executeBtn{min-height:38px!important;font-size:12px!important;font-weight:950!important}
  #controlPanel .tips{display:none!important}
  #analysisStats{font-size:8px!important;margin-top:5px!important;min-height:10px!important}

  /* Right-bottom compact 3-piece rack */
  #piecesPanel .pieces-heading{padding:0 0 5px!important;margin:0 0 5px!important}
  #piecesPanel .pieces-heading h2{font-size:13px!important;line-height:1.15!important}
  #piecesPanel .pieces-heading p{display:none!important}
  #piecesPanel .drag-badge{font-size:7px!important;padding:3px 5px!important}
  #piecesPanel .loot-rail{display:none!important}
  #piecesPanel .piece-row{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:5px!important}
  #piecesPanel .piece-card{padding:5px!important;border-radius:10px!important;min-width:0!important}
  #piecesPanel .piece-title{margin:0 0 3px!important;padding:0 1px 3px!important;min-height:20px!important}
  #piecesPanel .piece-title b{font-size:17px!important}
  #piecesPanel .piece-title span{font-size:7px!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;max-width:72%!important}
  #piecesPanel .preset-open{min-height:27px!important;margin:0 0 3px!important;padding:4px 2px!important;font-size:8px!important;line-height:1!important;border-radius:7px!important}
  #piecesPanel .current-piece-box{height:68px!important;min-height:68px!important;max-height:68px!important;margin:0!important;padding:3px 2px!important;border-radius:8px!important;overflow:hidden!important}
  #piecesPanel .current-piece-label{font-size:7px!important;min-height:9px!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;max-width:100%!important}
  #piecesPanel .piece-drag-shape{max-width:100%!important;max-height:48px!important;min-height:0!important;margin:auto!important;gap:2px!important}
  #piecesPanel .mini-piece-cell{width:13px!important;height:13px!important;border-radius:2px!important}
  #piecesPanel .piece-drag-shape.shape-max-4 .mini-piece-cell{width:11px!important;height:11px!important}
  #piecesPanel .piece-drag-shape.shape-max-5 .mini-piece-cell{width:9px!important;height:9px!important}
  #piecesPanel .nav-place{min-height:28px!important;margin:3px 0 0!important;padding:3px 2px!important;font-size:7px!important;line-height:1!important;border-radius:7px!important}
  #piecesPanel .custom-editor,#piecesPanel .micro,#piecesPanel .drag-copy{display:none!important}

  /* Result stays below; main operation above does not require scrolling */
  .result-panel{margin-top:10px!important}
}

/* Mobile: board and tiny 3-piece rack side-by-side */
@media (max-width: 760px){
  .app{padding:6px 5px 18px!important}
  .hero{margin-bottom:6px!important}
  .site-banner{border-radius:10px!important}
  .site-titlebar{margin-top:5px!important;padding:7px 8px!important;border-radius:10px!important}
  .pirate-title-crest{display:none!important}
  .site-kicker{font-size:7px!important;letter-spacing:.12em!important}
  .hero h1{font-size:16px!important;line-height:1.05!important}
  .hero p{display:none!important}
  .free-tag{font-size:7px!important;padding:4px 6px!important}
  .mobile-action-bar{margin:0 0 5px!important;padding:4px!important;gap:5px!important;border-radius:10px!important}
  .mobile-main-btn{min-height:38px!important;padding:5px 4px!important;font-size:12px!important;border-radius:8px!important}

  #topGrid{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 72px!important;
    grid-template-areas:
      "board pieces"
      "control control"!important;
    gap:5px!important;
    align-items:start!important;
  }
  #topGrid>.board-panel{grid-area:board!important;min-width:0!important}
  #topGrid>#piecesPanel{grid-area:pieces!important;min-width:0!important;margin:0!important}
  #topGrid>#controlPanel{grid-area:control!important;min-width:0!important}

  .board-panel{padding:4px!important;border-radius:10px!important}
  .board-panel .panel-cap{padding-bottom:3px!important;margin-bottom:4px!important}
  .board-panel .panel-cap span{font-size:6px!important;letter-spacing:.08em!important}
  .board-panel .panel-cap b{display:none!important}
  .pirate-board-stage{padding:3px!important;border-radius:8px!important}
  .board-wrap{padding:1px!important;max-width:none!important;width:100%!important}
  .brass-bolt{width:4px!important;height:4px!important}
  .drag-hint{font-size:7px!important;padding:4px 5px!important;margin-top:3px!important;border-radius:7px!important;line-height:1.2!important}
  .footer-actions{margin-top:3px!important;padding-top:3px!important;gap:3px!important}
  .footer-actions .button-row{gap:3px!important}
  .footer-actions .btn{min-height:25px!important;padding:3px 4px!important;font-size:7px!important;border-radius:6px!important}
  .footer-actions .stats{font-size:7px!important}

  /* Tiny vertical piece rack directly beside the board */
  #piecesPanel{padding:3px!important;border-radius:9px!important;overflow:visible!important}
  #piecesPanel .pieces-heading,#piecesPanel .loot-rail{display:none!important}
  #piecesPanel .piece-row{display:flex!important;flex-direction:column!important;gap:4px!important}
  #piecesPanel .piece-card{padding:3px 2px!important;border-radius:7px!important;min-height:0!important;overflow:hidden!important}
  #piecesPanel .pirate-rivet{display:none!important}
  #piecesPanel .piece-title{margin:0 0 2px!important;padding:0 1px 2px!important;min-height:14px!important}
  #piecesPanel .piece-title b{font-size:12px!important;line-height:1!important}
  #piecesPanel .piece-title span{display:none!important}
  #piecesPanel .preset-open{width:100%!important;min-height:22px!important;margin:0 0 2px!important;padding:2px 1px!important;font-size:6px!important;line-height:1!important;border-radius:5px!important}
  #piecesPanel .current-piece-box{height:51px!important;min-height:51px!important;max-height:51px!important;padding:2px 1px!important;margin:0!important;border-radius:5px!important;overflow:hidden!important}
  #piecesPanel .current-piece-label{display:none!important}
  #piecesPanel .piece-drag-shape{max-width:66px!important;max-height:45px!important;min-height:0!important;margin:auto!important;gap:1px!important}
  #piecesPanel .mini-piece-cell{width:9px!important;height:9px!important;border-radius:2px!important}
  #piecesPanel .piece-drag-shape.shape-max-4 .mini-piece-cell{width:8px!important;height:8px!important}
  #piecesPanel .piece-drag-shape.shape-max-5 .mini-piece-cell{width:7px!important;height:7px!important}
  #piecesPanel .nav-place{width:100%!important;min-height:22px!important;margin:2px 0 0!important;padding:2px 1px!important;font-size:5.5px!important;line-height:1!important;border-radius:5px!important;white-space:normal!important}
  #piecesPanel .custom-editor,#piecesPanel .micro,#piecesPanel .drag-copy{display:none!important}

  /* Command panel comes after board/rack; no need to scroll to pick or drag pieces */
  #controlPanel{padding:7px!important;border-radius:10px!important}
  #controlPanel .command-ornament{display:none!important}
  #controlPanel .panel-cap{padding-bottom:4px!important;margin-bottom:5px!important}
  #controlPanel .panel-cap span{font-size:7px!important;letter-spacing:.09em!important}
  #controlPanel .panel-cap b{font-size:7px!important}
  #controlPanel .controls{gap:5px!important;margin-bottom:4px!important}
  #controlPanel .field label{font-size:7px!important;margin-bottom:2px!important}
  #controlPanel .controls input{height:34px!important;padding:4px 6px!important;font-size:15px!important;border-radius:7px!important}
  #controlPanel .button-row{gap:4px!important;margin-top:4px!important}
  #controlPanel .btn{min-height:30px!important;padding:4px 5px!important;font-size:8px!important;border-radius:7px!important}
  #controlPanel .tips{display:none!important}
  #analysisStats{font-size:7px!important;margin-top:4px!important}
  .result-panel{margin-top:6px!important}
}

@media (max-width: 380px){
  #topGrid{grid-template-columns:minmax(0,1fr) 66px!important;gap:4px!important}
  #piecesPanel .current-piece-box{height:47px!important;min-height:47px!important;max-height:47px!important}
  #piecesPanel .mini-piece-cell{width:8px!important;height:8px!important}
  #piecesPanel .piece-drag-shape.shape-max-5 .mini-piece-cell{width:6px!important;height:6px!important}
}
