/* ─── Letter Boxed ────────────────────────────────────────────────────── */

.lb-game {
  display: flex; flex-direction: column;
  align-items: center; gap: 14px;
  width: 100%;
  padding: 8px 12px 16px;
  align-self: stretch;
}

.lb-input-row {
  width: min(94vw, 380px);
  display: flex; justify-content: center;
}
.lb-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 12px;
  color: var(--ink, #111);
}
.lb-input:focus { outline: none; border-color: #7c3aed; }
.lb-input.shake { animation: lb-shake 0.45s ease-in-out; }
@keyframes lb-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-5px); }
  75%      { transform: translateX(5px); }
}

.lb-msg {
  width: min(94vw, 380px);
  text-align: center; font-size: 14px; font-weight: 600;
  padding: 6px 12px; border-radius: 8px;
  background: rgba(0,0,0,0.05);
}
.lb-msg-err { background: #fef2f2; color: #991b1b; }
.lb-msg-ok  { background: #ecfdf5; color: #065f46; }
.lb-msg-win { background: linear-gradient(135deg, #d1f4d1 0%, #87e498 100%); color: #14532d; }

/* The 12-letter box. Square frame; 3 letters per side outside the
   square's edge. Sized via vmin so it scales on phones. */
.lb-box {
  position: relative;
  width: min(86vw, 320px);
  height: min(86vw, 320px);
  border: 3px solid var(--ink, #111);
  border-radius: 6px;
  margin: 18px auto;
  background: var(--surface);
  flex-shrink: 0;
}
.lb-box-lines {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.lb-side {
  position: absolute;
  display: flex;
  gap: 12%;
}
/* Each side stretches along its edge; letters sit OUTSIDE the box. */
.lb-side-top {
  top: -22px; left: 0; right: 0;
  justify-content: space-around;
  flex-direction: row;
}
.lb-side-bottom {
  bottom: -22px; left: 0; right: 0;
  justify-content: space-around;
  flex-direction: row;
}
.lb-side-left {
  top: 0; bottom: 0; left: -22px;
  justify-content: space-around;
  flex-direction: column;
}
.lb-side-right {
  top: 0; bottom: 0; right: -22px;
  justify-content: space-around;
  flex-direction: column;
}

.lb-letter {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--ink, #111);
  background: #fff;
  color: var(--ink, #111);
  font-size: 18px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 0.08s, background 0.12s;
  user-select: none;
  -webkit-user-select: none;
}
.lb-letter:hover, .lb-letter:focus { background: #f3e8ff; outline: none; }
.lb-letter:active { transform: scale(0.92); }

@media (max-width: 480px) {
  .lb-letter { width: 36px; height: 36px; font-size: 14px; }
  .lb-side-top, .lb-side-bottom { left: -2px; right: -2px; }
  .lb-side-top    { top: -18px; }
  .lb-side-bottom { bottom: -18px; }
  .lb-side-left   { left: -18px; }
  .lb-side-right  { right: -18px; }
}

.lb-actions {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
}

.lb-words-block {
  width: min(94vw, 540px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.lb-words-head {
  display: flex; gap: 6px; flex-wrap: wrap;
  font-size: 13px; margin-bottom: 8px;
}
.lb-words-list {
  display: flex; flex-wrap: wrap; gap: 6px;
  font-size: 14px;
}
.lb-words-list:empty::before {
  content: 'Words you play will show up here.';
  color: var(--muted);
  font-style: italic;
  font-size: 13px;
}
.lb-word {
  background: rgba(124,58,237,0.10);
  color: var(--accent, #7c3aed);
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
