/* =========================================================
   메인 홈페이지 스타일 (index.html, login.html, signup.html)
   회원 관리 화면(admin.html)은 style.css 를 따로 사용한다.
   ========================================================= */

/* ---------- 1. 디자인 기본값 (색상, 글꼴, 크기) ----------
   색상이나 크기를 바꾸고 싶으면 이 부분만 수정하면 된다. */
:root {
  --color-primary: #2f5bea;
  --color-primary-hover: #2449c4;
  --color-text: #1f2328;
  --color-text-muted: #5f6b7a;
  --color-border: #e3e6ea;
  --color-bg: #ffffff;
  --color-bg-muted: #f5f7fa;
  --color-placeholder: #e9edf2;
  --color-footer-bg: #1f2328;
  --color-footer-text: #b7bec8;

  --font-base: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", -apple-system, "Segoe UI", sans-serif;

  --container-width: 1200px;
  --header-height: 72px;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

/* ---------- 2. 공통 초기화 ---------- */
* {
  box-sizing: border-box;
}

/* 화면에는 안 보이지만 화면 낭독기는 읽는 글자 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* hidden 속성이 붙은 요소는 다른 스타일(display: flex 등)이 있어도 항상 숨긴다. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font-base);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  word-break: keep-all;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

/* 가운데 정렬된 콘텐츠 폭. 화면이 좁으면 자동으로 줄어든다. */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- 3. 버튼 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
}

.btn-ghost {
  background-color: transparent;
  color: var(--color-text);
}

.btn-ghost:hover {
  background-color: var(--color-bg-muted);
}

.btn-outline {
  background-color: #fff;
  border-color: var(--color-border);
  color: var(--color-text);
}

.btn-outline:hover {
  border-color: var(--color-text-muted);
}

.btn-lg {
  padding: 13px 26px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-danger {
  background-color: #d92d20;
  color: #fff;
}

.btn-danger:hover {
  background-color: #b42318;
}

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

/* ---------- 4. 헤더 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

/* Venn 로고: 두 원이 겹친 자리(교집합)만 색을 채운 모양 + 두 n 이 살짝 겹친 글자 */
.logo-mark {
  flex-shrink: 0;
  width: 37px;
  height: 28px;
}

.logo-ring {
  fill: none;
  stroke: currentColor;
  stroke-width: 3.4;
}

.logo-text {
  font-size: 25px;
  letter-spacing: -0.045em;
  line-height: 1;
}

.logo-n1 {
  color: #1d3fd8;
  mix-blend-mode: multiply;
}

.logo-n2 {
  margin-left: -0.07em;
  color: #8b5cf6;
  mix-blend-mode: multiply;
}

.site-footer .logo-n1,
.site-footer .logo-n2 {
  mix-blend-mode: screen; /* 어두운 바탕에서는 겹친 부분이 밝아지게 */
}

/* 메뉴 + 로그인/회원가입을 묶는 영역 */
.site-menu {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: space-between;
  margin-left: 48px;
}

.main-nav {
  display: flex;
  gap: 32px;
}

.main-nav a {
  font-weight: 500;
  color: var(--color-text-muted);
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  color: var(--color-text);
}

.account {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 로그인 후 헤더에 표시되는 "○○님" (누르면 마이페이지) */
.account-name {
  margin-right: 4px;
  font-size: 15px;
  font-weight: 600;
}

.account-name:hover {
  color: var(--color-primary);
}

/* 모바일 메뉴 버튼 (데스크톱에서는 숨김) */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0 9px;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  height: 2px;
  background-color: var(--color-text);
  border-radius: 2px;
}

/* ---------- 5. 메인 - 대표 영역 ---------- */
.hero {
  padding: 96px 0;
  background-color: var(--color-bg-muted);
}

.hero-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
}

.eyebrow {
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
}

.hero h1 {
  margin-bottom: 20px;
  font-size: 44px;
  line-height: 1.25;
}

.lead {
  font-size: 18px;
  color: var(--color-text-muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

/* 이미지/콘텐츠가 들어갈 자리를 표시하는 회색 상자 */
.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-placeholder);
  border-radius: var(--radius);
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 500;
}

.hero-visual {
  aspect-ratio: 4 / 3;
}

/* ---------- 6. 메인 - 콘텐츠 영역 ---------- */
.section {
  padding: 88px 0;
}

.section-muted {
  background-color: var(--color-bg-muted);
}

.section-head {
  margin-bottom: 40px;
  text-align: center;
}

.section h2 {
  margin-bottom: 12px;
  font-size: 30px;
  line-height: 1.3;
}

.section-head p,
.split p {
  color: var(--color-text-muted);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.card {
  padding: 20px;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-thumb {
  aspect-ratio: 16 / 10;
  margin-bottom: 20px;
}

.card h3 {
  margin-bottom: 8px;
  font-size: 19px;
}

.card p {
  font-size: 15px;
  color: var(--color-text-muted);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
}

.split-visual {
  min-height: 240px;
}

/* ---------- 7. 로그인 / 회원가입 페이지 ---------- */
.auth-page {
  display: flex;
  justify-content: center;
  padding: 72px 24px 96px;
  background-color: var(--color-bg-muted);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 40px 36px;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin-bottom: 8px;
  font-size: 26px;
  text-align: center;
}

.auth-desc {
  margin-bottom: 24px;
  font-size: 15px;
  color: var(--color-text-muted);
  text-align: center;
}

/* 로그인/회원가입 결과 메시지 (오류는 빨강, 성공은 초록) */
.form-message {
  white-space: pre-line;
  margin-bottom: 20px;
  padding: 12px 14px;
  font-size: 14px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.form-message.is-error {
  color: #b42318;
  background-color: #fef3f2;
  border-color: #fecdca;
}

.form-message.is-success {
  color: #067647;
  background-color: #ecfdf3;
  border-color: #abefc6;
}

.form-hint {
  margin-top: 6px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  outline: none;
}

.form-group input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(47, 91, 234, 0.15);
}

.auth-switch {
  margin-top: 24px;
  font-size: 14px;
  color: var(--color-text-muted);
  text-align: center;
}

.auth-switch a {
  font-weight: 600;
  color: var(--color-primary);
}

/* 마이페이지 */
.mypage {
  width: 100%;
  max-width: 520px;
}

.mypage-title {
  margin-bottom: 24px;
  font-size: 28px;
}

.mypage-card {
  max-width: none;
  margin-bottom: 20px;
  padding: 32px;
}

.mypage-card h2 {
  margin-bottom: 20px;
  font-size: 20px;
}

.mypage-card .auth-desc {
  text-align: left;
}

.info-list {
  margin: 0 0 24px;
  padding: 16px 18px;
  background-color: var(--color-bg-muted);
  border-radius: 8px;
}

.info-list div {
  display: flex;
  padding: 6px 0;
  font-size: 15px;
}

.info-list dt {
  width: 80px;
  flex-shrink: 0;
  color: var(--color-text-muted);
}

.info-list dd {
  margin: 0;
  font-weight: 600;
  word-break: break-all;
}

.danger-zone h2 {
  color: #b42318;
}

/* 마이페이지: 내 레벨 카드 */
.level-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.level-badge,
.rank-level {
  --tier-a: #3b6cff;
  --tier-b: #8b5cf6;
}

.level-badge[data-tier="1"], .rank-level[data-tier="1"] { --tier-a: #12b76a; --tier-b: #0e9384; }
.level-badge[data-tier="2"], .rank-level[data-tier="2"] { --tier-a: #f79009; --tier-b: #ef6820; }
.level-badge[data-tier="3"], .rank-level[data-tier="3"] { --tier-a: #ee46bc; --tier-b: #e31b54; }
.level-badge[data-tier="4"], .rank-level[data-tier="4"] { --tier-a: #344054; --tier-b: #101828; }

.level-badge {
  flex-shrink: 0;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  background: linear-gradient(135deg, var(--tier-a), var(--tier-b));
  border-radius: 14px;
  box-shadow: 0 6px 16px rgba(59, 108, 255, 0.25);
}

.level-badge b {
  font-size: 24px;
  font-weight: 800;
}

.level-who {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.level-who strong {
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-who span {
  font-size: 13.5px;
  color: var(--color-text-muted);
}

.level-stats {
  display: flex;
  gap: 14px;
  margin: 0;
  text-align: right;
}

.level-stats dt {
  font-size: 12px;
  color: var(--color-text-muted);
}

.level-stats dd {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.level-bar {
  height: 14px;
  overflow: hidden;
  background-color: #eef1f6;
  border-radius: 999px;
}

.level-fill {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #3b6cff, #8b5cf6);
  border-radius: inherit;
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.level-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.level-left {
  font-size: 12px;
  text-align: right;
}

.level-help {
  margin: 18px 0 0;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--color-text-muted);
  background-color: var(--color-bg-muted);
  border-radius: 8px;
}

.level-help a {
  font-weight: 700;
  color: var(--color-primary);
}

.level-recent h3 {
  margin: 20px 0 8px;
  font-size: 15px;
}

.level-recent ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.level-recent li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--color-border);
}

.level-recent li:last-child {
  border-bottom: 0;
}

.level-recent li span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-recent time {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.level-recent li b {
  color: #027a48;
  white-space: nowrap;
}

.level-recent .level-empty,
.rank-list .rank-empty {
  display: block;
  font-size: 14px;
  color: var(--color-text-muted);
}

/* 마이페이지: 랭킹 */
.rank-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.mypage-card .rank-head h2 {
  margin: 0;
}

.rank-tabs {
  display: flex;
  padding: 3px;
  background-color: var(--color-bg-muted);
  border-radius: 999px;
}

.rank-tabs button {
  padding: 6px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 999px;
}

.rank-tabs button.is-active {
  color: var(--color-text);
  background-color: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

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

.rank-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 14.5px;
  border-radius: 10px;
}

.rank-list li:nth-child(odd) {
  background-color: #fafbfc;
}

.rank-list li.is-me {
  background-color: #eef3ff;
  box-shadow: inset 0 0 0 1px #c7d6ff;
}

.rank-no {
  width: 28px;
  flex-shrink: 0;
  font-weight: 800;
  text-align: center;
}

.rank-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-level {
  flex-shrink: 0;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--tier-a), var(--tier-b));
  border-radius: 999px;
}

.rank-points {
  min-width: 64px;
  flex-shrink: 0;
  font-weight: 700;
  text-align: right;
}

.rank-me {
  margin: 12px 0 0;
  font-size: 13.5px;
  color: var(--color-text-muted);
  text-align: center;
}

/* 404 페이지 */
.not-found {
  text-align: center;
}

.not-found-code {
  margin-bottom: 8px;
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  color: var(--color-primary);
}

.not-found h1 {
  margin-bottom: 12px;
}

/* ---------- 게시판 ---------- */
.board-page {
  padding: 56px 0 88px;
  background-color: var(--color-bg-muted);
}

.board-container {
  max-width: 960px;
}

.board-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.board-head h1 {
  font-size: 28px;
}

.board-total {
  margin-top: 4px;
  font-size: 14px;
  color: var(--color-text-muted);
}

/* 글 목록: 데스크톱에서는 표처럼, 모바일에서는 카드처럼 보인다 */
.board-list {
  overflow: hidden;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.board-row {
  display: grid;
  grid-template-columns: 64px 1fr 110px 96px 76px 76px;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  font-size: 15px;
  border-top: 1px solid var(--color-border);
}

a.board-row:hover {
  background-color: var(--color-bg-muted);
}

.board-row-head {
  border-top: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  background-color: #fafbfc;
}

.board-row-head span:nth-child(2) {
  text-align: left;
}

.board-row > span {
  text-align: center;
}

.board-row .board-cell-title {
  overflow: hidden;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.board-cell-id,
.board-cell-author,
.board-cell-date,
.board-cell-views,
.board-cell-likes {
  font-size: 14px;
  color: var(--color-text-muted);
}

.board-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
}

.pagination a {
  min-width: 38px;
  padding: 7px 10px;
  font-size: 14px;
  text-align: center;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.pagination a[href]:hover {
  border-color: var(--color-text-muted);
}

.pagination a.is-current {
  color: #fff;
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.pagination a.is-disabled {
  color: #b5bcc6;
  cursor: default;
}

/* 정렬 탭 (최신순 / 인기순) */
.board-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
}

.sort-tabs {
  display: inline-flex;
  padding: 3px;
  background-color: #e9edf2;
  border-radius: 10px;
}

.sort-tabs a {
  padding: 6px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  border-radius: 8px;
}

.sort-tabs a.is-active {
  color: var(--color-text);
  background-color: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.popular-info {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.popular-info[hidden] {
  display: none;
}

.popular-info a {
  font-weight: 600;
  color: var(--color-primary);
}

/* 목록의 작은 표시 (공지, N, 사진/영상, 작성자) */
.badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
  border-radius: 4px;
}

.badge-notice {
  color: #fff;
  background-color: #d92d20;
}

.badge-new {
  color: #fff;
  background-color: #f97316;
}

.badge-media {
  color: var(--color-primary);
  background-color: #eef2ff;
}

.badge-writer {
  color: #067647;
  background-color: #ecfdf3;
  border: 1px solid #abefc6;
}

.board-cell-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.title-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.comment-count {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: #d92d20;
}

.board-notice-mobile {
  display: none;
}

.board-row.is-notice {
  background-color: #fff8f6;
}

.board-row.is-notice .title-text {
  font-weight: 700;
}

a.board-row.is-notice:hover {
  background-color: #fff1ed;
}

/* 검색 */
.board-search {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.board-search select,
.board-search input {
  height: 42px;
  padding: 0 12px;
  font-size: 15px;
  font-family: inherit;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  outline: none;
}

.board-search input {
  width: 280px;
}

.board-search select:focus,
.board-search input:focus {
  border-color: var(--color-primary);
}

/* 글 읽기 */
.back-link {
  margin-bottom: 16px;
  font-size: 14px;
}

.back-link a {
  color: var(--color-text-muted);
}

.back-link a:hover {
  color: var(--color-text);
}

.post {
  padding: 36px 40px;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.post-header {
  padding-bottom: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--color-border);
}

.post-header h1 {
  margin-bottom: 12px;
  font-size: 26px;
  line-height: 1.4;
  word-break: break-all;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 14px;
  color: var(--color-text-muted);
}

.post-meta span:first-child {
  font-weight: 600;
  color: var(--color-text);
}

/* 줄바꿈을 입력한 그대로 보여 준다 */
.post-content {
  min-height: 160px;
  font-size: 16px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-all;
}

/* 첨부 사진 / 동영상 */
.post-attachments {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 28px;
}

.attachment {
  margin: 0;
}

.attachment img,
.attachment video {
  display: block;
  max-width: 100%;
  max-height: 720px;
  border-radius: 8px;
  background-color: #000;
}

.attachment img {
  background-color: transparent;
}

/* 좋아요 */
.post-like {
  display: flex;
  justify-content: center;
  margin-top: 40px;
}

.like-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: var(--color-text);
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
}

.like-button:hover {
  border-color: #f04438;
}

.like-heart {
  font-size: 18px;
  line-height: 1;
  color: #f04438;
}

.like-button.is-liked {
  color: #d92d20;
  background-color: #fef3f2;
  border-color: #fecdca;
}

.post-notice-label {
  display: inline-block;
  margin-bottom: 8px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background-color: #d92d20;
  border-radius: 4px;
}

.post-notice-label[hidden] {
  display: none;
}

/* 댓글 */
.comments {
  margin-top: 24px;
  padding: 28px 40px;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.comments h2 {
  margin-bottom: 16px;
  font-size: 18px;
}

.comments h2 span {
  color: var(--color-primary);
}

.comment-list {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.comment {
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
}

/* 답글: 단계(--depth)마다 한 칸씩 더 들여 쓰고 앞에 ㄴ 표시 */
.comment.is-reply {
  --indent-step: 28px;
  position: relative;
  padding-left: calc(var(--depth) * var(--indent-step));
}

.comment.is-reply::before {
  content: "ㄴ";
  position: absolute;
  top: 16px;
  left: calc((var(--depth) - 1) * var(--indent-step) + 8px);
  color: #98a2b3;
}

.comment-mention {
  margin-right: 2px;
  font-weight: 600;
  color: var(--color-primary);
}

.comment-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.comment-author {
  font-size: 14px;
  font-weight: 700;
}

.comment-body {
  font-size: 15px;
  white-space: pre-wrap;
  word-break: break-all;
}

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.comment-meta[hidden],
.comment-body[hidden] {
  display: none;
}

.comment-action {
  padding: 0;
  font-size: 13px;
  font-family: inherit;
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
}

.comment-action:hover {
  color: var(--color-text);
  text-decoration: underline;
}

.comment-deleted,
.comment-empty {
  font-size: 14px;
  color: var(--color-text-muted);
}

.comment-empty {
  padding: 16px 0;
}

.comment-form textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.6;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  outline: none;
  resize: vertical;
}

.comment-form textarea:focus {
  border-color: var(--color-primary);
}

.comment-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
}

.comment-form-inline {
  margin-top: 12px;
}

.comment-login {
  padding: 16px;
  font-size: 14px;
  text-align: center;
  color: var(--color-text-muted);
  background-color: var(--color-bg-muted);
  border-radius: 8px;
}

.comment-login a {
  font-weight: 600;
  color: var(--color-primary);
}

/* 이전글 / 다음글 */
.post-nav {
  margin-top: 24px;
  overflow: hidden;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.post-nav-item {
  display: flex;
  gap: 16px;
  padding: 14px 20px;
  font-size: 15px;
}

.post-nav-item + .post-nav-item {
  border-top: 1px solid var(--color-border);
}

.post-nav-item:hover {
  background-color: var(--color-bg-muted);
}

.post-nav-label {
  flex-shrink: 0;
  width: 52px;
  font-size: 14px;
  color: var(--color-text-muted);
}

.post-nav-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.post-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 24px;
  margin-top: 32px;
  border-top: 1px solid var(--color-border);
}

.post-actions[hidden],
.post-actions [hidden] {
  display: none;
}

/* 글쓰기 */
.write-card {
  max-width: none;
}

.write-card h1 {
  margin-bottom: 24px;
  text-align: left;
}

.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.7;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  outline: none;
  resize: vertical;
}

.form-group textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(47, 91, 234, 0.15);
}

/* 글쓰기: 공지 체크, 파일 첨부 */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  color: #b42318;
  background-color: #fef3f2;
  border-radius: 8px;
  cursor: pointer;
}

.checkbox-label[hidden] {
  display: none;
}

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

.file-picker,
.form-group .file-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-muted);
  border: 2px dashed var(--color-border);
  border-radius: 10px;
  cursor: pointer;
}

.file-picker:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.file-picker-icon {
  font-size: 20px;
}

.file-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.file-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.file-preview-thumb {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  object-fit: cover;
  background-color: var(--color-placeholder);
  border-radius: 6px;
}

.file-preview-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.file-preview-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.file-preview-size {
  font-size: 12px;
  color: var(--color-text-muted);
}

.file-preview-remove {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  font-size: 18px;
  line-height: 1;
  color: var(--color-text-muted);
  background: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.file-preview-remove:hover {
  color: #d92d20;
  background-color: #fef3f2;
}

.upload-progress {
  margin-bottom: 16px;
}

.upload-progress[hidden] {
  display: none;
}

.upload-progress-bar {
  height: 8px;
  overflow: hidden;
  background-color: var(--color-bg-muted);
  border-radius: 999px;
}

.upload-progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  background-color: var(--color-primary);
  transition: width 0.2s;
}

.write-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- 인기 점수 실험실 ---------- */
.lab-container {
  max-width: 960px;
}

.lab-head {
  margin-bottom: 24px;
}

.lab-head h1 {
  margin-bottom: 8px;
  font-size: 28px;
}

.lab-head p {
  color: var(--color-text-muted);
}

.lab-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: 12px 0 0;
  padding: 0;
  font-size: 14px;
  color: var(--color-text-muted);
  list-style: none;
}

.lab-legend b {
  margin-right: 4px;
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 16px;
  font-style: italic;
  color: var(--color-text);
}

.lab-card {
  margin-bottom: 20px;
  padding: 28px 32px;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.lab-card h2 {
  margin-bottom: 16px;
  font-size: 19px;
}

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

.lab-card-head h2 {
  margin-bottom: 0;
}

.lab-desc {
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--color-text-muted);
}

.lab-formulas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.formula-option {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border: 2px solid var(--color-border);
  border-radius: 10px;
  cursor: pointer;
}

.formula-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.formula-option:has(input:checked) {
  border-color: currentColor;
  background-color: #f8faff;
}

.formula-option:has(input:focus-visible) {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.formula-rational {
  color: #2f5bea;
}

.formula-irrational {
  color: #c2410c;
}

.formula-irrational:has(input:checked) {
  background-color: #fff8f3;
}

.formula-name {
  font-size: 14px;
  font-weight: 700;
}

.formula-expr {
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 20px;
  font-style: italic;
  color: var(--color-text);
}

.lab-sliders {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
}

.slider {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
}

.slider output {
  color: var(--color-primary);
}

.slider small {
  font-weight: 400;
  color: var(--color-text-muted);
}

.slider input[type="range"] {
  width: 100%;
  accent-color: var(--color-primary);
}

#a-warning {
  margin: 16px 0 0;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  font-size: 13px;
  background-color: #e9edf2;
  border-radius: 10px;
}

.segmented label {
  position: relative;
  padding: 6px 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  border-radius: 8px;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label:has(input:checked) {
  color: var(--color-text);
  background-color: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.graph-wrap {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

#graph {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--font-base);
}

#graph .grid {
  stroke: #eef1f5;
  stroke-width: 1;
}

#graph .axis {
  stroke: #667085;
  stroke-width: 1.5;
}

#graph .tick {
  font-size: 12px;
  fill: #667085;
}

#graph .axis-label,
#graph .graph-note {
  font-size: 12px;
  font-weight: 600;
  fill: #475467;
}

#graph .graph-note {
  fill: #2f5bea;
}

