@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700;900&display=swap');

:root {
  --blue: #2d9cdb;
  --blue-dark: #1a75bb;
  --green: #6fcf3e;
  --green-dark: #4caf50;
  --orange: #f2a93b;
  --red: #eb5757;
  --navy: #16324f;
  --sky: #eaf6ff;
  --sky-deep: #d3ecff;
  --white: #ffffff;
  --radius-lg: 28px;
  --radius-md: 18px;
  --shadow-card: 0 12px 30px rgba(22, 50, 79, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  font-family: 'Noto Sans KR', sans-serif;
  color: var(--navy);
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky-deep) 420px, var(--white) 900px);
  line-height: 1.5;
  word-break: keep-all;
  overflow-wrap: break-word;
}

h1, h2, h3 {
  font-family: 'Noto Sans KR', sans-serif;
  margin: 0;
  letter-spacing: 0.01em;
}

a {
  color: var(--blue-dark);
}

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

/* ---------- header ---------- */

.site-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  max-width: 1080px;
  margin: 0 auto;
}

.site-header img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.site-header .wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.site-header .wordmark .org {
  font-size: 0.8rem;
  color: var(--blue-dark);
  font-weight: 700;
}

.site-header .wordmark .site {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 1.15rem;
  color: var(--navy);
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 40px 24px 60px;
  text-align: center;
}

.hero-inner {
  max-width: 720px;
  margin: 0 auto;
  animation: rise 0.7s ease-out both;
}

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

/* 물결이 제목 줄을 가로질러 지나가도록 하는 게 의도된 디자인이다 —
   본문 전체가 아니라 제목(h1)의 실제 렌더링 높이에 딱 맞게 깔아둬서,
   화면 크기·글자 크기가 달라져도 항상 제목 위에 걸치도록 한다. hero-inner
   (720px 제한)에는 안 넣고 .hero 바로 아래 둬서 화면 끝까지 꽉 차게 한다.*/
.hero-title-wrap {
  position: relative;
  animation: rise 0.7s ease-out both;
}

.hero-waves {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: translateY(-30%);
  z-index: 0;
  pointer-events: none;
}

.hero-title-wrap h1 {
  position: relative;
  z-index: 1;
  margin: 0;
}

.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  color: var(--navy);
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.6);
}

.hero h1 .accent {
  background: linear-gradient(90deg, var(--blue) 0%, var(--green) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}

.hero .hero-subtitle {
  margin: 10px auto 0;
  font-size: 1.1rem;
  font-weight: 500;
  color: #3a5776;
}

.hero p {
  margin: 16px auto 0;
  font-size: 1.05rem;
  color: #3a5776;
  max-width: 480px;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  padding: 16px 34px;
  border: none;
  border-radius: 999px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 1.1rem;
  color: var(--white);
  background: linear-gradient(90deg, var(--blue) 0%, var(--green) 100%);
  box-shadow: 0 10px 24px rgba(45, 156, 219, 0.35), inset 0 -3px 0 rgba(0, 0, 0, 0.12);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(45, 156, 219, 0.42), inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}

.cta-button:focus-visible,
button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

/* ---------- section shell ---------- */

section {
  padding: 36px 24px;
}

.section-head {
  max-width: 720px;
  margin: 0 auto 26px;
  text-align: center;
}

.section-head .eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--green-dark);
  background: rgba(111, 207, 62, 0.14);
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.section-head h2 {
  font-size: 1.6rem;
  color: var(--navy);
}

/* ---------- login card ---------- */

.login-card {
  max-width: 420px;
  margin: 0 auto;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px 30px;
  box-shadow: var(--shadow-card);
  border: 3px solid transparent;
  background-image: linear-gradient(var(--white), var(--white)),
    linear-gradient(120deg, var(--blue), var(--green));
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

.login-card label {
  display: block;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--navy);
  margin-bottom: 14px;
}

.login-card input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid #dceafb;
  border-radius: var(--radius-md);
  background: #f7fbff;
  color: var(--navy);
}

