/* --- style.css ---
 * 역할: 메인 타자연습 페이지 스타일
 * 설명: 레이아웃, 게임/결과 화면, 로그인 UI 등 핵심 스타일
 */

@import url("animation-open.css");
@import url("animation-rank.css");
@import url("modal-history.css");
@import url("modal-notice.css");

* {
  font-family: 'NanumSquareNeo', 'Pretendard', 'Noto Sans KR', 'Roboto', 'Malgun Gothic', sans-serif;
  font-variant-numeric: tabular-nums;
}

:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --bg-color: #f0f2f5;
  --text-main: #333333;
  --text-muted: #666666;
  --card-bg: #ffffff;
  --border-color: #dddddd;
  --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.1);
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 60px 20px;
  box-sizing: border-box;
  background-color: var(--bg-color);
  color: var(--text-main);
}

h1 {
  margin-bottom: 30px;
  color: #333;
}


#js-disabled-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  z-index: 99999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: 'Pretendard', sans-serif;
  padding: 20px;
}

@media (scripting: none) {
  #js-disabled-overlay { display: flex !important; }
  #banner-container, .container, footer { display: none !important; }
  body { background: white !important; overflow: hidden !important; }
}


#top-banner {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 1;
  object-fit: cover;
  transition: opacity 0.3s ease-in-out;
}

#banner-container {
  display: none;
  position: relative;
  width: 100%;
  max-width: 800px;
  aspect-ratio: 5 / 1;
  margin-bottom: 40px;
  overflow: hidden;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.banner-pause-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 101;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: rgba(255, 255, 255, 0.6);
  border: none;
  border-radius: 50%;
  color: #333;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.banner-pause-btn:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: scale(1.1);
}

.banner-pause-btn svg {
  display: block;
}

@media (min-width: 768px) {
  #banner-container {
  display: block;
  }
}

#top-banner,
.banner-item {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.banner-item {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.banner-item.active {
  z-index: 100;
  opacity: 1;
  visibility: visible;
}

.container {
  width: 100%;
  max-width: 800px;
  padding: 2rem;
  box-sizing: border-box;
  background-color: white;
  text-align: center;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
}

footer {
  position: fixed;
  bottom: 0;
  z-index: 100;
  width: 100%;
  padding: 18px 0;
  background: #222;
  color: #fff;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 300;
  letter-spacing: -0.5px;
  line-height: 1.1;
}


.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
  opacity: 0;
  transform: translateY(10px);
  }
  to {
  opacity: 1;
  transform: translateY(0);
  }
}

/* --- 정보 바 (Info Bar) --- */
.info-bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 10px 20px;
  background: #eee;
  color: #555;
  font-weight: bold;
  border-radius: 8px;
}

.text-display {
  min-height: 60px;
  margin-bottom: 20px;
  padding: 20px;
  background-color: #fff8e1;
  color: #555;
  font-weight: 800;
  font-size: 24px;
  line-height: 1.6;
  text-align: center;
  border: 1px solid #ffe0b2;
  border-radius: 8px;
  word-break: keep-all;
}

.text-display span {
  position: relative;
  display: inline-block;
}

.text-display span.space-char {
  width: 6px;
}

.text-display span.space-char::after {
  content: "ˇ";
  position: absolute;
  bottom: -15px;
  left: 50%;
  opacity: 0.8;
  color: #aaa;
  font-weight: 900;
  font-size: 32px;
  transform: translateX(-50%);
}

.text-display span.space-char.incorrect::after {
  color: #e53935;
}

.guide-text {
  margin-top: 10px;
  color: #888;
  font-size: 14px;
}

.incorrect {
  color: #e53935;
  font-weight: bold;
  text-decoration: underline;
}

input[type="text"] {
  width: 100%;
  max-width: 300px;
  padding: 12px 16px;
  box-sizing: border-box;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-color);
}

.input-group {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-bottom: 15px;
}

.input-area {
  width: 100%;
  padding: 15px;
  box-sizing: border-box;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-family: 'Pretendard', sans-serif;
  font-size: 24px;
}

.input-area:focus {
  outline: none;
  border-color: var(--primary-color);
}

#login-screen button,
#game-screen button {
  padding: 0.75rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

#result-screen .result-box {
  display: inline-block;
  width: 100%;
  max-width: 400px;
  margin-top: 20px;
  font-size: 18px;
  line-height: 1.5;
  text-align: left;
}

#result-screen .datetime-display,
#result-screen .sentence-display,
#result-screen .env-display {
  margin-top: 5px;
  color: #666;
  font-size: 14px;
  line-height: 1;
  text-align: right;
}

#result-screen #save-status {
  margin-bottom: 15px;
  color: #1976d2;
  font-weight: bold;
}

#result-screen #rank-status {
  margin: -6px 0 14px;
  color: #555;
  font-size: 14px;
  font-weight: 700;
  transform-origin: center;
}

#result-screen button {
  padding: 10px 25px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 5px;
  font-family: 'Pretendard', sans-serif;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s;
}

#result-screen button:hover {
  background-color: var(--primary-hover);
}

#result-screen .btn-history {
  background-color: #7f8c8d;
}

#result-screen .btn-history:hover {
  background-color: #95a5a6;
}