#graph .asymptote-label {
  font-size: 13px;
  font-weight: 700;
  font-style: italic;
  fill: #d92d20;
}

.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: 12px 0 0;
  padding: 0;
  font-size: 13px;
  color: var(--color-text-muted);
  list-style: none;
}

.graph-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  display: inline-block;
  width: 22px;
  height: 0;
  border-top: 3px solid;
}

.swatch-rational {
  border-color: #2f5bea;
}

.swatch-irrational {
  border-color: #f97316;
}

.swatch-asymptote {
  border-top: 2px dashed #d92d20;
}

.value-table {
  margin-top: 16px;
}

.value-table summary {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
}

.value-table table,
.ranking {
  width: 100%;
  margin-top: 12px;
  font-size: 14px;
  border-collapse: collapse;
}

.value-table th,
.value-table td,
.ranking th,
.ranking td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
}

.value-table th,
.ranking th {
  font-weight: 600;
  color: var(--color-text-muted);
  background-color: #fafbfc;
}

.ranking-scroll {
  overflow-x: auto;
}

.ranking {
  min-width: 600px;
}

.ranking .ranking-title {
  max-width: 280px;
  overflow: hidden;
  text-align: left;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ranking .ranking-title a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.lab-apply .btn {
  margin-top: 4px;
}

/* ---------- 집합·명제 실험실 ---------- */
.lab-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.lab-tabs a {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-primary);
  background-color: #eef2ff;
  border-radius: 999px;
}

.lab-tabs a:hover {
  background-color: #e0e7ff;
}

.lab-part-title {
  margin: 36px 0 16px;
  font-size: 22px;
  scroll-margin-top: calc(var(--header-height) + 16px);
}

.set-defs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.set-def {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  border: 2px solid;
  border-radius: 10px;
}

.set-def-a {
  border-color: #c7d4fb;
  background-color: #f8faff;
}

.set-def-b {
  border-color: #fed7aa;
  background-color: #fffaf5;
}

.set-name {
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 24px;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
}

.set-def-a .set-name {
  color: #2f5bea;
}

.set-def-b .set-name {
  color: #c2410c;
}

.set-condition {
  display: flex;
  gap: 8px;
}

.set-condition select,
.set-condition input,
.prop-select,
.prop-builder select {
  min-width: 0;
  padding: 9px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--color-text);
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.set-condition select {
  flex: 1;
}

.set-condition input {
  width: 96px;
}

.set-builder {
  margin: 0;
  font-size: 14px;
  color: var(--color-text-muted);
  word-break: break-all;
}

.set-builder.is-problem {
  color: #b42318;
}

.predict-toggle {
  margin: 16px 0 0;
  color: var(--color-text);
  background-color: var(--color-bg-muted);
}

.op-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.op-buttons label {
  position: relative;
  padding: 7px 12px;
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 16px;
  color: var(--color-text-muted);
  background-color: #f2f4f7;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.op-buttons input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.op-buttons label:has(input:checked) {
  color: #fff;
  background-color: var(--color-primary);
}

.op-buttons label:has(input:focus-visible) {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.venn-wrap {
  max-width: 560px;
  margin: 0 auto;
}

.venn {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--font-base);
}

.venn-region {
  fill: #2f5bea;
  fill-opacity: 0;
  transition: fill-opacity 0.25s;
}

.venn-region.is-on {
  fill-opacity: 0.16;
}

.venn-region.is-warn {
  fill: #d92d20;
  fill-opacity: 0.2;
}

/* 교과서 그림처럼: 검은 선, 반듯한 글씨 */
.venn-line {
  fill: none;
  stroke: #1f2328;
  stroke-width: 2;
}

.venn-name {
  font-size: 30px;
  font-weight: 700;
  fill: #1f2328;
}

/* 원소: 자리를 옮길 때 미끄러지고, 새로 들어오면 톡 튀어나오고, 가만히 있을 때도 살짝 떠다닌다 */
/* 다른 영역으로 옮겨 가는 원소만 부드럽게 움직인다 (출발과 도착이 모두 부드러운 곡선) */
.venn-elem-group {
  transition: transform 0.7s cubic-bezier(0.65, 0, 0.35, 1);
  cursor: default;
}

/* 마우스를 올리기 쉬운 보이지 않는 동그라미 */
.venn-hit {
  fill: transparent;
  pointer-events: all;
}

.venn-elem {
  font-size: 16px;
  font-weight: 500;
  fill: #1f2328;
  pointer-events: none;
  transform-box: fill-box;
  transform-origin: center;
  /* 글자를 픽셀에 맞추지 않아야 떠다닐 때 덜컥거리지 않는다 */
  text-rendering: geometricPrecision;
  transition: scale 0.12s ease-out, opacity 0.3s ease, fill 0.12s;
  animation: venn-float 6s ease-in-out infinite;
}

/* 새로 들어온 원소: 작게 숨어 있다가(is-entering) 살짝 튀어나온다(is-popping) */
.venn-elem.is-entering {
  scale: 0.4;
  opacity: 0;
}

.venn-elem.is-popping {
  transition: scale 0.4s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.3s ease;
}

.venn-elem.is-leaving {
  scale: 0.3;
  opacity: 0;
  transition: scale 0.3s ease-in, opacity 0.3s ease;
  transition-delay: 0ms !important;
}

