:root {
  --bg: #f6f4ff;
  --surface: #ffffff;
  --ink: #1f1b3a;
  --muted: #6b6788;
  --line: #e4e0f5;
  --accent: #5b3fd6;
  --accent-ink: #ffffff;
  --accent-soft: #ece7ff;
  --gold: #f4b62e;
  --good: #1f9d6b;
  --bad: #d64545;
  --radius: 16px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans KR", system-ui, -apple-system, "Apple SD Gothic Neo", sans-serif;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* 상단 바 */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 12px; }
.brand { font-weight: 800; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 14px; font-size: 14px; }
.nav a { text-decoration: none; color: var(--muted); }
.nav a.on { color: var(--accent); font-weight: 700; }

/* 첫 화면 */
.hero { padding: 32px 0 12px; text-align: center; }
.hero h1 { font-family: "Jua", sans-serif; font-weight: 400; font-size: clamp(26px, 6vw, 38px); line-height: 1.3; margin: 0 0 8px; letter-spacing: -0.01em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: var(--muted); margin: 0; }

/* 기준표 탭 */
.guide { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 20px 0; overflow: hidden; }
.guide-tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.guide-tabs button { flex: 0 0 auto; border: 0; background: none; padding: 12px 14px; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; }
.guide-tabs button.on { color: var(--accent); font-weight: 700; border-bottom-color: var(--accent); }
.guide-body { padding: 12px 16px 14px; font-size: 14px; }
.guide-body table { width: 100%; border-collapse: collapse; }
.guide-body td { padding: 3px 4px; line-height: 1.45; border-bottom: 1px dashed var(--line); vertical-align: top; }
.guide-body td:first-child { white-space: nowrap; font-weight: 700; color: var(--accent); width: 1%; padding-right: 12px; }
.guide-h { font-size: 14px; margin: 12px 0 4px; color: var(--ink); }
.guide-h:first-child { margin-top: 2px; }
.guide-body .chain { margin: 4px 0; }
.guide-note { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.chain { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chain span { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 4px 10px; font-size: 13px; }

/* 입력 폼 */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 16px 0; }
.panel h2 { font-size: 18px; margin: 0 0 12px; }
.grades { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; }
.grades label { cursor: pointer; }
.grades input { position: absolute; opacity: 0; pointer-events: none; }
.grades span { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 28px; border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; background: #fff; white-space: nowrap; letter-spacing: -0.02em; }
.grades span.long { font-size: 10.5px; letter-spacing: -0.06em; }
.grades input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.grades input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea { width: 100%; min-height: 170px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font: inherit; font-size: 16px; line-height: 1.7; resize: vertical; background: #fcfbff; }
textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.hint { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin: 6px 2px 0; gap: 8px; }
.notice { font-size: 12px; color: var(--muted); margin: 10px 2px 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 12px; padding: 12px 16px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); width: 100%; font-size: 17px; padding: 14px; margin-top: 14px; }
.btn:disabled { opacity: 0.6; cursor: progress; }
/* 보내기 버튼: 종이비행기·공유 아이콘 + 화살표 */
.btn .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.send-btn { background: #fff7e0; border-color: var(--gold); color: #7a5300; }
.send-btn:hover { background: #ffefc2; }
#invite1 { padding: 10px 18px; font-size: 15px; border-radius: 999px; border-width: 2px; }
#invite1 .arrow { transition: transform .2s; }
#invite1:hover .arrow { transform: translateX(3px); }
.error { color: var(--bad); font-size: 14px; margin: 10px 2px 0; }
.ts { margin-top: 12px; }

/* 결과 카드 */
.card { background: var(--surface); border-radius: 20px; border: 1px solid var(--line); overflow: hidden; }
.card-head { background: var(--accent); color: #fff; padding: 18px 18px 16px; display: flex; gap: 14px; align-items: center; }
.card-head .emoji { font-size: 42px; line-height: 1; }
.card-head .wiz { font-family: "Jua", sans-serif; font-size: 26px; line-height: 1.2; }
.card-head .sub { font-size: 13px; opacity: 0.85; }
.card-body { padding: 14px 18px 6px; }
.row { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.row:last-child { border-bottom: 0; }
.row .ic { width: 22px; flex: 0 0 22px; text-align: center; }
.row b { color: var(--accent); }
.summary { background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; margin: 10px 0; font-size: 14px; }
.future { margin: 12px 0 6px; border: 2px solid var(--gold); border-radius: 14px; padding: 12px 14px; background: #fffaf0; }
.future h3 { font-family: "Jua", sans-serif; font-weight: 400; font-size: 18px; margin: 0 0 6px; }
.future .row { border-bottom-color: #f6e6c2; }
.caution { background: #fff1ec; color: #a2401c; border-radius: 10px; padding: 8px 10px; margin: 6px 0; font-size: 13px; line-height: 1.5; }
.card-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px 14px; color: var(--muted); font-size: 12px; }
.card-foot strong { color: var(--ink); }
.writing { font-family: Georgia, "Times New Roman", serif; font-size: 15px; background: #fcfbff; border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.writing p { margin: 2px 0; }

/* 문장별 고치기 */
.fixes { list-style: none; padding: 0; margin: 0; }
.fixes li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.fixes li:last-child { border-bottom: 0; }
.fixes .orig { font-family: Georgia, serif; }
.fixes .ok { color: var(--good); font-weight: 700; font-size: 13px; }
.fixes .fix { font-family: Georgia, serif; color: var(--good); }
.fixes .why { color: var(--muted); font-size: 13px; }
.fixes .x { color: var(--bad); font-weight: 700; font-size: 13px; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.actions .wide { grid-column: 1 / -1; background: var(--gold); border-color: var(--gold); }
.cta { display: block; text-align: center; background: #1d1640; color: #fff; border-radius: var(--radius); padding: 16px; text-decoration: none; margin: 14px 0; }
.cta b { color: var(--gold); }
.growth { text-align: center; font-weight: 700; color: var(--accent); margin: 10px 0 0; }

/* 게시판 */
.filters { display: flex; gap: 6px; margin: 16px 0; }
.filters button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 14px; cursor: pointer; }
.filters button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.post { cursor: pointer; }
.post .card-head { padding: 12px 14px; }
.post .card-head .emoji { font-size: 28px; }
.post .card-head .wiz { font-size: 18px; }
.post .card-body { padding: 8px 14px 4px; }
.post .row { font-size: 13px; padding: 5px 0; }
.post .writing { font-size: 13px; }
.post .more { display: none; }
.post.open .more { display: block; }
.post .clip p:nth-child(n+3) { display: none; }
.post.open .clip p { display: block; }
.post-bar { display: flex; gap: 8px; padding: 8px 14px 12px; align-items: center; font-size: 13px; color: var(--muted); }
.post-bar button { border: 0; background: none; font: inherit; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.post-bar button.liked { color: var(--bad); font-weight: 700; }
.post-bar .sp { flex: 1; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* 이미지 보기 */
.overlay { position: fixed; inset: 0; background: rgba(20, 16, 40, 0.75); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.overlay img { max-width: 100%; max-height: 72vh; border-radius: 12px; background: #fff; }
.overlay p { color: #fff; margin: 12px 0; text-align: center; }
.overlay .btn { margin: 4px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1d1640; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 60; }

footer { text-align: center; color: var(--muted); font-size: 13px; padding: 32px 0 40px; }
footer .links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; margin-bottom: 8px; }
footer a { color: var(--muted); }
.hidden { display: none !important; }
.loading { text-align: center; padding: 30px 0; color: var(--muted); }
.loading .spin { font-size: 40px; display: inline-block; animation: wob 1.2s ease-in-out infinite; }
@keyframes wob { 0%,100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }

/* 폰 화면: 맨 위 줄이 두 줄로 깨지지 않게 */
.brand, .nav a { white-space: nowrap; }
@media (max-width: 480px) {
  .brand-sub { display: none; }
  .topbar .wrap { height: 50px; }
}

/* 한글은 단어(띄어쓰기) 단위로만 줄바꿈. 긴 영어 주소는 넘치지 않게 끊기 */
body { word-break: keep-all; overflow-wrap: break-word; }

/* 기준표 탭: 옆으로 더 있으면 오른쪽 끝에 "더 보기 ›" */
.tabs-wrap { position: relative; }
.tabs-more { display: none; position: absolute; right: 0; top: 0; bottom: 1px; border: 0; padding: 0 10px 0 28px; font: inherit; font-size: 13px; font-weight: 700; color: var(--accent); cursor: pointer;
  background: linear-gradient(to right, rgba(255,255,255,0), #fff 40%); }
.tabs-wrap.has-more .tabs-more { display: block; }
.tabs-wrap.has-more .tabs-more { animation: nudge 1.6s ease-in-out 2; }
@keyframes nudge { 0%,100% { transform: translateX(0); } 50% { transform: translateX(3px); } }

/* 내신 감점 단골 칩: 어학원 칩보다 작게 */
.chain.small { gap: 4px; }
.chain.small span { font-size: 11px; padding: 2px 7px; }

/* 한 문장 고치기 / 문장별 고치기: 쓴 문장 vs 고친 문장 틀 */
.fix-title { font-weight: 700; font-size: 14px; margin: 10px 0 6px; }
.fixbox { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 6px 0 4px; font-size: 14px; }
.fx-row { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; font-family: Georgia, "Times New Roman", serif; line-height: 1.6; }
.fx-row + .fx-row { border-top: 1px dashed var(--line); }
.fx-tag { flex: 0 0 auto; font-family: "Noto Sans KR", sans-serif; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 6px; margin-top: 2px; }
.fx-tag.bad { background: #fdecec; color: var(--bad); }
.fx-tag.good { background: #e6f6ef; color: var(--good); }
.fx-row:first-child { background: #fffafa; }
.fx-row:nth-child(2) { background: #f6fcf9; }
.fixbox del { color: var(--bad); text-decoration: line-through; text-decoration-thickness: 2px; background: #fde2e2; border-radius: 4px; padding: 0 2px; }
.fixbox ins { color: var(--good); text-decoration: none; font-weight: 700; background: #d6f3e5; border-radius: 4px; padding: 0 2px; }
.fx-why { font-size: 12.5px; color: var(--muted); padding: 6px 10px 8px; border-top: 1px dashed var(--line); background: #fff; }
.fixes .num { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; margin-right: 6px; font-family: "Noto Sans KR", sans-serif; }
.fixes .num-line { display: flex; align-items: center; margin-bottom: 2px; }

/* 카드 맨 아래: 4BLOCKS 안내와 사이트 이름을 두 줄로 */
.card-foot { display: block; text-align: center; padding: 10px 16px 14px; border-top: 1px solid var(--line); }
.card-foot .foot-cta { font-size: 13px; color: var(--ink); margin-bottom: 4px; }
.card-foot .foot-cta b { color: var(--accent); }
.card-foot .foot-brand { font-size: 12px; color: var(--muted); }

/* 게시판 바로가기 버튼 */
.board-btn { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid var(--accent); border-radius: var(--radius); padding: 12px 14px; color: var(--ink); text-decoration: none; font-weight: 700; margin: 12px 0 24px; }
.board-btn:hover { background: var(--accent-soft); }
.board-tag { flex: 0 0 auto; background: var(--accent); color: #fff; border-radius: 999px; padding: 3px 10px; font-size: 13px; }
.board-arrow { margin-left: auto; color: var(--accent); font-size: 18px; }
