/* 달까지 냥냥 게임 페이지
   색, 글자 크기, 배치는 design.html 시안을 따른다. */

:root {
  --banner-height: 88px;   /* 배너 높이 */
  --main-padding: 24px;    /* 본문 위아래 여백 */

  /* 스크롤 없이 게임 자리가 다 보이도록, 창 높이에 맞춰 게임 자리 높이를 정한다 */
  --slot-height: calc(100vh - var(--banner-height) - var(--main-padding) * 2);
}

* {
  box-sizing: border-box;
}

h1, h2, p, ul, ol, dl, dd {
  margin: 0;
}

body {
  margin: 0;
  background: #120b26;
  color: #f1ecff;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  word-break: keep-all;      /* 한글이 낱자 중간에서 끊기지 않게 한다 */
  overflow-wrap: anywhere;   /* 아주 긴 글자는 칸 안에서 줄을 바꾼다 */
}

/* ---------- 맨 위 배너 ---------- */

#game-banner {
  position: relative;
  overflow: hidden;
  height: var(--banner-height);
  display: flex;
  align-items: center;
  border-bottom: 1px solid #3a2a6b;
  background:
    repeating-linear-gradient(to bottom, rgba(255, 122, 192, 0.55) 0 2px, transparent 2px 5px) bottom / 100% 8px no-repeat,
    radial-gradient(circle at 6% 30%, #ffffff 1.5px, transparent 2px),
    radial-gradient(circle at 23% 22%, #ffd27a 1.2px, transparent 2px),
    radial-gradient(circle at 52% 18%, #ffffff 1.6px, transparent 2px),
    radial-gradient(circle at 61% 66%, #7fe3ff 1px, transparent 2px),
    radial-gradient(circle at 94% 62%, #ffffff 1.4px, transparent 2px),
    #1c1140;
}

/* 초승달: 노란 원 위에 배너 색 원을 겹쳐서 만든다 */
#game-banner::before,
#game-banner::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

#game-banner::before {
  right: 9%;
  top: 12px;
  width: 48px;
  height: 48px;
  background: #ffd27a;
  box-shadow: 0 0 40px rgba(255, 210, 122, 0.35);
}

#game-banner::after {
  right: calc(9% - 8px);
  top: 7px;
  width: 40px;
  height: 40px;
  background: #1c1140;
}

.banner-text {
  position: relative;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 18px;
}

#game-banner h1 {
  font-family: 'Jua', sans-serif;
  font-weight: 400;
  font-size: 56px;
  line-height: 1.2;
  color: #ffffff;
  letter-spacing: 1px;
}

.pink {
  color: #ff7ac0;
}

#game-banner p {
  font-size: 17px;
  color: #cfc4ef;
}

/* ---------- 세 칸 배치 ---------- */

.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--main-padding) 24px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(280px, 340px);
  gap: 24px;
  align-items: start;
}

.column {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

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

#game-slot {
  width: min(380px, calc(var(--slot-height) * 9 / 16));
  aspect-ratio: 9 / 16;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(to bottom, #241650 56%, #1c1140 56%);
  border: 1px solid #4a3888;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.slot-label {
  padding: 10px 18px;
  border: 2px dashed rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  background: rgba(18, 11, 38, 0.72);
  color: #ffffff;
  font-size: 15px;
  text-align: center;
}

/* ---------- 카드 공통 ---------- */

.card {
  background: #1c1140;
  border: 1px solid #3a2a6b;
  border-radius: 18px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card h2 {
  font-family: 'Jua', sans-serif;
  font-weight: 400;
  font-size: 24px;
  color: #ffffff;
}

.soft {
  color: #d9d0f5;
}

/* ---------- 가운데 칸: 조작법, 게임 정보 ---------- */

.controls {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.controls li {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.keys {
  display: inline-flex;
  gap: 6px;
}

kbd {
  min-width: 36px;
  padding: 4px 10px;
  border-radius: 8px;
  background: #2e1f5e;
  border: 1px solid #5a47a0;
  color: #ffffff;
  font-family: inherit;
  text-align: center;
}

.info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.info div {
  background: #241650;
  border-radius: 12px;
  padding: 12px 16px;
}

.info dt {
  font-size: 13px;
  color: #b9addb;
}

.info dd {
  font-weight: 700;
  color: #ffffff;
}

/* ---------- 오른쪽 칸: 입력칸, 버튼, 점수판 ---------- */

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

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

.field input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #5a47a0;
  background: #120b26;
  color: #ffffff;
  font-family: inherit;
  font-size: 16px;
}

.field input:focus {
  outline: 2px solid #7fe3ff;
  outline-offset: 2px;
}

#score-submit {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: #ff7ac0;
  color: #2a0b1d;
  font-family: 'Jua', sans-serif;
  font-size: 19px;
  cursor: pointer;
}

#score-submit:hover {
  filter: brightness(1.08);
}

#score-submit:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

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

.board-title span {
  font-size: 13px;
  color: #b9addb;
}

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

.scores li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #241650;
}

.rank {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #d9d0f5;   /* 4위부터는 배경 없이 밝은 글자로 보여 준다 */
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.name {
  flex: 1;
  min-width: 0;
  color: #ffffff;
  font-weight: 500;
}

.points {
  color: #ffffff;
  font-weight: 700;
}

.scores .first {
  background: #2e1f5e;
}

.first .rank {
  background: #ffd27a;
  color: #2a1406;
}

.first .points {
  color: #ffd27a;
}

.second .rank {
  background: #d9d0f5;
  color: #1c1140;
}

.third .rank {
  background: #e3a57a;
  color: #2a1406;
}

/* ---------- 작은 컴퓨터 화면, 태블릿: 점수 칸을 아래로 내린다 ---------- */

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .score-column {
    grid-column: 1 / -1;
  }
}

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

@media (max-width: 720px) {
  #game-banner {
    height: auto;
    padding: 14px 0 12px;
  }

  #game-banner::before,
  #game-banner::after {
    display: none;
  }

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

  .layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 20px 16px 40px;
  }

  #game-slot {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
  }

  .score-column {
    grid-column: auto;
  }
}