.venn-elem-group:hover .venn-elem {
  scale: 1.45;
  fill: var(--color-primary);
  font-weight: 700;
  transition: scale 0.1s ease-out, fill 0.1s;
}

@keyframes venn-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -1.5px; }
}

#prop-venn .venn-elem {
  font-size: 13px;
}

.venn-more {
  font-size: 12px;
  fill: #5f6b7a;
}

/* 숫자 가리기: 원소는 사라지고 영역마다 ? 가 나타난다 */
.venn-hidden-layer {
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.venn.is-hidden .venn-hidden-layer {
  opacity: 1;
}

.venn.is-hidden .venn-elem-layer {
  opacity: 0;
  pointer-events: none;
}

.venn-elem-layer {
  transition: opacity 0.3s;
}

.venn-hidden {
  font-size: 20px;
  font-weight: 700;
  fill: #98a2b3;
}

@media (prefers-reduced-motion: reduce) {
  .venn-elem-group,
  .venn-elem {
    transition: none;
    animation: none;
  }
}

.set-relation {
  margin: 12px 0 0;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  color: #027a48;
  background-color: #ecfdf3;
  border-radius: 8px;
}

.op-result {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.op-result-head {
  margin: 0 0 4px;
  font-size: 15px;
}

.op-result-head b {
  margin-right: 8px;
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 18px;
}

.set-roster {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--color-text-muted);
  word-break: break-all;
}

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

.op-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid #f2f4f7;
}

.op-list a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.op-list small {
  margin-left: auto;
  color: var(--color-text-muted);
}

.op-id {
  font-weight: 700;
  color: var(--color-primary);
}

.op-list .op-empty {
  color: var(--color-text-muted);
}

.law-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* 공식 하나 = 왼쪽 벤 다이어그램 + 오른쪽 식·설명 */
.law {
  display: grid;
  grid-template-columns: 300px 1fr;
  grid-template-rows: auto auto auto 1fr;
  column-gap: 20px;
  padding: 16px 18px;
  background-color: var(--color-bg-muted);
  border-radius: 12px;
}

.law > .law-venn {
  grid-column: 1;
  grid-row: 1 / span 4;
  align-self: center;
}

.law > :not(.law-venn) {
  grid-column: 2;
}

.law h3 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--color-text-muted);
}

.law-formula {
  margin: 0 0 10px;
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 17px;
  font-weight: 700;
}

/* 공식·법칙 벤 다이어그램: 식의 각 부분을 누르면 그 영역이 칠해진다 */
.law-venn {
  margin: 4px 0 10px;
  background-color: #fff;
  border-radius: 10px;
}

.law-region {
  fill: #6366f1;
  fill-opacity: 0;
  transition: fill-opacity 0.35s ease;
}

.law-region.lv-1 {
  fill-opacity: 0.22;
}

.law-region.lv-2 {
  fill-opacity: 0.55;
}

.law-name {
  font-size: 24px;
}

.law-count {
  font-size: 26px;
  font-weight: 700;
  fill: #1f2328;
}

.law-terms {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.law-term {
  padding: 5px 9px;
  font-family: "Cambria Math", "Times New Roman", var(--font-base);
  font-size: 15px;
  color: var(--color-text);
  background-color: #fff;
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
}

.law-term:hover {
  border-color: #a5b4fc;
  transform: translateY(-1px);
}

.law-term.is-active {
  color: #fff;
  background: linear-gradient(120deg, #3b4fe0, #8b5cf6);
  border-color: transparent;
}

.law-op {
  padding: 0 2px;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-muted);
}

.law-step {
  min-height: 42px;
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.6;
  color: #4338ca;
}

.law-check {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-size: 13px;
  word-break: break-all;
}

.law-check .is-ok,
.law-check .is-bad {
  margin-top: 4px;
  font-size: 14px;
}

.is-ok {
  color: #027a48;
}

.is-bad {
  color: #b42318;
}

.prop-select {
  width: 100%;
  margin-bottom: 16px;
}

.prop-builder {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.prop-builder label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.prop-builder select {
  flex: 1;
}

.prop-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 18px;
  font-style: italic;
  color: #fff;
  border-radius: 50%;
}

.prop-p {
  background-color: #2f5bea;
}

.prop-q {
  background-color: #f97316;
}

.prop-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.chip-button {
  padding: 5px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--color-text);
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
}

.chip-button:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.prop-sentence {
  margin: 16px 0 0;
  padding: 14px 16px;
  font-size: 17px;
  font-weight: 700;
  background-color: #f8faff;
  border-left: 4px solid var(--color-primary);
  border-radius: 6px;
}

.region-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.region-box {
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
}

.region-box.is-counter {
  border-color: #fda29b;
  background-color: #fef3f2;
}

.region-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin: 0 0 8px;
}

.region-head b {
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 16px;
}

.region-head small {
  color: var(--color-text-muted);
}

.region-chips,
.prop-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 14px;
  color: var(--color-text-muted);
}

.person-chip {
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  background-color: #f2f4f7;
  border-radius: 999px;
}

.person-chip.is-guest {
  background-color: #fff;
  border: 1px dashed #98a2b3;
}

.person-chip.is-me {
  color: #fff;
  background-color: var(--color-primary);
}

.prop-table {
  min-width: 680px;
}

.prop-table td {
  vertical-align: middle;
}

.prop-kind b {
  display: block;
}

.prop-kind small {
  font-family: "Cambria Math", "Times New Roman", serif;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.prop-table .prop-text {
  text-align: left;
}

.prop-table .prop-examples {
  justify-content: center;
  align-items: center;
}

.truth-badge {
  display: inline-block;
  padding: 3px 12px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
}

.truth-badge.is-true {
  color: #027a48;
  background-color: #ecfdf3;
}

.truth-badge.is-false {
  color: #b42318;
  background-color: #fef3f2;
}

.prop-conclusion {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 16px 0 0;
  font-size: 15px;
}

.prop-conclusion span::before {
  content: "• ";
  color: var(--color-primary);
}

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

  .law > .law-venn,
  .law > :not(.law-venn) {
    grid-column: 1;
    grid-row: auto;
  }

  .set-defs,
  .law-grid,
  .prop-builder,
  .region-grid {
    grid-template-columns: 1fr;
  }

  .op-buttons label {
    padding: 6px 10px;
    font-size: 15px;
  }
}

/* ---------- 홈 화면 (배너 / 수학 실험실 + 내 정보 / 공지 · 인기글 · 최신글) ---------- */
.home {
  background-color: var(--color-bg-muted);
}

.home-container {
  padding-top: 28px;
  padding-bottom: 56px;
}

.home-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 28px 32px;
  color: #fff;
  background: linear-gradient(120deg, #3b4fe0, #6a5cf5 45%, #9b5cf6 80%, #a855f7);
  border-radius: 20px;
}

.home-banner h1 {
  margin: 0 0 4px;
  font-size: 30px;
  letter-spacing: -0.03em;
  color: #fff;
}

.home-banner p {
  margin: 0;
  opacity: 0.92;
}

.home-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 12px 0 0;
  padding: 0;
  font-size: 14px;
  list-style: none;
  opacity: 0.95;
}

.home-write {
  flex-shrink: 0;
  font-weight: 700;
  color: var(--color-primary);
  background-color: #fff;
}

.home-write:hover {
  color: var(--color-primary-hover);
  background-color: #f1f4ff;
}

.home-row {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.home-row-top {
  grid-template-columns: 1fr 230px;
}

.home-row-lists {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 0;
}

.home-box {
  min-width: 0;
  padding: 20px 22px;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: 16px;
}

.home-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.home-box-head h2 {
  margin: 0;
  font-size: 16px;
}

.home-box-head a {
  font-size: 13px;
  color: var(--color-text-muted);
}

.home-box-head a:hover {
  color: var(--color-primary);
}

.home-lab-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.home-lab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background-color: #f5f7ff;
  border-radius: 12px;
  transition: transform 0.2s, background-color 0.2s;
}

.home-lab:hover {
  background-color: #eaefff;
  transform: translateY(-2px);
}

.home-lab b {
  display: block;
  font-size: 15px;
}

.home-lab small {
  font-size: 12.5px;
  color: var(--color-text-muted);
}

.home-lab-icon {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  border-radius: 12px;
}

.lab-icon-set {
  background: linear-gradient(135deg, #3b6cff, #8b5cf6);
}

.lab-icon-func {
  font-style: italic;
  background: linear-gradient(135deg, #f97316, #fbbf24);
}

.home-me {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 16px 18px;
  text-align: center;
}

.home-me-text {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.home-me-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
}

.home-me .btn {
  justify-content: center;
  width: 100%;
  padding: 9px 0;
}

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

.home-list li {
  border-bottom: 1px solid #f1f3f6;
}

.home-list li:last-child {
  border-bottom: 0;
}

.home-list a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 0;
  font-size: 14.5px;
}

.home-list a:hover .home-title {
  color: var(--color-primary);
  text-decoration: underline;
}

.home-rank {
  flex-shrink: 0;
  width: 20px;
  font-weight: 800;
  color: var(--color-primary);
  text-align: center;
}

.home-title {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.home-meta {
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 8px;
  font-size: 12.5px;
  color: #8a94a3;
  white-space: nowrap;
}

.home-list .badge,
.home-list .comment-count {
  flex-shrink: 0;
}

.home-empty {
  padding: 12px 0;
  font-size: 14px;
  color: var(--color-text-muted);
}

/* 실험실 목록 (labs.html) */
.labs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.labs-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 26px;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.labs-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.labs-unit {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
}

.labs-card b {
  font-size: 20px;
}

.labs-card p {
  margin: 0;
  font-size: 14.5px;
  color: var(--color-text-muted);
}

.labs-go {
  margin-top: auto;
  padding-top: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
}

@media (max-width: 1024px) {
  .home-row-lists {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .home-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px;
  }

  .home-row-top,
  .home-row-lists,
  .home-lab-grid,
  .labs-grid {
    grid-template-columns: 1fr;
  }

  .home-me {
    order: -1; /* 휴대폰에서는 로그인 칸을 실험실보다 위에 */
  }
}

/* ---------- 문제 풀기 (quiz.html) ---------- */
.quiz-container {
  max-width: 820px;
}

.quiz-card {
  padding: 32px 36px;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.05);
}

.quiz-head h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.quiz-head p {
  margin: 0 0 24px;
  color: var(--color-text-muted);
}

.quiz-option {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 16px;
}

.quiz-option-label {
  width: 64px;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-muted);
}

.quiz-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quiz-chips label {
  position: relative;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  background-color: #f2f4f7;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, transform 0.15s;
}

.quiz-chips label:active {
  transform: scale(0.96);
}

