/* ==========================================================================
   애플 스타일 2 (2026-11-23): style.css 다음에 불러와서 덮어씁니다.
   사용자 요청: "스타일과 애니메이션을 애플로, 지금도 애플이지만 뭔가 부족해"
   부족하다고 고른 것: 움직임, 화면 재질, 아이콘, 글꼴과 크기.
   - 글꼴: 애플 기기는 기기 글꼴(SF, Apple SD 산돌고딕 Neo), 나머지는 Pretendard. 크기는 iOS 글자 체계
   - 재질: 위쪽 막대와 떠 있는 아래 탭 막대는 흐린 유리, 카드와 목록은 설정 앱처럼 묶음
   - 아이콘: icons.js (Flaticon UIcons Regular Rounded)
   - 움직임: motion.js (화면 밀어 넣기 전환, 큰 제목 접기, 숫자 올라가기). 움직임 줄이기 설정이면 끔
   ========================================================================== */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Apple SD Gothic Neo", "Pretendard Variable", Pretendard, "Malgun Gothic", "Noto Sans KR", sans-serif;
  --ease-ios: cubic-bezier(.32, .72, 0, 1);   /* 애플 시트, 화면 전환 곡선 */
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --t-fast: .16s; --t-mid: .32s; --t-slow: .5s;
  --glass: rgba(250, 250, 252, .72);
  --glass-strong: rgba(250, 250, 252, .86);
  --glass-line: rgba(255, 255, 255, .6);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, .12), 0 1px 3px rgba(0, 0, 0, .08);
  --row-press: rgba(118, 118, 128, .16);
  --r-card: 16px; --r-row: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --glass: rgba(30, 30, 32, .66);
    --glass-strong: rgba(30, 30, 32, .84);
    --glass-line: rgba(255, 255, 255, .1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
    --row-press: rgba(118, 118, 128, .3);
  }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --glass: var(--paper); --glass-strong: var(--paper); }
}

/* ---------- 글꼴과 크기 (iOS 글자 체계) ---------- */
body { font-family: var(--font); font-size: 17px; line-height: 1.47; letter-spacing: -0.012em; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, .page-head h1, .c-top h1, .home-head h1 { font-size: 34px; line-height: 1.2; font-weight: 700; letter-spacing: -0.022em; }
h2 { font-size: 22px; line-height: 1.27; font-weight: 700; letter-spacing: -0.018em; }
h3 { font-size: 17px; line-height: 1.3; font-weight: 600; letter-spacing: -0.012em; }
.muted, .small-note { color: var(--ios-label2); }
small, .small { font-size: 13px; }
.hero h1 { font-size: clamp(34px, 7vw, 56px); font-weight: 700; letter-spacing: -0.03em; }

/* ---------- 아이콘 ---------- */
.ic { width: 1.15em; height: 1.15em; flex: none; fill: currentColor; vertical-align: -0.18em; }
.btn .ic { width: 18px; height: 18px; }
.lock.ic { width: 14px; height: 14px; margin-right: 3px; vertical-align: -2px; }
.pl-ic .ic { width: 17px; height: 17px; }
.pl-go .ic { width: 18px; height: 18px; vertical-align: middle; }
.pl-go { display: inline-flex; align-items: center; }
.mc-ic .ic { width: 30px; height: 30px; }
.timer .ic { width: 16px; height: 16px; }

/* ---------- 재질: 위쪽 막대 (흐린 유리, 스크롤하면 가는 선과 작은 제목) ---------- */
.topbar { background: var(--glass); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px); border-bottom: .5px solid transparent; transition: border-color var(--t-mid) var(--ease-out), background-color var(--t-mid) var(--ease-out); view-transition-name: topbar; }
.topbar.scrolled { border-bottom-color: var(--ios-sep); background: var(--glass-strong); }
.topbar-in { position: relative; height: 52px; }
.bar-title { position: absolute; left: 50%; top: 50%; max-width: 56%; transform: translate(-50%, -35%); opacity: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.012em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; transition: opacity var(--t-fast) var(--ease-out), transform var(--t-mid) var(--ease-ios); }
.topbar.scrolled .bar-title { opacity: 1; transform: translate(-50%, -50%); }
@media (min-width: 900px) { .bar-title { display: none; } }
.brand-mark { border-radius: 9px; background: var(--accent); }
/* 넓은 화면 위쪽 메뉴: 유리 캡슐 안의 세그먼트 */
.topnav { gap: 2px; padding: 3px; border-radius: 999px; background: var(--ios-fill); }
.topnav a { border-radius: 999px; padding: 6px 14px; font-size: 15px; font-weight: 600; color: var(--ink); transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out); }
.topnav a.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
.topnav a:hover:not(.on) { background: transparent; color: var(--accent); }

/* ---------- 재질: 떠 있는 아래 탭 막대 (휴대폰) ---------- */
@media (max-width: 899px) {
  .tabbar { left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 6px; border-radius: 999px; border: .5px solid var(--glass-line); border-top: .5px solid var(--glass-line); background: var(--glass); box-shadow: var(--glass-shadow); backdrop-filter: saturate(180%) blur(28px); -webkit-backdrop-filter: saturate(180%) blur(28px); view-transition-name: tabbar; }
  .tabbar a { position: relative; gap: 1px; padding: 6px 0 5px; border-radius: 999px; color: var(--ios-label2); font-size: 10.5px; font-weight: 600; transition: color var(--t-fast) var(--ease-out); }
  .tabbar a::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--ios-fill); opacity: 0; transform: scale(.85); transition: opacity var(--t-mid) var(--ease-ios), transform var(--t-mid) var(--ease-ios); }
  .tabbar a.on { color: var(--accent); }
  .tabbar a.on::before { opacity: 1; transform: none; }
  .tabbar a .ic, .tabbar a svg { position: relative; width: 24px; height: 24px; }
  .tabbar a.on svg path { fill: currentColor; }
  .tabbar a span { position: relative; }
  .tabbar a:active .ic { transform: scale(.88); }
  .tabbar a .ic { transition: transform var(--t-fast) var(--ease-out); }
  body:has(.tabbar) { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
}

/* ---------- 재질: 카드와 묶음 목록 ---------- */
.subj-card, .plan, .cu, .tier-card, .mode-card, .unit-list, .ai-card, .res-hero { border-radius: var(--r-card); }
.unit-list { padding: 0; overflow: hidden; }
.unit-list li + li { border-top: 0; }
.unit-card { position: relative; padding: 12px 16px; transition: background-color var(--t-fast) var(--ease-out); }
.unit-list li + li .unit-card::before, .plan-list li + li a::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; height: .5px; background: var(--ios-sep); }
.unit-card:active, .plan-list a:active { opacity: 1; background: var(--row-press); }
.plan-list li + li { border-top: 0; }
.plan-list a { position: relative; transition: background-color var(--t-fast) var(--ease-out); border-radius: 0; }
.st-sem { font-size: 13px; font-weight: 400; color: var(--ios-label2); text-transform: none; letter-spacing: 0; margin: 24px 16px 8px; }

