@font-face {
  font-family: 'GowunBatang';
  src: url('/fonts/gowun-batang.woff') format('woff');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'GowunBatang';
  src: url('/fonts/gowun-batang-bold.woff') format('woff');
  font-weight: 700; font-display: swap;
}
@font-face {
  font-family: 'SongMyung';
  src: url('/fonts/song-myung.woff') format('woff');
  font-weight: 400; font-display: swap;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
  background: #0f1b2d;
  color: #e8edf5;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.site-header { text-align: center; padding: 52px 20px 26px; }
.site-header .emblem { font-size: 32px; color: #d4af37; }
.site-header h1 {
  font-family: 'SongMyung', serif; font-weight: 400;
  font-size: 30px; letter-spacing: 8px; margin-top: 12px;
}
.site-header .tagline { margin-top: 10px; color: #93a3ba; font-size: 13px; line-height: 1.6; }

main { flex: 1; width: 100%; max-width: 1160px; margin: 0 auto; padding: 12px 28px 56px; }
.panel {
  background: #16263d; border: 1px solid #23385a; border-radius: 16px;
  padding: 32px 36px; margin-top: 20px;
}
.field { margin-bottom: 26px; }
.field label { display: block; font-size: 14px; color: #9fb2cc; margin-bottom: 10px; letter-spacing: 1px; }
#picked-label { color: #d4af37; font-weight: 700; }
input[type=text] {
  width: 100%; padding: 14px 16px; border-radius: 10px; border: 1px solid #2c466e;
  background: #0e1a2c; color: #e8edf5; font-size: 16px; outline: none;
}
input[type=text]:focus { border-color: #d4af37; }
#char-search { margin-bottom: 12px; }

.char-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px; max-height: 342px; overflow-y: auto; padding: 10px;
  border: 1px solid #23385a; border-radius: 12px; background: #0e1a2c;
}
.grid-loading { grid-column: 1/-1; text-align: center; color: #93a3ba; padding: 36px 0; font-size: 13px; }
.char-cell {
  cursor: pointer; border-radius: 10px; border: 2px solid transparent;
  text-align: center; padding: 7px 3px; transition: border-color .12s, background .12s;
}
.char-cell:hover { background: #1b3050; }
.char-cell.selected { border-color: #d4af37; background: #21365a; }
.char-cell img { width: 58px; height: 58px; border-radius: 9px; display: block; margin: 0 auto; background: #1b2c46; }
.char-cell .nm { font-size: 12px; margin-top: 5px; color: #c9d5e6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 스킨 선택 */
#skin-field { display: none; }
#skin-field.visible { display: block; }
.skin-row { display: flex; gap: 12px; overflow-x: auto; padding: 10px; border: 1px solid #23385a; border-radius: 12px; background: #0e1a2c; }
.skin-cell {
  cursor: pointer; flex: 0 0 auto; width: 96px; text-align: center;
  border: 2px solid transparent; border-radius: 10px; padding: 8px 4px;
  transition: border-color .12s, background .12s;
}
.skin-cell:hover { background: #1b3050; }
.skin-cell.selected { border-color: #d4af37; background: #21365a; }
.skin-cell img { width: 68px; height: 68px; border-radius: 9px; background: #1b2c46; }
.skin-cell .nm { font-size: 11.5px; margin-top: 5px; color: #c9d5e6; line-height: 1.35; word-break: keep-all; }
.skin-cell .gd { font-size: 10px; color: #8fa2bd; margin-top: 2px; }

/* 증서 양식 선택 */
.style-row { display: flex; gap: 12px; flex-wrap: wrap; }
.style-cell {
  cursor: pointer; flex: 1; min-width: 200px;
  border: 2px solid #23385a; border-radius: 12px; padding: 14px 16px;
  background: #0e1a2c; transition: border-color .12s, background .12s;
}
.style-cell:hover { background: #1b3050; }
.style-cell.selected { border-color: #d4af37; background: #21365a; }
.style-cell .tt { font-size: 15px; font-weight: 700; color: #e8edf5; }
.style-cell .dd { font-size: 12px; color: #8fa2bd; margin-top: 5px; }

button {
  cursor: pointer; border: none; border-radius: 10px; padding: 14px 24px;
  font-size: 15px; font-weight: 700; color: #14243c;
  background: linear-gradient(135deg, #e8c96a, #d4af37);
}
button:disabled { opacity: .45; cursor: not-allowed; }
#issue-btn { width: 100%; letter-spacing: 2px; }
.error { color: #ff8a8a; margin-top: 14px; font-size: 14px; }

.spinner {
  width: 42px; height: 42px; margin: 10px auto 16px; border-radius: 50%;
  border: 4px solid #23385a; border-top-color: #d4af37; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-section { text-align: center; color: #b7c5da; }

#cert-wrap { margin-top: 20px; }
#cert-wrap svg { width: 100%; height: auto; display: block; border-radius: 6px; box-shadow: 0 18px 50px rgba(0,0,0,.5); }
.cert-actions { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.cert-actions button { flex: 1; min-width: 150px; }
#again-btn { background: #2c466e; color: #e8edf5; }

#season-detail h3 { font-size: 15px; margin: 20px 0 14px; color: #d4af37; letter-spacing: 1px; }
#season-detail h3:first-child { margin-top: 0; }

.mode-cards { display: flex; gap: 12px; flex-wrap: wrap; }
.mode-card {
  flex: 1; min-width: 180px; border: 1px solid #23385a; border-radius: 12px;
  background: #0e1a2c; padding: 14px 16px;
}
.mode-card.cobalt { border-color: #2a6b63; }
.mode-card .mk { font-size: 12.5px; color: #9fb2cc; letter-spacing: 1px; }
.mode-card.cobalt .mk { color: #3fd8c7; }
.mode-card .mv { font-size: 22px; font-weight: 800; margin-top: 6px; }
.mode-card .ms { font-size: 12px; color: #8fa2bd; margin-top: 5px; }
.table-scroll { overflow-x: auto; }
.season-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.season-table th, .season-table td { padding: 8px 10px; text-align: right; border-bottom: 1px solid #22375a; white-space: nowrap; }
.season-table th { color: #9fb2cc; font-weight: 600; }
.season-table td:first-child, .season-table th:first-child { text-align: left; }

footer { text-align: center; color: #64768f; font-size: 12px; padding: 24px 20px 38px; line-height: 1.7; }
footer a { color: #93a3ba; }

/* ---------- 모바일 ---------- */
@media (max-width: 680px) {
  .site-header { padding: 34px 14px 16px; }
  .site-header h1 { font-size: 18px; letter-spacing: 3px; }
  .site-header .tagline { font-size: 11px; word-break: keep-all; }
  main { padding: 6px 12px 40px; }
  .panel { padding: 20px 16px; border-radius: 13px; }
  .field { margin-bottom: 20px; }
  input[type=text] { font-size: 15px; padding: 12px 14px; }
  .char-grid { grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 7px; max-height: 264px; padding: 7px; }
  .char-cell img { width: 46px; height: 46px; }
  .char-cell .nm { font-size: 10.5px; }
  .skin-cell { width: 80px; }
  .skin-cell img { width: 54px; height: 54px; }
  .cert-actions { flex-direction: column; }
  .cert-actions button { min-width: 0; }
  .season-table { font-size: 12px; }
}
