/**
 * AlphaMax Web — Letter Value Box (css/letter-box.css)
 */

/* ==========================================================================
   BOX 1: LEFT LETTER VALUE BOX (Default Left-Aligned Layout)
   ========================================================================== */
.letter-key-box {
  border: 1.5px solid var(--tile-empty-border);
  border-radius: 3px;
  align-self: start;
}

.letter-box-header {
  position: relative;
  height: clamp(32.5px, 4.8vw, 44.5px);
  background-color: var(--panel-secondary-bg);
  color: var(--panel-secondary-text);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: var(--subtitle-size);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.letter-box-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 6px;
  right: 6px;
  height: 0;
  border-bottom: 1px solid var(--inner-divider);
}

.letter-box-body {
  flex: 1;
  background-color: var(--panel-primary-bg);
  color: var(--panel-primary-text);
  font-family: var(--mono-font);
  padding: clamp(3px, 0.6vw, 6px) clamp(4px, 0.7vw, 6px);
  display: flex;
  flex-direction: column;
  gap: clamp(2px, 0.42vw, 3.75px);
}

.letter-grid-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  text-align: center;
  font-size: clamp(10.5px, 1.5vw, 14px);
  line-height: 1.1;
}

.letter-grid-bottom {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: clamp(2px, 0.4vw, 3.5px) clamp(2px, 0.5vw, 6px);
  text-align: center;
  font-size: clamp(10.5px, 1.75vw, 14px);
  line-height: 1.1;
}

.letter-cell {
  white-space: nowrap;
  border-radius: 2px;
  transition: background-color 0.12s ease, color 0.12s ease;
}

/* ==========================================================================
   BOTTOM-ALIGNED LETTER VALUE BOX (.layout-bottom)
   ========================================================================== */
.alphamax-stage.layout-bottom {
  max-width: 816px;
}

.alphamax-stage.layout-bottom .board-layout {
  display: flex;
  flex-direction: column-reverse;
  gap: clamp(4px, 0.8vw, 6px);
}

.alphamax-stage.layout-bottom .center-board {
  height: auto;
}

.alphamax-stage.layout-bottom .bottom-control-bar {
  padding-bottom: 2px;
}

.alphamax-stage.layout-bottom .letter-key-box {
  width: auto;
  margin-left: var(--tile-gap);
  margin-right: var(--tile-gap);
  align-self: stretch;
}

.alphamax-stage.layout-bottom .letter-box-header {
  height: clamp(22px, 3.4vw, 28px);
}

.alphamax-stage.layout-bottom .letter-box-header::after {
  left: clamp(8px, 1.6vw, 12px);
  right: clamp(8px, 1.6vw, 12px);
}

.alphamax-stage.layout-bottom .letter-box-body {
  padding: clamp(4.5px, 0.7vw, 6px) clamp(8px, 1.8vw, 14px);
}

@media (max-width: 680px) {
  .letter-grid-bottom {
    grid-template-columns: repeat(auto-fit, minmax(clamp(26px, 6vw, 36px), 1fr));
    gap: clamp(2px, 0.45vw, 3.5px) clamp(2px, 0.5vw, 4px);
    font-size: clamp(10.5px, 1.9vw, 14px);
  }
}

/* ==========================================================================
   MOBILE / NARROW VIEWPORT STACKING (<= 720px)
   ========================================================================== */
@media (max-width: 720px) {
  .board-layout {
    display: flex;
    flex-direction: column-reverse;
    gap: clamp(4px, 0.8vw, 6px);
  }

  .letter-key-box {
    width: auto;
    margin-left: var(--tile-gap);
    margin-right: var(--tile-gap);
    align-self: stretch;
  }

  .letter-box-header {
    height: clamp(22px, 3.4vw, 28px);
  }

  .letter-box-header::after {
    left: clamp(8px, 1.6vw, 12px);
    right: clamp(8px, 1.6vw, 12px);
  }

  .letter-box-body {
    padding: clamp(4.5px, 0.7vw, 6px) clamp(8px, 1.8vw, 14px);
  }
}
