/* 글쓰기 보드, 브러시 툴바 및 알림 모달 스타일 */

/* 캔버스 화면 레이아웃 */
.arena-container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  align-items: flex-start;
  max-width: 950px;
  width: 100%;
  margin: 0 auto;
  padding: 10px 0;
}

/* 왼쪽 학습 글자 및 정보 카드 */
.letter-info-panel {
  flex: 1 1 280px;
  max-width: 320px;
  background: white;
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.06);
  border: 4px solid var(--lego-yellow);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.info-illustration-box {
  width: 120px;
  height: 120px;
  background: var(--bg-pastel-blue);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
  border: 3px dashed var(--lego-blue);
}

.info-title {
  font-size: 38px;
  color: var(--text-dark);
  margin-bottom: 5px;
}

.info-name {
  font-size: 20px;
  color: var(--lego-blue-dark);
  background: var(--bg-pastel-blue);
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 15px;
}

.info-desc {
  font-size: 16px;
  color: var(--text-light);
  line-height: 1.5;
  margin-bottom: 20px;
}

.btn-tts {
  background: #a855f7;
  color: white;
  border: none;
  font-family: var(--font-kids);
  font-size: 18px;
  padding: 10px 20px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 0 #7e22ce;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.btn-tts:active {
  transform: translateY(4px);
  box-shadow: none;
}

.btn-guide {
  background: var(--lego-blue);
  color: white;
  border: none;
  font-family: var(--font-kids);
  font-size: 18px;
  padding: 10px 20px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--lego-blue-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-guide.active {
  background: #0f172a;
  box-shadow: 0 4px 0 #020617;
}

.btn-guide:active {
  transform: translateY(4px);
  box-shadow: none;
}

/* 캔버스 칠판 플레이트 */
.canvas-wrapper {
  position: relative;
  background: white;
  border-radius: 28px;
  border: 10px solid #475569; /* 아스팔트 회색 테두리 */
  box-shadow: 0 12px 24px rgba(0,0,0,0.15), inset 0 4px 0 rgba(255,255,255,0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1 1 500px;
  max-width: 580px;
  aspect-ratio: 1 / 1;
}

#draw-canvas {
  background-color: #ffffff;
  border-radius: 18px;
  cursor: crosshair;
  touch-action: none; /* 브라우저 터치 줌/스크롤 제어 차단 */
}

/* 하단 툴바 */
.toolbar-container {
  flex: 1 1 100%;
  background: white;
  border-radius: 24px;
  padding: 15px 25px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.06);
  border: 3px solid #cbd5e1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  max-width: 950px;
  width: 100%;
  margin: auto;
}

/* 색상 피커 그룹 */
.color-picker-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.color-dot {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform 0.15s;
}

.color-dot:hover {
  transform: scale(1.15);
}

.color-dot.active {
  transform: scale(1.15);
  border-color: #1e293b;
}

.color-dot.rainbow {
  background: linear-gradient(to right, red, orange, yellow, green, blue, purple);
}

.brush-size-control {
  flex: 0 1 210px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 8px;
  min-width: 190px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 8px 10px;
}

.brush-size-label,
.brush-size-text {
  color: var(--text-dark);
  font-size: 15px;
  white-space: nowrap;
}

.brush-size-text {
  min-width: 42px;
  text-align: center;
  color: var(--text-light);
}

.brush-size-slider {
  width: 100%;
  min-width: 82px;
  accent-color: var(--lego-blue);
  cursor: pointer;
}

.brush-size-preview {
  width: 24px;
  height: 24px;
  min-width: 14px;
  min-height: 14px;
  max-width: 36px;
  max-height: 36px;
  border-radius: 50%;
  background: var(--lego-red);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.35), 0 2px 5px rgba(0,0,0,0.15);
}

/* 제어 버튼 그룹 */
.control-btn-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.practice-progress {
  flex: 1 1 220px;
  min-width: 220px;
  max-width: 320px;
}

.practice-progress-track {
  width: 100%;
  height: 14px;
  background: #e2e8f0;
  border: 2px solid #cbd5e1;
  border-radius: 999px;
  overflow: hidden;
}

.practice-progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--lego-green), var(--lego-yellow));
  border-radius: inherit;
  transition: width 0.18s ease;
}

.practice-progress-label {
  margin-top: 5px;
  color: var(--text-light);
  font-size: 15px;
  text-align: center;
  line-height: 1.25;
}

.btn-control {
  background: #e2e8f0;
  border: none;
  font-family: var(--font-kids);
  font-size: 16px;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 0 #cbd5e1;
  transition: transform 0.1s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-control:active {
  transform: translateY(4px);
  box-shadow: none;
}

.btn-control.active {
  background: #cbd5e1;
  box-shadow: inset 0 3px 5px rgba(0,0,0,0.15);
}

.btn-control.clear {
  background: var(--lego-yellow);
  box-shadow: 0 4px 0 var(--lego-yellow-dark);
}

.btn-control.clear:active {
  transform: translateY(4px);
  box-shadow: none;
}

.btn-done {
  background: var(--lego-green);
  color: white;
  border: none;
  font-family: var(--font-kids);
  font-size: 24px;
  padding: 12px 30px;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--lego-green-dark);
  transition: transform 0.1s;
}

