/* Veloxity Crossword Game - minimal styles (iteration 1) */
.vlx-cw-grid {
  display: grid;
  grid-gap: 0;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  outline: none;
}

.vlx-cw-grid:focus {
  outline: none;
}

/* Custom keyboard animation for crossword - simple fade + slide */
.virtual-keyboard.keyboard-crossword.keyboard-enter {
  opacity: 0;
}

.virtual-keyboard.keyboard-crossword.keyboard-enter-active {
  opacity: 1;
  transition: opacity 0.15s ease;
}

.virtual-keyboard.keyboard-crossword.keyboard-exit {
  opacity: 1;
}

.virtual-keyboard.keyboard-crossword.keyboard-exit-active {
  opacity: 0;
  transition: opacity 0.15s ease;
}

/* Background layer with opacity control */
.vlx-cw-grid:not(.border-compensation)::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  z-index: 0;
  pointer-events: none;
}

/* Ensure grid cells are above background */
.vlx-cw-grid > * {
  position: relative;
  z-index: 1;
}

.vlx-cw-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  user-select: none;
  aspect-ratio: 1 / 1;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  min-height: 0;
  min-width: 0;
}

/* Only non-empty cells get default styling */
.vlx-cw-cell:not(.empty) {
  background: #ffffff;
}

/* Empty cells have no background or border */
.vlx-cw-cell.empty {
  background: transparent;
  border: none;
}

/* Border compensation using positioned divs */
.vlx-cw-cell-border {
  position: absolute;
  background: currentColor;
  pointer-events: none;
  z-index: 1;
}

.vlx-cw-cell-border.top {
  top: 0;
  left: 0;
  right: 0;
  /* Extend slightly to fill corner gaps */
  margin-left: -0.5px;
  margin-right: -0.5px;
}

.vlx-cw-cell-border.bottom {
  bottom: 0;
  left: 0;
  right: 0;
  /* Extend slightly to fill corner gaps */
  margin-left: -0.5px;
  margin-right: -0.5px;
}

.vlx-cw-cell-border.left {
  top: 0;
  bottom: 0;
  left: 0;
  /* Extend slightly to fill corner gaps */
  margin-top: -0.5px;
  margin-bottom: -0.5px;
}

.vlx-cw-cell-border.right {
  top: 0;
  bottom: 0;
  right: 0;
  /* Extend slightly to fill corner gaps */
  margin-top: -0.5px;
  margin-bottom: -0.5px;
}
.vlx-cw-hints-container {
  overflow: auto;
  max-height: 100%;
}
.vlx-cw-hints-inner {
  font-size: 14px;
  line-height: 1.4;
}
.vlx-cw-hints-inner .vlx-cw-section-title {
  font-weight: 700;
  margin: 6px 0;
}
.vlx-cw-hints-inner ul {
  list-style: none;
  padding: 0;
  margin: 0 0 10px 0;
}
.vlx-cw-hints-inner li { margin: 2px 0; }
.vlx-cw-hints-separator {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  height: 5px;
}
.vlx-cw-empty-state { pointer-events: none; }

/* Editor preview enhancements */
.elementor-editor-active .vlx-cw-cell {
  /* Make cells more visible in editor */
  min-height: 20px;
  font-size: 16px;
}



/* Gameplay additions */
.vlx-cw-cell { position: relative; font-size: 18px; }
.vlx-cw-cell .num {
  position: absolute;
  top: 5%;
  left: 5%;
  font-size: 10px;
  font-weight: 700;
  opacity: 0.7;
  pointer-events: none;
}
.vlx-cw-cell .ch { display:block; }
/* Selected/active visual defaults are driven by widget style controls.
   Remove hard-coded blue outline/background. */
