/* Somersault Classic Mode — Excel-era faithful styling */

.som-classic-body {
  background: #808080;
  font-family: Tahoma, "MS Sans Serif", Arial, sans-serif;
  font-size: 12px;
  color: #000;
}

.som-classic-topbar {
  background: #000080;
  border-bottom: 2px solid #000;
}

.som-classic-topbar .brand .name,
.som-classic-topbar .nav a {
  color: #fff;
}

.som-classic-app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px;
}

.som-title-bar {
  background: linear-gradient(180deg, #000080 0%, #1084d0 100%);
  color: #fff;
  padding: 6px 12px;
  border: 2px outset #c0c0c0;
  margin-bottom: 6px;
}

.som-title-bar h1 {
  font-size: 14px;
  font-weight: bold;
  margin: 0;
}

.som-subtitle {
  font-size: 11px;
  margin: 2px 0 0;
  opacity: 0.9;
}

.som-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: #c0c0c0;
  border: 2px outset #dfdfdf;
  padding: 6px;
  margin-bottom: 6px;
}

.som-btn {
  font-family: Tahoma, Arial, sans-serif;
  font-size: 11px;
  padding: 3px 10px;
  min-height: 24px;
  background: #c0c0c0;
  border: 2px outset #fff;
  cursor: pointer;
  color: #000;
}

.som-btn:active {
  border-style: inset;
}

/* Workbook sheet — puzzle + solution side-by-side (Stand Alone.xls print area A1:BH27) */
.som-workbook-sheet {
  background: #fff;
  border: 2px inset #808080;
  margin-bottom: 6px;
  padding: 4px 6px 0;
}

.som-workbook-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  font-weight: bold;
  font-size: 12px;
  padding: 2px 4px 0;
}

.som-workbook-head-left,
.som-workbook-head-right {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.som-wb-brand {
  letter-spacing: 0.5px;
}

.som-wb-section-title {
  color: #000080;
  font-size: 13px;
}

.som-workbook-tagline {
  margin: 0;
  padding: 0 4px 4px;
  font-size: 10px;
  color: #333;
  border-bottom: 1px solid #c0c0c0;
}

.som-workbook-panes {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  border-top: 1px solid #808080;
}

.som-orientation-palette {
  width: 88px;
  min-width: 88px;
  border-left: 1px solid #808080;
  border-right: 1px solid #808080;
  background: #f0f0f0;
  padding: 4px 2px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-height: 420px;
}

.som-palette-header {
  font-weight: bold;
  font-size: 10px;
  text-align: center;
  color: #000080;
  margin-bottom: 2px;
}

.som-palette-hint {
  margin: 0 0 4px;
  font-size: 8px;
  text-align: center;
  color: #333;
  line-height: 1.2;
}

.som-palette-step-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-bottom: 4px;
  font-size: 9px;
}

.som-palette-step-btn {
  font-size: 8px;
  padding: 0 4px;
  min-width: 18px;
  min-height: 18px;
  background: #c0c0c0;
  border: 1px outset #fff;
  cursor: pointer;
}

.som-palette-step-label strong {
  font-size: 11px;
}

.som-palette-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 0 1px;
}

.som-palette-die {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1px;
  background: #fff;
  border: 1px solid #808080;
  cursor: grab;
  font-size: 7px;
}

.som-palette-die:active,
.som-palette-die.som-palette-dragging {
  cursor: grabbing;
  border-color: #000080;
  background: #ffffcc;
}

.som-palette-die img {
  display: block;
  width: 36px;
  height: 36px;
  pointer-events: none;
}

.som-palette-tbl {
  font-family: "Courier New", monospace;
  font-size: 7px;
  line-height: 1.1;
}

.som-board svg.som-board-drop-active {
  outline: 2px dashed #000080;
  outline-offset: 2px;
}

.som-board .som-drop-cell.som-drop-highlight {
  fill: #cce5ff;
  stroke: #000080;
  stroke-width: 1.5;
}

.som-board .som-drop-cell {
  pointer-events: all;
}

.som-workbook-pane {
  padding: 4px;
  min-width: 0;
}

.som-pane-puzzle {
  border-right: 1px solid #808080;
}

.som-wb-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
  align-items: flex-end;
}

.som-wb-start-table,
.som-wb-puzzle-meta-table,
.som-wb-solution-steps-table {
  border-collapse: collapse;
  font-size: 10px;
  background: #fff;
}

.som-wb-puzzle-meta-table {
  width: 100%;
  max-width: 100%;
}

.som-wb-puzzle-meta-table .som-wb-meta-caption-row th {
  text-align: left;
  font-weight: bold;
  border: none;
  padding: 0 4px 2px;
  background: transparent;
}

.som-wb-puzzle-meta-table .som-wb-caption-cell {
  border-bottom: none;
}

.som-wb-solution-steps-table th[scope="row"] {
  text-align: left;
  font-weight: normal;
  background: #fff;
}