.btn-done:disabled {
  background: #cbd5e1;
  color: #64748b;
  cursor: not-allowed;
  box-shadow: 0 6px 0 #94a3b8;
  transform: none;
}

.btn-done:disabled:hover,
.btn-done:disabled:active {
  transform: none;
  box-shadow: 0 6px 0 #94a3b8;
}

.btn-done:active {
  transform: translateY(6px);
  box-shadow: none;
}

/* 성공 보상 리워드 모달 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.reward-modal-card {
  background: white;
  width: 90%;
  max-width: 420px;
  border-radius: 32px;
  padding: 30px;
  text-align: center;
  border: 8px solid var(--lego-yellow);
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  transform: scale(0.8);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .reward-modal-card {
  transform: scale(1);
}

.stamp-box {
  position: relative;
  width: 130px;
  height: 130px;
  margin: 15px auto;
}

.stamp-badge {
  width: 100%;
  height: 100%;
  background: #ef4444;
  border-radius: 50%;
  color: white;
  font-size: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  transform: rotate(-12deg) scale(0.1);
  opacity: 0;
  box-shadow: 0 6px 12px rgba(239, 68, 68, 0.3);
  border: 4px dashed white;
}

@keyframes stampImpact {
  0% { transform: rotate(-50deg) scale(3); opacity: 0; }
  80% { transform: rotate(-10deg) scale(0.9); opacity: 1; }
  100% { transform: rotate(-12deg) scale(1.0); opacity: 1; }
}

.modal-overlay.active .stamp-badge {
  animation: stampImpact 0.4s 0.2s forwards cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

.reward-stars {
  font-size: 38px;
  color: var(--lego-yellow);
  margin: 15px 0;
}

.reward-unlocked-item {
  background: var(--bg-pastel-blue);
  border: 3px dashed var(--lego-blue);
  border-radius: 18px;
  padding: 15px;
  margin: 15px 0;
}

.reward-unlocked-icon {
  font-size: 55px;
  margin-bottom: 5px;
}

.reward-unlocked-name {
  font-size: 16px;
  color: var(--text-dark);
}

.btn-next {
  background: var(--lego-blue);
  color: white;
  border: none;
  font-family: var(--font-kids);
  font-size: 22px;
  padding: 12px 35px;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--lego-blue-dark);
  transition: transform 0.1s;
}

.btn-next:active {
  transform: translateY(6px);
  box-shadow: none;
}

@media (max-width: 760px) {
  .arena-container {
    gap: 12px;
  }

  .letter-info-panel {
    flex: 1 1 100%;
    max-width: 100%;
    padding: 14px;
    border-radius: 18px;
    display: grid;
    grid-template-columns: 76px 1fr;
    column-gap: 12px;
    align-items: center;
    text-align: left;
  }

  .info-illustration-box {
    width: 76px;
    height: 76px;
    grid-row: span 4;
    margin: 0;
  }

  .info-title {
    font-size: 31px;
    margin: 0;
  }

  .info-name {
    width: fit-content;
    margin-bottom: 4px;
    font-size: 17px;
  }

  .info-desc {
    margin-bottom: 8px;
    font-size: 14px;
  }

  .btn-tts,
  .btn-guide {
    width: 100%;
    justify-content: center;
    font-size: 16px;
    padding: 9px 12px;
    margin-bottom: 0;
  }

  .canvas-wrapper {
    flex-basis: 100%;
    max-width: min(100%, 520px);
    border-width: 7px;
    border-radius: 20px;
  }

  #draw-canvas {
    border-radius: 13px;
  }

  .toolbar-container {
    padding: 12px;
    gap: 12px;
    border-radius: 18px;
  }

  .color-picker-group,
  .brush-size-control,
  .control-btn-group,
  .practice-progress,
  .btn-done {
    flex: 1 1 100%;
  }

  .color-picker-group {
    gap: 8px;
  }

  .color-dot {
    width: 36px;
    height: 36px;
  }

  .practice-progress {
    min-width: 0;
    max-width: none;
  }

  .brush-size-control {
    grid-template-columns: auto 1fr auto auto;
    min-width: 0;
  }

  .btn-done {
    font-size: 21px;
    padding: 12px 18px;
  }
}

@media (max-width: 420px) {
  .letter-info-panel {
    grid-template-columns: 62px 1fr;
  }

  .info-illustration-box {
    width: 62px;
    height: 62px;
  }

  .btn-tts,
  .btn-guide {
    grid-column: 1 / -1;
  }
}