.user-comment-section {
  display: none !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 0 !important;
  width: 400px !important;
  max-width: 100% !important;
  margin-top: 20px !important;
  margin-right: auto !important;
  margin-left: auto !important;
  padding: 0 5px !important;
  box-sizing: border-box !important;
}

.user-comment-section.active {
  display: flex !important;
}

.user-comment-section * {
  box-sizing: border-box !important;
}

.user-comment-section input {
  flex: 1 !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 10px 15px !important;
  border: 1px solid #ddd !important;
  border-right: none !important;
  border-radius: 5px 0 0 5px !important;
  font-size: 14px !important;
}

.user-comment-section button {
  flex: 0 0 90px !important;
  margin: 0 !important;
  padding: 10px 5px !important;
  background-color: var(--primary-color) !important;
  color: white !important;
  border: none !important;
  border-radius: 0 5px 5px 0 !important;
  font-size: 14px !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  transition: background 0.3s !important;
}

.user-comment-section button:hover {
  background-color: var(--primary-hover) !important;
}

#result-screen .action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 400px;
  margin-top: 20px;
  margin-right: auto;
  margin-left: auto;
  padding: 0 5px;
  box-sizing: border-box;
}

#result-screen .action-buttons button {
  flex: 1 1 120px;
  padding: 10px 5px;
  box-sizing: border-box;
  font-size: 14px;
  white-space: nowrap;
}

.spacer-bottom-20vh {
  padding-bottom: 20vh;
}

.privacy-notice-small {
  font-size: 0.6rem;
}


@media screen and (max-width: 480px) {
  body {
  padding: 40px 10px;
  }

  .container {
  padding: 1.5rem 1rem;
  border-radius: 8px;
  }

  .info-bar {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  justify-content: space-between !important;
  gap: 5px !important;
  padding: 10px 5px !important;
  }

  #user-display {
  flex: 0 0 100% !important;
  margin-bottom: 8px !important;
  padding-bottom: 8px !important;
  border-bottom: 1px solid #ddd;
  text-align: center !important;
  }

  .info-bar > span:not(#user-display) {
  flex: 1 1 auto !important;
  font-size: 12px !important;
  text-align: center !important;
  white-space: nowrap !important;
  }

  #result-screen .action-buttons {
  flex-direction: row;
  gap: 15px;
  }

  #result-screen button {
  width: auto;
  padding: 10px 15px;
  font-size: 14px;
  }

  .user-comment-section {
  width: 100% !important;
  gap: 5px !important;
  padding: 0 !important;
  flex-wrap: nowrap !important;
  }

  .user-comment-section input {
  padding: 8px 10px !important;
  font-size: 13px !important;
  }

  .user-comment-section button {
  padding: 8px 10px !important;
  font-size: 13px !important;
  }
}

@media screen and (max-width: 320px) {
  .user-comment-section {
  gap: 10px !important;
  flex-wrap: wrap !important;
  }

  .user-comment-section input,
  .user-comment-section button {
  flex: 0 0 100% !important;
  width: 100% !important;
  }
}

.admin-session-line {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 13px;
  color: #666;
}

.admin-sentence-label {
  color: #555;
}

.admin-sentence-change-btn {
  padding: 4px 8px;
  font-size: 12px;
  color: #fff;
  background-color: #546e7a;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.2;
}

.admin-sentence-change-btn:hover {
  background-color: #455a64;
}

.admin-sentence-editor {
  display: flex;
  flex-direction: column;
  flex-basis: 100%;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 6px;
}

.admin-sentence-editor[hidden] {
  display: none !important;
}

.admin-sentence-editor-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
}

.admin-sentence-editor-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.admin-sentence-editor .admin-sentence-input {
  width: 180px;
  max-width: 46vw;
  padding: 4px 8px;
  border: 1px solid #cfd8dc;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.2;
}

.admin-sentence-apply-btn,
.admin-sentence-cancel-btn {
  padding: 4px 8px;
  font-size: 12px;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.2;
}

.admin-sentence-apply-btn {
  background-color: #546e7a;
}

.admin-sentence-apply-btn:hover {
  background-color: #455a64;
}

.admin-sentence-cancel-btn {
  background-color: #8a8a8a;
}

.admin-sentence-cancel-btn:hover {
  background-color: #757575;
}

.admin-sentence-suggestion-list {
  display: flex;
  flex-direction: column;
  width: 100%;
  box-sizing: border-box;
  max-height: 120px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #cfd8dc;
  border-radius: 6px;
  background-color: #fff;
}

.admin-sentence-suggestion-list[hidden] {
  display: none !important;
}

.admin-sentence-suggestion-item {
  flex-shrink: 0;
  padding: 6px 8px;
  border: none;
  border-bottom: 1px solid #eceff1;
  background-color: #fff;
  color: #333;
  font-size: 12px;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}

.admin-sentence-suggestion-item:last-child {
  border-bottom: none;
}

.admin-sentence-suggestion-item:hover {
  background-color: #f5f7f8;
}

.admin-logout-btn {
  padding: 4px 8px;
  font-size: 12px;
  color: #fff;
  background-color: #546e7a;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.2;
}

.admin-logout-btn:hover {
  background-color: #455a64;
}