.som-wb-start-table th,
.som-wb-start-table td,
.som-wb-puzzle-meta-table th,
.som-wb-puzzle-meta-table td,
.som-wb-solution-steps-table th,
.som-wb-solution-steps-table td {
  border: 1px solid #000;
  padding: 1px 4px;
  text-align: center;
  min-width: 1.6em;
}

.som-wb-caption {
  caption-side: top;
  text-align: left;
  font-weight: bold;
  font-size: 10px;
  padding: 0 0 2px;
  color: #000;
}

.som-pane-puzzle .som-wb-meta-row {
  align-items: flex-start;
}

.som-pane-solution .som-wb-meta-row {
  align-items: flex-end;
}

.som-wb-start-table th,
.som-wb-puzzle-meta-table thead th,
.som-wb-solution-steps-table thead th {
  background: #fff;
  font-weight: normal;
}

.som-board-area {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  background: #fff;
  min-height: 280px;
}

.som-pane-puzzle .som-board-area {
  min-height: 240px;
}

.som-pane-solution .som-board-area {
  min-height: 213px;
}

.som-board-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  overflow: auto;
  padding: 4px 4px 8px 4px;
}

.som-compass-margin {
  flex: 0 0 auto;
  width: 96px;
  min-width: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px 8px 2px;
  pointer-events: none;
}

.som-pane-puzzle .som-compass-margin {
  width: 120px;
  min-width: 120px;
}

.som-pane-solution .som-compass-margin {
  width: 96px;
  min-width: 96px;
}

.som-compass {
  position: relative;
  width: 100%;
  max-width: 108px;
  aspect-ratio: 200 / 160;
}

.som-pane-puzzle .som-compass {
  max-width: 144px;
}

.som-pane-solution .som-compass {
  max-width: 108px;
}

.som-compass-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.som-compass-die {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1;
}

.som-pane-puzzle .som-compass-die {
  width: 64px;
  height: 64px;
}

.som-pane-solution .som-compass-die {
  width: 48px;
  height: 48px;
}

.som-pane-puzzle .som-compass-label {
  font-size: 12px;
}

.som-pane-solution .som-compass-label {
  font-size: 9px;
}

.som-pane-puzzle .som-compass-face {
  font-size: 11px;
}

.som-pane-solution .som-compass-face {
  font-size: 8px;
}

.som-compass-axis {
  stroke: #000080;
  stroke-width: 1.2;
  opacity: 0.4;
}

.som-compass-label,
.som-compass-face {
  fill: #000080;
  font-size: 9px;
  font-weight: bold;
  font-family: Tahoma, Arial, sans-serif;
}

.som-compass-face {
  font-size: 8px;
  opacity: 0.85;
}

.som-workbook-sheet .som-orientation-display {
  border-top: 1px solid #808080;
  margin-top: 0;
}

@media (max-width: 820px) {
  .som-workbook-head {
    grid-template-columns: 1fr 1fr;
  }

  .som-workbook-panes {
    grid-template-columns: 1fr;
  }

  .som-orientation-palette {
    width: auto;
    min-width: 0;
    border-left: none;
    border-right: none;
    border-top: 1px solid #808080;
    border-bottom: 1px solid #808080;
    max-height: 140px;
  }

  .som-palette-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .som-pane-puzzle {
    border-right: none;
    border-bottom: none;
  }
}

.som-btn-sm {
  min-width: 32px;
  padding: 2px 6px;
}

.som-main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

@media (max-width: 760px) {
  .som-main-grid {
    grid-template-columns: 1fr;
  }
}

.som-panel {
  background: #c0c0c0;
  border: 2px inset #808080;
  padding: 0;
}

