:root {
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --bg: #ffffff;
  --soft: #f3f6fb;
  --line: #e5e7eb;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: break-word;
}

main { flex: 1; }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

/* 맨 위 줄 */
.topbar { border-bottom: 1px solid var(--line); }

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
}

.brand { font-weight: 700; }

.btn-small {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

a.btn-small {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.btn-small:hover { border-color: var(--accent); color: var(--accent); }

/* 구매 버튼 */
.btn-buy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 240px;
  min-height: 56px;
  padding: 0 32px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-size: 19px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

.btn-buy:hover { background: var(--accent-dark); }

.btn-buy:focus-visible,
.btn-small:focus-visible,
summary:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 3px;
}

/* 첫 구역 */
.hero {
  padding: 88px 0 72px;
  text-align: center;
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(28px, 6vw, 44px);
  line-height: 1.3;
}

.tagline {
  margin: 0 0 24px;
  font-size: 19px;
  color: var(--muted);
}

.price {
  margin: 0 0 28px;
  font-size: 30px;
  font-weight: 700;
  color: var(--accent);
}

/* 공통 구역 */
.section { padding: 72px 0; }

.section:nth-of-type(even) { background: var(--soft); }

.section h2 {
  margin: 0 0 28px;
  font-size: 26px;
  line-height: 1.4;
  text-align: center;
}

.section ul,
.section ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* 누구를 위한 상품인가요: 체크 카드 */
.check-cards { display: grid; gap: 12px; }

.check-cards li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.check {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

/* 해결되는 것: 번호 목록 */
.numbered { counter-reset: step; display: grid; gap: 16px; }

.numbered li {
  counter-increment: step;
  position: relative;
  padding-left: 52px;
  min-height: 36px;
}

.numbered li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--soft);
  color: var(--accent);
  font-weight: 700;
}

.section:nth-of-type(even) .numbered li::before { background: var(--bg); }

/* 받는 것: 파일 모양 글자 아이콘 */
.file-list { display: grid; gap: 12px; }

.file-list li {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.file-icon {
  flex: none;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 40px;
  height: 50px;
  padding-bottom: 7px;
  border-radius: 4px;
  background: var(--accent);
  clip-path: polygon(0 0, 70% 0, 100% 24%, 100% 100%, 0 100%);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.file-icon::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 30%;
  height: 24%;
  background: rgba(255, 255, 255, 0.45);
  clip-path: polygon(0 0, 100% 100%, 0 100%);
}

.file-name { font-weight: 600; word-break: break-all; }

/* 자주 묻는 질문 */
.faq details {
  border-bottom: 1px solid var(--line);
}

.faq details:first-of-type { border-top: 1px solid var(--line); }

.faq summary {
  position: relative;
  padding: 18px 40px 18px 4px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 24px;
  font-weight: 400;
}

.faq details[open] summary::after { content: "−"; }

.faq details p {
  margin: 0;
  padding: 0 4px 20px;
  color: var(--muted);
}

/* 마지막 구역 */
.buy-again { text-align: center; }

.buy-name {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 600;
}

.buy-again .price { margin-bottom: 24px; }

.pay-note {
  margin: 16px 0 0;
  font-size: 15px;
  color: var(--muted);
}

/* 바닥 */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 24px 0;
  font-size: 14px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
}

.site-footer a { color: inherit; }

/* 화면 위 작은 안내 */
.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border-radius: 12px;
  background: #111827;
  color: #ffffff;
  font-size: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  transform: translateX(-50%);
}

.toast[hidden] { display: none; }

/* 로그인·내 정보·관리자 화면 */
.brand { color: inherit; text-decoration: none; }

.page { padding: 56px 0 72px; }

