body {
  font-family: 'Noto Sans KR', sans-serif;
  background-color: #f5f5f5;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 30px 10px;
}

.container {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  background-color: #ffffff;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.game-title {
  margin-top: 10px;
  text-align: center;
}

h1 {
  font-family: "Roboto Slab", serif;
  font-size: 36px;
  font-weight: 400;
  line-height: 1.4;
  margin: 0 0 1em 0;
  text-align: center;
  color: #151515;
   
}

.history-btn {
  margin-left: 8px;
  font-size: 12px;
  padding: 3px 6px;
  background-color: #eee;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.history-btn:hover {
  background-color: #ccc;
}

/* 카드 영역 */
.card-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 30px 0;
}

.card-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 10px;
  color: #444;
}

.card-box {
  width: 120px;
  height: 160px;
  border: 2px solid #999;
  border-radius: 12px;
  font-size: 64px;
  font-weight: bold;
  color: #222;
  background-color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 2px 4px 8px rgba(0,0,0,0.2);
}

/* 확률 */
#probability {
  font-size: 16px;
  margin: 10px 0 20px;
  text-align: center;
}

/* 점수 결과 */
#result {
  margin-top: 1.5em;
  font-size: 18px;
  color: #d32f2f;
  text-align: center;
}

#result div {
  text-align: center;
}

/* 버튼들 */
.buttons {
  display: flex;
  justify-content: space-between;
  gap: 2%;
  flex-wrap: nowrap;
  margin-top: 15px;
}

.buttons button {
  width: 32%;
  padding: 12px 8px;
  font-size: 15px;
  font-weight: 600;
  background-color: #FF944D;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: normal;             /* ✅ 줄바꿈 허용 */
  word-break: keep-all;            /* ✅ 영어 줄내림 시 단어 단위 유지 */
  text-align: center;
  line-height: 1.2;
  height: auto;                    /* ✅ 높이 자동 조정 */
  min-height: 45px;                /* ✅ 터치 가능성 유지 */
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.game-button {
  flex: 1;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background-color: #FF944D;
  color: #fff;
  transition: background-color 0.2s ease, transform 0.2s ease;
  min-width: 120px;
}

.buttons button:hover,
.game-button:hover {
  background-color: #FF6F00;
  transform: scale(1.03);
}

/* restart 버튼은 숨기되, 재시작 시 활성화 */
#restart-btn {
  display: none;
  margin-top: 15px;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background-color: #4CAF50;  /* ✅ 초록색 */
  color: white;
  transition: background-color 0.2s ease, transform 0.2s ease;
  min-width: 140px;
}

#restart-btn:hover {
  background-color: #388E3C;  /* ✅ 더 진한 초록 hover */
  transform: scale(1.03);
}

/* 랭킹 제출 폼 */
#submit-form {
  background-color: #f8f9fa;
  border: 1px solid #ccc;
  padding: 20px 25px;
  border-radius: 10px;
  max-width: 500px;
  margin: 30px auto 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  text-align: center;
}

#submit-form input[type="text"] {
  width: 100%;
  padding: 12px;
  margin: 10px 0;
  font-size: 16px;
  border: 1px solid #bbb;
  border-radius: 6px;
  box-sizing: border-box;
}

/* 버튼 그룹 */
.form-buttons {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* 이긴 카드 기록 */
#history h2 {
  margin-top: 2em;
  font-size: 20px;
  font-weight: bold;
  text-align: center;
}

#card-history {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}

.card-item {
  background-color: #f1f1f1;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 15px;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.1);
}

/* 게임 규칙 */
.game-rules {
  background-color: #f5f7fa;
  border: 1px solid #d1d9e6;
  padding: 15px;
  border-radius: 8px;
  margin-top: 30px;
  font-size: 15px;
  line-height: 1.6;
  color: #333;
}

