/* ARCANE CHAIN — WordPress Plugin Styles
   Mobile-first, dark mystical theme. */

.ac-wrapper {
  max-width: 640px;
  margin: 0 auto;
  font-family: 'Cinzel', 'Georgia', serif;
  color: #d4c4a8;
}

/* === Background & atmosphere === */
.ac-bg {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top, #2a1a4a 0%, transparent 60%),
    radial-gradient(ellipse at bottom, #1a0a2e 0%, transparent 60%),
    linear-gradient(180deg, #0a0518 0%, #1a0f2e 50%, #0a0518 100%);
  overflow-x: hidden;
}

.ac-bg::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(255, 215, 100, 0.4), transparent),
    radial-gradient(1px 1px at 60% 70%, rgba(180, 130, 255, 0.5), transparent),
    radial-gradient(2px 2px at 80% 20%, rgba(255, 215, 100, 0.3), transparent),
    radial-gradient(1px 1px at 40% 80%, rgba(180, 130, 255, 0.4), transparent);
  background-size: 250px 250px;
  animation: ac-drift 40s linear infinite;
  pointer-events: none;
  z-index: 0;
}
@keyframes ac-drift {
  from { background-position: 0 0; }
  to   { background-position: 250px 250px; }
}

/* === Sound toggle (fixed top-right) === */
.ac-sound-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  background: rgba(15, 8, 30, 0.85);
  border: 1px solid rgba(180, 130, 255, 0.3);
  color: #f4d97a;
  padding: 10px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  z-index: 9999;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.ac-sound-toggle.muted { color: #8a7aaa; }
.ac-sound-toggle:active { transform: scale(0.96); }

/* === Main container === */
.ac-container {
  background: linear-gradient(180deg, rgba(45, 25, 70, 0.92) 0%, rgba(25, 15, 50, 0.96) 100%);
  border: 1px solid rgba(180, 130, 255, 0.3);
  border-radius: 6px;
  padding: 32px 36px;
  margin: 20px auto;
  max-width: 640px;
  box-shadow: 0 0 60px rgba(120, 60, 200, 0.3);
  position: relative;
  z-index: 1;
}
.ac-container::before,
.ac-container::after {
  content: '✦';
  position: absolute;
  color: rgba(255, 215, 100, 0.6);
  font-size: 1.4rem;
  text-shadow: 0 0 10px rgba(255, 215, 100, 0.8);
}
.ac-container::before { top: 10px; left: 14px; }
.ac-container::after  { bottom: 10px; right: 14px; }

.ac-title {
  color: #f4d97a;
  text-align: center;
  margin: 0 0 6px;
  font-size: 2.4rem;
  font-weight: 400;
  letter-spacing: 4px;
  text-transform: uppercase;
  text-shadow: 0 0 20px rgba(255, 215, 100, 0.5);
}
.ac-subtitle {
  text-align: center;
  color: #b094d4;
  margin: 0 0 22px;
  font-size: 0.85rem;
  letter-spacing: 2px;
  font-style: italic;
}

/* === Instructions panel === */
.ac-instructions {
  background: rgba(15, 8, 30, 0.6);
  border: 1px solid rgba(180, 130, 255, 0.2);
  border-radius: 4px;
  padding: 18px 22px;
  margin-bottom: 22px;
  font-size: 0.92rem;
  line-height: 1.75;
}
.ac-instructions-title {
  color: #f4d97a;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 12px;
  text-align: center;
  text-shadow: 0 0 10px rgba(255, 215, 100, 0.4);
}
.ac-instructions ol { padding-left: 24px; margin: 0; }
.ac-instructions li { margin-bottom: 6px; color: #c8b8d8; }
.ac-instructions li::marker { color: #b482ff; font-weight: bold; }

/* === Start button === */
.ac-start-section { text-align: center; margin-top: 24px; }
.ac-start-btn {
  padding: 16px 50px;
  background: linear-gradient(180deg, #6a4a9a 0%, #4a2a7a 100%);
  color: #f4d97a;
  border: 1px solid rgba(255, 215, 100, 0.5);
  border-radius: 4px;
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 4px;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  text-shadow: 0 0 12px rgba(255, 215, 100, 0.6);
  box-shadow: 0 0 25px rgba(180, 130, 255, 0.3);
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.ac-start-btn:hover {
  background: linear-gradient(180deg, #8a6aba 0%, #6a3a9a 100%);
  box-shadow: 0 0 40px rgba(255, 215, 100, 0.5);
  transform: translateY(-2px);
}
.ac-start-btn:active { transform: translateY(0); }

/* === Game area === */
.ac-game { display: none; }
.ac-game.active { display: block; animation: ac-fade-in 0.6s; }
@keyframes ac-fade-in { from { opacity: 0; } to { opacity: 1; } }

.ac-stats {
  display: flex;
  justify-content: space-around;
  background: rgba(15, 8, 30, 0.5);
  border: 1px solid rgba(180, 130, 255, 0.15);
  padding: 14px;
  margin-bottom: 18px;
  border-radius: 4px;
}
.ac-stat { text-align: center; }
.ac-stat-label {
  color: #8a7aaa;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 4px;
}
.ac-stat-value {
  color: #f4d97a;
  font-size: 1.65rem;
  font-weight: 400;
  font-family: 'Courier New', monospace;
  text-shadow: 0 0 15px rgba(255, 215, 100, 0.4);
}
.ac-timer.warning { color: #ffaa44; }
.ac-timer.danger {
  color: #ff4a4a;
  animation: ac-pulse 1s infinite;
}
@keyframes ac-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.15); opacity: 0.7; }
}

.ac-word-box {
  background: linear-gradient(180deg, rgba(60, 30, 100, 0.6) 0%, rgba(30, 15, 60, 0.7) 100%);
  border: 1px solid rgba(180, 130, 255, 0.4);
  padding: 28px;
  text-align: center;
  margin-bottom: 18px;
  border-radius: 4px;
  position: relative;
}
.ac-word-label {
  font-size: 0.78rem;
  color: #b094d4;
  margin-bottom: 10px;
  letter-spacing: 4px;
  text-transform: uppercase;
}
.ac-current-word {
  font-size: 2.8rem;
  color: #f4d97a;
  font-weight: 400;
  letter-spacing: 5px;
  font-family: 'Courier New', monospace;
  text-shadow: 0 0 20px rgba(255, 215, 100, 0.6);
  animation: ac-glow 3s ease-in-out infinite;
  word-break: break-all;
}
@keyframes ac-glow {
  0%, 100% { text-shadow: 0 0 20px rgba(255, 215, 100, 0.6), 0 0 40px rgba(255, 215, 100, 0.3); }
  50%      { text-shadow: 0 0 30px rgba(255, 215, 100, 0.9), 0 0 60px rgba(255, 215, 100, 0.5); }
}

/* === Input row === */
.ac-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.ac-input {
  flex: 1;
  min-width: 0; /* fix flex shrinking */
  padding: 14px 16px;
  font-size: 1.1rem;
  background: rgba(15, 8, 30, 0.7);
  border: 1px solid rgba(180, 130, 255, 0.3);
  border-radius: 4px;
  outline: none;
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
  color: #f4d97a;
  -webkit-appearance: none;
  appearance: none;
}
.ac-input:focus {
  border-color: #f4d97a;
  box-shadow: 0 0 20px rgba(255, 215, 100, 0.3);
}
.ac-input:disabled { opacity: 0.5; }

.ac-btn {
  padding: 14px 22px;
  background: linear-gradient(180deg, #5a3a8a 0%, #3a1a6a 100%);
  color: #f4d97a;
  border: 1px solid rgba(180, 130, 255, 0.4);
  border-radius: 4px;
  font-size: 0.92rem;
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  text-shadow: 0 0 8px rgba(255, 215, 100, 0.4);
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.ac-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #7a4aaa 0%, #5a2a8a 100%);
  box-shadow: 0 0 25px rgba(180, 130, 255, 0.5);
}
.ac-btn:active:not(:disabled) { transform: scale(0.97); }
.ac-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.ac-message {
  text-align: center;
  padding: 10px;
  margin-bottom: 14px;
  font-size: 0.9rem;
  min-height: 20px;
  font-style: italic;
}
.ac-message.success { color: #88e088; }
.ac-message.error   { color: #ff7a7a; }
.ac-message.info    { color: #b094d4; }

.ac-history {
  background: rgba(15, 8, 30, 0.5);
  border: 1px solid rgba(180, 130, 255, 0.15);
  padding: 14px;
  max-height: 140px;
  overflow-y: auto;
  border-radius: 4px;
}
.ac-history-title {
  color: #8a7aaa;
  margin: 0 0 10px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 3px;
}
.ac-history-list { display: flex; flex-wrap: wrap; gap: 6px; }
.ac-history-item {
  background: rgba(30, 15, 60, 0.6);
  padding: 4px 10px;
  border: 1px solid rgba(180, 130, 255, 0.2);
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  color: #c8b8d8;
  font-size: 0.88rem;
}
.ac-history-item.current {
  background: linear-gradient(180deg, rgba(120, 80, 180, 0.6) 0%, rgba(80, 40, 140, 0.6) 100%);
  color: #f4d97a;
  border-color: rgba(255, 215, 100, 0.5);
  text-shadow: 0 0 8px rgba(255, 215, 100, 0.4);
}

/* === Leaderboard === */
.ac-leaderboard {
  background: rgba(15, 8, 30, 0.5);
  border: 1px solid rgba(180, 130, 255, 0.2);
  padding: 20px;
  margin-top: 18px;
  border-radius: 4px;
}
.ac-leaderboard-title {
  color: #f4d97a;
  text-align: center;
  margin: 0 0 14px;
  font-size: 1rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(255, 215, 100, 0.4);
}
.ac-lb-list { list-style: none; padding: 0; margin: 0; }
.ac-lb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  margin-bottom: 6px;
  background: rgba(30, 15, 60, 0.4);
  border-radius: 3px;
  border-left: 3px solid rgba(180, 130, 255, 0.3);
  font-size: 0.9rem;
}
.ac-lb-item:nth-child(1) { border-left-color: #ffd700; background: rgba(80, 60, 30, 0.4); }
.ac-lb-item:nth-child(2) { border-left-color: #c0c0c0; }
.ac-lb-item:nth-child(3) { border-left-color: #cd7f32; }
.ac-lb-rank {
  color: #f4d97a;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  width: 28px;
  text-align: center;
}
.ac-lb-name { flex: 1; color: #c8b8d8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-lb-score { color: #f4d97a; font-family: 'Courier New', monospace; }
.ac-lb-words { color: #8a7aaa; font-size: 0.75rem; min-width: 60px; text-align: right; }
.ac-lb-empty {
  text-align: center;
  color: #8a7aaa;
  font-style: italic;
  padding: 20px;
}

/* === Modal (game over) === */
.ac-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
  padding: 20px;
}
.ac-modal.show { display: flex; animation: ac-fade-in 0.4s; }
.ac-modal-content {
  background: linear-gradient(180deg, rgba(45, 25, 70, 0.98) 0%, rgba(25, 15, 50, 0.98) 100%);
  border: 1px solid rgba(180, 130, 255, 0.4);
  padding: 32px 28px;
  border-radius: 6px;
  text-align: center;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 0 80px rgba(120, 60, 200, 0.6);
  animation: ac-scale-in 0.4s;
}
@keyframes ac-scale-in {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.ac-modal h2 {
  color: #f4d97a;
  margin: 0 0 14px;
  font-size: 1.7rem;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.ac-modal p { color: #b094d4; margin: 6px 0; font-size: 0.92rem; }
.ac-final-score {
  font-size: 3rem;
  color: #f4d97a;
  margin: 16px 0 8px;
  font-family: 'Courier New', monospace;
  text-shadow: 0 0 30px rgba(255, 215, 100, 0.6);
}
.ac-rank-badge {
  display: inline-block;
  background: linear-gradient(180deg, #ffd700 0%, #c89000 100%);
  color: #1a0a2e;
  padding: 4px 14px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.85rem;
  margin: 8px 0;
  letter-spacing: 1px;
}

/* Name input in modal */
.ac-name-input {
  width: 80%;
  padding: 10px 14px;
  margin: 8px 0;
  background: rgba(15, 8, 30, 0.7);
  border: 1px solid rgba(180, 130, 255, 0.3);
  border-radius: 4px;
  color: #f4d97a;
  font-family: 'Cinzel', 'Georgia', serif;
  font-size: 1rem;
  text-align: center;
  outline: none;
}
.ac-name-input:focus { border-color: #f4d97a; }

.ac-rank-message {
  background: rgba(255, 215, 100, 0.1);
  border: 1px solid rgba(255, 215, 100, 0.3);
  padding: 10px;
  border-radius: 4px;
  margin: 10px 0;
  color: #ffd700;
  font-size: 0.95rem;
}

/* === Loading screen === */
.ac-loading {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, #2a1a4a 0%, #0a0518 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.6s;
}
.ac-loading.hidden { opacity: 0; pointer-events: none; }
.ac-loading-content { text-align: center; color: #f4d97a; }
.ac-spinner {
  width: 50px;
  height: 50px;
  border: 2px solid rgba(180, 130, 255, 0.2);
  border-top-color: #f4d97a;
  border-right-color: #b482ff;
  border-radius: 50%;
  animation: ac-spin 1.2s linear infinite;
  margin: 0 auto 24px;
  box-shadow: 0 0 30px rgba(180, 130, 255, 0.4);
}
@keyframes ac-spin { to { transform: rotate(360deg); } }
.ac-loading-text {
  font-size: 1rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  animation: ac-shimmer 2s ease-in-out infinite;
}
@keyframes ac-shimmer {
  0%, 100% { opacity: 0.7; }
  50%      { opacity: 1; }
}

/* Scrollbar */
.ac-history::-webkit-scrollbar { width: 6px; }
.ac-history::-webkit-scrollbar-track { background: rgba(15, 8, 30, 0.3); }
.ac-history::-webkit-scrollbar-thumb {
  background: rgba(180, 130, 255, 0.4);
  border-radius: 3px;
}

/* ============================================
   MOBILE OPTIMIZATIONS (≤ 600px)
   ============================================ */
@media (max-width: 600px) {
  .ac-container { padding: 22px 18px; margin: 12px; }
  .ac-title { font-size: 1.7rem; letter-spacing: 2px; }
  .ac-current-word { font-size: 2rem; letter-spacing: 3px; }
  .ac-stat-value { font-size: 1.3rem; }
  .ac-stat-label { font-size: 0.62rem; letter-spacing: 1.5px; }
  .ac-instructions { font-size: 0.85rem; padding: 14px 16px; line-height: 1.6; }
  .ac-sound-toggle { top: 10px; right: 10px; font-size: 0.75rem; padding: 8px 12px; }
  .ac-start-btn { padding: 14px 36px; font-size: 0.95rem; letter-spacing: 3px; }
  .ac-input { font-size: 1rem; padding: 12px 14px; }
  .ac-btn { padding: 12px 18px; font-size: 0.85rem; }
  .ac-word-box { padding: 22px 16px; }
  .ac-final-score { font-size: 2.4rem; }
  .ac-modal-content { padding: 24px 20px; }
  .ac-lb-item { font-size: 0.85rem; padding: 7px 10px; gap: 8px; }
  .ac-lb-words { display: none; } /* hide on mobile to save space */
}

/* ============================================
   TOUCH-SPECIFIC: prevent double-tap zoom, etc.
   ============================================ */
.ac-input, .ac-btn, .ac-start-btn, .ac-sound-toggle, .ac-name-input {
  touch-action: manipulation;
}

/* Prevent text selection on UI elements */
.ac-title, .ac-subtitle, .ac-stat-label, .ac-stat-value,
.ac-word-label, .ac-history-title, .ac-leaderboard-title {
  user-select: none;
  -webkit-user-select: none;
}