.som-panel-header {
  background: linear-gradient(180deg, #000080, #1084d0);
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  padding: 3px 8px;
}

.som-board-panel .som-board,
.som-board-wrap .som-board {
  background: transparent;
  padding: 0;
  min-height: 200px;
  display: block;
  overflow: visible;
}

.som-board-wrap .som-board svg.som-board-svg {
  display: block;
  max-width: 100%;
  height: auto;
  flex-shrink: 0;
  margin-right: auto;
}

.som-workbook-pane .som-board-wrap .som-board svg.som-board-svg {
  max-width: 100%;
}

/* SOM4 wireframe board — light grey rhombi on white panel */
.som-board .cell {
  vector-effect: non-scaling-stroke;
}

.som-board svg.som-board-svg {
  display: block;
  max-width: 100%;
  height: auto;
  min-width: 0;
  overflow: visible;
}

.som-workbook-pane .som-board svg.som-board-svg {
  max-width: 100%;
}

.som-board .som-die,
.som-board .som-die-layer {
  pointer-events: none;
}

.som-board .som-die polygon {
  stroke: #000;
  stroke-width: 2.5;
}

.som-board .som-die .som-pip {
  fill: #000;
}

.som-board .som-die .som-pip-halo {
  fill: #fff;
}

.som-board .som-die-layer {
  isolation: isolate;
}

.som-orientation-display {
  background: #ffffcc;
  border-top: 1px solid #808080;
  padding: 4px 8px;
  font-size: 11px;
}

.som-orientation-display strong {
  font-size: 14px;
  margin-right: 12px;
}

.som-pos-label {
  margin-left: 8px;
}

.som-table-wrap {
  max-height: 280px;
  overflow: auto;
  background: #fff;
}

.som-steps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.som-steps-table th,
.som-steps-table td {
  border: 1px solid #808080;
  padding: 2px 6px;
  text-align: center;
}

.som-steps-table th {
  background: #000080;
  color: #fff;
  position: sticky;
  top: 0;
}

.som-steps-table tr.som-row-active {
  background: #ffff99;
}

.som-steps-table tr.som-row-correct td {
  color: #006400;
}

.som-steps-table tr.som-row-wrong td {
  color: #8b0000;
  background: #ffe4e1;
}

.som-entry-panel,
.som-solver-panel {
  padding-bottom: 8px;
}

.som-entry-workbook {
  padding: 4px 8px 6px;
}

.som-entry-start-table,
.som-entry-steps-table {
  margin-bottom: 6px;
}

.som-entry-steps-table select {
  width: 100%;
  min-width: 2.4em;
  max-width: 3.2em;
  font-size: 10px;
  font-family: Tahoma, Arial, sans-serif;
  padding: 0 1px;
  border: 1px solid #808080;
  background: #fff;
  cursor: pointer;
}

.som-entry-steps-table td {
  padding: 1px 2px;
}

.som-entry-panel .som-label,
.som-solver-panel .som-label {
  display: block;
  padding: 6px 8px 2px;
  font-size: 11px;
}

.som-input {
  display: block;
  width: calc(100% - 20px);
  margin: 0 8px 6px;
  font-family: "Courier New", monospace;
  font-size: 14px;
  padding: 4px;
  border: 2px inset #808080;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.som-move-buttons {
  display: flex;
  gap: 4px;
  padding: 0 8px 6px;
}

.som-dir-btn {
  flex: 1;
  font-size: 14px;
  font-weight: bold;
  padding: 6px;
  background: #c0c0c0;
  border: 2px outset #fff;
  cursor: pointer;
}

.som-dir-btn:active {
  border-style: inset;
}

.som-status {
  margin: 4px 8px;
  padding: 4px 6px;
  background: #fff;
  border: 1px inset #808080;
  min-height: 1.4em;
  font-size: 11px;
}

.som-meta {
  margin: 0 8px 6px;
  font-size: 10px;
  color: #333;
}

.som-playback-controls {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
}

.som-slider {
  width: calc(100% - 16px);
  margin: 0 8px 6px;
}

.som-why {
  margin: 0 8px 6px;
  padding: 6px;
  background: #ffffcc;
  border: 1px inset #808080;
  font-size: 11px;
  min-height: 3em;
}

.som-overlay-panel {
  background: #c0c0c0;
  border: 2px inset #808080;
  margin-top: 6px;
  padding: 4px 8px;
  font-size: 11px;
}

.som-overlay-panel summary {
  cursor: pointer;
  font-weight: bold;
  color: #000080;
}

.som-overlay-content {
  padding: 6px 0;
  display: grid;
  gap: 6px;
}

.som-overlay-content label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.som-overlay-content select {
  font-size: 11px;
  padding: 2px;
}

.som-classic-footer {
  background: #c0c0c0;
  border-top: 2px solid #000;
  margin-top: 12px;
}

@media print {
  .som-classic-topbar,
  .som-toolbar,
  .som-overlay-panel,
  .som-classic-footer,
  .som-entry-panel,
  .som-solver-panel,
  .som-steps-panel {
    display: none !important;
  }

  .som-classic-body {
    background: #fff;
  }

  .som-classic-app {
    max-width: none;
  }

  .som-workbook-sheet {
    border: none;
    padding: 0;
  }

  .som-workbook-panes {
    grid-template-columns: 1fr 1fr;
  }

  .som-main-grid {
    grid-template-columns: 1fr;
  }

  .som-panel {
    border: 1px solid #000;
    break-inside: avoid;
  }

  .som-board svg.som-board-svg {
    max-width: 100%;
    min-width: 0;
  }

  .som-print-puzzle_only #som-board-solution,
  .som-print-puzzle_only .som-pane-solution {
    display: none !important;
  }

  .som-print-puzzle_only .som-workbook-panes {
    grid-template-columns: 1fr;
  }
}

.som-classic-body.som-high-contrast {
  background: #000;
  color: #fff;
}

.som-classic-body.som-high-contrast .som-panel {
  background: #000;
  border-color: #fff;
}

.som-classic-body.som-high-contrast .som-steps-table th {
  background: #000;
  border-color: #fff;
}

.som-classic-body.som-high-contrast .som-steps-table td {
  border-color: #fff;
  color: #fff;
}

.som-classic-body.som-large-print {
  font-size: 16px;
}

.som-classic-body.som-large-print .som-board svg {
  transform: scale(1.25);
  transform-origin: top center;
}

.som-edu-tip {
  background: #e6f3ff;
  border: 1px solid #000080;
  padding: 6px 8px;
  margin: 6px 8px;
  font-size: 11px;
}
