.puzzle-info {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 16px;
  letter-spacing: 0.05em;
}

#help-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

.word-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 auto 20px;
  width: min(80vw, 320px);
}

.word-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elev);
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: clamp(1.6rem, 7vw, 2.2rem);
  font-weight: 800;
  color: var(--text);
  user-select: none;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}

.cell.filled {
  border-color: rgba(255,255,255,0.3);
}

.cell.flip {
  animation: flip 0.5s ease;
}

@keyframes flip {
  0%   { transform: rotateX(0); }
  50%  { transform: rotateX(90deg); }
  100% { transform: rotateX(0); }
}

.cell.correct {
  background: #2ed573;
  border-color: #2ed573;
  color: var(--bg);
}

.cell.present {
  background: #ffa502;
  border-color: #ffa502;
  color: var(--bg);
}

.cell.absent {
  background: #2c3e50;
  border-color: #2c3e50;
  color: rgba(255,255,255,0.55);
}

.cell.shake {
  animation: rowShake 0.4s ease;
}

@keyframes rowShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.input-row {
  display: flex;
  gap: 8px;
  max-width: min(80vw, 320px);
  margin: 0 auto;
}

.input-row input {
  flex: 1;
  min-width: 0; /* flexbox 기본 min-width: auto 가 input intrinsic 너비를 강제해 부모 max-width 넘김 — 모바일 가로 오버플로우 원인 */
  padding: 12px 16px;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 1.1rem;
  font-family: inherit;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.input-row input:focus { border-color: var(--accent); }

.input-row input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.input-row .btn {
  padding: 12px 18px;
  font-size: 0.95rem;
}

.hint {
  text-align: center;
  margin-top: 18px;
  color: var(--text-dim);
  font-size: 0.88rem;
  min-height: 1.3em;
}

.hint.error { color: #ff6b6b; }

/* ===== 도움말 모달 ===== */

.help-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 41, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
  animation: fadeIn 0.2s ease;
}

.help-modal.hidden { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.help-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px 24px;
  max-width: 380px;
  width: 100%;
  text-align: left;
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow-y: auto;
}

.help-card h2 {
  font-size: 1.3rem;
  margin-bottom: 12px;
}

.help-card p {
  color: var(--text-dim);
  margin-bottom: 12px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.help-card p b { color: var(--text); }
.help-card p strong { color: var(--text); }

.help-example {
  margin: 16px 0;
}

.help-example .word-row {
  width: 200px;
  margin-bottom: 10px;
}

.help-example .cell {
  font-size: 1.5rem;
}

.help-tip {
  background: rgba(108, 142, 255, 0.1);
  padding: 10px 14px;
  border-radius: 10px;
  margin-top: 16px;
  font-size: 0.85rem !important;
  color: var(--text) !important;
}

/* ===== 결과 모달 ===== */

.result-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 41, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
  animation: fadeIn 0.25s ease;
}

.result-modal.hidden { display: none; }

.result-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-emoji { font-size: 3.5rem; margin-bottom: 8px; }
.result-card h2 { font-size: 1.5rem; margin-bottom: 8px; }
.result-msg { color: var(--text-dim); margin-bottom: 20px; }

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.result-stats > div {
  background: rgba(255,255,255,0.05);
  padding: 14px;
  border-radius: 12px;
}

.result-stats span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.result-stats strong {
  font-size: 1.4rem;
  font-weight: 800;
}

.emoji-grid {
  font-family: -apple-system, "Apple Color Emoji", "Segoe UI Emoji", monospace;
  font-size: 1.4rem;
  line-height: 1.1;
  margin: 12px 0 16px;
  background: rgba(0,0,0,0.2);
  padding: 12px;
  border-radius: 12px;
  white-space: pre;
  letter-spacing: 4px;
  text-align: center;
}

.streak-info {
  font-size: 0.95rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 16px;
}

.next-puzzle {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.result-actions .btn {
  padding: 12px 14px;
  text-align: center;
  font-size: 0.9rem;
}
