* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e7eaef;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  color: #2f3640;
}

/* 메인 카드 */
.card {
  width: min(900px, 96vw);
  padding: 28px 30px 20px;
  border-radius: 32px;
  background: #e7eaef;
  box-shadow:
    18px 18px 36px #c3c7cf,
    -18px -18px 36px #ffffff;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: 0.25s ease;
}

/* 헤더 */
.top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #e7eaef;
  box-shadow:
    inset 2px 2px 4px #cdd0d8,
    inset -2px -2px 4px #ffffff;
}

.badge-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #f9737a;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  box-shadow:
    4px 4px 8px rgba(0,0,0,0.12),
    -2px -2px 6px rgba(255,255,255,0.9);
}

.badge-link {
  text-decoration: none;
  color: inherit;
  display: inline-block;
}


.badge-text {
  display: flex;
  flex-direction: column;
  font-size: 12px;
}
.badge-text span:first-child { color: #7b8190; }
.badge-text span:last-child  { font-weight: 600; }

.mode-pill {
  padding: 6px 14px;
  border-radius: 999px;
  background: #e7eaef;
  box-shadow:
    inset 2px 2px 4px #cdd0d8,
    inset -2px -2px 4px #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #737b8c;
  white-space: nowrap;
  border: none;
  outline: none;
  cursor: pointer;
}

.mode-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,0.3);
}



.mode-pill:active {
  transform: translateY(1px);
  box-shadow:
    inset 2px 2px 4px #cdd0d8,
    inset -2px -2px 4px #ffffff;
}


/* 문장 카드 */
.sentence-card {
  margin-top: 4px;
  border-radius: 26px;
  padding: 30px 32px 22px;
  background: #e7eaef;
  box-shadow:
    inset 2px 2px 4px #cdd0d8,
    inset -2px -2px 4px #ffffff;
}

.sentence-line {
  font-size: 20px;
  line-height: 1.9;
  text-align: center;
  white-space: pre-wrap;
  color: #3a4250;
  margin-bottom: 14px;
}

.sentence-prefix,
.sentence-suffix {
  vertical-align: middle;
}

/* 답 박스 */
.answer-pill {
  display: inline-flex;
  min-width: 260px;
  padding: 10px 20px;
  margin: 0 8px;
  border-radius: 24px;
  background: #e7eaef;
  box-shadow:
    6px 6px 12px #c3c7cf,
    -6px -6px 12px #ffffff;
  justify-content: center;
  align-items: center;
}

.answer-visual-inner {
  display: inline-flex;
  align-items: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 24px;
  letter-spacing: 0.18em;
  white-space: pre;
}

#patternBefore {
  white-space: pre;
  color: #2f3640;
  font-weight: 600;
}

#patternAfter {
  white-space: pre;
  color: #c2c6d0;
  font-weight: 500;
}

#caret {
  margin-left: 4px;
  color: #ff7c93;
  font-size: 22px;
  animation: blink 0.9s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.meaning {
  font-size: 14px;
  color: #7a8190;
  text-align: center;
  margin-top: 4px;
}

/* 입력 영역 */
.bottom-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}

.input-shell {
  border-radius: 999px;
  background: #e7eaef;
  padding: 2px;
  box-shadow:
    inset 2px 2px 4px #cdd0d8,
    inset -2px -2px 4px #ffffff;
}

.input-inner {
  display: flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 14px;
  background: #e7eaef;
  box-shadow:
    4px 4px 8px #c3c7cf,
    -4px -4px 8px #ffffff;
}

.prompt-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 10px;
  background: radial-gradient(circle at 30% 30%, #ffe4ea, #ff7c93);
  box-shadow:
    3px 3px 6px rgba(0,0,0,0.15),
    -2px -2px 4px rgba(255,255,255,0.9);
  flex-shrink: 0;
}

#answerInput {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  padding: 6px 2px;
  font-family: inherit;
  color: #2f3640;
}

#answerInput::placeholder {
  color: #a3a9b8;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  background: #e7eaef;
  font-size: 13px;
  color: #2f3640;
  cursor: pointer;
  box-shadow:
    6px 6px 12px #c3c7cf,
    -6px -6px 12px #ffffff;
}

.btn:active {
  box-shadow:
    inset 3px 3px 6px #c3c7cf,
    inset -3px -3px 6px #ffffff;
  transform: translateY(1px);
}

/* 상태 + 메타 */
.status {
  font-size: 13px;
  min-height: 20px;
  text-align: center;
  margin-top: 6px;
  color: #7a8190;
}
.status.correct { color: #22a857; }
.status.wrong   { color: #e63946; }

.meta {
  margin-top: 4px;
  font-size: 11px;
  color: #8c92a0;
  display: flex;
  justify-content: space-between;
}

/* 애니메이션 */
.card.flash {
  animation: flash 0.35s ease-out;
}
@keyframes flash {
  0% {
    box-shadow:
      0 0 0 2px rgba(68,214,120,0.6),
      18px 18px 36px #c3c7cf,
      -18px -18px 36px #ffffff;
  }
  100% {
    box-shadow:
      18px 18px 36px #c3c7cf,
      -18px -18px 36px #ffffff;
  }
}

.card.shake {
  animation: shake 0.25s ease-in-out;
}
@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  50% { transform: translateX(2px); }
  75% { transform: translateX(-1px); }
  100% { transform: translateX(0); }
}

/* ---------------------------
   반응형 (태블릿)
---------------------------- */
@media (max-width: 768px) {
  .card {
    width: 100vw;
    min-height: 100vh;
    border-radius: 0;
    padding: 20px 16px 24px;
    box-shadow: none;
  }

  .top-row {
    flex-direction: row;
    align-items: center;
  }

  .sentence-card {
    padding: 22px 16px 18px;
  }

  .sentence-line {
    font-size: 18px;
    line-height: 1.7;
  }

  .answer-visual-inner {
    font-size: 20px;
    letter-spacing: 0.16em;
  }

  .bottom-row {
    grid-template-columns: 1fr;
  }

  .btn {
    width: 100%;
    text-align: center;
  }
}

/* ---------------------------
   반응형 (휴대폰)
---------------------------- */
@media (max-width: 480px) {
  body {
    align-items: stretch;
    justify-content: stretch;
  }

  .card {
    padding: 18px 12px 20px;
  }

  .badge-text {
    font-size: 11px;
  }

  .sentence-card {
    padding: 18px 12px 16px;
  }

  .sentence-line {
    font-size: 16px;
  }

  .answer-pill {
    min-width: 0;
    padding: 8px 12px;
    margin: 0 4px;
  }

  .answer-visual-inner {
    font-size: 18px;
    letter-spacing: 0.12em;
  }

  .meaning {
    font-size: 13px;
  }

  .input-inner {
    padding: 6px 10px;
  }

  #answerInput {
    font-size: 14px;
  }

  .meta {
    font-size: 10px;
  }
}
/* bottom-row 전체 레이아웃: PC에서는 가로 3열 */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr auto auto; 
  gap: 12px;
  align-items: center;
}

/* 버튼 공통 스타일 보정 */
.btn {
  padding: 10px 20px;
  font-size: 15px;
  white-space: nowrap;
}

/* 모바일에서는 자동으로 세로 정렬 */
@media (max-width: 600px) {
  .bottom-row {
    grid-template-columns: 1fr;
  }

  /* 버튼은 한 줄씩 */
  #enterBtn,
  #skipBtn {
    width: 100%;
  }
}

