:root{
  --bg:#0b0e14;
  --card:#101626;
  --card2:#0f1524;
  --text:#e9eefc;
  --muted:#aab4d6;
  --line:rgba(255,255,255,.08);
  --shadow:0 10px 30px rgba(0,0,0,.35);
}

*{ box-sizing:border-box; }

/* ✅ height 고정 금지: 길어질 때 배경 끊김 방지 */
html, body{
  min-height:100%;
}

body{
  margin:0;
  min-height:100vh;
  background: var(--bg); /* ✅ 바닥색만 담당 */
  color:var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  overflow-x:hidden;
  position: relative;
}

/* ✅ 그라데이션을 화면 전체에 “항상” 깔기(스크롤 길어져도 유지) */
body::before{
  content:"";
  position: fixed;
  inset: 0;
  z-index: -1;

  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(127,90,240,.25), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(34,197,94,.18), transparent 60%),
    linear-gradient(180deg, rgba(11,14,20,.88) 0%, rgba(11,14,20,1) 65%, rgba(7,10,18,1) 100%);

  background-repeat:no-repeat;
  background-size: cover;
}

.container{
  width:100%;
  max-width:1100px;
  margin:0 auto;
  padding:18px 14px 26px;
}

.topbar{
  display:flex;
  gap:14px;
  align-items:flex-start;
  justify-content:space-between;
  flex-wrap:wrap;
  padding:10px 0 6px;
}

.brand{ display:flex; gap:12px; align-items:center; }
.logo{
  width:36px; height:36px; border-radius:12px;
  background: linear-gradient(135deg, rgba(127,90,240,.95), rgba(34,197,94,.75));
  box-shadow: var(--shadow);
}
h1{ margin:0; font-size:20px; letter-spacing:.2px; }
.sub{ font-size:12px; color:var(--muted); margin-top:2px; }

.pills{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.pill{
  padding:8px 10px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  border-radius:999px;
  font-size:12px;
  color:var(--muted);
  max-width: 52vw;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.pill.ok{ border-color:rgba(34,197,94,.35); color:#bff3d0; background:rgba(34,197,94,.10); }
.pill.no{ border-color:rgba(255,255,255,.10); }

.hero{
  margin-top:10px;
  padding:14px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border:1px solid var(--line);
  border-radius:16px;
  box-shadow: var(--shadow);
}
.heroTop{
  display:flex;
  gap:14px;
  justify-content:space-between;
  flex-wrap:wrap;
  align-items:flex-start;
}
.heroTitle{ margin:0; font-size:16px; line-height:1.35; }
.heroDesc{ margin:8px 0 0; font-size:12.5px; color:var(--muted); line-height:1.55; }
.heroActions{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
.kbd{
  font-size:12px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  color:var(--muted);
  background:rgba(0,0,0,.18);
}

.tabs{ display:flex; gap:8px; margin-top:12px; }
.tab{
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--muted);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  font-weight:600;
}
.tab.active{
  color:var(--text);
  border-color:rgba(127,90,240,.45);
  background:rgba(127,90,240,.12);
}

.grid2{
  display:grid;
  grid-template-columns: 1.25fr .85fr;
  gap:14px;
  margin-top:14px;
  align-items:start;
}

/* ✅ 모바일에서 1열로 */
@media (max-width: 980px){
  .grid2{ grid-template-columns: 1fr; }
  .topbar { gap: 12px; }
  .pills { flex-wrap: wrap; justify-content: flex-start; }
}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border:1px solid var(--line);
  border-radius:16px;
  box-shadow: var(--shadow);
  padding:14px;
  min-width:0; /* ✅ 긴 텍스트로 grid 깨지는 것 방지 */
  max-width:100%;
}

.cardTitle{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:10px;
}
.cardTitle h2{ margin:0; font-size:16px; }
.mini{ font-size:12px; color:var(--muted); }

.notice{
  display:flex;
  gap:10px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.18);
  max-width:100%;
}

.progressWrap{
  height:10px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  overflow:hidden;
  margin:12px 0;
}
.progressBar{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, rgba(127,90,240,.9), rgba(34,197,94,.75));
}

