/* =====================================================
   숫자 맞추기 게임 - 클린 카드 테마
   ===================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #f0f4f8;
  --card: #ffffff;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-active: #1d4ed8;
  --text: #1e293b;
  --text-sub: #64748b;
  --text-placeholder: #94a3b8;
  --border: #e2e8f0;
  --input-bg: #f8fafc;
  --red: #ef4444;
  --orange: #f97316;
  --green: #22c55e;
  --gold: #f59e0b;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans KR', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
}

/* =====================================================
   광고 배너
   ===================================================== */

.ad-banner {
  width: 100%;
  max-width: 728px;
  min-height: 90px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-top {
  margin-bottom: 20px;
}

.ad-bottom {
  margin-top: 20px;
}

/* =====================================================
   게임 카드
   ===================================================== */

.game-container {
  width: 100%;
  max-width: 420px;
  padding: 36px 32px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* =====================================================
   타이틀
   ===================================================== */

.game-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text);
  text-align: center;
  line-height: 1.3;
  letter-spacing: -0.5px;
}

.game-subtitle {
  font-size: 0.9rem;
  color: var(--text-sub);
  text-align: center;
  margin-top: -8px;
}

/* =====================================================
   시도 횟수
   ===================================================== */

.attempts-display {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  padding: 8px 18px;
  border-radius: 100px;
  font-size: 0.85rem;
}

.attempts-label {
  color: var(--text-sub);
  font-weight: 400;
}

.attempts-count {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

/* =====================================================
   입력 영역
   ===================================================== */

.input-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.guess-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--input-bg);
  color: var(--text);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: 10px;
  outline: none;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
  -moz-appearance: textfield;
}

.guess-input::-webkit-outer-spin-button,
.guess-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.guess-input::placeholder {
  color: var(--text-placeholder);
  font-weight: 400;
  font-size: 1rem;
}

.guess-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  background: #fff;
}

.guess-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--bg);
}

.submit-btn {
  width: 100%;
  padding: 14px 16px;
  background: var(--primary);
  color: #fff;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.submit-btn:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.submit-btn:active {
  background: var(--primary-active);
  transform: translateY(1px);
  box-shadow: none;
}

.submit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* =====================================================
   메시지 영역
   ===================================================== */

.message-area {
  width: 100%;
  min-height: 80px;
  padding: 16px 20px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.message-icon {
  font-size: 1.5rem;
  line-height: 1;
  min-height: 1.6rem;
}

.message-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-sub);
  font-weight: 400;
  word-break: keep-all;
}

.message-text.error {
  color: var(--red);
  font-weight: 600;
}

.message-text.hint-low {
  color: var(--orange);
  font-weight: 600;
}

.message-text.hint-high {
  color: var(--orange);
  font-weight: 600;
}

.message-text.win {
  color: var(--gold);
  font-size: 1.05rem;
  font-weight: 700;
}

.message-text.lose {
  color: var(--red);
  font-weight: 700;
}

/* =====================================================
   승리 애니메이션
   ===================================================== */

@keyframes win-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.message-area:has(.win) {
  background: #fffbeb;
  border-color: #fde68a;
  animation: win-pulse 1s ease-in-out infinite;
}

/* =====================================================
   다시 시작 버튼
   ===================================================== */

.restart-btn {
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  color: var(--text-sub);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.restart-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(59, 130, 246, 0.04);
}

.restart-btn:active {
  background: rgba(59, 130, 246, 0.08);
}

.hidden {
  display: none !important;
}

/* =====================================================
   반응형
   ===================================================== */

@media (max-width: 480px) {
  .game-container {
    padding: 28px 20px;
    border-radius: 12px;
  }

  .game-title {
    font-size: 1.3rem;
  }

  .guess-input {
    font-size: 1.1rem;
  }
}
