* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f2f4f8; }

.wf-outer {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.wf-container {
  width: 100%;
  max-width: 780px;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 45px rgba(0,0,0,0.15);
}

/* ---------- Header ---------- */
.wf-header {
  background: #5b3a29;
  color: #fff;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.wf-instruction { font-size: 13px; font-weight: 600; max-width: 340px; }
.wf-instruction-short { display: none; }
.wf-header-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.wf-progress, .wf-score, .wf-life { font-size: 13px; font-weight: 700; }
.wf-home-btn {
  background: #2ecc71; color: #fff; border: none; border-radius: 20px; padding: 6px 16px;
  font-size: 12px; font-weight: 700; cursor: pointer;
}

/* ---------- Scene (wood texture, per screen reference) ---------- */
.wf-scene {
  position: relative;
  min-height: 460px;
  background: repeating-linear-gradient(180deg, #c98d5c 0px, #c98d5c 38px, #bd7f4d 38px, #bd7f4d 40px);
  padding: 24px 18px 30px;
}

.wf-loading, .wf-warning {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; gap: 14px; color: #3a2a1a;
}
.wf-spinner {
  width: 36px; height: 36px; border: 4px solid #f2d9bd; border-top-color: #5b3a29;
  border-radius: 50%; animation: wf-spin 0.8s linear infinite;
}
@keyframes wf-spin { to { transform: rotate(360deg); } }
.wf-warning-icon { font-size: 40px; }

/* ---------- Clue ---------- */
.wf-clue {
  text-align: center;
  background: #fff8ee;
  border: 2px dashed #a8672f;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 700;
  color: #5b3a29;
  max-width: 560px;
  margin: 0 auto 22px;
}

/* ---------- Word row ---------- */
.wf-word-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.wf-word {
  display: flex;
  gap: 6px;
}
.wf-word-base .wf-letter-box,
.wf-word-base { display: flex; gap: 6px; }
.wf-arrow { font-size: 26px; color: #fff; font-weight: 900; }

.wf-word-base {
  background: #ffffffcc;
  border-radius: 10px;
  padding: 6px 10px;
}
.wf-word-base::before { content: none; }

.wf-letter-box {
  width: 46px; height: 54px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 900;
  border-radius: 8px;
  background: #fff;
  color: #5b3a29;
  border: 2px solid #a8672f;
}
.wf-word-base .wf-letter-box { border-color: transparent; background: transparent; }

.wf-blank {
  background: #fff3d6;
  border: 3px dashed #e08a1f;
  cursor: pointer;
  color: #e08a1f;
  transition: transform .12s ease;
}
.wf-blank.wf-filled {
  background: #fff;
  border-style: solid;
  color: #1c8f4f;
  animation: wf-pop .18s ease;
}
@keyframes wf-pop { from { transform: scale(0.7); } to { transform: scale(1); } }

/* ---------- Feedback ---------- */
.wf-feedback {
  text-align: center;
  font-weight: 800;
  font-size: 15px;
  padding: 8px 14px;
  border-radius: 10px;
  max-width: 320px;
  margin: 0 auto 16px;
}
.wf-feedback-correct { background: #d7f5df; color: #1c8f4f; }
.wf-feedback-wrong { background: #fde2e2; color: #c0392b; }

/* ---------- Letter tray ---------- */
.wf-letters-label {
  text-align: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.wf-letters {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.wf-letter-tile {
  width: 52px; height: 58px;
  font-size: 24px; font-weight: 900;
  color: #5b3a29;
  background: #ffe9c2;
  border: 3px solid #a8672f;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 0 #8a5323;
  transition: transform .08s ease, box-shadow .08s ease;
}
.wf-letter-tile:active { transform: translateY(2px); box-shadow: 0 2px 0 #8a5323; }
.wf-letter-tile:disabled,
.wf-letter-tile.wf-tile-used {
  opacity: .35;
  cursor: default;
  box-shadow: none;
  transform: translateY(4px);
}

/* ---------- Bird check button ---------- */
.wf-bird-wrap { display: flex; justify-content: center; }
.wf-bird-btn {
  display: flex; align-items: center; gap: 10px;
  background: #2ecc71; color: #fff; border: none; border-radius: 30px;
  padding: 12px 26px; font-size: 15px; font-weight: 800; cursor: pointer;
  box-shadow: 0 5px 0 #1f9c56;
}
.wf-bird-btn:disabled { background: #b7c4bd; box-shadow: 0 5px 0 #93a09a; cursor: not-allowed; }
.wf-bird-emoji { font-size: 22px; }

/* ---------- Result screen ---------- */
.wf-result {
  min-height: 460px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; color: #fff; gap: 8px; padding: 20px;
}
.wf-result-icon { font-size: 56px; }
.wf-result h2 { margin: 0; font-size: 24px; }
.wf-result p { margin: 0 0 12px; font-size: 14px; opacity: .9; }
.wf-result-stats { display: flex; gap: 24px; margin-bottom: 18px; }
.wf-result-stats div { display: flex; flex-direction: column; align-items: center; }
.wf-result-stats span { font-size: 22px; font-weight: 800; }
.wf-result-stats small { font-size: 11px; opacity: .85; }
.wf-result-actions { display: flex; gap: 12px; }

.wf-btn {
  border: none; border-radius: 22px; padding: 10px 22px; font-size: 13px; font-weight: 800;
  cursor: pointer; text-decoration: none; display: inline-block;
}
.wf-btn-primary { background: #2ecc71; color: #fff; }
.wf-btn-secondary { background: #fff; color: #5b3a29; }

/* ---------- Home confirm modal ---------- */
.wf-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.wf-modal {
  background: #fff; border-radius: 14px; padding: 24px; max-width: 320px; text-align: center;
}
.wf-modal p { margin: 0 0 16px; font-weight: 700; color: #333; }
.wf-modal-actions { display: flex; gap: 10px; justify-content: center; }
.wf-modal .wf-btn-primary { background: #2ecc71; }
.wf-modal .wf-btn-secondary { background: #eee; color: #333; }

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .wf-instruction-long { display: none; }
  .wf-instruction-short { display: inline; }
  .wf-letter-box { width: 38px; height: 46px; font-size: 21px; }
  .wf-letter-tile { width: 44px; height: 50px; font-size: 20px; }
}