.qRow{ display:flex; gap:8px; align-items:center; margin-bottom:6px; flex-wrap:wrap; }
.tag{
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  color:var(--muted);
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
}
.qTitle{ margin:8px 0 10px; font-size:15px; line-height:1.4; }

textarea{
  width:100%;
  min-height:110px;
  resize:vertical;
  border-radius:14px;
  border:1px solid var(--line);
  padding:12px;
  background:rgba(0,0,0,.20);
  color:var(--text);
  outline:none;
  box-sizing:border-box;
}
textarea:focus{ border-color:rgba(127,90,240,.45); }

select{
  width:100%;
  border-radius:12px;
  border:1px solid var(--line);
  padding:10px 10px;
  background:rgba(0,0,0,.18);
  color:var(--text);
  outline:none;
}

.fieldRow{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}
@media (max-width: 520px){
  .fieldRow{ grid-template-columns: 1fr; }
}

.actions{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  margin-top:12px;
}
.spacer{ flex:1; }

.btn{
  border:1px solid var(--line);
  background:rgba(255,255,255,.05);
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  font-weight:700;
}
.btn:hover{ filter:brightness(1.05); }
.btn:disabled{ opacity:.6; cursor:not-allowed; }

.btn.primary{
  border-color:rgba(127,90,240,.45);
  background:rgba(127,90,240,.18);
}
.btn.green{
  border-color:rgba(34,197,94,.45);
  background:rgba(34,197,94,.16);
}
.btn.ghost{
  background:transparent;
}
.btn.danger{
  border-color:rgba(239,68,68,.45);
  background:rgba(239,68,68,.12);
}
.hidden{ display:none !important; }

.hint{
  color:var(--muted);
  font-size:12.5px;
  line-height:1.5;
}

.bar{
  height:10px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  overflow:hidden;
}
.bar > div{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, rgba(34,197,94,.75), rgba(127,90,240,.85));
}

.resultTop{
  display:flex;
  gap:14px;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  margin-bottom:12px;
}
.scoreBig{
  font-size:40px;
  font-weight:900;
  line-height:1;
}

.grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:10px;
}
@media (max-width: 720px){
  .grid{ grid-template-columns: 1fr; }
}

.listItem{
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px;
  background:rgba(0,0,0,.16);
  min-width:0;
  max-width:100%;
}
.listTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}

.upsell{
  border:1px solid rgba(127,90,240,.25);
  background:rgba(127,90,240,.08);
  border-radius:16px;
  padding:12px;
  margin:12px 0;
  max-width:100%;
}
.upsellTop{
  display:flex;
  gap:12px;
  justify-content:space-between;
  align-items:flex-start;
  flex-wrap:wrap;
}
.upsellTitle{ font-weight:900; margin-bottom:4px; }
.upsellList{ margin:10px 0 0; padding-left:18px; color:var(--muted); line-height:1.6; }

/* ✅ pay.html 같은 중앙 카드 페이지: 길어져도 위에서부터 자연스럽게 */
.pageCenter{
  min-height:100vh;
  display:flex;
  align-items:flex-start; /* center → flex-start */
  justify-content:center;
  padding:18px 14px;
}
.payCard{ width:min(720px, 100%); }

.badgePrice{
  display:inline-block;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(34,197,94,.35);
  background:rgba(34,197,94,.10);
  font-weight:900;
}

.footer{
  margin-top:16px;
  color:rgba(255,255,255,.45);
  font-size:12px;
  text-align:center;
  padding-bottom:24px; /* ✅ 아래쪽 여백 */
}

/* ✅ 긴 JSON/텍스트가 결과에서 레이아웃 깨는 거 방지 */
#gradeResult, #genResult{
  overflow-wrap:anywhere;
  word-break:break-word;
}

/* ✅ 결과 카드 내부가 길어져도 레이아웃 안 무너지게 */
#resultCard{
  overflow:hidden;
}
