/* ══════════════════════════════════════════════════════════
   SPOT THE CHARACTER — Stylesheet
   ══════════════════════════════════════════════════════════ */

/* ── Dwell Ring ─────────────────────────────────────────── */
.stc-dwell-ring {
  pointer-events: none;
}
.stc-dwell-ring svg {
  filter: drop-shadow(0 0 8px rgba(99,102,241,0.6));
}

/* ── View Container ─────────────────────────────────────── */
#view-spot-char {
  width: 100%;
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0 0 40px;
}

/* ── Settings Panel ─────────────────────────────────────── */
.stc-settings-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 24px;
  padding: 36px 40px 40px;
  width: 100%;
  max-width: 580px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(99, 102, 241, 0.1) inset;
  backdrop-filter: blur(16px);
}

.stc-game-title {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, #06b6d4, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 4px;
  text-align: center;
  letter-spacing: -0.02em;
}

.stc-game-subtitle {
  font-size: 0.78rem;
  color: #64748b;
  text-align: center;
  margin-bottom: 32px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stc-field-group {
  margin-bottom: 24px;
  position: relative;
}

.stc-field-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

/* Input row: text input + clear button */
.stc-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.stc-text-input {
  flex: 1;
  background: rgba(2, 6, 23, 0.7);
  border: 1.5px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  padding: 12px 16px;
  color: #f1f5f9;
  font-size: 0.92rem;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  font-family: inherit;
}

.stc-text-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.stc-text-input::placeholder {
  color: #334155;
}

.stc-clear-btn {
  flex-shrink: 0;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: 10px;
  color: #64748b;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 10px 12px;
  transition: all 0.2s;
  white-space: nowrap;
}
.stc-clear-btn:hover {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.3);
  color: #f87171;
}

/* ── Dropdown History ────────────────────────────────────── */
.stc-dropdown-wrap {
  position: relative;
}

.stc-history-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #0f172a;
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  z-index: 100;
  max-height: 220px;
  overflow-y: auto;
  display: none;
}
.stc-history-dropdown.open {
  display: block;
  animation: stcDropIn 0.15s ease;
}

@keyframes stcDropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stc-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stc-dropdown-header span {
  font-size: 0.62rem;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.stc-dropdown-clear-all {
  background: none;
  border: none;
  color: #6366f1;
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.15s;
  text-decoration: underline;
}
.stc-dropdown-clear-all:hover { background: rgba(99, 102, 241, 0.1); }

.stc-history-item {
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #cbd5e1;
  cursor: pointer;
  transition: background 0.12s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.stc-history-item:hover {
  background: rgba(99, 102, 241, 0.1);
  color: #f1f5f9;
}
.stc-history-item .stc-hist-icon {
  font-size: 0.75rem;
  opacity: 0.4;
}

.stc-dropdown-empty {
  padding: 14px;
  font-size: 0.78rem;
  color: #334155;
  text-align: center;
  font-style: italic;
}

/* Library item label grows, remove button fixed right */
.stc-lib-label { flex: 1; }

.stc-lib-remove {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #475569;
  font-size: 0.7rem;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  transition: all 0.15s;
  opacity: 0;
}
.stc-history-item:hover .stc-lib-remove { opacity: 1; }
.stc-lib-remove:hover { background: rgba(248,113,113,0.15); color: #f87171; }

/* Add-new row */
.stc-lib-add-row {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.stc-lib-add-btn {
  width: 100%;
  background: rgba(99,102,241,0.08);
  border: 1px dashed rgba(99,102,241,0.3);
  border-radius: 8px;
  color: #818cf8;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  padding: 7px 10px;
  text-align: left;
  transition: all 0.15s;
}
.stc-lib-add-btn:hover { background: rgba(99,102,241,0.16); color: #a5b4fc; }

/* Taller dropdown for long library lists */
.stc-history-dropdown { max-height: 300px; }

/* ── Slider ─────────────────────────────────────────────── */
.stc-slider-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
}

.stc-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, #6366f1 var(--pct, 12.5%), #1e293b var(--pct, 12.5%));
  outline: none;
  cursor: pointer;
}

.stc-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.5);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.stc-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.6);
}

.stc-slider-value {
  font-size: 1.3rem;
  font-weight: 900;
  color: #818cf8;
  min-width: 38px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.stc-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  color: #334155;
  margin-top: 4px;
  font-weight: 600;
}