/* ---------- 버튼: 누르면 살짝 작아지고 흐려짐 ---------- */
.btn { border-radius: 12px; font-weight: 600; transition: transform var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out), opacity var(--t-fast) var(--ease-out); }
.btn:active { transform: scale(.96); opacity: .75; }
.btn.lg { min-height: 50px; border-radius: 14px; font-size: 17px; }
.mode-card { transition: transform var(--t-mid) var(--ease-ios), box-shadow var(--t-mid) var(--ease-out); }
.mode-card:active { transform: scale(.97); }
.mc-go { border-radius: 999px; font-weight: 600; }

/* ---------- 시트: 아래에서 올라오는 창, 손잡이 ---------- */
.csheet { border-radius: 14px 14px 0 0; background: var(--bg); transform: translateY(100%); }
.csheet-wrap.open .csheet { transition: transform var(--t-slow) var(--ease-ios); }
.csheet-back { transition: opacity var(--t-mid) var(--ease-out); }
.csheet-bar { position: relative; padding-top: 18px; border-bottom: .5px solid var(--ios-sep); border-radius: 14px 14px 0 0; }
.csheet-bar::before { content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--ios-fill2); }
.csheet.dragging { transition: none !important; }

/* ---------- 화면 전환 (View Transitions, motion.js가 방향을 정함) ---------- */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-group(root) { animation-duration: var(--t-slow); animation-timing-function: var(--ease-ios); }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .38s; animation-timing-function: var(--ease-ios); }
  html[data-nav="fade"]::view-transition-old(root) { animation-name: rf-fade-out; }
  html[data-nav="fade"]::view-transition-new(root) { animation-name: rf-fade-in; }
  html[data-nav="push"]::view-transition-old(root) { animation-name: rf-push-old; }
  html[data-nav="push"]::view-transition-new(root) { animation-name: rf-push-new; }
  html[data-nav="pop"]::view-transition-old(root) { animation-name: rf-pop-old; z-index: 2; }
  html[data-nav="pop"]::view-transition-new(root) { animation-name: rf-pop-new; z-index: 1; }
  ::view-transition-old(topbar), ::view-transition-new(topbar), ::view-transition-old(tabbar), ::view-transition-new(tabbar) { animation: none; }
  #app.vt > main { animation: none; }
}
@keyframes rf-fade-out { to { opacity: 0; } }
@keyframes rf-fade-in { from { opacity: 0; transform: translateY(6px); } }
/* 넓은 화면은 짧게 밀고, 휴대폰은 아이폰처럼 화면 끝에서 밀어 넣음 */
@keyframes rf-push-new { from { transform: translateX(40px); opacity: 0; } }
@keyframes rf-push-old { to { transform: translateX(-24px); opacity: 0; } }
@keyframes rf-pop-new { from { transform: translateX(-40px); opacity: 0; } }
@keyframes rf-pop-old { to { transform: translateX(40px); opacity: 0; } }
@media (max-width: 899px) {
  @keyframes rf-push-new { from { transform: translateX(100%); } }
  @keyframes rf-push-old { to { transform: translateX(-30%); opacity: .6; } }
  @keyframes rf-pop-new { from { transform: translateX(-30%); opacity: .6; } }
  @keyframes rf-pop-old { to { transform: translateX(100%); } }
}

/* 처음 열 때 한 번: 내용이 살짝 올라오며 나타남 */
@media (prefers-reduced-motion: no-preference) {
  #app.first > main > * { animation: rf-rise .5s var(--ease-ios) both; }
  #app.first > main > *:nth-child(2) { animation-delay: .04s; }
  #app.first > main > *:nth-child(3) { animation-delay: .08s; }
  #app.first > main > *:nth-child(4) { animation-delay: .12s; }
  #app.first > main > *:nth-child(n+5) { animation-delay: .16s; }
}
@keyframes rf-rise { from { opacity: 0; transform: translateY(12px); } }

/* ==========================================================================
   사용자 참고 사이트 맞춤 (2026-11-23): surveto.pages.dev, owntools.pages.dev처럼
   - 색: 바탕 #f5f5f7, 글자 #1d1d1f, 보조 글자 #6e6e73, 파랑 #0071e3 (어두운 모드는 검정 바탕)
   - 위쪽 막대는 처음엔 투명, 스크롤하면 유리와 작은 제목
   - 제목 위 작은 줄(eyebrow), 큰 제목은 넓은 화면에서 44
   - 색 사각형 앱 아이콘, 둥근 알약 버튼, 부드러운 카드 그림자, 벤토 카드 안 미리 보기
   ========================================================================== */
:root {
  --bg: #f5f5f7; --paper: #fff; --ink: #1d1d1f; --muted: #6e6e73; --ios-label2: #6e6e73; --label-3: #aeaeb2;
  --accent: #0071e3; --accent-soft: rgba(0, 113, 227, .1); --omr: #0071e3;
  --ios-sep: rgba(60, 60, 67, .13);
  --glass: rgba(245, 245, 247, .74); --glass-strong: rgba(255, 255, 255, .86);
  --shadow-card: 0 1px 1px rgba(0, 0, 0, .02), 0 6px 20px rgba(0, 0, 0, .045);
  --shadow-float: 0 14px 44px rgba(0, 0, 0, .16);
  --r-xl: 22px; --r-lg: 18px; --r-md: 12px; --r-pill: 980px; --r-card: 18px;
  --spring: cubic-bezier(.32, .72, 0, 1); --bounce: cubic-bezier(.34, 1.56, .64, 1);
  --c-blue: #0071e3; --c-green: #34c759; --c-orange: #ff9500; --c-red: #ff3b30; --c-indigo: #5856d6; --c-teal: #30b0c7; --c-pink: #ff2d55;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000; --paper: #1c1c1e; --ink: #f5f5f7; --muted: #98989d; --ios-label2: #98989d; --label-3: #636366;
    --accent: #0a84ff; --accent-soft: rgba(10, 132, 255, .2); --omr: #0a84ff;
    --ios-sep: rgba(84, 84, 88, .6);
    --glass: rgba(0, 0, 0, .72); --glass-strong: rgba(44, 44, 46, .86);
    --shadow-card: none; --shadow-float: 0 14px 44px rgba(0, 0, 0, .55);
    --c-blue: #0a84ff; --c-green: #30d158; --c-orange: #ff9f0a; --c-red: #ff453a; --c-indigo: #5e5ce6; --c-teal: #40c8e0; --c-pink: #ff375f;
  }
}
body { background: var(--bg); color: var(--ink); letter-spacing: -0.01em; word-break: keep-all; overflow-wrap: anywhere; }

/* 위쪽 막대: 처음엔 투명, 스크롤하면 유리 */
.topbar { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom: 0; }
.topbar::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); box-shadow: 0 .5px 0 var(--ios-sep); opacity: 0; transition: opacity .3s var(--ease-out); }
.topbar.scrolled::before { opacity: 1; }
.topbar.scrolled { background: transparent; border-bottom: 0; }
.c-tabs { top: 52px; }

