/* Anagram Builder — own styles, theme variables only. Root class: .ab */

.ab { width: 100%; max-width: 640px; }

.ab-bar { display: flex; gap: 10px; margin-bottom: 10px; }
.ab-stat {
  flex: 1;
  padding: 8px 14px 6px;
  text-align: center;
  border-radius: 10px;
  background: var(--gm-surface, #1b2740);
  border: 1px solid var(--gm-line, rgba(255, 255, 255, 0.09));
}
.ab-stat b {
  display: block;
  font: 500 1.35rem/1.15 var(--gm-display, "Fraunces", Georgia, serif);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ab-lab {
  display: block;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gm-muted, rgba(242, 238, 230, 0.66));
}

.ab-meter {
  height: 8px;
  margin-bottom: 18px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--gm-surface-2, #22304a);
  border: 1px solid var(--gm-line, rgba(255, 255, 255, 0.09));
}
.ab-meter span { display: block; height: 100%; width: 0; background: var(--gm-accent, #c0392b); border-radius: 99px; transition: width 0.3s ease; }

.ab-current {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 64px;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: var(--gm-radius, 12px);
  background: var(--gm-bg-2, #131c2b);
  border: 1px dashed var(--gm-line-2, rgba(255, 255, 255, 0.2));
  flex-wrap: wrap;
}
.ab-ph { color: var(--gm-muted, rgba(242, 238, 230, 0.66)); font: 500 0.95rem/1.2 var(--gm-body, "DM Sans", system-ui, sans-serif); }
.ab-ch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 46px;
  font: 600 1.7rem/1 var(--gm-display, "Fraunces", Georgia, serif);
  text-transform: uppercase;
  color: var(--gm-text, #f2eee6);
  border-bottom: 3px solid var(--gm-accent, #c0392b);
}
.ab-current.is-shake { animation: ab-shake 0.3s ease; }
@keyframes ab-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.ab-tiles { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 14px; }
.ab-tile {
  appearance: none;
  -webkit-appearance: none;
  aspect-ratio: 1;
  min-height: 44px;
  padding: 0;
  font: 600 clamp(1.3rem, 6vw, 2rem)/1 var(--gm-display, "Fraunces", Georgia, serif);
  text-transform: uppercase;
  color: var(--gm-text, #f2eee6);
  background: var(--gm-surface-2, #22304a);
  border: 1px solid var(--gm-line-2, rgba(255, 255, 255, 0.2));
  border-bottom-width: 3px;
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s ease, opacity 0.15s ease, border-color 0.2s ease;
}
.ab-tile:hover:not(:disabled) { border-color: var(--gm-accent-bright, #e0584a); }
.ab-tile:active:not(:disabled) { transform: translateY(2px); }
.ab-tile:focus-visible { outline: 3px solid var(--gm-accent-bright, #e0584a); outline-offset: 2px; }
.ab-tile.is-used { opacity: 0.25; transform: none; }
.ab-tile:disabled { cursor: default; }

.ab-ctrl { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.ab-ctrl .gm-btn { min-height: 44px; min-width: 96px; justify-content: center; touch-action: manipulation; }

.ab-lists { margin-top: 18px; }
.ab-lists h2 { margin: 0 0 8px; font-size: 1rem; }
.ab-words { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }
.ab-words li {
  padding: 4px 10px;
  font: 500 0.92rem/1.3 var(--gm-body, "DM Sans", system-ui, sans-serif);
  color: var(--gm-text, #f2eee6);
  background: var(--gm-surface, #1b2740);
  border: 1px solid var(--gm-line, rgba(255, 255, 255, 0.09));
  border-radius: 99px;
}
.ab-words li.is-full { background: var(--gm-accent-soft, rgba(192, 57, 43, 0.3)); border-color: var(--gm-accent-line, #c0392b); font-weight: 700; }
.ab-words li.is-empty { color: var(--gm-muted, rgba(242, 238, 230, 0.66)); border-style: dashed; background: transparent; }
.ab-words.is-missed li { color: var(--gm-muted, rgba(242, 238, 230, 0.66)); background: transparent; border-style: dashed; }

#gm-anagram-builder .gm-status { margin-top: 4px; }
.gm-seg button, .gm-actions .gm-btn { min-height: 44px; }
.ab-bylen { margin-top: 8px; }

@media (max-width: 480px) {
  .ab-tiles { gap: 5px; }
  .ab-ch { width: 32px; height: 40px; font-size: 1.45rem; }
  .ab-ctrl .gm-btn { min-width: 0; flex: 1; padding-left: 8px; padding-right: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .ab-meter span, .ab-tile { transition: none; }
  .ab-current.is-shake { animation: none; }
}
.gm-side .gm-panel > .gm-label { display: block; margin-top: 16px; }