/* ── Start Button ───────────────────────────────────────── */
.stc-start-btn {
  width: 100%;
  padding: 16px;
  margin-top: 8px;
  background: linear-gradient(135deg, #06b6d4, #6366f1);
  border: none;
  border-radius: 14px;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.35);
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
}
.stc-start-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background 0.2s;
}
.stc-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(99, 102, 241, 0.45);
}
.stc-start-btn:hover::before {
  background: rgba(255, 255, 255, 0.06);
}
.stc-start-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}
.stc-start-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ── Loading Screen ─────────────────────────────────────── */
#stc-loading-view {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 24px;
  text-align: center;
}

.stc-spinner-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 5px solid rgba(99, 102, 241, 0.15);
  border-top-color: #6366f1;
  border-right-color: #06b6d4;
  animation: stcSpin 1.1s linear infinite;
}

@keyframes stcSpin {
  to { transform: rotate(360deg); }
}

.stc-loading-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #e2e8f0;
  animation: stcPulse 2s ease-in-out infinite;
}

.stc-loading-tip {
  font-size: 0.8rem;
  color: #475569;
  max-width: 300px;
  line-height: 1.5;
}

@keyframes stcPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* ── Game View (fullscreen — set via JS when game starts) ────────────────── */
#stc-game-view {
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.stc-game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 16px;
  background: rgba(2, 6, 23, 0.95);
  border-bottom: 1px solid rgba(99, 102, 241, 0.15);
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 6px;
  box-sizing: border-box;
}

.stc-game-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stc-game-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 800;
  color: #06b6d4;
}

.stc-game-attempts {
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
}

.stc-game-btns {
  display: flex;
  gap: 6px;
}

.stc-hint-btn, .stc-playagain-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.08);
  color: #818cf8;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.stc-hint-btn:hover {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
}
.stc-playagain-btn {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.06);
  color: #34d399;
}
.stc-playagain-btn:hover { background: rgba(16, 185, 129, 0.14); }

/* ── Image Canvas Container ────────────────────────────────────────────────── */
.stc-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #020617;
  cursor: crosshair;
  user-select: none;
  padding-bottom: 16px; /* breathing room between image and browser bottom edge */
}

.stc-game-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* ── Miss Ripple ────────────────────────────────────────── */
.stc-miss-ripple {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 3px solid #f87171;
  pointer-events: none;
  animation: stcMissRipple 0.6s ease-out forwards;
  transform: translate(-50%, -50%);
}

@keyframes stcMissRipple {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(0.3); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.5); }
}

/* ── Hint Pulse ─────────────────────────────────────────── */
.stc-hint-pulse {
  position: absolute;
  border-radius: 50%;
  border: 4px solid rgba(251, 191, 36, 0.8);
  background: rgba(251, 191, 36, 0.08);
  pointer-events: none;
  animation: stcHintPulse 1.4s ease-in-out infinite;
}

@keyframes stcHintPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1);   opacity: 0.9; }
  50%       { transform: translate(-50%, -50%) scale(1.25); opacity: 0.4; }
}

/* ── Win/Fail Overlay ───────────────────────────────────── */
.stc-result-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  pointer-events: all;
  animation: stcOverlayIn 0.35s ease;
}

@keyframes stcOverlayIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

.stc-result-overlay.win {
  background: rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(6px);
}
.stc-result-overlay.fail {
  background: rgba(2, 6, 23, 0.6);
}

.stc-result-emoji {
  font-size: 4rem;
  animation: stcBounce 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes stcBounce {
  0%   { transform: scale(0.3); }
  50%  { transform: scale(1.25); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.stc-result-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: #f1f5f9;
  text-shadow: 0 2px 16px rgba(0,0,0,0.8);
}

.stc-result-subtitle {
  font-size: 1rem;
  color: #94a3b8;
  font-weight: 600;
}

.stc-result-btns {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.stc-result-btn-primary {
  padding: 14px 32px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #06b6d4, #6366f1);
  color: #fff;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}
.stc-result-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.5);
}

.stc-result-btn-secondary {
  padding: 14px 32px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: #94a3b8;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.stc-result-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
}

/* ── Confetti particle ──────────────────────────────────── */
.stc-confetti {
  position: fixed;
  top: -10px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 9999;
  animation: stcConfettiFall linear forwards;
}

@keyframes stcConfettiFall {
  0%   { transform: translateY(0) rotate(0deg);   opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ── Error message ─────────────────────────────────────── */
.stc-error-box {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 12px;
  padding: 14px 18px;
  color: #fca5a5;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  margin-top: 12px;
  display: none;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .stc-settings-card {
    padding: 24px 20px 28px;
    border-radius: 18px;
  }
  .stc-game-title { font-size: 1.6rem; }
  .stc-result-title { font-size: 1.6rem; }
}