/* 제목 위 작은 줄과 큰 제목 */
.eyebrow { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; font-size: 13px; font-weight: 600; letter-spacing: 0; color: var(--muted); }
.eyebrow .ic { width: 16px; height: 16px; }
.page-head, .c-top { padding-top: 20px; }
@media (min-width: 768px) {
  h1, .page-head h1, .c-top h1 { font-size: 44px; line-height: 1.13; letter-spacing: -0.025em; }
  .page-head, .c-top { padding-top: 36px; }
}

/* 앱 아이콘: 색 사각형 + 흰 그림, 살짝 위가 밝은 광택 */
.app-ic { display: inline-grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 7px; color: #fff; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 78%, #fff), var(--c)); box-shadow: inset 0 .5px 0 rgba(255, 255, 255, .35); --c: var(--c-blue); }
.app-ic .ic { width: 17px; height: 17px; }
.app-ic.big { width: 56px; height: 56px; border-radius: 14px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 6px 16px color-mix(in srgb, var(--c) 30%, transparent); }
.app-ic.big .ic { width: 30px; height: 30px; }
.app-ic.c-blue, .app-ic.c-eng { --c: var(--c-blue); }
.app-ic.c-green, .app-ic.c-sci { --c: var(--c-green); }
.app-ic.c-orange, .app-ic.c-math { --c: var(--c-orange); }
.app-ic.c-indigo, .app-ic.c-soc { --c: var(--c-indigo); }
.app-ic.c-red, .app-ic.c-kor { --c: var(--c-red); }

/* 카드: 테두리 없이 흰 판 + 부드러운 그림자, 큰 둥근 모서리 */
.subj-card, .plan, .tier-card, .unit-list, .ai-card, .res-hero, .cu { border: 0; border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
.sc-head { align-items: center; justify-content: flex-start; gap: 12px; border-bottom: 0; padding-bottom: 4px; }
.sc-head h3 { flex: 1; font-size: 22px; font-weight: 700; letter-spacing: -0.018em; }
.sc-head .app-ic { width: 40px; height: 40px; border-radius: 10px; }
.sc-head .app-ic .ic { width: 22px; height: 22px; }

/* 버튼: 둥근 알약 */
.btn { border-radius: var(--r-pill); padding: 0 20px; }
.btn.lg { border-radius: var(--r-pill); min-height: 50px; padding: 0 26px; }
.btn.primary { background: var(--accent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 90%, #fff); }
.btn.sm { border-radius: var(--r-pill); }
.c-tabs a { border-radius: var(--r-pill); }

/* ---------- 홈: 가운데 큰 제목 + 벤토 카드 ---------- */
.home { max-width: 1000px; }
.home-hero { text-align: center; padding: 40px 0 28px; }
.home-hero h1 { font-size: clamp(36px, 8vw, 64px); line-height: 1.08; letter-spacing: -0.035em; font-weight: 700; margin: 0; }
.home-hero .sub { max-width: 34em; margin: 14px auto 0; font-size: 17px; color: var(--muted); }
@media (min-width: 768px) { .home-hero { padding: 72px 0 40px; } .home-hero .sub { font-size: 19px; } }
.bento { display: grid; gap: 16px; }
@media (min-width: 900px) { .bento { grid-template-columns: 1fr 1fr; } }
.bento-card { position: relative; display: grid; grid-template-columns: 1fr; gap: 20px; padding: 24px; border-radius: var(--r-xl); background: var(--paper); color: var(--ink); text-decoration: none; box-shadow: var(--shadow-card); overflow: hidden; transition: transform .45s var(--spring), box-shadow .3s var(--ease-out); }
@media (min-width: 560px) { .bento-card { grid-template-columns: minmax(0, 1fr) minmax(0, 200px); align-items: center; } }
.bento-card:hover { box-shadow: var(--shadow-float); }
.bento-card:active { transform: scale(.98); }
.bc-main { display: grid; gap: 8px; justify-items: start; min-width: 0; }
.bc-main .app-ic { margin-bottom: 10px; }
.bc-t { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -0.022em; }
.bc-d { font-size: 15px; line-height: 1.45; color: var(--muted); }
.bc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.bc-chips span { padding: 4px 10px; border-radius: var(--r-pill); background: var(--ios-fill); font-size: 13px; font-weight: 600; color: var(--ink); }
.bc-go { display: inline-flex; align-items: center; gap: 2px; margin-top: 6px; font-size: 15px; font-weight: 600; color: var(--accent); }
.bc-go .ic { width: 15px; height: 15px; transition: transform .3s var(--spring); }
.bento-card:hover .bc-go .ic { transform: translateX(3px); }
/* 미리 보기: 기본은 단원 목록, 시험 대비는 OMR 답안표 */
.bc-prev { justify-self: center; width: 100%; max-width: 220px; pointer-events: none; }
.bp-list { display: grid; padding: 6px 0; border-radius: var(--r-md); background: var(--bg); box-shadow: inset 0 0 0 .5px var(--ios-sep); }
.bp-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; font-size: 13px; font-weight: 600; }
.bp-row + .bp-row { box-shadow: inset 0 .5px 0 var(--ios-sep); }
.bp-no { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--c-green); color: #fff; font-size: 11px; font-weight: 700; flex: none; }
.bp-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp-row .ic { width: 13px; height: 13px; color: var(--label-3); }
.bp-omr .hero-sheet { position: static; width: 100%; max-width: 220px; margin: 0 auto; transform: rotate(-2deg) scale(.92); box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 22%, transparent); }
/* 과목 바로 가기 줄 */
.subj-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; margin-top: 16px; }
.ss-item { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px 14px; border-radius: var(--r-lg); background: var(--paper); box-shadow: var(--shadow-card); color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 600; transition: transform .45s var(--spring); }
.ss-item:active { transform: scale(.95); }
.ss-item .app-ic { width: 44px; height: 44px; border-radius: 11px; }
.ss-item .app-ic .ic { width: 24px; height: 24px; }
.home-links { gap: 24px; margin-top: 28px; }
.home-links a { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.home-links .ic { width: 16px; height: 16px; }

/* 목록 화면은 가운데 좁은 칸 (설정 앱처럼) */
.wrap.study, .wrap.tiers { max-width: 720px; }

/* ---------- 바닥글: 가운데 작은 글씨 ---------- */
.foot { border-top: 0; margin-top: 40px; padding: 24px 0 40px; text-align: center; font-size: 12px; color: var(--label-3); }
.foot p { max-width: 46em; margin: 4px auto; }
.foot a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.foot-credit { font-size: 12px; }

/* ==========================================================================
   밤이 기본 (2026-11-23, 사용자 요청 "기본을 밤으로"): theme.js가 밤, 낮, 기기 설정을 정함.
   유리 윤곽선 ("애플처럼 유리 윤곽선"): 빛이 왼쪽 위에서 비친 것처럼 가장자리 한 줄이
   왼쪽 위에서 가장 밝고, 옆은 흐려지고, 오른쪽 아래에서 다시 조금 밝음.
   ========================================================================== */
:root {
  --edge-hi: rgba(255, 255, 255, .95); --edge-mid: rgba(0, 0, 0, .05); --edge-lo: rgba(0, 0, 0, .09);
  --card-grad: var(--paper);
}
@media (prefers-color-scheme: dark) {
  :root {
    --edge-hi: rgba(255, 255, 255, .26); --edge-mid: rgba(255, 255, 255, .05); --edge-lo: rgba(255, 255, 255, .12);
    --card-grad: linear-gradient(180deg, #1c1c1e, #141416);
    --glass: rgba(28, 28, 30, .6); --glass-strong: rgba(28, 28, 30, .78);
  }
  .subj-card, .plan, .unit-list, .tier-card, .ai-card, .cu, .ss-item, .bento-card, .res-hero { background: var(--card-grad); }
}
.subj-card, .plan, .unit-list, .tier-card, .ai-card, .cu, .ss-item, .bento-card, .res-hero, .topnav, .csheet { position: relative; }
.subj-card::after, .plan::after, .unit-list::after, .tier-card::after, .ai-card::after, .cu::after, .ss-item::after, .bento-card::after, .res-hero::after,
.tabbar::after, .topnav::after, .csheet::after, .topbar::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(135deg, var(--edge-hi) 0%, var(--edge-mid) 38%, var(--edge-mid) 62%, var(--edge-lo) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
/* 위쪽 막대는 아래 가장자리만, 스크롤해서 유리가 보일 때만 */
.topbar::after { inset: auto 0 0 0; height: 1px; padding: 0; -webkit-mask: none; mask: none; background: linear-gradient(90deg, transparent, var(--edge-hi) 30%, var(--edge-hi) 70%, transparent); opacity: 0; transition: opacity .3s var(--ease-out); }
.topbar.scrolled::after { opacity: .6; }
.topbar.scrolled::before { box-shadow: none; }
/* 떠 있는 탭 막대와 메뉴 캡슐은 윤곽선을 조금 더 또렷하게 */
.tabbar::after, .topnav::after { background: linear-gradient(160deg, var(--edge-hi) 0%, transparent 45%, transparent 60%, var(--edge-lo) 100%); }
@media (max-width: 899px) { .tabbar { border: 0; } }
.unit-list { overflow: visible; }
.unit-list > li:first-child .unit-card { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.unit-list > li:last-child .unit-card { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.unit-list > li:only-child .unit-card { border-radius: var(--r-lg); }

/* 바닥글 화면 색 고르기 */
.theme-pick { display: inline-flex; gap: 2px; margin: 0 0 12px; padding: 3px; border-radius: var(--r-pill); background: var(--ios-fill); }
.theme-pick button { padding: 6px 14px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: background-color .2s var(--ease-out), color .2s var(--ease-out); }
.theme-pick button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
/* 밤: 세그먼트에서 고른 칸이 바탕과 같은 색이 되지 않게 (애플 어두운 세그먼트 색) */
@media (prefers-color-scheme: dark) {
  .seg-ctl a.on, .seg-ctl button.on, .seg-ctl .on, .plan-g label:has(input:checked) span, .topnav a.on, .theme-pick button[aria-pressed="true"] { background: #636366; color: #fff; }
}

/* ==========================================================================
   단순하게 다시 짜기 (2026-11-23, 사용자: "ui가 너무 복잡해 재구성", "키 입력하는 ui도 부실해",
   "버튼 누르면 그 버튼이 커져서 하나에 창이 되는 애니메이션")
   ========================================================================== */
/* 위쪽 막대 작은 제목: 로고와 겹치지 않게 가운데 좁은 폭만 */
.bar-title { max-width: calc(100% - 232px); }

/* 목록 화면: 가운데 좁은 칸 */
.wrap.list-page { max-width: 720px; }
.list-page .page-head { padding-bottom: 8px; }
.list-page .page-head .seg-ctl { margin-top: 14px; }

/* 묶음 목록 (설정 앱) */
.group-label { margin: 28px 16px 7px; font-size: 13px; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.group { position: relative; border-radius: var(--r-md); background: var(--card-grad, var(--paper)); box-shadow: var(--shadow-card); }
.group-note { margin: 8px 16px 0; font-size: 13px; line-height: 1.42; color: var(--muted); }
.row { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 16px; border: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; transition: background-color .2s var(--ease-out); }
.row + .row::before { content: ""; position: absolute; top: 0; left: 58px; right: 0; height: .5px; background: var(--ios-sep); }
.group > .row:first-child { border-radius: var(--r-md) var(--r-md) 0 0; }
.group > .row:last-child { border-radius: 0 0 var(--r-md) var(--r-md); }
.group > .row:only-child { border-radius: var(--r-md); }
.row.press:active { background: var(--row-press); }
.row.dis { cursor: default; }
.row.dis .row-title { color: var(--muted); }
.row .app-ic { width: 30px; height: 30px; border-radius: 7px; }
.row-main { flex: 1 1 0%; min-width: 0; display: grid; gap: 1px; }
.row-title { font-size: 17px; font-weight: 500; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; line-height: 1.35; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rval { flex: none; max-width: 45%; font-size: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.row-lock { flex: none; display: inline-flex; color: var(--muted); }
.row-lock .lock.ic { margin: 0; width: 15px; height: 15px; }
.row.locked .app-ic { filter: saturate(.2); opacity: .55; }
.chev { flex: none; display: grid; place-items: center; color: var(--label-3); }
.chev .ic { width: 15px; height: 15px; }

/* 과목 화면 */
.back-link { display: inline-flex; align-items: center; gap: 2px; margin: 14px 0 0 -6px; padding: 6px; border-radius: 10px; color: var(--accent); font-size: 17px; text-decoration: none; }
.back-link .ic { width: 22px; height: 22px; }
.back-link:active { opacity: .4; }
.sp-head { display: flex; align-items: center; gap: 16px; padding: 18px 0 22px; }
.sp-head .eyebrow { margin-bottom: 2px; }
.sp-head h1 { margin: 0; }
.sp-go { display: flex; flex-direction: column; gap: 2px; width: 100%; min-height: 64px; padding: 10px 24px; }
.sp-go span { font-size: 17px; font-weight: 600; }
.sp-go small { font-size: 13px; font-weight: 500; opacity: .8; }
.subj-page .ana-card { margin-top: 28px; }

/* 홈: 더 단순하게 (칩, 과목 줄, 링크 줄 없음), 좁은 화면에선 미리 보기 숨김 */
.bento-card { gap: 16px; }
@media (max-width: 559px) { .bc-prev { display: none; } .bento-card { padding: 22px; } }
.bc-t { font-size: 24px; }

/* ---------- 레디포 키 창: 가운데 유리 창 ---------- */
.kwin-wrap { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; }
.kwin-back { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
/* 누른 버튼의 바탕만 복사한 판: 가운데로 날아가며 창 모양이 됨 (motion.js expand, collapse) */
.rf-ghost { position: absolute; z-index: 0; overflow: hidden; pointer-events: none; contain: layout paint; will-change: left, top, width, height; }
.rf-ghost > i { position: absolute; inset: 0; background-size: cover; }
.kwin-wrap.closing { pointer-events: none; }
.kwin { position: relative; width: min(100%, 400px); display: grid; justify-items: center; gap: 8px; padding: 28px 22px 20px; border-radius: var(--r-xl); background: var(--glass-strong); backdrop-filter: saturate(180%) blur(30px); -webkit-backdrop-filter: saturate(180%) blur(30px); box-shadow: var(--shadow-float); text-align: center; }
.kwin::after { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; background: linear-gradient(135deg, var(--edge-hi) 0%, var(--edge-mid) 38%, var(--edge-mid) 62%, var(--edge-lo) 100%); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }
.kwin h2 { margin: 6px 0 0; font-size: 22px; }
.kwin-msg { margin: 0; font-size: 15px; color: var(--muted); }
.kwin-msg b { color: var(--ink); font-weight: 600; }
.kwin-note { margin: 4px 0 0; font-size: 12px; color: var(--label-3); }
.kwin-x { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--ios-fill); color: var(--muted); cursor: pointer; }
.kwin-x .ic { width: 16px; height: 16px; }
.kwin .app-ic.big { margin-bottom: 2px; }

/* 키 입력: RF- + 4칸 - 4칸 */
.kf { display: grid; justify-items: center; gap: 10px; width: 100%; margin: 10px 0 0; }
.kf-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.kf-box { position: relative; display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; padding: 4px 0; }
.kf-rf { font: 600 20px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--muted); }
.kf-dash { font-size: 18px; color: var(--label-3); }
.kf-cells { display: flex; gap: 4px; }
.kf-c { display: grid; place-items: center; width: 30px; height: 42px; border-radius: 9px; background: var(--ios-fill); font: 600 20px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--ink); box-shadow: inset 0 0 0 1px transparent; transition: box-shadow .2s var(--ease-out), background-color .2s var(--ease-out), transform .25s var(--bounce); }
@media (min-width: 380px) { .kf-c { width: 34px; height: 46px; } }
.kf-c.fill { animation: kf-pop .25s var(--bounce); }
.kf-c.cur { box-shadow: inset 0 0 0 2px var(--accent); }
.kf-c.cur:empty::after { content: ""; width: 2px; height: 22px; border-radius: 1px; background: var(--accent); animation: kf-blink 1s steps(1) infinite; }
.kf-in { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; font-size: 16px; color: transparent; caret-color: transparent; background: transparent; cursor: text; }
.kf-help { margin: 0; font-size: 13px; color: var(--muted); }
.kf-go { width: 100%; }
.kf-go:disabled { opacity: .35; transform: none; }
.kf-go.busy { pointer-events: none; opacity: .7; }
.kf .key-err { margin: 0; min-height: 1.2em; font-size: 14px; font-weight: 600; color: var(--bad); }
.kf.bad .kf-cells { animation: kf-shake .4s var(--ease-out); }
.kf.bad .kf-c { box-shadow: inset 0 0 0 1.5px var(--bad); }
.kf.ok .kf-c { background: color-mix(in srgb, var(--c-green) 22%, transparent); box-shadow: inset 0 0 0 1.5px var(--c-green); transform: scale(1.04); }
@keyframes kf-pop { 40% { transform: scale(1.12); } }
@keyframes kf-blink { 50% { opacity: 0; } }
@keyframes kf-shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
/* 등급 화면 키 칸 */
.ai-panel .kp-open { margin-top: 14px; width: 100%; }
.kp-open .ic { width: 16px; height: 16px; }

/* ---------- 누른 것이 커져서 창이 되는 전환 (motion.js가 이름 rf-win을 붙임) ---------- */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-group(rf-win) { animation-duration: .52s; animation-timing-function: var(--spring); overflow: clip; border-radius: var(--r-xl); }
  ::view-transition-old(rf-win) { animation: rf-fade-out .2s ease-out both; }
  ::view-transition-new(rf-win) { animation: rf-fade-in-plain .32s .08s ease-out both; }
  html[data-nav="expand"]::view-transition-old(root), html[data-nav="collapse"]::view-transition-old(root) { animation: rf-fade-out .3s var(--ease-out) both; }
  html[data-nav="expand"]::view-transition-new(root), html[data-nav="collapse"]::view-transition-new(root) { animation: rf-fade-in-plain .36s .1s var(--ease-out) both; }
  html[data-nav="win"]::view-transition-old(root), html[data-nav="win"]::view-transition-new(root) { animation-duration: .32s; }
}
@keyframes rf-fade-in-plain { from { opacity: 0; } }
/* 키 칸: 좁은 휴대폰에서도 창 안에 들어가게 칸 너비를 화면에 맞춤 */
.kwin { min-width: 0; max-width: 100%; }
.kf-box { flex-wrap: nowrap; gap: 3px; }
.kf-rf { flex: none; white-space: nowrap; font-size: 18px; }
.kf-cells { gap: 3px; }
.kf-c { width: clamp(24px, 7.4vw, 34px); height: clamp(36px, 10.6vw, 46px); font-size: clamp(16px, 4.8vw, 20px); border-radius: 8px; }
@media (min-width: 380px) { .kf-c { width: clamp(24px, 7.4vw, 34px); height: clamp(36px, 10.6vw, 46px); } }

/* ==========================================================================
   unslop 손질 (2026-11-23): 사용자가 고른 밤, 유리 윤곽선, 앱 아이콘, 알약 버튼, 카드 2장은 그대로 두고
   남은 AI 티만 정리. 방향: 차분하고 정확하고 조금 다정함, 밤 공부 책상과 OMR 답안지,
   색과 공을 들이는 곳은 답안지 미리 보기 하나, 표시는 채점하는 곳의 빨간 펜 동그라미
   ========================================================================== */
/* 1. 간격: 4px 단위로 맞춤 */
.group-label { margin: 28px 16px 8px; }
.back-link { margin-top: 12px; }
.sp-head { padding: 16px 0 24px; }
.kwin { padding: 28px 24px 20px; }
.kf-box, .kf-cells { gap: 4px; }
@media (max-width: 559px) { .bento-card { padding: 24px; } }

/* 2. 색: 색이 번지는 그림자 빼기 (깊이는 바탕 단계와 윤곽선으로) */
.app-ic.big { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 2px 6px rgba(0, 0, 0, .18); }
.bp-omr .hero-sheet { box-shadow: 0 12px 32px rgba(0, 0, 0, .28); }
@media (prefers-color-scheme: dark) { .bp-omr .hero-sheet { box-shadow: 0 12px 32px rgba(0, 0, 0, .6); } }

/* 6. 배치: 첫 화면은 한 화면으로 (큰 제목과 카드가 가운데, 빈 띠 없이), 카드 안 글은 위에서부터 */
@media (min-width: 900px) {
  .home { min-height: calc(100dvh - 52px); display: flex; flex-direction: column; justify-content: center; padding-bottom: 48px; }
  .home-hero { padding: 24px 0 40px; }
}
.bento-card { align-items: start; }
.bc-main { align-self: start; }
.bc-prev { align-self: center; }

/* 7. 바닥글: 고르기, 한 줄 안내, 출처 */
.foot { margin-top: 24px; padding: 32px 0 40px; }
.foot .theme-pick { margin: 0 0 16px; }
.foot-note { margin: 0 auto 4px; font-size: 12px; line-height: 1.5; }
.foot-credit { margin: 0; }
/* 카드: 아이콘은 위, 제목과 설명은 아래 (카드 높이를 미리 보기가 정해도 빈 곳이 생기지 않게) */
.bento-card { align-items: stretch; }
.bc-main { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; gap: 24px; align-self: stretch; }
.bc-main .app-ic { margin-bottom: 0; }
.bc-main .bc-t { margin-top: auto; }
.bc-main { gap: 8px; } .bc-main .bc-t { padding-top: 24px; }

/* ==========================================================================
   2026-11-23 사용자 요청: "페이지 넘길 때 아이콘이 겹쳐", "자물쇠 파란 배경 지워", "렉 최적화",
   "1, 2학년 옮길 때 깜빡이는 걸 스크롤링 애니메이션으로", "자리가 부족하면 사이즈 늘어나고 줄어들게"
   ========================================================================== */
/* 1. 아이콘 겹침: 전환 중에 옛 막대 그림을 숨김 (예전엔 옛 그림과 새 그림이 함께 보여 탭 아이콘이 겹쳤음) */
.c-grade { view-transition-name: seg-grade; }
.c-tabs { view-transition-name: seg-tabs; }
::view-transition-old(topbar), ::view-transition-old(tabbar), ::view-transition-old(seg-grade), ::view-transition-old(seg-tabs) { display: none; }
::view-transition-new(topbar), ::view-transition-new(tabbar), ::view-transition-new(seg-grade), ::view-transition-new(seg-tabs) { animation: none; }
::view-transition-group(seg-grade), ::view-transition-group(seg-tabs) { z-index: 3; animation: none; }
/* 흐리게 바뀔 때도 옛 화면이 먼저 빠지고 새 화면이 들어와 겹쳐 보이지 않게 */
@media (prefers-reduced-motion: no-preference) {
  html[data-nav="fade"]::view-transition-old(root) { animation: rf-fade-out .14s ease-out both; }
  html[data-nav="fade"]::view-transition-new(root) { animation: rf-fade-in .26s .1s var(--ease-out) both; }
  ::view-transition-old(rf-win) { animation: rf-fade-out .14s ease-out both; }
  ::view-transition-new(rf-win) { animation: rf-fade-in-plain .26s .12s ease-out both; }
}

/* 2. 키 창 자물쇠: 바탕 없이 그림만 */
.kwin-ic { display: grid; place-items: center; width: 56px; height: 56px; color: var(--ink); }
.kwin-ic .ic { width: 40px; height: 40px; }

/* 3. 가볍게: 카드 윤곽선은 마스크 대신 안쪽 그림자(그리기가 훨씬 쌈), 흐림 효과는 막대 두 개에만 */
:root { --ring: rgba(0, 0, 0, .05); --ring-top: rgba(255, 255, 255, .9); }
@media (prefers-color-scheme: dark) { :root { --ring: rgba(255, 255, 255, .07); --ring-top: rgba(255, 255, 255, .13); } }
.subj-card::after, .plan::after, .unit-list::after, .tier-card::after, .ai-card::after, .cu::after, .ss-item::after, .bento-card::after, .res-hero::after {
  padding: 0; background: none; -webkit-mask: none; mask: none;
  box-shadow: inset 0 1px 0 var(--ring-top), inset 0 0 0 1px var(--ring);
}
.group { box-shadow: var(--shadow-card), inset 0 1px 0 var(--ring-top), inset 0 0 0 1px var(--ring); }
.c-tabs { backdrop-filter: none; -webkit-backdrop-filter: none; background: color-mix(in srgb, var(--bg) 94%, transparent); }
.kwin-back { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(0, 0, 0, .55); }
.topbar::before { backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px); }
@media (max-width: 899px) { .tabbar { backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px); } }
.bento-card { transition: transform .4s var(--spring); }
.bento-card:hover { box-shadow: var(--shadow-card); }
.tabbar, .topbar { contain: layout paint; }
.row, .unit-card, .bento-card, .subj-card { contain: layout paint style; }
::view-transition-group(root) { animation-duration: .36s; }

/* 4. 학년, 과목 바꾸기: 고른 칸 바탕이 옆으로 미끄러지고 화면은 옆으로 넘어감 */
.c-grade a, .c-tabs a { position: relative; }
.c-grade a.on, .c-tabs a.on { background: transparent !important; box-shadow: none !important; }
.seg-thumb { position: absolute; inset: 0; z-index: 0; border-radius: inherit; background: var(--paper); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); view-transition-name: seg-thumb; }
.tab-thumb { background: var(--accent); box-shadow: none; view-transition-name: tab-thumb; }
@media (prefers-color-scheme: dark) { .seg-thumb { background: #636366; } .tab-thumb { background: var(--accent); } }
.seg-t { position: relative; z-index: 1; }
::view-transition-group(seg-thumb), ::view-transition-group(tab-thumb) { z-index: 2; animation-duration: .42s; animation-timing-function: var(--spring); }
::view-transition-old(seg-thumb), ::view-transition-new(seg-thumb), ::view-transition-old(tab-thumb), ::view-transition-new(tab-thumb) { animation: none; }
::view-transition-old(seg-thumb), ::view-transition-old(tab-thumb) { display: none; }
@media (prefers-reduced-motion: no-preference) {
  html[data-nav="side-l"]::view-transition-old(root) { animation: rf-side-out-l .42s var(--spring) both; }
  html[data-nav="side-l"]::view-transition-new(root) { animation: rf-side-in-l .42s var(--spring) both; }
  html[data-nav="side-r"]::view-transition-old(root) { animation: rf-side-out-r .42s var(--spring) both; }
  html[data-nav="side-r"]::view-transition-new(root) { animation: rf-side-in-r .42s var(--spring) both; }
}
@keyframes rf-side-out-l { to { transform: translateX(-100%); } }
@keyframes rf-side-in-l { from { transform: translateX(100%); } }
@keyframes rf-side-out-r { to { transform: translateX(100%); } }
@keyframes rf-side-in-r { from { transform: translateX(-100%); } }

/* 5. 자리에 맞춰 크기가 늘고 줄어듦 (화면 폭 기준) */
@media (max-width: 767px) {
  h1, .page-head h1, .c-top h1 { font-size: clamp(28px, 8.4vw, 34px); }
  .home-hero h1 { font-size: clamp(32px, 9.6vw, 44px); }
}
.c-tabs { gap: clamp(2px, 1vw, 6px); }
.c-tabs a { flex: 1 1 auto; min-width: 0; justify-content: center; padding: 0 clamp(8px, 2.8vw, 18px); font-size: clamp(14px, 3.9vw, 17px); }
.c-tabs .seg-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg-ctl.c-grade a { padding: 6px clamp(14px, 4.4vw, 24px); font-size: clamp(14px, 3.9vw, 16px); }
.row-title { font-size: clamp(15px, 4.3vw, 17px); }
.row-sub { font-size: clamp(12px, 3.4vw, 13px); }
.bc-t { font-size: clamp(20px, 5.6vw, 26px); }
.sp-head .app-ic.big { width: clamp(48px, 14vw, 56px); height: clamp(48px, 14vw, 56px); }
@media (max-width: 899px) { .tabbar a { font-size: clamp(10px, 2.8vw, 11px); } }
.subj-card, .bento-card { contain: none; } /* 넘치는 배지와 미리 보기가 잘리지 않게 */

/* ==========================================================================
   학년, 과목 바꾸기 (2026-11-23 고침): 화면 전체를 옆으로 미는 대신,
   칸은 제자리에서 새 크기로 늘고 줄어들고, 칸 안의 글자가 위로 굴러 올라가며 바뀜
   (사용자: "텍스트가 스크롤링으로 올라가라는 거야. 삐져나올 것 같으면 칸 사이즈를 늘리거나 줄이는 애니메이션")
   다음 학년, 과목은 위로(roll-up), 앞 학년, 과목은 아래로(roll-down)
   ========================================================================== */
html[data-nav="roll-up"]::view-transition-old(root), html[data-nav="roll-up"]::view-transition-new(root),
html[data-nav="roll-down"]::view-transition-old(root), html[data-nav="roll-down"]::view-transition-new(root) { animation: none; }
html[data-nav="roll-up"]::view-transition-old(root), html[data-nav="roll-down"]::view-transition-old(root) { display: none; }
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-group(.rf-roll) { overflow: clip; border-radius: var(--r-lg); animation-duration: .46s; animation-timing-function: var(--spring); }
  html[data-nav="roll-up"]::view-transition-old(.rf-roll) { animation: rf-roll-out-up .32s var(--spring) both; }
  html[data-nav="roll-up"]::view-transition-new(.rf-roll) { animation: rf-roll-in-up .44s var(--spring) both; }
  html[data-nav="roll-down"]::view-transition-old(.rf-roll) { animation: rf-roll-out-down .32s var(--spring) both; }
  html[data-nav="roll-down"]::view-transition-new(.rf-roll) { animation: rf-roll-in-down .44s var(--spring) both; }
}
@keyframes rf-roll-out-up { to { transform: translateY(-36%); opacity: 0; } }
@keyframes rf-roll-in-up { from { transform: translateY(36%); opacity: 0; } }
@keyframes rf-roll-out-down { to { transform: translateY(36%); opacity: 0; } }
@keyframes rf-roll-in-down { from { transform: translateY(-36%); opacity: 0; } }
/* 굴러가는 글이 칸 밖으로 보이지 않게 칸 안에서만 보이도록 자름 */
::view-transition-image-pair(.rf-roll) { overflow: hidden; border-radius: var(--r-lg); }

/* 터치 (2026-11-23, 사용자: "터치가 안돼"): 화면 전환 애니메이션이 도는 동안(약 0.5초) 터치가 막혀
   빠르게 누르면 먹지 않았음. 전환 그림이 터치를 가로채지 않게 해서 바로 아래의 새 화면이 터치를 받음 */
::view-transition { pointer-events: none; }
::view-transition-group(rf-win) { animation-duration: .42s; }

/* 굴림 전환 다시 (2026-11-23, 사용자: "텍스트만, 배경은 그냥 늘어나기만 하고(줄어들기도 하고) 카메라가 움직이지 않게")
   칸 배경(rf-box)은 새 판 하나만 보이며 크기만 늘고 줄어듦. 글(rf-text)만 위아래로 굴러 바뀜 */
::view-transition-group(.rf-box) { animation-duration: .46s; animation-timing-function: var(--spring); }
::view-transition-old(.rf-box) { display: none; }
::view-transition-new(.rf-box) { animation: none; width: 100%; height: 100%; }
::view-transition-group(.rf-text) { animation-duration: .46s; animation-timing-function: var(--spring); }
::view-transition-image-pair(.rf-text) { overflow: hidden; }
@media (prefers-reduced-motion: no-preference) {
  html[data-nav="roll-up"]::view-transition-old(.rf-text) { animation: rf-roll-out-up .3s var(--spring) both; }
  html[data-nav="roll-up"]::view-transition-new(.rf-text) { animation: rf-roll-in-up .42s var(--spring) both; }
  html[data-nav="roll-down"]::view-transition-old(.rf-text) { animation: rf-roll-out-down .3s var(--spring) both; }
  html[data-nav="roll-down"]::view-transition-new(.rf-text) { animation: rf-roll-in-down .42s var(--spring) both; }
}
@keyframes rf-roll-out-up { to { transform: translateY(-70%); opacity: 0; } }
@keyframes rf-roll-in-up { from { transform: translateY(70%); opacity: 0; } }
@keyframes rf-roll-out-down { to { transform: translateY(70%); opacity: 0; } }
@keyframes rf-roll-in-down { from { transform: translateY(-70%); opacity: 0; } }

/* 오늘 할 것 접기, 펴기 (2026-11-23 사용자 요청 "접기 펴기 옵션, 아이콘으로") */
.plan-fold-h { display: flex; align-items: center; gap: 8px; width: 100%; margin: 16px 0 4px; padding: 6px 0; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; }
.plan-fold-h .pf-n { font-style: normal; font-variant-numeric: tabular-nums; padding: 0 8px; border-radius: var(--r-pill); background: var(--ios-fill); color: var(--ink); font-size: 12px; line-height: 20px; }
.plan-fold-h .pf-chev { margin-left: auto; width: 18px; height: 18px; transform: rotate(90deg); transition: transform .36s var(--spring); }
.plan-fold-h[aria-expanded="false"] .pf-chev { transform: rotate(0deg); }
.plan-fold-h:active { opacity: .6; }
.plan-fold-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .4s var(--spring), opacity .3s var(--ease-out); }
.plan-fold-body > div { min-height: 0; overflow: hidden; }
.plan-fold-body.folded { grid-template-rows: 0fr; opacity: 0; }
@media (prefers-reduced-motion: reduce) { .plan-fold-body, .plan-fold-h .pf-chev { transition: none; } }

/* 등급 화면 (2026-11-23, 사용자: "등급이 너무 세로로 납작해 좀 늘려, 굳이 맞출 필요 없어"):
   목록 화면의 좁은 칸(720)에 맞추지 않고 넓게, 카드 높이도 억지로 맞추지 않음 */
.wrap.tiers { max-width: 1120px; }
.tier-grid { gap: 16px; align-items: start; }
@media (min-width: 900px) { .tier-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; } }
.tier-card { padding: 24px; }
.wrap.tiers .tier-key { max-width: 720px; }
/* 둥근 사각형은 전환 효과에서 빼고 motion.js가 탭 줄 안에서 직접 옮김 (탭 줄 배경에 가려 안 보이던 문제) */
.seg-thumb, .tab-thumb { view-transition-name: none !important; }
/* 고르지 않은 과목 탭 글자는 회색 (파란 둥근 사각형이 지나갈 때 같은 파랑이라 글자가 사라지던 것) */
.c-tabs a { color: var(--muted); }
.c-tabs a:hover { color: var(--ink); }
.c-tabs a.on { color: #fff; }

/* 시험 기간에 기본을 누르면 뜨는 창 (2026-11-24): 키 창과 같은 모양, 버튼 두 개 */
.ap-acts { display: grid; gap: 8px; width: 100%; margin-top: 10px; }
.ap-acts .btn { width: 100%; justify-content: center; }

/* ---------- 오늘의 복습 (2026-11-24) ---------- */
main.daily { max-width: 720px; }
.dy-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dy-count { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); }
.dy-bar { height: 4px; margin: 8px 0 14px; border-radius: 2px; background: var(--ios-fill); overflow: hidden; }
.dy-bar span { display: block; height: 100%; background: var(--c-green); border-radius: 2px; transition: width .4s var(--ease-out); }
.dy-tag { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin: 0 0 10px; font-weight: 700; }
.dy-tag span { font-weight: 500; font-size: 13px; color: var(--muted); }
.dy-tag em { font-style: normal; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.dy-hint { margin: 12px 4px 0; }
.dy-conf { margin-top: 16px; text-align: center; }
.dy-conf p { margin: 0 0 10px; font-weight: 600; }
.dy-conf-b { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dy-conf-b .btn { justify-content: center; min-height: 48px; }
.dy-ex { margin-top: 16px; padding: 16px; border-radius: var(--r-lg, 18px); background: var(--paper); box-shadow: inset 0 0 0 1px var(--line-soft); }
.dy-ex label { display: grid; gap: 4px; margin-bottom: 10px; }
.dy-ex label small { color: var(--muted); font-size: 13px; }
.dy-ex textarea { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 12px; border: 0; background: var(--ios-fill); color: var(--ink); font: inherit; font-size: 16px; resize: vertical; }
.dy-ex-b { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.dy-ex-b .btn.busy { opacity: .7; pointer-events: none; }
.dy-ai { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--ios-fill); }
.dy-ai b { display: block; margin-bottom: 2px; }
.dy-ai p { margin: 0; }
.dy-ai.dy-ok b { color: var(--c-green); }
.dy-ai.dy-mid b { color: var(--c-orange); }
.dy-ai.dy-bad b { color: var(--c-red); }
.dy-err { margin: 10px 0 0; color: var(--c-red); font-size: 14px; }
.dy-good { margin: 14px 4px 0; color: var(--muted); }
.dy-next { margin-top: 18px; }
.dy-next .btn { width: 100%; justify-content: center; }
.dy-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0 14px; }
.dy-sum div { display: grid; gap: 2px; padding: 16px 10px; border-radius: 18px; background: var(--paper); text-align: center; }
.dy-sum b { font-size: 28px; font-variant-numeric: tabular-nums; }
.dy-sum b small { font-size: 15px; color: var(--muted); font-weight: 500; }
.dy-sum span { font-size: 13px; color: var(--muted); }
.dy-end-b { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.home-daily { max-width: 720px; margin: 18px auto 0; }
.dy-hidefb .fb .fb-exp, .dy-hidefb .fb .why, .dy-hidefb .fb .con-btn { display: none; }

/* ---------- 해설 되묻기 (app.js askBlock) ---------- */
.ask { margin-top: 12px; }
.ask-open { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 14px; border: 0; border-radius: var(--r-pill); background: var(--ios-fill); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.ask-open:active { transform: scale(.97); }
.ask-turn { display: grid; gap: 6px; margin-bottom: 10px; }
.ask-me { justify-self: end; max-width: 86%; margin: 0; padding: 8px 12px; border-radius: 14px 14px 4px 14px; background: var(--accent, #0a84ff); color: #fff; font-size: 14px; }
.ask-ai { max-width: 94%; margin: 0; padding: 10px 12px; border-radius: 14px 14px 14px 4px; background: var(--paper); color: var(--ink); font-size: 15px; line-height: 1.55; box-shadow: inset 0 0 0 1px var(--line-soft); }
.ask-warn { margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.ask-form label { display: grid; gap: 4px; }
.ask-form label small { color: var(--muted); font-size: 13px; }
.ask-in { width: 100%; box-sizing: border-box; margin-top: 4px; padding: 10px 12px; border: 0; border-radius: 12px; background: var(--paper); color: var(--ink); font: inherit; font-size: 16px; resize: vertical; box-shadow: inset 0 0 0 1px var(--line-soft); }
.ask-b { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

/* 해설 되묻기 AI 답 꾸밈 (2026-11-25, askmd.js가 그림) */
.ask-ai p { margin: 0; }
.ask-ai > * + * { margin-top: 8px; }
.ask-ai b { font-weight: 700; }
.ask-ai u { text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: var(--accent, #0a84ff); }
.ask-ai mark { padding: 0 3px; border-radius: 4px; background: rgba(255, 214, 10, .38); color: inherit; }
.ask-ai ol, .ask-ai ul { margin-bottom: 0; padding-left: 22px; }
.ask-ai li + li { margin-top: 3px; }
.ask-ai li::marker { color: var(--muted); font-weight: 600; }
.ask-tbl { overflow-x: auto; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line-soft); }
.ask-tbl table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.45; }
.ask-tbl th, .ask-tbl td { padding: 7px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
.ask-tbl tr:last-child td { border-bottom: 0; }
.ask-tbl td + td, .ask-tbl th + th { border-left: 1px solid var(--line-soft); }
.ask-tbl th { background: var(--ios-fill); font-weight: 700; white-space: nowrap; }

/* 로고 = 사이트 아이콘 (2026-11-25, 사용자 요청 "로고 R을 사이트 아이콘으로") */
.brand-mark.brand-icon { display: block; width: 30px; height: 30px; padding: 0; border-radius: 8px; background: none; box-shadow: none; object-fit: contain; }
.ask-ai code { padding: 1px 5px; border-radius: 5px; background: var(--ios-fill); font: inherit; font-weight: 600; }