.login-card input:focus {
  border-color: var(--blue);
  background: var(--white);
}

.login-card button[type='submit'] {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  border: none;
  border-radius: 999px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 1.05rem;
  color: var(--white);
  background: linear-gradient(90deg, var(--blue) 0%, var(--green) 100%);
  box-shadow: 0 8px 18px rgba(45, 156, 219, 0.3);
  cursor: pointer;
}

#error-message {
  min-height: 1.2em;
  color: var(--red);
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
  margin: 12px 0 0;
}

.privacy-notice {
  max-width: 560px;
  margin: 16px auto 0;
  font-size: 0.68rem;
  color: #5c7893;
  text-align: center;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .privacy-notice {
    white-space: normal;
  }
}

.admin-link {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 10px;
  padding: 4px 0;
  font-size: 0.85rem;
  color: #5c7893;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
}

.admin-link::after {
  content: ' ▾';
  display: inline-block;
  transition: transform 0.15s ease;
}

.admin-link.open::after {
  transform: rotate(180deg);
}

.admin-login-panel {
  max-width: 340px;
  margin: 10px auto 0;
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  border: 2px solid #eaf6ff;
}

.admin-login-panel label {
  display: block;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--navy);
  margin-bottom: 10px;
}

.admin-login-panel input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 9px 10px;
  font-size: 0.92rem;
  font-family: inherit;
  border: 2px solid #dceafb;
  border-radius: 10px;
  background: #f7fbff;
  color: var(--navy);
}

.admin-login-panel button[type='submit'] {
  width: 100%;
  margin-top: 4px;
  padding: 10px;
  border: none;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--white);
  background: linear-gradient(90deg, var(--blue) 0%, var(--green) 100%);
  cursor: pointer;
}

.admin-login-panel #admin-error-message {
  min-height: 1.1em;
  color: var(--red);
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
  margin: 8px 0 0;
}

/* ---------- feature cards ---------- */

.feature-grid {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.feature-card {
  display: block;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 14px 14px 20px;
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: var(--navy);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 34px rgba(22, 50, 79, 0.18);
}

.feature-card img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  display: block;
}

.feature-card p {
  margin: 14px 4px 0;
  font-size: 0.88rem;
  color: #3a5776;
  text-align: center;
}

/* ---------- leaderboard ---------- */

.leaderboard-card {
  max-width: 640px;
  margin: 0 auto;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table thead {
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.leaderboard-table th {
  color: var(--white);
  font-size: 0.85rem;
  padding: 14px 12px;
  text-align: center;
}

.leaderboard-table td {
  padding: 12px;
  border-bottom: 1px solid #eef4fa;
  font-size: 0.92rem;
  text-align: center;
}

.leaderboard-table tbody tr:last-child td {
  border-bottom: none;
}

/* 이름 span은 메달 없이 이름 글자만의 너비로 가운데 정렬돼서 헤더 "이름"과
   정확히 맞는다. 메달은 이 span 기준으로 절대 위치시켜 왼쪽으로 튀어나오게
   해서, 정렬 계산에 전혀 영향을 주지 않는다. */
.lb-name {
  position: relative;
  display: inline-block;
}

.leaderboard-table tbody tr:nth-child(1) .lb-name::before {
  content: '🥇';
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 4px;
}

.leaderboard-table tbody tr:nth-child(2) .lb-name::before {
  content: '🥈';
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 4px;
}

.leaderboard-table tbody tr:nth-child(3) .lb-name::before {
  content: '🥉';
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 4px;
}

/* ---------- footer ---------- */

.site-footer {
  text-align: center;
  padding: 30px 24px 40px;
  color: #7691a9;
  font-size: 0.82rem;
}

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  .feature-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .site-header img {
    width: 84px;
    height: 84px;
  }
  .site-header .wordmark .org {
    font-size: 1.6rem;
    line-height: 1.2;
  }
  .hero h1 {
    font-size: 2rem;
  }
  .hero .hero-subtitle {
    font-size: 1rem;
  }
  .login-card {
    padding: 26px 20px;
  }
}
