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

.co-bg {
  min-height: 100vh;
  background-color: #fff4d6;
  background-image: repeating-linear-gradient(45deg, rgba(255,193,7,0.12) 0px, rgba(255,193,7,0.12) 2px, transparent 2px, transparent 14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.co-container {
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 720px;
  overflow: hidden;
}

/* ---------- Header ---------- */
.co-header {
  background: #1b2a4b;
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.co-instruction { font-size: 14px; font-weight: 600; }
.co-life { font-size: 14px; font-weight: 700; background: rgba(255,255,255,0.12); padding: 6px 12px; border-radius: 10px; }
.co-life.low-life { background: #e74c3c; }
.co-home-btn {
  background: #2ecc71; color: #fff; text-decoration: none; font-size: 13px; font-weight: 700;
  padding: 8px 16px; border-radius: 10px;
}

.co-progress {
  display: flex; justify-content: space-between; padding: 10px 20px; font-size: 13px; font-weight: 600; color: #55606f;
  background: #f5f7fb;
}

/* ---------- Loading / Warning ---------- */
.co-loading, .co-warning {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; gap: 14px; color: #7a5c00;
}
.co-spinner {
  width: 36px; height: 36px; border: 4px solid #ffe6a1; border-top-color: #ff9f1c;
  border-radius: 50%; animation: co-spin 0.8s linear infinite;
}
@keyframes co-spin { to { transform: rotate(360deg); } }
.co-warning-icon { font-size: 40px; }

/* ---------- Board ---------- */
.co-board { padding: 18px 22px 26px; }
.co-help-text { text-align: center; font-size: 13px; color: #6b6b6b; margin: 0 0 14px; }

.co-object-area {
  background: #dfe9f5;
  border: 3px solid #fff;
  outline: 2px solid #b9cbe3;
  border-radius: 16px;
  padding: 18px;
  min-height: 110px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-content: center;
  justify-content: center;
}

.co-object {
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.co-object:hover { transform: scale(1.08); }
.co-object.placed { opacity: 0; pointer-events: none; width: 0; height: 0; overflow: hidden; margin: 0; }

.co-divider { height: 2px; background: #eee; margin: 18px 0; border-radius: 2px; }

.co-boxes-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }

.co-boxes {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  max-width: 560px;
  width: 100%;
}

.co-box {
  aspect-ratio: 1 / 1;
  background: #eaf2ff;
  border: 2px solid #4a6fa5;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.co-box.filled { cursor: pointer; background: #fff; border-color: #2ecc71; }
.co-box svg { width: 70%; height: 70%; }

.co-clear-btn {
  background: none; border: none; color: #5b8def; font-size: 12px; font-weight: 700; cursor: pointer;
  text-decoration: underline; padding: 4px;
}

.co-answers {
  display: flex; justify-content: center; gap: 14px; margin: 22px 0 14px; flex-wrap: wrap;
}
.co-answer-btn {
  background: #ffd166; border: 3px solid #ffb703; border-radius: 14px; padding: 14px 26px;
  font-size: 22px; font-weight: 800; color: #6b4400; cursor: pointer; min-width: 72px;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.co-answer-btn:hover { transform: translateY(-2px); }
.co-answer-btn.selected { background: #5b8def; border-color: #3f6fd8; color: #fff; }
.co-answer-btn.correct { background: #2ecc71; border-color: #23a35e; color: #fff; }
.co-answer-btn.incorrect { background: #e74c3c; border-color: #c0392b; color: #fff; animation: co-shake 0.4s; }
.co-answer-btn:disabled { cursor: default; }
@keyframes co-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.co-feedback {
  text-align: center; font-size: 15px; font-weight: 700; padding: 10px; border-radius: 10px; margin-bottom: 14px;
}
.co-feedback-correct { background: #e6f9ee; color: #1e8449; }
.co-feedback-incorrect { background: #fdecea; color: #c0392b; }

.co-actions { display: flex; justify-content: center; }
.co-btn {
  border: none; border-radius: 12px; padding: 13px 30px; font-size: 15px; font-weight: 700;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: transform 0.15s, opacity 0.15s;
  text-decoration: none;
}
.co-btn:hover { transform: translateY(-2px); }
.co-btn-submit { background: #2ecc71; color: #fff; }
.co-btn-submit:disabled { opacity: 0.5; cursor: default; transform: none; }
.co-btn-home { background: #5b8def; color: #fff; }

/* ---------- Result screen ---------- */
.co-result {
  text-align: center; padding: 50px 30px;
}
.co-result-icon { font-size: 56px; margin-bottom: 8px; }
.co-result h2 { margin: 0 0 8px; color: #2f3542; }
.co-result p { color: #6b6b6b; margin: 0 0 20px; }
.co-result-stats { display: flex; justify-content: center; gap: 30px; margin-bottom: 26px; }
.co-result-stats span { display: block; font-size: 26px; font-weight: 800; color: #ff9f1c; }
.co-result-stats small { color: #999; font-size: 12px; }
.co-result-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .co-bg { padding: 10px; }
  .co-container { border-radius: 16px; }
  .co-header { padding: 10px 12px; }
  .co-instruction { font-size: 12px; flex-basis: 100%; text-align: center; order: 1; }
  .co-life { font-size: 12px; order: 2; }
  .co-home-btn { font-size: 11px; padding: 6px 12px; order: 3; }

  .co-board { padding: 12px 12px 20px; }
  .co-object-area { padding: 12px; min-height: 90px; gap: 6px; }
  .co-boxes { grid-template-columns: repeat(10, 1fr); gap: 4px; }
  .co-answer-btn { font-size: 17px; padding: 11px 18px; min-width: 56px; }
  .co-btn { width: 100%; justify-content: center; }
  .co-result-stats { gap: 18px; }
}

@media (max-width: 380px) {
  .co-boxes { grid-template-columns: repeat(10, 1fr); gap: 3px; }
  .co-answer-btn { font-size: 15px; padding: 9px 14px; min-width: 48px; }
}