/* 랭킹 박스 */
#ranking {
  background-color: #fff7e6;
  border: 1px solid #ffd591;
  padding: 15px 20px;
  border-radius: 8px;
  margin-top: 30px;
  font-size: 15px;
  line-height: 1.5;
  color: #333;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

#ranking-list {
  list-style-type: none;
  padding-left: 0;
}

#ranking h2 {
  text-align: center;
  font-size: 20px;
  font-weight: bold;
  white-space: nowrap; /* ✅ 줄바꿈 방지 */
  margin-bottom: 14px;
  color: #d46b08; /* 진한 주황 */
}

.card-item.lose {
  background-color: #f44336;  /* 빨간색 */
  color: white;
  border-radius: 6px;
  padding: 2px 6px;
  margin: 2px;
  display: inline-block;
}

.card-item.stop {
  background-color: #e6ffe6;
  border: 1px solid #66cc66;
  color: #267326;
  font-weight: bold;
}

.card {
  width: 60px;
  height: 90px;
  border-radius: 8px;
  text-align: center;
  line-height: 90px;
  font-weight: bold;
  font-size: 24px;
  background-color: #ffffff;
  border: 2px solid #333;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
}

.card.small {
  width: 40px;
  height: 60px;
  font-size: 16px;
  line-height: 60px;
  opacity: 0.4;
  background-color: #eee;
  border: 1px solid #aaa;
  border-radius: 6px;
  text-align: center;
}

.loss-card {
  background-color: #ffe6e6;
  border: 1px solid #ff5c5c;
  color: #b30000;
  font-weight: bold;
}

/* 버튼 줄별 구분 */
.top-buttons button,
.bottom-buttons button {
  width: 48%;
}

/* Skip 버튼 파란색 */
#skip-btn {
  background-color: #2196F3;
  color: white;
}
#skip-btn:hover {
  background-color: #1976D2;
  transform: scale(1.03);
}

.card-item.skip {
  background-color: #e3f2fd;
  color: #1565c0;
  border: 1px solid #64b5f6;
  font-weight: bold;
}

#stop-btn {
  background-color: #2e7d32;
  color: white;
}
#stop-btn:hover {
  background-color: #1b5e20;
  transform: scale(1.03);
}

@keyframes fadeZoomIn {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.ending-image {
  animation: fadeZoomIn 0.6s ease-out;
}

.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.popup-content {
  background: #fff;
  padding: 20px 40px;
  border-radius: 12px;
  text-align: center;
  max-width: 500px;
  margin: 0 20px;
  max-height: 80%;
  overflow-y: auto;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  font-family: 'Noto Sans KR', sans-serif;
}

.popup-close-btn {
  margin-top: 12px;
  padding: 8px 20px;
  background: #3498db;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

#popup-history-text {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 10px 0;
  box-sizing: border-box;
}

#popup-history-text .card-item {
  background: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 12px;
  padding: 4px 8px;
  min-width: 36px;
  text-align: center;
  font-family: monospace;
  box-sizing: border-box;
}



.card-item.skip {
  background: #d9ecff;
  color: #0366d6;
  font-weight: bold;
}

.card-item.stop {
  background: #e7fce7;
  color: #2e7d32;
  font-weight: bold;
}

.card-item.loss {
  background: #ffe3e3;
  color: #d32f2f;
  font-weight: bold;
}

@media (max-width: 600px) {
  #popup-history-text .card-item {
    font-size: 11px;
    padding: 3px 6px;
    min-width: 30px;
  }
}


.top-bar {
  display: flex;
  justify-content: space-between;  /* 왼쪽, 오른쪽 정렬 */
  align-items: center;
  padding: 6px 8px;
  font-family: 'Arial', sans-serif;
  font-size: 14px;
  flex-wrap: wrap;
}

/* 왼쪽 그룹 (mode-select) */
.mode-select {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
}

/* 오른쪽 그룹 (language-select) */
.language-select {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: normal;
}