.vlx-cw-cell.is-wrong { background: #ffe9e9; }
.vlx-cw-cell.guessed { cursor: not-allowed; pointer-events: none; }

/* Active cell pulse animation */
.vlx-cw-cell.active {
  animation: cell-pulse 1.5s ease-in-out infinite;
}

@keyframes cell-pulse {
  0%, 100% {
    background-color: inherit;
  }
  50% {
    background-color: rgba(66, 133, 244, 0.2);
  }
}

.vlx-cw-hints-inner li { cursor: default; padding: 2px 4px; border-radius: 4px; }
.vlx-cw-hints-inner li.active { background: #e9f1ff; }
.vlx-cw-hints-inner li.guessed {
  cursor: not-allowed;
  pointer-events: none;
}

.vlx-cw-timer {
  background: rgba(0,0,0,0.6);
  color:#fff;
  padding: 6px 10px;
  border-radius: 16px;
  font-weight:700;
  font-family: Arial, Helvetica, sans-serif;
  box-sizing: border-box;
}
.vlx-cw-reset {
  background:#333;
  color:#fff;
  padding:6px 10px;
  border-radius: 16px;
  font-weight:600;
  cursor:pointer;
  user-select:none;
  box-sizing: border-box;
}
.vlx-cw-reset:active { transform: scale(0.98); }


.vlx-cw-complete { position:absolute; inset:0; background: rgba(0,0,0,0.5); display:flex; align-items:center; justify-content:center; color:#fff; font-size: 28px; font-weight:800; opacity:0; pointer-events:none; transition: opacity .25s ease; z-index: 100; }
.vlx-cw-complete.show { opacity:1; pointer-events:auto; }

/* Starting Screen */
.vlx-cw-screen-start {
  display: none;
  pointer-events: none;
}

.vlx-cw-screen-start.active {
  display: block;
  pointer-events: auto;
}

.vlx-cw-start-button {
  transition: transform 0.2s ease;
}

.vlx-cw-start-button:hover {
  transform: translate(-50%, -50%) scale(1.05);
}

.vlx-cw-start-button:active {
  transform: translate(-50%, -50%) scale(0.98);
}

/* Word completion animation */
.vlx-cw-cell.word-complete-correct {
  animation: word-complete-pulse 0.4s ease;
}

.vlx-cw-cell.word-complete-incorrect {
  animation: word-complete-incorrect 0.4s ease;
}

@keyframes word-complete-pulse {
  0% {
    background-color: inherit;
  }
  50% {
    background-color: #4ade80;
  }
  100% {
    background-color: inherit;
  }
}

@keyframes word-complete-incorrect {
  0% {
    background-color: inherit;
  }
  50% {
    background-color: #fca5a5;
  }
  100% {
    background-color: inherit;
  }
}

/* Result Popups */
.vlx-cw-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    cursor: pointer;
}

.vlx-cw-overlay.show {
    display: flex;
    opacity: 1;
}

/* No Overlay Mode - hide background, position content absolutely */
.vlx-cw-overlay.vlx-cw-no-overlay {
    background: transparent !important;
    width: auto !important;
    height: auto !important;
    display: block;
}

.vlx-cw-overlay.vlx-cw-no-overlay .vlx-cw-overlay-content {
    position: relative;
}

.vlx-cw-overlay-content {
    background: white;
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    transform: scale(0.7);
    opacity: 0;
    transition: all 0.3s ease;
}

.vlx-cw-overlay.show .vlx-cw-overlay-content {
    transform: scale(1);
    opacity: 1;
}

/* Animation: None */
.vlx-cw-overlay.vlx-cw-animation-none {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.vlx-cw-overlay.vlx-cw-animation-none.show {
    opacity: 1;
    pointer-events: all;
}

.vlx-cw-overlay.vlx-cw-animation-none .vlx-cw-overlay-content {
    transform: none;
}

/* Animation: Fade In */
.vlx-cw-overlay.vlx-cw-animation-fade {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.vlx-cw-overlay.vlx-cw-animation-fade.show {
    opacity: 1;
    pointer-events: all;
}

.vlx-cw-overlay.vlx-cw-animation-fade .vlx-cw-overlay-content {
    transform: none;
}

/* Animation: Scale In (default) */
.vlx-cw-overlay.vlx-cw-animation-scale {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.vlx-cw-overlay.vlx-cw-animation-scale.show {
    opacity: 1;
    pointer-events: all;
}

.vlx-cw-overlay.vlx-cw-animation-scale .vlx-cw-overlay-content {
    transform: scale(0.7);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.vlx-cw-overlay.vlx-cw-animation-scale.show .vlx-cw-overlay-content {
    transform: scale(1);
    opacity: 1;
}

.vlx-cw-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px 30px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: opacity 0.2s;
    text-decoration: none;
    align-self: center;
}

/* Support for text-align: center (default) */
.vlx-cw-overlay-content[style*="text-align: center"] .vlx-cw-button {
    align-self: center;
}

.vlx-cw-button:hover {
    opacity: 0.9;
}

.vlx-cw-button img {
    max-width: 100%;
    height: auto;
    display: block;
}

.vlx-cw-button i {
    font-size: inherit;
}

.vlx-cw-button span {
    white-space: nowrap;
}

/* Editor Enhancements */
.elementor-editor-active .vlx-cw-game-wrapper {
    /* Make elements more visible in editor */
}

/* Editor Preview Overlays - render at full screen */
.elementor-editor-active .vlx-cw-overlay.vlx-cw-won.show,
.elementor-editor-active .vlx-cw-overlay.vlx-cw-lost.show {
    position: absolute;
    opacity: 1 !important;
    pointer-events: none;
}

.elementor-editor-active .vlx-cw-overlay.vlx-cw-won.show .vlx-cw-overlay-content,
.elementor-editor-active .vlx-cw-overlay.vlx-cw-lost.show .vlx-cw-overlay-content {
    transform: scale(1) !important;
    opacity: 1 !important;
}