.quiz-chips input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.quiz-chips label:has(input:checked) {
  color: #fff;
  background: linear-gradient(120deg, #3b4fe0, #8b5cf6);
}

.quiz-chips label:has(input:focus-visible) {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.quiz-start {
  justify-content: center;
  width: 100%;
  margin-top: 8px;
  padding: 14px 0;
  font-size: 16px;
}

.quiz-record {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--color-text-muted);
  text-align: center;
}

.quiz-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.quiz-bar {
  flex: 1;
  height: 8px;
  overflow: hidden;
  background-color: #eef0f4;
  border-radius: 999px;
}

.quiz-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #3b4fe0, #8b5cf6);
  border-radius: 999px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.quiz-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.quiz-tags span {
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
}

.tag-topic {
  color: #4338ca;
  background-color: #eef2ff;
}

.tag-type {
  color: #475467;
  background-color: #f2f4f7;
}

.tag-level {
  color: #b54708;
  background-color: #fffaeb;
}

.quiz-question {
  margin-bottom: 20px;
  font-size: 17px;
  line-height: 1.85;
  word-break: keep-all;
}

.quiz-question.is-in {
  animation: fade-up 0.35s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.quiz-no {
  margin-right: 4px;
  font-weight: 800;
  color: var(--color-primary);
}

.qm {
  font-family: "Cambria Math", "Times New Roman", var(--font-base);
  white-space: nowrap;
}

.quiz-question .qm,
.quiz-choice .qm {
  white-space: normal;
}

.q-table {
  margin-top: 10px;
  font-size: 14px;
  border-collapse: collapse;
}

.q-table th,
.q-table td {
  padding: 4px 14px;
  text-align: center;
  border: 1px solid var(--color-border);
}

.q-table th {
  background-color: #f8f9fb;
}

.q-bogi {
  margin-top: 12px;
  padding: 12px 16px;
  font-size: 15.5px;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
}

.q-bogi b {
  display: block;
  margin-bottom: 4px;
  text-align: center;
}

.qx-list {
  margin: 8px 0;
  padding-left: 18px;
}

.quiz-choices {
  display: grid;
  gap: 8px;
}

.quiz-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  font: inherit;
  font-size: 15.5px;
  text-align: left;
  color: var(--color-text);
  background-color: #fff;
  border: 1.5px solid var(--color-border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
}

.quiz-choice:hover:not(:disabled) {
  border-color: #a5b4fc;
  transform: translateX(3px);
}

.quiz-choice-no {
  flex-shrink: 0;
  font-weight: 700;
  color: var(--color-text-muted);
}

.quiz-choice.is-selected {
  border-color: var(--color-primary);
  background-color: #f5f7ff;
}

.quiz-choice.is-selected .quiz-choice-no {
  color: var(--color-primary);
}

.quiz-choice.is-correct {
  border-color: #12b76a;
  background-color: #ecfdf3;
  animation: pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.quiz-choice.is-wrong {
  border-color: #f04438;
  background-color: #fef3f2;
  animation: quiz-shake 0.35s;
}

/* 모두 고르기: 동그라미 번호 대신 네모 체크 느낌 */
.quiz-choices.is-multi .quiz-choice.is-selected .quiz-choice-no {
  color: #fff;
  background-color: var(--color-primary);
  border-radius: 6px;
}

.quiz-choices.is-multi .quiz-choice-no {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1.5px solid #c4c9d1;
  border-radius: 6px;
}

.quiz-choice.is-missed {
  border-style: dashed;
}

.q-count {
  font-size: 14px;
  font-weight: 700;
  color: #b54708;
  white-space: nowrap;
}

.quiz-choice:disabled {
  cursor: default;
}

.quiz-number {
  width: 200px;
  padding: 12px 16px;
  font: inherit;
  font-size: 18px;
  border: 1.5px solid var(--color-border);
  border-radius: 12px;
}

.quiz-number:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(47, 91, 234, 0.15);
}

.quiz-number.is-correct {
  border-color: #12b76a;
  background-color: #ecfdf3;
}

.quiz-number.is-wrong {
  border-color: #f04438;
  background-color: #fef3f2;
  animation: quiz-shake 0.35s;
}

.quiz-help {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.quiz-set {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quiz-set-chip {
  min-width: 46px;
  padding: 9px 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  background-color: #fff;
  border: 1.5px solid var(--color-border);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s, background-color 0.15s, border-color 0.15s, color 0.15s;
}

.quiz-set-chip:active:not(:disabled) {
  transform: scale(0.92);
}

.quiz-set-chip.is-selected {
  color: #fff;
  background: linear-gradient(135deg, #3b4fe0, #8b5cf6);
  border-color: transparent;
}

.quiz-set-chip.is-correct {
  color: #027a48;
  background: #ecfdf3;
  border-color: #12b76a;
}

.quiz-set-chip.is-wrong {
  color: #b42318;
  background: #fef3f2;
  border-color: #f04438;
  text-decoration: line-through;
}

.quiz-set-chip:disabled {
  cursor: default;
}

.quiz-set-preview {
  margin: 12px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: #4338ca;
}

.quiz-feedback {
  margin-top: 20px;
  padding: 16px 18px;
  background-color: #f8f9fb;
  border-radius: 14px;
  animation: fade-up 0.3s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.quiz-verdict {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 800;
}

.quiz-verdict.is-correct {
  color: #027a48;
}

.quiz-verdict.is-wrong {
  color: #b42318;
}

/* 정답 포인트 (+20P · Lv. 3 ...) */
.quiz-points {
  display: inline-block;
  margin: 0 0 10px;
  padding: 4px 12px;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 999px;
}

.quiz-points.is-gain {
  color: #3b2fc9;
  background: linear-gradient(90deg, #eef3ff, #f4edff);
  animation: points-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.quiz-points.is-info {
  font-weight: 500;
  color: var(--color-text-muted);
  background-color: var(--color-bg-muted);
}

@keyframes points-pop {
  from { opacity: 0; transform: translateY(6px) scale(0.9); }
  to { opacity: 1; transform: none; }
}

.quiz-result-points {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: #3b2fc9;
  text-align: center;
}

/* 시작 화면의 내 레벨 (누르면 마이페이지) */
.quiz-level {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 10px auto 0;
  font-size: 13px;
  color: var(--color-text-muted);
}

.quiz-level:hover {
  color: var(--color-primary);
}

.quiz-level b {
  color: var(--color-text);
}

.quiz-level-bar {
  width: 120px;
  height: 8px;
  overflow: hidden;
  background-color: #eef1f6;
  border-radius: 999px;
}

.quiz-level-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3b6cff, #8b5cf6);
  border-radius: inherit;
}

.quiz-explain {
  font-size: 14.5px;
  line-height: 1.8;
  color: #344054;
}

.quiz-explain > b {
  margin-right: 6px;
  color: #4338ca;
}

.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

.quiz-actions .btn-ghost:first-child {
  margin-right: auto;
}

.quiz-score {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  text-align: center;
  background: linear-gradient(120deg, #3b4fe0, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.quiz-score-sub {
  margin: 4px 0 20px;
  text-align: center;
  color: var(--color-text-muted);
}

.quiz-result-list {
  display: grid;
  gap: 6px;
}

.quiz-result-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 14px;
  border-radius: 10px;
}

.quiz-result-row.is-correct {
  background-color: #f6fef9;
}

.quiz-result-row.is-wrong {
  background-color: #fffbfa;
}

.quiz-result-mark {
  font-weight: 800;
}

.is-correct > .quiz-result-mark {
  color: #12b76a;
}

.is-wrong > .quiz-result-mark {
  color: #f04438;
}

.quiz-seed {
  margin: 16px 0 0;
  font-size: 12.5px;
  color: #98a2b3;
  text-align: center;
}

/* 시작 화면 탭: 새 문제 풀기 / 오답노트 */
.quiz-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 22px;
  padding: 4px;
  background-color: #f2f4f7;
  border-radius: 12px;
}

.quiz-tabs button {
  flex: 1;
  padding: 10px 0;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-muted);
  background: none;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.quiz-tabs button.is-active {
  color: var(--color-text);
  background-color: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.quiz-tab-count {
  display: inline-block;
  min-width: 22px;
  margin-left: 4px;
  padding: 0 6px;
  font-size: 12px;
  color: #fff;
  background-color: #f04438;
  border-radius: 999px;
}

/* 오답노트 */
.note-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.note-list {
  display: grid;
  gap: 10px;
}

.note-item {
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  animation: fade-up 0.3s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.note-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.note-head span:not(.note-meta) {
  padding: 2px 9px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 999px;
}

.note-meta {
  margin-left: auto;
  font-size: 12px;
  color: #98a2b3;
}

.note-text {
  margin: 8px 0 10px;
  font-size: 14px;
  line-height: 1.6;
  color: #344054;
}

.note-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.note-buttons .btn {
  padding: 7px 14px;
  font-size: 13px;
}

.note-delete {
  margin-left: auto;
  color: #b42318;
}

.note-empty {
  padding: 28px 0;
  text-align: center;
  color: var(--color-text-muted);
}

/* 문제 위 도구 줄: 태그 + 계산기·메모장 버튼 */
.quiz-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.quiz-toolbar .quiz-tags {
  margin-bottom: 0;
}

.quiz-tools {
  display: flex;
  gap: 6px;
}

.tool-button {
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #344054;
  background-color: #f2f4f7;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  cursor: pointer;
}

.tool-button.is-on {
  color: #fff;
  background-color: #344054;
  border-color: #344054;
}

/* 떠 있는 창 (컴퓨터 시험 화면의 계산기·메모장처럼) */
.float-window {
  position: fixed;
  z-index: 1000;
  overflow: hidden;
  background-color: #f3f4f6;
  border: 1px solid #c4c9d1;
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
  animation: pop-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.float-window:focus {
  outline: none;
}

.float-window.is-dragging {
  opacity: 0.92;
}

.float-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 8px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, #3b4fe0, #6d5df5);
  cursor: move;
  user-select: none;
  touch-action: none;
}

.float-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 투명도 조절 바 (제목 줄 안, 닫기 버튼 왼쪽) */
.float-opacity {
  width: 84px;
  height: 4px;
  accent-color: #fff;
  cursor: ew-resize;
  opacity: 0.85;
}

.float-close {
  width: 26px;
  height: 26px;
  font-size: 18px;
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.float-close:hover {
  background: #f04438;
}

.calc-window {
  width: 280px;
}

.calc-screen {
  padding: 10px 14px 6px;
  text-align: right;
  background-color: #fff;
  border-bottom: 1px solid #e4e7ec;
}

.calc-expr {
  min-height: 18px;
  font-size: 12px;
  color: #667085;
}

.calc-display {
  overflow: hidden;
  font-size: 30px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.calc-keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 6px;
}

.calc-keys button {
  height: 44px;
  font: inherit;
  font-size: 16px;
  color: #1f2328;
  background-color: #fff;
  border: 1px solid #e4e7ec;
  border-radius: 6px;
  cursor: pointer;
}

.calc-keys button:hover {
  background-color: #eef2ff;
}

.calc-keys button.is-pressed {
  animation: calc-press 0.15s;
}

.calc-keys .calc-op {
  font-size: 18px;
  background-color: #f8f9fb;
}

.calc-keys .calc-eq {
  color: #fff;
  background-color: #3b4fe0;
  border-color: #3b4fe0;
}

.calc-keys .calc-eq:hover {
  background-color: #2f3fc4;
}

@keyframes calc-press {
  50% { transform: scale(0.93); }
}

.memo-window {
  display: flex;
  flex-direction: column;
  width: 320px;
  height: 320px;
  min-width: 220px;
  min-height: 160px;
}

/* 창을 끌거나 크기를 바꾸는 동안 페이지 글자가 파랗게 선택되지 않게 */
body.float-busy,
body.float-busy * {
  user-select: none;
}

.calc-keys {
  user-select: none;
}

.memo-window textarea {
  display: block;
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: 12px 14px;
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  background-color: #fffef5;
  border: 0;
  resize: none;
}

/* 크기 조절 손잡이: 변은 얇게, 모서리는 조금 크게 (보이지 않지만 마우스 모양이 바뀜) */
.rs {
  position: absolute;
  z-index: 2;
  touch-action: none;
}

.rs-n, .rs-s { left: 10px; right: 10px; height: 8px; cursor: ns-resize; }
.rs-e, .rs-w { top: 10px; bottom: 10px; width: 8px; cursor: ew-resize; }
.rs-n { top: -4px; }
.rs-s { bottom: -4px; }
.rs-e { right: -4px; }
.rs-w { left: -4px; }
.rs-ne, .rs-nw, .rs-se, .rs-sw { width: 16px; height: 16px; }
.rs-ne { top: -4px; right: -4px; cursor: nesw-resize; }
.rs-sw { bottom: -4px; left: -4px; cursor: nesw-resize; }
.rs-nw { top: -4px; left: -4px; cursor: nwse-resize; }
.rs-se { bottom: -4px; right: -4px; cursor: nwse-resize; }

.memo-window textarea:focus {
  outline: none;
}

.memo-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 6px 14px;
  font-size: 12px;
  color: #667085;
  border-top: 1px solid #e4e7ec;
}

.memo-foot .btn {
  padding: 5px 10px;
  font-size: 12px;
}

@media (max-width: 640px) {
  .calc-window,
  .memo-window {
    width: calc(100vw - 16px);
  }
}

/* ---------- 문제 풀기: 단원 고르기 (대단원별) ---------- */
.quiz-option-units {
  align-items: flex-start;
}

.quiz-option-units .quiz-option-label {
  padding-top: 4px;
}

.unit-picker {
  display: grid;
  flex: 1;
  gap: 12px;
  min-width: 0;
}

.unit-group {
  display: grid;
  gap: 6px;
}

.unit-group-head {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--color-text);
  cursor: pointer;
}

.unit-group-head input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #4f46e5;
}

/* ---------- 문제 풀기: 단원별 핵심 포인트 ---------- */
.unit-points {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--color-border);
}

.unit-points h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.point-chapter {
  margin: 18px 0 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: #4338ca;
}

.point-card {
  margin-bottom: 8px;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.point-card[open] {
  border-color: #c7d2fe;
  box-shadow: 0 6px 18px rgba(67, 56, 202, 0.08);
}

.point-card > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 12px 16px;
  list-style: none;
  cursor: pointer;
}

.point-card > summary::-webkit-details-marker {
  display: none;
}

.point-card > summary::after {
  content: "+";
  margin-left: auto;
  font-weight: 700;
  color: var(--color-text-muted);
}

.point-card[open] > summary::after {
  content: "−";
}

.point-card summary small {
  font-size: 12.5px;
  color: var(--color-text-muted);
}

.point-no {
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #4338ca;
  background-color: #eef2ff;
  border-radius: 999px;
}

.point-body {
  padding: 0 16px 16px;
}

.point-body h4 {
  margin: 10px 0 6px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.point-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.6;
  color: #344054;
}

.point-tips li::marker {
  content: "✓  ";
  color: #12b76a;
  font-weight: 700;
}

.point-go {
  margin-top: 12px;
}

/* 해설 아래 한 줄 핵심 포인트 */
.qx-point {
  margin: 12px 0 0;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.6;
  color: #7a2e0e;
  background-color: #fffaeb;
  border: 1px solid #fedf89;
  border-radius: 10px;
}

.qx-point b {
  margin-right: 6px;
  color: #b54708;
}

/* 분수: 위·아래로 보이고, 글자로 옮기면 a/b 로 읽힌다 */
.qf {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin: 0 2px;
  font-size: 0.92em;
  line-height: 1.2;
  vertical-align: middle;
}

.qf-n {
  padding: 0 4px 1px;
  border-bottom: 1.3px solid currentColor;
}

.qf-d {
  padding: 1px 4px 0;
}

.qf-s {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@keyframes quiz-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@media (max-width: 768px) {
  .quiz-card {
    padding: 22px 18px;
  }

  .quiz-option-label {
    width: 100%;
  }

  .quiz-question {
    font-size: 16px;
  }

  .quiz-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .quiz-actions .btn-ghost:first-child {
    margin-right: 0;
  }
}

/* ---------- 8. 푸터 ---------- */
.site-footer {
  padding-top: 56px;
  background-color: var(--color-footer-bg);
  color: var(--color-footer-text);
  font-size: 14px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  padding-bottom: 40px;
}

.site-footer .logo {
  display: inline-flex;
  margin-bottom: 12px;
  color: #fff;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-links a:hover {
  color: #fff;
}

.footer-bottom p {
  padding: 20px 0 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
}

/* ---------- 9. 반응형: 태블릿 (1024px 이하) ---------- */
@media (max-width: 1024px) {
  .hero {
    padding: 72px 0;
  }

  .hero h1 {
    font-size: 36px;
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- 10. 반응형: 모바일 (768px 이하) ---------- */
@media (max-width: 768px) {
  :root {
    --header-height: 64px;
  }

  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  /* 메뉴를 숨기고 버튼을 누르면 아래로 펼쳐지게 한다 */
  .menu-toggle {
    display: flex;
  }

  .site-menu {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    margin-left: 0;
    padding: 16px;
    background-color: #fff;
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow);
  }

  .site-menu.is-open {
    display: flex;
  }

  .main-nav {
    flex-direction: column;
    gap: 0;
  }

  .main-nav a {
    padding: 12px 4px;
    border-bottom: 1px solid var(--color-border);
  }

  .account {
    flex-wrap: wrap;
  }

  .account .btn {
    flex: 1;
  }

  .account-name {
    flex-basis: 100%;
    padding: 4px;
  }

  .hero {
    padding: 48px 0;
  }

  .hero-inner,
  .split {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .hero h1 {
    font-size: 30px;
  }

  .lead {
    font-size: 16px;
  }

  .section {
    padding: 56px 0;
  }

  .section h2 {
    font-size: 24px;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .split-visual {
    min-height: 180px;
  }

  .auth-page {
    padding: 40px 16px 64px;
  }

  .auth-card,
  .mypage-card {
    padding: 32px 20px;
  }

  .level-top {
    flex-wrap: wrap;
  }

  .level-stats {
    width: 100%;
    justify-content: space-around;
    padding-top: 10px;
    text-align: center;
    border-top: 1px solid var(--color-border);
  }

  .level-recent time {
    display: none;
  }

  .footer-inner {
    flex-direction: column;
  }

  /* 게시판 모바일: 제목을 위에, 나머지 정보를 아래 한 줄로 */
  .board-page {
    padding: 32px 0 56px;
  }

  .board-row-head,
  .board-row .board-cell-id {
    display: none;
  }

  .board-row {
    gap: 4px 12px;
    padding: 14px 16px;
  }

  .board-row:not(.board-row-head) {
    border-top: none;
  }

  .board-row + .board-row {
    border-top: 1px solid var(--color-border);
  }

  .board-row-head + .board-row {
    border-top: none;
  }

  .board-row .board-cell-title {
    grid-column: 1 / -1;
    flex-wrap: wrap;
  }

  .board-row .title-text {
    white-space: normal;
  }

  .board-row {
    grid-template-columns: auto auto auto 1fr;
  }

  .board-notice-mobile {
    display: inline-flex;
  }

  .board-search {
    flex-wrap: wrap;
  }

  .board-search input {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .comments {
    padding: 20px;
  }

  .comment.is-reply {
    --indent-step: 18px;
  }

  .comment.is-reply::before {
    left: calc((var(--depth) - 1) * var(--indent-step) + 2px);
  }

  .board-row > span {
    text-align: left;
  }

  .post {
    padding: 28px 20px;
  }

  .lab-card {
    padding: 20px;
  }

  .lab-formulas,
  .lab-sliders {
    grid-template-columns: 1fr;
  }

  .post-header h1 {
    font-size: 22px;
  }
}

/* ---------- 실험실 공통: 좌표평면 (lab-plane.js) ---------- */
.plane-wrap {
  overflow: hidden;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
}

.plane {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--font-base);
  touch-action: none; /* 점을 끌 때 화면이 같이 움직이지 않게 */
  user-select: none;
}

.plane-line { stroke: #eef1f5; stroke-width: 1; }
.plane-axis { stroke: #667085; stroke-width: 1.5; }
.plane-tick { font-size: 11px; fill: #667085; }
.plane-axis-name { font-size: 14px; font-style: italic; font-weight: 700; fill: #475467; }

.lab-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 14px;
  color: var(--color-text-muted);
}

.lab-checks input {
  accent-color: var(--color-primary);
}

/* 성질 목록 (함수 실험실, 도형 실험실 공용) */
.fx-props {
  margin: 0;
}

.fx-props div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 10px 0;
  font-size: 14.5px;
  border-bottom: 1px solid var(--color-border);
}

.fx-props div:last-child {
  border-bottom: 0;
}

.fx-props dt {
  font-weight: 700;
  color: var(--color-text-muted);
}

.fx-props dd {
  margin: 0;
  line-height: 1.7;
  word-break: keep-all;
}

/* ---------- 유리함수 · 무리함수 실험실 ---------- */
.fx-formula {
  margin: 20px 0 0;
  padding: 14px 18px;
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 24px;
  text-align: center;
  background-color: var(--color-bg-muted);
  border-radius: 10px;
}

.fx-root {
  padding: 0 2px;
  border-top: 1.5px solid currentColor;
}

.fx-curve { fill: none; stroke-width: 3.5; stroke-linecap: round; }
.fx-curve.fx-rational { stroke: #2f5bea; }
.fx-curve.fx-irrational { stroke: #c2410c; }
.fx-base { fill: none; stroke: #98a2b3; stroke-width: 2; stroke-dasharray: 5 5; }
.fx-asymptote { stroke: #d92d20; stroke-width: 1.5; stroke-dasharray: 6 5; }
.fx-asymptote-label { font-size: 13px; font-weight: 700; font-style: italic; fill: #d92d20; }
.fx-yx { stroke: #12b76a; stroke-width: 1.2; stroke-dasharray: 3 4; }
.fx-yx-label { font-size: 12px; font-weight: 700; fill: #039855; }
.fx-inverse { fill: none; stroke: #12b76a; stroke-width: 2.5; opacity: 0.85; }
.fx-target { fill: none; stroke: #f04438; stroke-width: 3; stroke-dasharray: 9 6; opacity: 0.85; }
.fx-start { fill: #c2410c; stroke: #fff; stroke-width: 2; }
.fx-start-label { font-size: 13px; font-weight: 700; fill: #c2410c; }

.swatch-base { border-top: 3px dashed #98a2b3; }
.swatch-inverse { border-top-color: #12b76a; }

/* 좌표평면이 너무 커지지 않게 */
.lab-card > .plane-wrap {
  max-width: 560px;
  margin: 0 auto;
}

.fx-challenge {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fx-result {
  min-height: 1.6em;
  margin: 14px 0 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.fx-result.is-correct {
  font-size: 18px;
  color: #027a48;
}

/* ---------- 도형의 방정식 실험실 ---------- */
.geo-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.geo-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.geo-sliders {
  grid-template-columns: 1fr 1fr;
}

.geo-label {
  margin: 0 0 -8px;
  font-size: 14px;
  font-weight: 600;
}

.geo-reflect,
.geo-shape {
  flex-wrap: wrap;
  align-self: flex-start;
}

/* 끌 수 있는 점 */
.geo-handle { cursor: grab; }
.geo-handle.is-dragging { cursor: grabbing; }
.geo-handle-hit { fill: transparent; }
.geo-handle-dot { fill: #2f5bea; stroke: #fff; stroke-width: 2.5; transition: r 0.12s; }
.geo-handle:hover .geo-handle-dot,
.geo-handle.is-dragging .geo-handle-dot { r: 8.5; }
.geo-handle-label { font-size: 13px; font-weight: 700; fill: #1d3fbf; paint-order: stroke; stroke: #fff; stroke-width: 4px; }

.geo-segment { stroke: #2f5bea; stroke-width: 3; }
.geo-line { stroke: #2f5bea; stroke-width: 1.2; opacity: 0.45; }
.geo-helper { fill: none; stroke: #98a2b3; stroke-width: 1.5; stroke-dasharray: 4 4; }
.geo-helper-label,
.geo-d-label,
.geo-image-label,
.geo-p-label { font-size: 12.5px; font-weight: 700; paint-order: stroke; stroke: #fff; stroke-width: 4px; }
.geo-helper-label { fill: #667085; }
.geo-mid { fill: #fff; stroke: #2f5bea; stroke-width: 2; }
.geo-point-p { fill: #8b5cf6; stroke: #fff; stroke-width: 2; }
.geo-p-label { fill: #6d28d9; }

/* 원과 직선: 만나면 초록, 접하면 보라, 안 만나면 회색 */
.geo-circle { fill: rgba(47, 91, 234, 0.06); stroke: #2f5bea; stroke-width: 2.5; }
.geo-line-strong { stroke-width: 2.5; }
.geo-line-strong.is-meet2 { stroke: #039855; }
.geo-line-strong.is-tangent { stroke: #7c3aed; }
.geo-line-strong.is-apart { stroke: #98a2b3; }
.geo-perp { stroke: #f79009; stroke-width: 2; stroke-dasharray: 5 4; }
.geo-foot { fill: #f79009; }
.geo-d-label { fill: #b54708; font-style: italic; font-size: 14px; }
.geo-meet { fill: #fff; stroke: #d92d20; stroke-width: 2.5; }

.geo-verdict {
  margin: 0;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 10px;
}

.geo-verdict.is-meet2 { color: #027a48; background-color: #ecfdf3; }
.geo-verdict.is-tangent { color: #6d28d9; background-color: #f4edff; }
.geo-verdict.is-apart { color: #475467; background-color: var(--color-bg-muted); }

/* 도형의 이동 */
.geo-ghost-circle { fill: rgba(47, 91, 234, 0.06); stroke: #2f5bea; stroke-width: 2; stroke-dasharray: 5 4; }
.geo-ghost-mid-circle { fill: none; stroke: #98a2b3; stroke-width: 1.5; stroke-dasharray: 4 4; }
.geo-ghost-mid-dot { fill: #98a2b3; }
.geo-image-circle { fill: rgba(139, 92, 246, 0.1); stroke: #7c3aed; stroke-width: 2.5; }
.geo-image-dot { fill: #7c3aed; stroke: #fff; stroke-width: 2; }
.geo-image-label { fill: #6d28d9; }
.geo-arrow { stroke: #667085; stroke-width: 1.5; }
.geo-arrow-head { fill: #667085; }
.geo-mirror { stroke: #f04438; stroke-width: 2; stroke-dasharray: 8 5; }
.geo-mirror-point { fill: none; stroke: #f04438; stroke-width: 2; }

.lab-icon-geo {
  background: linear-gradient(135deg, #12b76a, #0e9384);
}

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

  .fx-props div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .fx-formula {
    font-size: 20px;
  }
}

/* ---------- 빨간 테두리 버튼 (삭제, 초기화) ---------- */
.btn-danger-ghost {
  color: #b42318;
  background-color: #fff;
  border: 1px solid #fecdca;
}

.btn-danger-ghost:hover {
  color: #fff;
  background-color: #d92d20;
  border-color: #d92d20;
}

/* 마이페이지 랭킹: 초기화 안내와 관리자 버튼 */
.rank-since {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--color-text-muted);
  text-align: center;
}

.rank-admin {
  margin-top: 16px;
  padding-top: 16px;
  text-align: center;
  border-top: 1px dashed var(--color-border);
}

/* ---------- 회원 관리 (views/admin.html) ---------- */
.admin-container {
  max-width: 1100px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.admin-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 24px;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.admin-stat span {
  font-size: 13.5px;
  color: var(--color-text-muted);
}

.admin-stat b {
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(90deg, #3b6cff, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.admin-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.admin-form-card {
  position: sticky;
  top: calc(var(--header-height) + 16px);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.admin-form-card.is-editing {
  border-color: #b8c7ff;
  box-shadow: 0 0 0 3px rgba(47, 91, 234, 0.12);
}

.admin-form-buttons {
  display: flex;
  gap: 8px;
}

.admin-form-buttons .btn {
  flex: 1;
}

.admin-search {
  display: flex;
  gap: 6px;
}

.admin-search input {
  width: 180px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  outline: none;
}

.admin-search input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(47, 91, 234, 0.15);
}

.admin-table {
  width: 100%;
}

.admin-table td:first-child {
  color: var(--color-text-muted);
}

.admin-table tr.is-editing td {
  background-color: #eef3ff;
}

.admin-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.admin-empty {
  padding: 28px 0 !important;
  color: var(--color-text-muted);
  text-align: center;
}

.admin-site-card {
  margin-top: 20px;
}

@media (max-width: 900px) {
  .admin-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-form-card {
    position: static;
  }
}

@media (max-width: 600px) {
  .admin-stats {
    grid-template-columns: 1fr 1fr;
  }

  .admin-stat:first-child {
    grid-column: 1 / -1;
  }

  .admin-search {
    width: 100%;
  }

  .admin-search input {
    flex: 1;
    width: auto;
    min-width: 0;
  }
}

/* ---------- 내 펫 · 포인트 상점 (views/pet.html) ---------- */
.pet-container {
  max-width: 1100px;
}

.pet-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.pet-wallet {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding: 14px 20px;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.pet-wallet span {
  font-size: 13px;
  color: var(--color-text-muted);
}

.pet-wallet b {
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(90deg, #3b6cff, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.species-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.species-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 8px;
  font-family: inherit;
  font-size: 15px;
  background-color: #fff;
  border: 2px solid var(--color-border);
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.species-card:hover {
  transform: translateY(-3px);
}

.species-card.is-picked {
  background-color: #f4f7ff;
  border-color: var(--color-primary);
}

.species-emoji {
  font-size: 44px;
}

.pet-name-form {
  display: flex;
  gap: 8px;
  max-width: 420px;
}

.pet-name-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 15px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.pet-layout {
  display: grid;
  grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.pet-card {
  position: sticky;
  top: calc(var(--header-height) + 16px);
  text-align: center;
}

/* 펫이 사는 방 */
.pet-stage {
  position: relative;
  display: grid;
  place-items: center;
  height: 240px;
  margin-bottom: 16px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 120%, #dfe7ff 0 45%, transparent 46%), linear-gradient(180deg, #f5f8ff, #eef1fb);
  border-radius: 16px;
}

.pet-figure {
  position: relative;
  display: grid;
  place-items: center;
  animation: pet-idle 2.6s ease-in-out infinite;
}

/* 펫 크기는 .pet-figure 의 글자 크기로 정하고, 몸과 꾸미기는 그 비율(em)로 맞춘다 */
.pet-figure { font-size: 96px; }
.pet-figure[data-stage="0"] { font-size: 80px; }
.pet-figure[data-stage="1"] { font-size: 84px; }
.pet-figure[data-stage="3"] { font-size: 108px; }
.pet-figure[data-stage="4"] { font-size: 116px; }

.pet-body {
  font-size: 1em;
  line-height: 1;
  filter: drop-shadow(0 10px 10px rgba(15, 23, 42, 0.15));
}

.pet-figure[data-stage="4"] .pet-body { filter: drop-shadow(0 0 16px rgba(251, 191, 36, 0.8)); }

.pet-figure[data-stage="0"] { animation: pet-wobble 2.2s ease-in-out infinite; }
.pet-figure.is-sad { animation-duration: 5s; filter: saturate(0.6); }

.pet-wear {
  --wx: 0em;   /* 직접 옮긴 거리 (pet-page.js 가 정함) */
  --wy: 0em;
  --ws: 1;     /* 직접 정한 크기 */
  --wr: 0deg;  /* 직접 정한 각도 */
  position: absolute;
  z-index: 1;
  line-height: 1;
  pointer-events: none;
}

/* 위치 조정 중: 펫은 가만히 있고 꾸미기를 끌 수 있다 */
.pet-figure.is-editing { animation: none !important; }
.pet-figure.is-editing .pet-wear:not(.is-target) { pointer-events: auto; cursor: pointer; opacity: 0.75; }
.pet-figure.is-editing .pet-wear.is-target {
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  outline: 2px dashed #8b5cf6;
  outline-offset: 3px;
  border-radius: 6px;
}

.wear-edit-open {
  margin: -6px 0 12px;
}

.wear-edit {
  display: grid;
  gap: 10px;
  margin: -4px 0 16px;
  padding: 14px;
  text-align: left;
  background-color: #f8f5ff;
  border: 1px solid #e3d7ff;
  border-radius: 12px;
}

.wear-edit-help {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-muted);
}

.wear-nudge {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.wear-nudge button {
  width: 38px;
  height: 34px;
  font-size: 16px;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
}

.wear-edit-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

/* 꾸미기마다 알맞은 크기와 자리 (펫 얼굴을 가리지 않게) */
.pet-wear[data-wear="ribbon"] { top: -0.08em; right: -0.02em; font-size: 0.34em; transform: translate(var(--wx), var(--wy)) rotate(18deg) rotate(var(--wr)) scale(var(--ws)); }
.pet-wear[data-wear="glasses"] { top: 0.4em; left: 50%; font-size: 0.36em; transform: translate(var(--wx), var(--wy)) translateX(-50%) rotate(var(--wr)) scale(var(--ws)); opacity: 0.9; }
.pet-wear[data-wear="cap"] { top: -0.36em; left: 50%; font-size: 0.48em; transform: translate(var(--wx), var(--wy)) translateX(-50%) rotate(-6deg) rotate(var(--wr)) scale(var(--ws)); }
.pet-wear[data-wear="crown"] { top: -0.32em; left: 50%; font-size: 0.42em; transform: translate(var(--wx), var(--wy)) translateX(-50%) rotate(var(--wr)) scale(var(--ws)); filter: drop-shadow(0 2px 3px rgba(180, 120, 0, 0.4)); }
.pet-wear[data-wear="flower"] { top: -0.04em; left: -0.02em; font-size: 0.3em; transform: translate(var(--wx), var(--wy)) rotate(-16deg) rotate(var(--wr)) scale(var(--ws)); }
.pet-wear[data-wear="bow"] { top: 2.75em; left: 50%; font-size: 0.32em; transform: translate(var(--wx), var(--wy)) translateX(-50%) rotate(var(--wr)) scale(var(--ws)); }
.pet-wear[data-wear="scarf"] { top: 2.05em; left: 50%; font-size: 0.4em; transform: translate(var(--wx), var(--wy)) translateX(-50%) rotate(var(--wr)) scale(var(--ws)); }
.pet-wear[data-wear="baseball"] { top: -0.34em; left: 50%; font-size: 0.46em; transform: translate(var(--wx), var(--wy)) translateX(-50%) rotate(-8deg) rotate(var(--wr)) scale(var(--ws)); }
.pet-wear[data-wear="strawhat"] { top: -0.38em; left: 50%; font-size: 0.5em; transform: translate(var(--wx), var(--wy)) translateX(-50%) rotate(5deg) rotate(var(--wr)) scale(var(--ws)); }
.pet-wear[data-wear="tophat"] { top: -0.44em; left: 50%; font-size: 0.46em; transform: translate(var(--wx), var(--wy)) translateX(-50%) rotate(var(--wr)) scale(var(--ws)); }
.pet-wear[data-wear="necklace"] { top: 2.1em; left: 2.3em; font-size: 0.34em; transform: translate(var(--wx), var(--wy)) rotate(-12deg) rotate(var(--wr)) scale(var(--ws)); filter: drop-shadow(0 0 3px rgba(125, 211, 252, 0.9)); }
.pet-wear[data-wear="unicorn"] { top: -0.5em; left: 50%; font-size: 0.44em; transform: translate(var(--wx), var(--wy)) translateX(-50%) rotate(var(--wr)) scale(var(--ws)); }
.pet-wear[data-wear="planet"] { top: -0.62em; left: 50%; font-size: 0.5em; transform: translate(var(--wx), var(--wy)) translateX(-50%) rotate(-10deg) rotate(var(--wr)) scale(var(--ws)); }
.pet-wear[data-wear="halo"] { top: -0.3em; left: 50%; font-size: 0.4em; transform: translate(var(--wx), var(--wy)) translateX(-50%) rotate(var(--wr)) scale(var(--ws)); filter: drop-shadow(0 0 4px rgba(253, 176, 34, 0.8)); }

.icon-bowtie { width: 1.5em; height: auto; }
.icon-halo { width: 1.6em; height: auto; }
.pet-wear[data-wear="bow"] .icon-bowtie { width: 1.6em; }
.pet-wear[data-wear="halo"] .icon-halo { width: 1.9em; }

.pet-figure.is-jumping {
  animation: pet-jump 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pet-idle {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  50% { transform: translateY(-6px) scale(1.02, 0.98); }
}

@keyframes pet-wobble {
  0%, 70%, 100% { transform: rotate(0); }
  76% { transform: rotate(-9deg); }
  84% { transform: rotate(8deg); }
  92% { transform: rotate(-4deg); }
}

@keyframes pet-jump {
  0% { transform: translateY(0) scale(1, 1); }
  30% { transform: translateY(-34px) scale(0.95, 1.06); }
  60% { transform: translateY(0) scale(1.08, 0.92); }
  100% { transform: translateY(0) scale(1, 1); }
}

.pet-effects {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pet-bit {
  position: absolute;
  bottom: 40%;
  font-size: 26px;
  opacity: 0;
  animation: pet-bit 1.4s ease-out forwards;
}

@keyframes pet-bit {
  0% { opacity: 0; transform: translateY(0) scale(0.6); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-110px) scale(1.2); }
}

.pet-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 20px;
}

.pet-badge {
  padding: 3px 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #3b6cff, #8b5cf6);
  border-radius: 999px;
}

.pet-rename {
  font-size: 15px;
  background: none;
  border: 0;
  cursor: pointer;
  opacity: 0.6;
}

.pet-rename:hover {
  opacity: 1;
}

.pet-mood {
  margin: 6px 0 16px;
  font-size: 14px;
  color: var(--color-text-muted);
}

.pet-bars {
  display: grid;
  gap: 10px;
  text-align: left;
}

.pet-bar {
  display: grid;
  grid-template-columns: 76px 1fr 36px;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}

.pet-bar div {
  height: 12px;
  overflow: hidden;
  background-color: #eef1f6;
  border-radius: 999px;
}

.pet-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

#bar-full { background: linear-gradient(90deg, #fdb022, #f79009); }
#bar-happy { background: linear-gradient(90deg, #f670c7, #ee46bc); }
#bar-exp { background: linear-gradient(90deg, #3b6cff, #8b5cf6); }

.pet-bar b {
  text-align: right;
}

.pet-next {
  margin: 8px 0 16px;
  font-size: 12.5px;
  color: var(--color-text-muted);
  text-align: right;
}

.pet-stroke {
  width: 100%;
}

.pet-message {
  min-height: 1.5em;
  margin: 10px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: #6d28d9;
}

.pet-side .lab-card {
  margin-bottom: 20px;
}

.bag-grid,
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.bag-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 6px;
  font-family: inherit;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s;
}

.bag-item:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

.bag-item.is-wearing {
  background-color: #f4edff;
  border-color: #8b5cf6;
}

.bag-emoji,
.shop-emoji {
  font-size: 32px;
}

.bag-name {
  font-size: 14px;
  font-weight: 600;
}

.bag-count {
  font-size: 12px;
  color: var(--color-text-muted);
}

.bag-empty {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 14px;
  color: var(--color-text-muted);
}

.shop-tabs {
  margin-bottom: 14px;
}

.shop-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  text-align: center;
  background-color: var(--color-bg-muted);
  border-radius: 12px;
}

.shop-item small {
  min-height: 2.6em;
  font-size: 12px;
  color: var(--color-text-muted);
}

.shop-item .btn {
  width: 100%;
  margin-top: 4px;
}

/* 마이페이지의 펫 바로가기 */
.level-pet-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 12px 16px;
  font-weight: 700;
  color: #6d28d9;
  background: linear-gradient(90deg, #f4edff, #eef3ff);
  border-radius: 10px;
}

@media (max-width: 860px) {
  .pet-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .pet-card {
    position: static;
  }

  .species-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .pet-wallet {
    align-items: flex-start;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pet-figure,
  .pet-bit {
    animation: none !important;
  }
}

/* ---------- 출석체크 (views/attendance.html) ---------- */
.attend-container {
  max-width: 760px;
}

.attend-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

/* 제목 | 2026년 ○월 (가운데) | 오늘 버튼 — 양쪽 칸 너비를 같게 해서 날짜가 정확히 가운데 온다 */
.attend-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.attend-head #this-month {
  justify-self: end;
}

.attend-nav b {
  min-width: 7.5em;
  text-align: center;
}

.attend-head h2 {
  margin: 0;
}

.attend-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 18px;
}

.attend-arrow {
  width: 34px;
  height: 34px;
  font-size: 24px;
  line-height: 1;
  color: var(--color-text);
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  cursor: pointer;
}

.attend-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}

.attend-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

#attend-weekdays span {
  padding: 10px 0;
  font-size: 13.5px;
  color: var(--color-text-muted);
  text-align: center;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

#attend-weekdays .is-sun,
.attend-day.is-sun .attend-no { color: #d92d20; }
#attend-weekdays .is-sat,
.attend-day.is-sat .attend-no { color: #2f5bea; }

.attend-day {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 84px;
  padding: 6px;
  border-bottom: 1px solid #f0f2f5;
}

.attend-day.is-today {
  background-color: #f4f7ff;
  border-radius: 10px;
}

.attend-no {
  font-size: 13px;
  font-weight: 600;
}

/* 도장: 톱니 테두리 동그라미 */
.attend-stamp {
  display: grid;
  place-items: center;
  align-self: center;
  width: 52px;
  height: 52px;
  font-size: 13px;
  font-weight: 800;
  border-radius: 50%;
  transform: rotate(-14deg);
}

.attend-stamp.is-done {
  color: #475467;
  border: 3px dotted #667085;
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px #98a2b3;
}

.attend-stamp.is-bonus {
  color: #fff;
  background: radial-gradient(circle, #fb6514 55%, #e04f16);
  border: 3px dotted #fff;
  box-shadow: 0 0 0 2px #fb6514;
}

.attend-stamp.is-today {
  color: var(--color-primary);
  border: 2px dashed var(--color-primary);
  animation: attend-pulse 1.6s ease-in-out infinite;
}

.attend-stamp.is-future {
  color: #d0d5dd;
  border: 3px dotted #e4e7ec;
}

.attend-stamp.is-missed {
  visibility: hidden;
}

.attend-stamp.is-new {
  animation: attend-stamp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes attend-pulse {
  50% { transform: rotate(-14deg) scale(1.08); }
}

@keyframes attend-stamp {
  0% { transform: rotate(-30deg) scale(2.2); opacity: 0; }
  100% { transform: rotate(-14deg) scale(1); opacity: 1; }
}

.attend-button {
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  font-size: 17px;
}

.attend-message {
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--color-text-muted);
  text-align: center;
}

.level-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.level-attend-link {
  color: #b54708;
  background: linear-gradient(90deg, #fff6ed, #fffaeb);
}

@media (max-width: 600px) {
  .attend-head {
    grid-template-columns: 1fr auto;
  }

  .attend-head .attend-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
  }

  .attend-day {
    min-height: 64px;
    padding: 4px 2px;
  }

  .attend-stamp {
    width: 38px;
    height: 38px;
    font-size: 10.5px;
    border-width: 2px;
  }

  .attend-stats .admin-stat {
    padding: 14px;
  }

  .level-links {
    grid-template-columns: 1fr;
  }
}

/* ---------- 경험치 부스트 룰렛 ---------- */
.boost-card {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 24px;
  align-items: center;
}

.boost-status {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.boost-status.is-active {
  color: #b54708;
}

.boost-spin {
  min-width: 160px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.roulette {
  position: relative;
  width: 220px;
  height: 220px;
}

.roulette-pin {
  position: absolute;
  z-index: 1;
  top: -10px;
  left: 50%;
  font-size: 26px;
  color: #d92d20;
  transform: translateX(-50%);
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
}

.roulette-wheel {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  border-radius: 50%;
  box-shadow: 0 0 0 6px #fff, 0 0 0 9px #e4e7ec, 0 10px 24px rgba(15, 23, 42, 0.15);
  /* 빨리 돌다가 천천히 멈춘다 */
  transition: transform 4.2s cubic-bezier(0.12, 0.8, 0.12, 1);
}

.wheel-text {
  font-family: var(--font-base);
  font-size: 15px;
  font-weight: 800;
  fill: #fff;
  pointer-events: none;
}

/* 1% 칸: 칸 폭(약 5)보다 작은 글씨 */
.wheel-text.is-thin {
  font-size: 3.4px;
  letter-spacing: 0.1px;
}

.wheel-rim { fill: none; stroke: #fff; stroke-width: 1.5; }
.wheel-hub { fill: #fff; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25)); }
.wheel-slot.is-picked path { filter: brightness(1.25); }

.boost-odds {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0 0 6px;
  padding: 0;
  font-size: 13.5px;
  list-style: none;
}

.boost-odds i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 5px;
  border-radius: 3px;
}

@media (max-width: 600px) {
  .boost-card {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}

/* 안경 그림 (이모지 대신) */
.item-icon {
  display: inline-grid;
  place-items: center;
  line-height: 1;
}

.icon-glasses {
  width: 1.4em;
  height: auto;
}

.pet-wear[data-wear="glasses"] .icon-glasses {
  width: 2em;
}

.admin-grant {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-grant input {
  min-width: 0;
  padding: 7px 12px;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.admin-grant input[type="text"] { flex: 1 1 160px; }
.admin-grant input[type="number"] { width: 110px; }

.admin-grant-kind {
  flex-wrap: wrap;
  margin-bottom: 6px;
}

#grant-hint {
  margin: 0 0 10px;
}

/* 지급할 회원의 지금 상태 */
.grant-status {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.grant-status div {
  padding: 10px 12px;
  background-color: var(--color-bg-muted);
  border-radius: 10px;
}

.grant-status dt {
  font-size: 12px;
  color: var(--color-text-muted);
}

.grant-status dd {
  margin: 2px 0 0;
  font-size: 14px;
  font-weight: 700;
  word-break: keep-all;
}

.grant-status.is-missing dd {
  color: var(--color-text-muted);
}

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

.admin-reset {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  font-size: 14px;
  border-top: 1px dashed var(--color-border);
}

.admin-reset small {
  flex-basis: 100%;
  color: var(--color-text-muted);
}

/* ---------- 홈: 바로가기 (출석체크 · 룰렛 · 펫 · 레벨) ---------- */
.home-play {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.home-play-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  color: var(--color-text);
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.home-play-card:hover {
  border-color: #c7d6ff;
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.home-play-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  font-size: 26px;
  border-radius: 14px;
}

.play-attend .home-play-icon { background-color: #fff6ed; }
.play-boost .home-play-icon { background-color: #fef7c3; }
.play-pet .home-play-icon { background-color: #f4edff; }
.play-level .home-play-icon { background-color: #eef3ff; }

.home-play-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.home-play-text b {
  font-size: 15px;
}

.home-play-text small {
  overflow: hidden;
  font-size: 12.5px;
  color: var(--color-text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 해야 할 것이 있으면 눈에 띄게 */
.home-play-card.is-todo {
  border-color: #fdb022;
  box-shadow: 0 0 0 3px rgba(253, 176, 34, 0.15);
}

.home-play-card.is-todo small {
  font-weight: 700;
  color: #b54708;
}

@media (max-width: 900px) {
  .home-play {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .home-play-card {
    gap: 8px;
    padding: 12px;
  }

  .home-play-icon {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }

  .home-play-text small {
    display: -webkit-box;
    white-space: normal;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

/* ---------- 실험실 공통: 단원 목차, 교과서 정리 ---------- */
.lab-toc {
  position: sticky;
  z-index: 5;
  top: calc(var(--header-height) + 8px);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 20px;
  padding: 8px;
  background-color: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.lab-toc a {
  padding: 6px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-text-muted);
  border-radius: 999px;
}

.lab-toc a:hover {
  color: var(--color-primary);
  background-color: #eef3ff;
}

.lab-unit {
  scroll-margin-top: calc(var(--header-height) + 70px);
}

.lab-unit-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 32px 0 14px;
  font-size: 22px;
}

.lab-unit-title small {
  padding: 2px 10px;
  font-size: 13px;
  color: #fff;
  background: linear-gradient(135deg, #3b6cff, #8b5cf6);
  border-radius: 999px;
}

/* 교과서 정리: 눌러서 펼치기 */
.lab-concept {
  margin: 0 0 16px;
  background-color: #f8faff;
  border: 1px solid #dbe4ff;
  border-radius: 12px;
}

.lab-concept summary {
  padding: 12px 16px;
  font-size: 14.5px;
  font-weight: 700;
  color: #1d3fbf;
  cursor: pointer;
  list-style: none;
}

.lab-concept summary::-webkit-details-marker { display: none; }
.lab-concept summary::before { content: "📘 "; }
.lab-concept summary::after { content: " 펼치기 ▾"; font-size: 12.5px; font-weight: 500; color: var(--color-text-muted); }
.lab-concept[open] summary::after { content: " 접기 ▴"; }

.lab-concept ul {
  margin: 0;
  padding: 0 18px 14px 36px;
  font-size: 14.5px;
  line-height: 1.9;
}

.lab-concept b {
  color: #1d3fbf;
}

.lab-concept .math {
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 15.5px;
}

.geo-line-one { stroke: #2f5bea; stroke-width: 2.5; }
.geo-line-two { stroke: #f79009; stroke-width: 2.5; }
.geo-line-two.is-same { stroke-dasharray: 8 6; }
.geo-line-label { font-size: 16px; font-weight: 800; paint-order: stroke; stroke: #fff; stroke-width: 4px; }
.geo-line-label.one { fill: #2f5bea; }
.geo-line-label.two { fill: #b54708; }

/* ---------- Ⅲ-1 함수: 대응 그림 ---------- */
.map-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin-bottom: 16px;
}

.map-tables {
  display: grid;
  gap: 14px;
}

.map-table {
  border-collapse: separate;
  border-spacing: 4px;
}

.map-table caption {
  margin-bottom: 4px;
  font-size: 14px;
  text-align: left;
}

.map-table th {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.map-cell {
  width: 40px;
  height: 34px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-muted);
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
}

.map-cell.map-f.is-on { color: #fff; background-color: #2f5bea; border-color: #2f5bea; }
.map-cell.map-g.is-on { color: #fff; background-color: #f79009; border-color: #f79009; }
b.map-f { color: #2f5bea; }
b.map-g { color: #b54708; }

.map-svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--font-base);
}

.map-oval { fill: #f8faff; stroke: #c7d6ff; stroke-width: 2; }
.map-set-name { font-size: 15px; font-weight: 800; fill: #475467; }
.map-dot { fill: #fff; stroke: #475467; stroke-width: 2; }
.map-dot-text { font-size: 14px; font-weight: 700; fill: #1f2328; }
.map-arrow { stroke-width: 2.5; }
.map-arrow.map-f { stroke: #2f5bea; }
.map-arrow.map-g { stroke: #f79009; }
.map-fn-name { font-size: 18px; font-weight: 800; font-style: italic; }
.map-fn-name.map-f { fill: #2f5bea; }
.map-fn-name.map-g { fill: #b54708; }

@media (max-width: 700px) {
  .map-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .map-tables {
    grid-template-columns: minmax(0, 1fr);
  }
}

.lab-unit-badge {
  margin-right: 6px;
  padding: 2px 10px;
  font-size: 13px;
  color: #fff;
  vertical-align: middle;
  background: linear-gradient(135deg, #3b6cff, #8b5cf6);
  border-radius: 999px;
}

/* 명제의 증명: 한 단계씩 */
.proof-tabs { margin-bottom: 12px; }
.proof-claim { margin: 0 0 10px; font-size: 16px; font-weight: 700; }
.proof-steps { margin: 0 0 14px; padding-left: 22px; font-size: 15px; line-height: 1.9; }
.proof-steps li { animation: proof-in 0.35s ease-out; }
.proof-buttons { display: flex; gap: 8px; }
@keyframes proof-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 절대부등식 반원 */
.ineq-arc { fill: rgba(47, 91, 234, 0.06); stroke: #2f5bea; stroke-width: 2.5; }
.ineq-base { stroke: #475467; stroke-width: 2; }
.ineq-am { stroke: #2f5bea; stroke-width: 3; }
.ineq-gm { stroke: #f79009; stroke-width: 3; }
.ineq-dot { fill: #f79009; }
.ineq-label { font-size: 13px; font-weight: 700; fill: #475467; paint-order: stroke; stroke: #fff; stroke-width: 4px; }
.ineq-label.am { fill: #2f5bea; }
.ineq-label.gm { fill: #b54708; }

.labs-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 0 4px;
}

.labs-chips i {
  padding: 2px 9px;
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
  color: #1d3fbf;
  background-color: #eef3ff;
  border-radius: 999px;
}

/* 홈 내 정보 칸: 보유 포인트 */
.home-me-points {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin-bottom: 4px;
  padding: 10px 14px;
  color: var(--color-text);
  background: linear-gradient(90deg, #fff8e6, #fffbf0);
  border: 1px solid #fde7b0;
  border-radius: 10px;
  transition: border-color 0.15s;
}

.home-me-points:hover {
  border-color: #fdb022;
}

.home-me-points-label {
  font-size: 13px;
  color: #93370d;
}

.home-me-points b {
  font-size: 17px;
  font-weight: 800;
  color: #b54708;
}

.plane-missing {
  margin: 0;
  padding: 40px 20px;
  font-size: 14.5px;
  line-height: 1.7;
  color: #b42318;
  text-align: center;
  background-color: #fef3f2;
}

/* Ⅲ-1 함수: f, g 예시 줄과 빨간 초기화 버튼 */
.map-presets {
  align-items: center;
  margin-bottom: 8px;
}

.map-preset-name {
  min-width: 44px;
  font-size: 13.5px;
  font-weight: 800;
}

.map-preset-name.map-f { color: #2f5bea; }
.map-preset-name.map-g { color: #b54708; }

.chip-button.map-reset {
  margin-left: auto;
  color: #b42318;
  background-color: #fff;
  border-color: #fecdca;
}

.chip-button.map-reset:hover {
  color: #fff;
  background-color: #d92d20;
  border-color: #d92d20;
}

/* ---------- 근호: 근호 안의 식 전체를 위쪽 선이 덮는다 (math-root.js) ---------- */
/* √ 기호는 그림(mask)으로 그려서 글꼴과 상관없이 위쪽 선과 정확히 이어진다. */
.rt {
  display: inline-flex;
  align-items: stretch;
  line-height: 1.2; /* 줄 간격이 넓은 곳에서도 위쪽 선이 글자에 붙게 */
  white-space: nowrap;
}

.rt-sign {
  flex-shrink: 0;
  width: 0.62em;
  overflow: hidden;
  text-indent: 200%; /* 글자 √ 는 복사·읽기용으로만 두고 밖으로 밀어서 보이지 않게 */
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 24' preserveAspectRatio='none'%3E%3Cpath d='M0.6 14.2 L3 12.6 L6.6 22.6 L11.7 0.75' fill='none' stroke='black' stroke-width='1.5' stroke-linejoin='miter'/%3E%3C/svg%3E") no-repeat 0 0 / 100% 100%;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 24' preserveAspectRatio='none'%3E%3Cpath d='M0.6 14.2 L3 12.6 L6.6 22.6 L11.7 0.75' fill='none' stroke='black' stroke-width='1.5' stroke-linejoin='miter'/%3E%3C/svg%3E") no-repeat 0 0 / 100% 100%;
}

.rt-in {
  padding: 0.12em 0.14em 0 0.04em;
  border-top: 0.065em solid currentColor;
}

/* 가방 탭의 개수 표시 */
.bag-tab-count {
  margin-left: 2px;
  padding: 0 6px;
  font-size: 11.5px;
  color: #fff;
  background-color: #98a2b3;
  border-radius: 999px;
}

.segmented label:has(input:checked) .bag-tab-count {
  background-color: var(--color-primary);
}

/* 꾸미기의 한 줄 설명이 길어도 카드 높이가 맞도록 */
.shop-item small {
  min-height: 3.9em;
  line-height: 1.3;
  word-break: keep-all;
}

/* 여러 꾸미기를 담는 칸: 펫과 같은 크기로 겹쳐 둔다 */
.pet-wears {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.wear-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wear-pick .chip-button.is-active {
  color: #fff;
  background-color: #7c3aed;
  border-color: #7c3aed;
}

.wear-pick .item-icon {
  font-size: 15px;
}

.icon-bubble { width: 1.15em; height: auto; }

/* 함수 표: 드래그로 여러 칸 선택 (끄는 동안 글자가 선택되거나 화면이 움직이지 않게) */
.map-table {
  touch-action: none;
  user-select: none;
}

/* ---------- 함수 실험실: 그래프는 왼쪽에 붙여 두고 오른쪽에서 조절 ---------- */
.fx-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 20px;
  align-items: start;
}

.fx-graph-col {
  position: sticky;
  top: calc(var(--header-height) + 70px); /* 단원 목차 아래에 붙는다 */
}

.fx-graph-col .lab-card,
.fx-side-col .lab-card {
  margin-bottom: 16px;
}

.fx-side-col .lab-formulas {
  grid-template-columns: 1fr 1fr;
}

.fx-side-col .formula-expr {
  font-size: 16px;
}

.fx-side-col .fx-formula {
  font-size: 20px;
}

.fx-graph-col .plane-wrap {
  max-width: none;
}

@media (max-width: 900px) {
  .fx-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  /* 휴대폰에서는 그래프를 맨 위에 */
  .fx-graph-col {
    order: -1;
  }

  /* 휴대폰: 그래프를 위에 붙여 두고 아래에서 조절 */
  .fx-graph-col {
    z-index: 4;
    top: calc(var(--header-height) + 4px);
  }

  .fx-graph-col .lab-card {
    padding: 10px;
  }

  .fx-graph-col .graph-legend {
    display: none;
  }

  .fx-graph-col .lab-card-head {
    margin-bottom: 6px;
  }

  .fx-graph-col .lab-card-head h2 {
    font-size: 15px;
  }

  .fx-graph-col .plane-wrap {
    max-width: 300px;
    margin: 0 auto;
  }
}

/* 휴대폰: 단원 목차는 따라오지 않게 (그래프가 가려지지 않도록) */
@media (max-width: 900px) {
  .lab-toc {
    position: static;
  }
}

/* ---------- 이용약관 · 개인정보처리방침 · 문의하기 ---------- */
.doc-container {
  max-width: 820px;
}

.doc h2 {
  margin: 26px 0 10px;
  font-size: 18px;
}

.doc h2:first-child {
  margin-top: 0;
}

.doc p,
.doc li {
  font-size: 15px;
  line-height: 1.8;
  color: #344054;
}

.doc ul {
  margin: 0;
  padding-left: 20px;
}

.doc a {
  font-weight: 600;
  color: var(--color-primary);
}

.doc-table {
  width: 100%;
  margin-bottom: 10px;
}

.doc-table td {
  font-size: 14px;
  text-align: left;
}

.doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.doc-actions .btn {
  color: inherit;
}

.doc-actions .btn-primary {
  color: #fff;
}

/* ---------- 직접 만들기 (make.html) ---------- */
.make-container { max-width: 1280px; }
.make-app { border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-bg); box-shadow: var(--shadow); overflow: hidden; }
.make-toolbar { display: flex; gap: 6px 14px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--color-border); background: var(--color-bg-muted); }
.make-tool-group { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.make-group-name { font-size: 12px; font-weight: 700; color: var(--color-text-muted); margin-right: 2px; }
.make-tool { border: 1px solid var(--color-border); background: #fff; border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; color: var(--color-text); }
.make-tool:hover { border-color: var(--color-primary); color: var(--color-primary); }
.make-tool.is-on { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.make-options { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--color-border); background: #f3f6ff; }
.make-options { min-height: 46px; align-items: center; }
.make-opt-none { margin: 0; font-size: 13px; color: var(--color-text-muted); }
.make-opt { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: 13px; }
.make-opt label { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.make-opt input { border: 1px solid var(--color-border); border-radius: 6px; padding: 4px 6px; font: inherit; width: auto; }
.make-opt small { color: var(--color-text-muted); }
.make-chip { border: 1px solid var(--color-border); background: #fff; border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; color: var(--color-text); }
.make-chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.make-chip.is-on { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.make-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
.make-stage-wrap { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--color-border); }
.make-stage { position: relative; height: min(68vh, 640px); min-height: 360px; touch-action: none; }
.make-svg { display: block; width: 100%; height: 100%; user-select: none; background: #fff; }
.make-svg.is-dragging { cursor: grabbing !important; }
.make-grid { stroke: #eef1f5; stroke-width: 1; }
.make-axis { stroke: #667085; stroke-width: 1.4; }
.make-tick { font-size: 11px; fill: #667085; }
.make-axis-name { font-size: 14px; font-style: italic; font-weight: 700; fill: #475467; }
.make-shape { stroke-width: 2.2; fill-rule: evenodd; }
.make-shape.is-hot { stroke-width: 4; }
.make-point { stroke: #fff; stroke-width: 1.5; }
.make-point.is-hot { stroke: #ffd43b; stroke-width: 3; }
.make-label { font-size: 13px; font-weight: 700; fill: #1f2328; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.make-value { font-size: 12px; font-weight: 600; fill: #344054; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.make-dash { stroke: #98a2b3; stroke-width: 1.5; stroke-dasharray: 5 4; fill: none; }
.make-zoom { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 4px; }
.make-zoom button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--color-border); background: #fff; font-size: 18px; cursor: pointer; box-shadow: var(--shadow); }
.make-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--color-border); font-size: 14px; }
.make-status { margin: 0; color: var(--color-text); min-height: 1.4em; }
.make-snap { white-space: nowrap; font-size: 13px; color: var(--color-text-muted); }
.make-pane { padding: 14px; display: flex; flex-direction: column; gap: 12px; max-height: calc(min(68vh, 640px) + 44px); overflow: auto; }
.make-pane-title { display: block; margin: 0; font-size: 15px; font-weight: 800; }
.make-input-row { display: flex; gap: 6px; margin-top: 6px; }
.make-input-row input { flex: 1; min-width: 0; border: 1px solid var(--color-border); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 15px; }
.make-input-row input:focus { outline: 2px solid var(--color-primary); outline-offset: -1px; }
.make-input-msg { margin: 6px 0 0; min-height: 1.2em; font-size: 13px; }
.make-input-msg.is-ok { color: #12a150; }
.make-input-msg.is-err { color: #e5484d; }
.make-samples { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.make-help { margin-top: 8px; font-size: 13px; color: var(--color-text-muted); }
.make-help summary { cursor: pointer; font-weight: 600; }
.make-help ul { margin: 6px 0 0; padding-left: 18px; }
.make-help code { background: var(--color-bg-muted); padding: 0 4px; border-radius: 4px; }
.make-pane-actions { display: flex; flex-direction: column; gap: 8px; }
.make-pane-actions select { border: 1px solid var(--color-border); border-radius: 8px; padding: 8px; font: inherit; background: #fff; }
.make-history { display: flex; gap: 6px; flex-wrap: wrap; }
.make-history .btn { padding: 6px 10px; font-size: 13px; }
.make-clear { color: #e5484d; }
.make-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.make-empty { color: var(--color-text-muted); font-size: 13px; }
.make-item { display: flex; align-items: flex-start; gap: 8px; padding: 8px; border: 1px solid var(--color-border); border-radius: 8px; font-size: 14px; }
.make-item.is-selected { border-color: var(--color-primary); background: #f3f6ff; }
.make-item.is-bad .make-main { color: #e5484d; }
.make-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.make-main { font-weight: 600; word-break: break-all; }
.make-how { color: var(--color-text-muted); }
.make-dot { flex: none; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--dot); background: var(--dot); cursor: pointer; padding: 0; }
.make-dot.is-off { background: #fff; }
.make-del { flex: none; border: 0; background: none; color: #98a2b3; font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }
.make-del:hover { color: #e5484d; }
.make-slider { flex-direction: column; gap: 4px; background: #fafbff; }
.make-slider-top { display: flex; align-items: center; gap: 6px; width: 100%; }
.make-slider-top output { font-weight: 700; color: var(--color-primary); min-width: 3em; }
.make-range-lim { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--color-text-muted); }
.make-range-lim input { width: 46px; border: 1px solid var(--color-border); border-radius: 4px; padding: 2px; font: inherit; font-size: 12px; }
.make-slider input[type="range"] { width: 100%; }
@media (max-width: 900px) {
  .make-body { grid-template-columns: 1fr; }
  .make-stage-wrap { border-right: 0; border-bottom: 1px solid var(--color-border); }
  .make-stage { height: 62vh; min-height: 300px; }
  .make-pane { max-height: none; }
  .make-toolbar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .make-tool-group { flex-wrap: nowrap; }
  .make-bar { flex-wrap: wrap; }
}

.make-app:fullscreen { display: flex; flex-direction: column; border-radius: 0; }
.make-app:fullscreen .make-body { flex: 1; min-height: 0; }
.make-app:fullscreen .make-stage-wrap { min-height: 0; }
.make-app:fullscreen .make-stage { flex: 1; height: auto; min-height: 0; }
.make-app:fullscreen .make-pane { max-height: none; }
.make-app:fullscreen .make-shape { stroke-width: 3; }
.make-app:fullscreen .make-label { font-size: 16px; }

/* ---------- 연습장 (sketchpad.js) ---------- */
.sketch-on, .sketch-on body { overflow: hidden; }
.sketch-overlay { position: fixed; inset: 0; z-index: 9000; background: rgba(255, 255, 255, 0.04); touch-action: none; }
.sketch-overlay[hidden] { display: none; }
.sketch-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sketch-bar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  max-width: calc(100vw - 24px); padding: 8px 12px; background: #fff; border: 1px solid var(--color-border); border-radius: 14px; box-shadow: 0 8px 28px rgba(15, 23, 42, 0.18); font-size: 13px; }
.sketch-title { font-weight: 800; }
.sketch-group { display: flex; align-items: center; gap: 4px; padding-left: 10px; border-left: 1px solid var(--color-border); }
.sketch-btn { border: 1px solid var(--color-border); background: #fff; border-radius: 8px; padding: 6px 10px; font: inherit; cursor: pointer; color: var(--color-text); white-space: nowrap; }
.sketch-btn:hover:not(:disabled) { border-color: var(--color-primary); color: var(--color-primary); }
.sketch-btn.is-on { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.sketch-btn:disabled { opacity: 0.4; cursor: default; }
.sketch-close { color: #e5484d; }
.sketch-eraser { position: relative; }
.sketch-menu { position: absolute; top: calc(100% + 6px); left: 0; display: flex; flex-direction: column; min-width: 120px; background: #fff; border: 1px solid var(--color-border); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.sketch-menu[hidden] { display: none; }
.sketch-menu button { border: 0; background: none; padding: 9px 12px; text-align: left; font: inherit; cursor: pointer; }
.sketch-menu button:hover { background: var(--color-bg-muted); }
.sketch-menu button[data-erase="all"] { color: #e5484d; }
.sketch-color { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; background: var(--c); box-shadow: 0 0 0 1px var(--color-border); cursor: pointer; padding: 0; position: relative; overflow: hidden; }
.sketch-color.is-on { box-shadow: 0 0 0 2px var(--color-primary); }
.sketch-custom { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.sketch-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.sketch-size input { width: 90px; }
.sketch-size-name { color: var(--color-text-muted); white-space: nowrap; }
.sketch-dot { display: inline-block; border-radius: 50%; border: 1px solid #98a2b3; flex: none; }
.sketch-fab { position: fixed; left: 16px; bottom: 16px; z-index: 800; border: 0; border-radius: 999px; padding: 10px 16px; background: var(--color-primary); color: #fff; font: inherit; font-weight: 700; box-shadow: 0 6px 18px rgba(47, 91, 234, 0.35); cursor: pointer; }
@media (max-width: 640px) {
  .sketch-bar { top: 8px; gap: 6px; padding: 6px 8px; }
  .sketch-group { padding-left: 6px; }
  .sketch-title, .sketch-fab span { display: none; }
}
.sketch-on .sketch-fab { display: none; }
@media (min-width: 900px) { .sketch-bar { flex-wrap: nowrap; width: max-content; } }

/* ---------- 랭킹 페이지 (views/ranking.html) ---------- */
.rank-container { max-width: 760px; }
.rank-page-tabs { margin-bottom: 20px; }
.rank-podium { list-style: none; margin: 0 0 20px; padding: 0; display: flex; justify-content: center; align-items: flex-end; gap: 12px; }
.rank-podium[hidden] { display: none; }
.rank-step { flex: 1; max-width: 200px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; min-width: 0; }
.rank-step-medal { font-size: 34px; line-height: 1; }
.rank-step-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-step-points { font-size: 13px; color: var(--color-text-muted); font-weight: 600; }
.rank-step-block { width: 100%; margin-top: 6px; border-radius: 12px 12px 0 0; display: flex; align-items: flex-start; justify-content: center; padding-top: 8px; font-size: 22px; font-weight: 800; color: #fff; }
.rank-step-1 .rank-step-block { height: 110px; background: linear-gradient(180deg, #f5b400, #e09a00); }
.rank-step-2 .rank-step-block { height: 80px; background: linear-gradient(180deg, #a8b3c2, #8592a3); }
.rank-step-3 .rank-step-block { height: 60px; background: linear-gradient(180deg, #d58a4f, #b8703a); }
.rank-step.is-me .rank-step-name { color: var(--color-primary); }
.rank-page-card { padding: 20px; }
.rank-mine { margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; background: #f3f6ff; color: var(--color-primary); font-weight: 700; }
.rank-mine[hidden] { display: none; }

/* 홈 화면 랭킹 TOP 5 */
.home-ranking { margin-bottom: 16px; }
.home-ranking-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.home-ranking-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-bg-muted); text-align: center; min-width: 0; }
.home-ranking-item.is-me { border-color: var(--color-primary); background: #f3f6ff; }
.home-ranking-no { font-size: 22px; font-weight: 800; line-height: 1.2; }
.home-ranking-name { font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-ranking-meta { font-size: 12px; color: var(--color-text-muted); }
.home-ranking-empty { grid-column: 1 / -1; color: var(--color-text-muted); font-size: 14px; }
.home-ranking-empty a { color: var(--color-primary); font-weight: 700; }
@media (max-width: 760px) {
  .home-ranking-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-ranking-item { flex-direction: row; justify-content: flex-start; gap: 8px; padding: 8px 10px; }
  .home-ranking-meta { margin-left: auto; }
  .rank-step-medal { font-size: 26px; }
}
.home-row-rank { grid-template-columns: minmax(0, 1fr); }
.home-ranking { margin-bottom: 0; }
.rank-page-card { max-width: none; width: 100%; margin: 0; }
