/* ==========================================================================
   ANAGRAM GAME - ORDKONGEN.NO COMPACT 3D & GLASSMORPHISM THEME
   ========================================================================== */

.anagram-layout {
  grid-template-columns: minmax(0, 1fr);
  max-width: 680px;
  margin: 0.5rem auto 1.5rem auto;
}

.anagram-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: min(100%, 680px);
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.90) 0%, rgba(30, 41, 59, 0.94) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #ffffff;
  border-radius: var(--radius-lg, 24px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.15);
  border: 1.5px solid rgba(245, 176, 65, 0.3);
  position: relative;
}

/* Corner Pins - Royal Gold Jewels */
.anagram-panel::before,
.anagram-panel::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  background: radial-gradient(circle at 30% 30%, #fef08a, #d97706);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.6), inset 0 -1px 2px rgba(0,0,0,0.5);
}
.anagram-panel::before { top: 0.85rem; left: 0.85rem; }
.anagram-panel::after { top: 0.85rem; right: 0.85rem; }

.anagram-head {
  text-align: center;
  margin-bottom: 0.25rem;
}

.anagram-title {
  margin: 0 0 0.4rem 0;
  font-family: var(--font-heading, 'Rowdies', cursive);
  font-size: clamp(1.8rem, 5vw, 3rem);
  line-height: 1;
  letter-spacing: 0.04em;
  color: #ffffff;
  text-shadow: 2px 2px 0px #d97706, 0 4px 10px rgba(0,0,0,0.4);
  text-transform: uppercase;
}

.score-badge {
  display: inline-flex;
  gap: 0.75rem;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-family: var(--font-body, 'Outfit', sans-serif);
  font-size: 0.85rem;
  font-weight: 700;
  color: #f1f5f9;
  border: 1px solid rgba(245, 176, 65, 0.25);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

.score-badge span {
  display: inline-flex;
  align-items: center;
}

.anagram-slots,
.anagram-tiles {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0.5rem 0;
}

.anagram-slots {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 18px;
  padding: 0.85rem 0.75rem;
  border: 1.5px dashed rgba(245, 176, 65, 0.25);
  box-shadow: inset 0 4px 10px rgba(0,0,0,0.4);
  min-height: 68px;
  align-items: center;
}

/* 3D Tactile Slot & Tile Design */
.anagram-slot,
.anagram-tile {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-family: var(--font-heading, 'Rowdies', cursive);
  font-size: 1.6rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.12s ease, background 0.12s ease;
}

/* Empty Inset Slot */
.anagram-slot {
  color: #ffffff;
  background: rgba(15, 23, 42, 0.5);
  border: 2px dashed rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 3px 6px rgba(0,0,0,0.4);
}

/* Filled Slot with 3D Pop */
.anagram-slot:not(:empty) {
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
  border: 1.5px solid #60a5fa;
  border-bottom-width: 2px;
  color: #ffffff;
  box-shadow: 0 4px 0 #1e40af, 0 6px 12px rgba(0, 0, 0, 0.35);
  transform: translateY(-2px);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.anagram-slot:not(:empty):hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 0 #1e40af, 0 8px 14px rgba(0, 0, 0, 0.4);
}

.anagram-slot:not(:empty):active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #1e40af, 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 3D Wooden/Gold Scrabble Tile */
.anagram-tile {
  color: #ffffff;
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
  border: 1.5px solid #fef08a;
  border-bottom-color: #b45309;
  box-shadow: 0 5px 0 #b45309, 0 6px 12px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.anagram-tile:hover:not(:disabled) {
  transform: translateY(-2px);
  background: linear-gradient(180deg, #fcd34d 0%, #eab308 100%);
  box-shadow: 0 7px 0 #b45309, 0 8px 16px rgba(0, 0, 0, 0.35);
}

.anagram-tile:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #b45309, 0 3px 6px rgba(0, 0, 0, 0.25);
}

.anagram-tile:disabled {
  color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
  cursor: default;
  transform: translateY(4px);
  opacity: 0.4;
}

/* Action Controls Bar */
.anagram-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 9999px;
  border: 1px solid rgba(245, 176, 65, 0.2);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  width: fit-content;
  margin: 0.5rem auto 0 auto;
  max-width: 100%;
}

.anagram-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.45rem 0.85rem;
  font-family: var(--font-body, 'Outfit', sans-serif);
  font-size: 0.82rem;
  font-weight: 800;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.12s ease, background 0.12s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.anagram-btn:hover {
  transform: translateY(-1.5px);
}

.anagram-btn:active {
  transform: translateY(1px);
}

.anagram-btn-check {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.35);
  border: 1px solid #34d399;
}

.anagram-btn-hint {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.3);
  border: 1px solid #fbbf24;
}

.hint-badge {
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.28);
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 2px;
}

.anagram-btn-next {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(59, 130, 246, 0.35);
  border: 1px solid #60a5fa;
}

.anagram-btn-fullscreen {
  background: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.anagram-btn-fullscreen:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

/* Animations & Micro-interactions */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.shake {
  animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  border-color: #ef4444 !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.6), inset 0 2px 4px rgba(0,0,0,0.5) !important;
}

@keyframes tilePopIn {
  0% { transform: scale(0.6) translateY(8px); opacity: 0.5; }
  70% { transform: scale(1.12) translateY(-3px); }
  100% { transform: scale(1) translateY(-2px); opacity: 1; }
}

.tile-pop-in {
  animation: tilePopIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes waveBounce {
  0% { transform: translateY(-2px) scale(1); }
  35% { transform: translateY(-16px) scale(1.18); box-shadow: 0 12px 24px rgba(245, 176, 65, 0.8), 0 0 24px rgba(16, 185, 129, 0.9); }
  70% { transform: translateY(2px) scale(0.95); }
  100% { transform: translateY(-2px) scale(1); }
}

.wave-bounce {
  animation: waveBounce 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  animation-delay: calc(var(--tile-idx, 0) * 0.08s);
  background: linear-gradient(180deg, #10b981 0%, #047857 100%) !important;
  border-color: #6ee7b7 !important;
  box-shadow: 0 4px 0 #065f46, 0 0 16px rgba(16, 185, 129, 0.6) !important;
}

.solved-glow {
  animation: glow 1s ease-in-out alternate;
}

@keyframes glow {
  0% { box-shadow: 0 0 0 rgba(16, 185, 129, 0); }
  50% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.8); }
  100% { box-shadow: 0 0 0 rgba(16, 185, 129, 0); }
}

/* Mobile Responsive Adjustments */
@media (max-width: 600px) {
  .anagram-layout {
    margin: 0.25rem auto 1rem auto;
  }
  .anagram-panel {
    padding: 1rem 0.65rem;
    gap: 0.75rem;
  }
  .anagram-slot,
  .anagram-tile {
    width: 44px;
    height: 44px;
    font-size: 1.35rem;
    border-radius: 10px;
  }
  .anagram-slots {
    padding: 0.65rem 0.4rem;
    min-height: 58px;
  }
  .anagram-title {
    font-size: 1.9rem;
  }
  .score-badge {
    padding: 0.25rem 0.65rem;
    font-size: 0.78rem;
    gap: 0.5rem;
  }
  .anagram-actions {
    gap: 0.25rem;
    padding: 0.25rem 0.35rem;
  }
  .anagram-btn {
    padding: 0.4rem 0.55rem;
    font-size: 0.74rem;
  }
}