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

.ms-outer { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.ms-container {
  width: 100%; max-width: 780px; background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 18px 45px rgba(0,0,0,0.15);
}

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

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

.ms-board { min-height: 420px; padding: 26px 18px 30px; background: linear-gradient(180deg, #f4effc 0%, #ffffff 100%); }

.ms-clue { text-align: center; font-size: 13px; font-weight: 700; color: #6c3fc9; margin-bottom: 14px; }

.ms-slots { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 18px; min-height: 54px; }
.ms-slot {
  min-width: 70px; height: 48px; padding: 0 10px;
  display: flex; align-items: center; justify-content: center;
  border: 3px dashed #b79ce8; border-radius: 10px;
  font-size: 16px; font-weight: 800; color: #4a2c8c;
  background: #faf7ff; cursor: pointer;
}
.ms-slot-filled { border-style: solid; background: #fff; cursor: pointer; }

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

.ms-tray-label { text-align: center; color: #6c3fc9; font-weight: 700; font-size: 13px; margin-bottom: 10px; }
.ms-tray { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 24px; }
.ms-word-tile {
  padding: 10px 16px; font-size: 15px; font-weight: 800; color: #4a2c8c;
  background: #ede4fb; border: 3px solid #a479e0; border-radius: 10px; cursor: pointer;
  box-shadow: 0 4px 0 #7d54bb;
}
.ms-word-tile:active { transform: translateY(2px); box-shadow: 0 2px 0 #7d54bb; }
.ms-word-tile:disabled, .ms-tile-used { opacity: .35; cursor: default; box-shadow: none; transform: translateY(4px); }

.ms-submit-wrap { display: flex; justify-content: center; }
.ms-submit-btn {
  background: #2ecc71; color: #fff; border: none; border-radius: 30px; padding: 12px 30px;
  font-size: 15px; font-weight: 800; cursor: pointer; box-shadow: 0 5px 0 #1f9c56;
}
.ms-submit-btn:disabled { background: #b7c4bd; box-shadow: 0 5px 0 #93a09a; cursor: not-allowed; }

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

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

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