.card {
  max-width: 440px;
  margin: 0 auto;
  padding: 28px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.wrap-wide { max-width: 960px; }

.wrap-wide .card { max-width: none; }

.card h1 {
  margin: 0 0 20px;
  font-size: 26px;
  line-height: 1.4;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 24px;
  padding: 4px;
  border-radius: 12px;
  background: var(--soft);
}

.tab {
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: var(--bg);
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.field { display: block; margin-bottom: 16px; }

.field span {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font: inherit;
}

.field input:focus,
.field select:focus {
  outline: 3px solid #93c5fd;
  outline-offset: 1px;
  border-color: var(--accent);
}

.hint { margin: -8px 0 16px; font-size: 15px; color: var(--muted); }

.card .btn-buy { width: 100%; min-width: 0; }

.btn-buy:disabled { opacity: 0.6; cursor: wait; }

.message { min-height: 1.7em; margin: 14px 0 0; font-size: 16px; }

.message.error { color: #b91c1c; }

.message.ok { color: #047857; }

.info-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.info-row strong { word-break: break-all; }

.placeholder {
  margin: 20px 0;
  padding: 20px;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--muted);
  text-align: center;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-head h1 { margin: 0; }

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.data-table th { background: var(--soft); font-weight: 700; }

/* 내 자료실: 이용권·코드 넣기 */
.card-sub { margin: 28px 0 12px; font-size: 20px; }

.hint-text { color: var(--muted); }

.ent-list { margin: 0; padding: 0; list-style: none; }

.ent-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 14px 16px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.ent-list li span { color: var(--muted); font-size: 15px; }

.my-files { margin-bottom: 20px; }

.my-files li { align-items: center; background: var(--bg); }

.my-files li strong { word-break: break-all; }

.redeem-form .field input { text-transform: uppercase; letter-spacing: 0.08em; }

/* 결제 후 이동 페이지 */
.thanks { text-align: center; }

.thanks .field { text-align: left; }

.thanks-title { font-size: 30px; }

.code-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 20px 0 12px;
  padding: 22px 16px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--soft);
}

.code-text {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 38px;
  letter-spacing: 0.12em;
  word-break: break-all;
}

.code-warn { margin: 0 0 22px; font-weight: 700; color: #b45309; }

.thanks a.btn-buy { text-decoration: none; justify-content: center; }

/* 관리자 화면(07단계) */
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: var(--soft);
}

.admin-tabs .tab { flex: 1 1 auto; padding: 0 14px; }

.field select { background: var(--bg); color: var(--text); }

.btn-strong { border-color: var(--accent); background: var(--accent); color: #ffffff; font-weight: 700; }

.btn-strong:hover { background: var(--accent-dark); color: #ffffff; }

.btn-small:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-small[aria-pressed="true"] { border-color: var(--accent); background: #dbeafe; color: var(--accent-dark); font-weight: 700; }

.search-row, .choice-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.search-row input {
  flex: 1 1 220px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font: inherit;
}

.row-actions { display: flex; gap: 6px; }

.row-actions .btn-small { min-height: 34px; padding: 0 10px; font-size: 14px; }

.row-dim td { color: #9ca3af; }

.code-box[hidden] { display: none; }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 6px 0 4px;
}

.stat-card {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.stat-label { color: var(--muted); font-size: 15px; }

.stat-value { font-size: 24px; word-break: keep-all; }

.stat-sub { color: var(--muted); font-size: 14px; }

.file-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; cursor: pointer; }

.file-pick .btn-small { display: inline-flex; align-items: center; }

.file-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.file-pick:focus-within .btn-small { outline: 3px solid #93c5fd; outline-offset: 3px; }

.header-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }

.header-chips li { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--soft); font-size: 15px; }

.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 14px; }

.map-grid .field select { min-height: 44px; padding: 0 10px; }

@media (max-width: 720px) {
  .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-value { font-size: 20px; }
}

@media (max-width: 480px) {
  .hero { padding: 56px 0 48px; }
  .section { padding: 56px 0; }
  .section h2 { font-size: 23px; }
  .btn-buy { display: flex; width: 100%; min-width: 0; }
}
