/* ============================================
   SPELLING-WORDSEARCH.CSS
   Scoped arcade styles for Hangul Search
   All colors via CSS custom properties only.
   Hard edges, 48px+ touch targets.
   ============================================ */

.spelling-wordsearch-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-body);
  overflow: hidden;
}

/* Header bar */
.wordsearch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-sm);
  height: 56px;
  background-color: var(--color-surface);
  border-bottom: 2px solid var(--color-primary);
  box-shadow: 0 0 10px var(--color-primary);
  z-index: 100;
  flex-shrink: 0;
}

/* Grid container fills remaining height */
.wordsearch-grid-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
  min-height: 0;
  overflow: hidden;
}

.wordsearch-grid {
  display: grid;
  width: 100%;
  max-width: min(100%, 520px);
  aspect-ratio: 1 / 1;
  gap: 1px;
  background-color: var(--color-text-muted);
  border: 2px solid var(--color-primary);
  border-radius: var(--border-radius-sm);
  box-shadow: 0 0 12px var(--color-primary);
  padding: 2px;
  box-sizing: border-box;
}

.grid-cell {
  background-color: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-korean);
  font-weight: 700;
  font-size: clamp(14px, 3.5vw, 20px);
  color: var(--color-text);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  transition: background-color 80ms ease, color 80ms ease;
  min-height: 32px;
  min-width: 32px;
}

.grid-cell.selected {
  background-color: var(--color-accent);
  color: var(--color-background);
  z-index: 10;
}

.grid-cell.found {
  background-color: var(--color-correct);
  color: var(--color-background);
  font-weight: 900;
}

/* Word list drawer */
.word-list-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(280px, 75vw);
  height: 100dvh;
  background-color: var(--color-surface);
  border-left: 3px solid var(--color-primary);
  box-shadow: -4px 0 20px rgba(0,0,0,0.4);
  transform: translateX(100%);
  transition: transform 250ms ease;
  z-index: 200;
  display: flex;
  flex-direction: column;
}

.word-list-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 2px solid var(--color-text-muted);
  font-family: var(--font-display);
  font-size: var(--font-size-md);
  color: var(--color-secondary);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
  -webkit-overflow-scrolling: touch;
}

.drawer-word-item {
  padding: var(--space-md);
  margin-bottom: 4px;
  background-color: var(--color-background);
  border: 2px solid var(--color-text-muted);
  border-radius: var(--border-radius-sm);
  font-family: var(--font-korean);
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text);
  transition: all var(--transition-fast);
}

.drawer-word-item.found {
  text-decoration: line-through;
  opacity: 0.45;
  border-color: var(--color-correct);
}

/* Overlay behind drawer */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--color-background);
  opacity: 0.85;
  z-index: 150;
}

/* Completion state */
.wordsearch-complete {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: var(--space-xl);
  text-align: center;
}
