/* 구름 저 위로: 게임 페이지 뼈대 스타일 (design.html 시안의 색, 글자 크기, 배치를 따름) */

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: #0b130e;
  color: #e6eee4;
  /* 인터넷 글꼴 대신 컴퓨터에 있는 글꼴을 쓴다 */
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

h1, h2 {
  margin: 0;
  font-family: "Batang", "AppleMyungjo", "Noto Serif KR", serif;
  font-weight: 700;
  color: #f1ead0;
}

h2 { font-size: 22px; }

p { margin: 0; }

/* ── 맨 위 배너 ── */

#game-banner {
  position: relative;
  overflow: hidden;
  height: 112px;
  padding: 0 48px;
  background: #101c24;
  border-bottom: 1px solid #22372b;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.banner-art,
.slot-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#game-banner h1 {
  position: relative;
  font-size: 44px;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

#game-banner p {
  position: relative;
  font-size: 16px;
  line-height: 1.5;
  color: #c3d2c4;
}

/* ── 세 칸 배치 ── */

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 48px 48px;
}

.cols {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(280px, 330px);
  gap: 24px;
  align-items: start;
}

/* ── 왼쪽 칸: 게임 자리 ── */

#game-slot {
  position: relative;
  /* 컴퓨터 화면에서 스크롤 없이 다 보이도록, 화면 높이에서 배너와 위아래 여백을 뺀 만큼만 쓴다 */
  height: calc(100vh - 112px - 48px);
  max-height: 640px;
  min-height: 400px;
  aspect-ratio: 9 / 16;
  background: #0f1b22;
  border: 1px solid #2a4234;
  border-radius: 16px;
  overflow: hidden;
}

.slot-box {
  position: absolute;
  top: 50%;
  left: 11%;
  right: 11%;
  transform: translateY(-50%);
  padding: 28px 16px;
  border: 2px dashed #4f6f5c;
  border-radius: 12px;
  background: rgba(11, 19, 14, 0.72);
  text-align: center;
}

.slot-box p {
  font-size: 18px;
  line-height: 1.5;
  color: #dfe8dc;
}

/* ── 공통 카드 ── */

.card {
  background: #121f18;
  border: 1px solid #22372b;
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── 가운데 칸: 게임 소개 ── */

#game-about,
.score-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.about-text {
  font-size: 16px;
  line-height: 1.75;
  color: #c9d6ca;
}

.keys {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.key-row {
  flex: 1 1 200px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #0e1912;
  border-radius: 12px;
  font-size: 16px;
  color: #dfe8dc;
}

.key {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid #3c5a48;
  border-radius: 8px;
  color: #e6eee4;
}

.facts {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 16px;
}

.facts div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.facts dt {
  font-size: 13px;
  color: #9fb3a3;
}

.facts dd {
  margin: 0;
  font-size: 17px;
  color: #e6eee4;
}

/* ── 오른쪽 칸: 점수 올리기 ── */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 14px;
  color: #b7c7b9;
}

#nickname-input,
#score-input,
#comment-nickname,
#comment-input,
#admin-password {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid #3c5a48;
  border-radius: 10px;
  background: #0b130e;
  color: #e6eee4;
  font-family: inherit;
  font-size: 16px;
}

#nickname-input::placeholder,
#score-input::placeholder,
#comment-nickname::placeholder,
#comment-input::placeholder {
  color: #7f9585;
}

#score-submit,
#comment-submit,
#admin-load {
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  background: #8fca78;
  color: #0f1a12;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}

#score-submit:hover,
#comment-submit:hover,
#admin-load:hover { background: #a3d690; }

/* 저장하는 동안 버튼을 잠근다 */
#score-submit:disabled,
#comment-submit:disabled,
#admin-load:disabled {
  background: #4f6f5c;
  cursor: wait;
}

.score-message {
  min-height: 1.5em;
  font-size: 14px;
  line-height: 1.5;
  color: #b7c7b9;
}

.score-message.error { color: #f0b27a; }
.score-message.ok { color: #8fca78; }

/* ── 오른쪽 칸: 점수판 ── */

#scoreboard { gap: 12px; }

.board-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.board-head span {
  font-size: 13px;
  color: #9fb3a3;
}

#scoreboard ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#scoreboard li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #0e1912;
  border-radius: 10px;
  font-size: 16px;
}

.rank {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #2a4234;
  color: #e6eee4;
  font-size: 14px;
  font-weight: 700;
}

.rank.first {
  background: #ecd99a;
  color: #14201a;
}

/* 1등 순위 옆 왕관 */
.crown {
  flex: none;
  margin-left: -6px;
  font-size: 18px;
  line-height: 1;
}

.name {
  flex: 1 1 auto;
  min-width: 0;
  color: #e6eee4;
}

.points {
  color: #dfe8dc;
  font-variant-numeric: tabular-nums;
}

.points.first { color: #ecd99a; }

.board-empty {
  font-size: 14px;
  color: #9fb3a3;
}

.board-note {
  font-size: 12px;
  line-height: 1.5;
  color: #7f9585;
}

/* ── 맨 아래: 댓글 (세 칸과 같은 폭, 칸 사이와 같은 여백) ── */

#game-comments { margin-top: 24px; }

#comment-input {
  min-height: 92px;
  padding: 12px 14px;
  line-height: 1.6;
  resize: vertical;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.comment-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: #0e1912;
  border-radius: 10px;
}

.comment.pending {
  font-size: 14px;
  color: #9fb3a3;
}

.comment-name {
  font-size: 14px;
  font-weight: 700;
  color: #b7c7b9;
}

.comment-body {
  font-size: 16px;
  line-height: 1.6;
  color: #e6eee4;
  white-space: pre-wrap;
}

/* ── 관리자 페이지 ── */

.admin-wrap {
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-actions {
  display: flex;
  gap: 8px;
}

.admin-actions button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #3c5a48;
  border-radius: 10px;
  background: #121f18;
  color: #e6eee4;
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
}

.admin-actions button:hover { background: #1a2b21; }
.admin-actions button:disabled { opacity: 0.5; cursor: default; }
.admin-actions .danger { border-color: #8a4b3a; color: #f0b27a; }

.comment-meta {
  font-size: 13px;
  color: #9fb3a3;
}

/* ── 휴대폰과 좁은 화면: 배너, 게임, 소개, 점수 순서로 쌓는다 ── */

@media (max-width: 960px) {
  #game-banner {
    height: auto;
    min-height: 80px;
    padding: 14px 20px;
  }

  #game-banner h1 { font-size: 34px; }

  #game-banner p { font-size: 15px; }

  .wrap { padding: 20px 16px 40px; }

  .cols { grid-template-columns: minmax(0, 1fr); }

  #game-slot {
    width: 100%;
    max-width: 400px;
    height: auto;
    max-height: none;
    min-height: 0;
    margin: 0 auto;
  }
}
