/* ==========================================================================
   자격증 시험일정 — Apple HIG 기반 디자인 토큰
   - 색상: iOS 시스템 컬러/시맨틱 컬러 (label, separator, fill, grouped background)
   - 타이포: iOS Dynamic Type "Large" 기본 스케일 (size / leading / tracking)
   - 재질: Liquid Glass 는 기능 레이어(내비 바, 팝오버, 시트, 토스트)에만 사용
   - 접근성: 44pt 터치 타깃, 대비 강화·투명도 감소·동작 줄이기 대응
   ========================================================================== */
:root {
  /* Grouped backgrounds */
  --bg: #F2F2F7;             /* systemGroupedBackground */
  --card: #FFFFFF;           /* secondarySystemGroupedBackground */
  --card-2: #F2F2F7;         /* tertiarySystemGroupedBackground */

  /* Labels (secondary 는 AA 4.5:1 을 맞추도록 불투명 값 사용) */
  --label: #000000;
  --label-2: #6E6E73;
  --label-3: rgba(60, 60, 67, .45);

  /* Separators & fills */
  --sep: rgba(60, 60, 67, .29);
  --sep-opaque: #C6C6C8;
  --fill: rgba(120, 120, 128, .20);
  --fill-2: rgba(120, 120, 128, .16);
  --fill-3: rgba(118, 118, 128, .12);
  --fill-4: rgba(116, 116, 128, .08);

  /* System colors: 채움용(base) / 텍스트용 고대비(ink) */
  --accent: #007AFF;  --accent-ink: #0062CC;
  --apply: #007AFF;   --apply-ink: #0062CC;
  --exam: #FF3B30;    --exam-ink: #D70015;
  --result: #34C759;  --result-ink: #248A3D;
  --live: #FF9500;    --live-ink: #C93400;
  --star: #FF9F0A;
  --on-accent: #FFFFFF;

  /* Materials (Liquid Glass 근사치 — Apple 공식 수치 아님) */
  --glass: rgba(242, 242, 247, .72);
  --glass-pop: rgba(255, 255, 255, .90);
  --glass-dark: rgba(30, 30, 32, .78);
  --glass-border: rgba(255, 255, 255, .55);
  --glass-blur: blur(24px) saturate(1.6);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-pop: 0 10px 40px rgba(0, 0, 0, .14), 0 2px 8px rgba(0, 0, 0, .06);
  --dim: rgba(0, 0, 0, .35);

  /* Typography (px = pt @1x) */
  --font: "SF Pro Text", "SF Pro KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard Variable", Pretendard, system-ui, "Segoe UI", sans-serif;
  --font-display: "SF Pro Display", "SF Pro KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard Variable", Pretendard, system-ui, sans-serif;

  /* Spacing (4pt 그리드) & radii */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px; --r-pill: 999px;
  --tap: 44px;

  /* Motion */
  --ease: cubic-bezier(.32, .72, 0, 1);        /* iOS 시트/내비 전환 곡선 */
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.36, .64, 1);   /* 약한 바운스 */
  --d-fast: 160ms; --d: 280ms; --d-slow: 420ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1C1C1E;
    --card-2: #2C2C2E;
    --label: #FFFFFF;
    --label-2: #98989F;
    --label-3: rgba(235, 235, 245, .35);
    --sep: rgba(84, 84, 88, .65);
    --sep-opaque: #38383A;
    --fill: rgba(120, 120, 128, .36);
    --fill-2: rgba(120, 120, 128, .32);
    --fill-3: rgba(118, 118, 128, .24);
    --fill-4: rgba(118, 118, 128, .18);
    --accent: #0A84FF;  --accent-ink: #409CFF;
    --apply: #0A84FF;   --apply-ink: #409CFF;
    --exam: #FF453A;    --exam-ink: #FF6961;
    --result: #30D158;  --result-ink: #30DB5B;
    --live: #FF9F0A;    --live-ink: #FFB340;
    --star: #FFD60A;
    --glass: rgba(0, 0, 0, .66);
    --glass-pop: rgba(44, 44, 46, .94);
    --glass-dark: rgba(58, 58, 60, .82);
    --glass-border: rgba(255, 255, 255, .10);
    --shadow-1: none;
    --shadow-pop: 0 10px 40px rgba(0, 0, 0, .6);
    --dim: rgba(0, 0, 0, .55);
  }
}

/* 대비 강화 */
@media (prefers-contrast: more) {
  :root {
    --label-2: #3A3A3C;
    --sep: #8E8E93;
    --fill-3: rgba(118, 118, 128, .24);
    --glass: var(--bg);
    --glass-pop: var(--card);
    --glass-border: var(--sep);
  }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root { --label-2: #D1D1D6; --sep: #8E8E93; }
}
/* 투명도 줄이기 → 불투명 재질 */
@media (prefers-reduced-transparency: reduce) {
  :root { --glass: var(--bg); --glass-pop: var(--card); --glass-dark: #3A3A3C; }
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light dark; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: 17px; line-height: 22px; letter-spacing: -0.022em;   /* Body 17/22 */
  word-break: keep-all; overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01" 0;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-left)); }
button { font: inherit; color: inherit; letter-spacing: inherit; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
svg.i { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.125em; }
svg.i.fill { fill: currentColor; }

:focus { outline: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; border-radius: var(--r-sm); }

/* --------------------------------------------- nav bar (Liquid Glass) */
.top {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--s4) + env(safe-area-inset-top)) 0 var(--s3);
  margin-bottom: var(--s2);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-bottom: .5px solid transparent;
  transition: border-color var(--d) var(--ease), padding var(--d) var(--ease);
}
.top.compact { border-bottom-color: var(--sep); padding-top: calc(var(--s2) + env(safe-area-inset-top)); padding-bottom: var(--s2); }
.title-row { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); transition: margin var(--d) var(--ease); }
.top h1 {
  margin: 0; font-family: var(--font-display);
  font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: .012em;   /* Large Title */
  transform-origin: left center;
  transition: font-size var(--d) var(--ease), line-height var(--d) var(--ease);
}
.sub { margin: 0; color: var(--label-2); font-size: 13px; line-height: 18px; letter-spacing: -0.006em; transition: opacity var(--d-fast) linear; }
.top.compact h1 { font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -0.026em; }
.top.compact .title-row { margin-bottom: var(--s2); }
.top.compact .sub { opacity: 0; }

/* search field */
.search { position: relative; }
.search-ico { position: absolute; left: 10px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--label-2); stroke-width: 2.2; stroke-linecap: round; pointer-events: none; }
.search input {
  width: 100%; height: 40px; font: inherit; font-size: 17px; letter-spacing: -0.022em;
  padding: 0 12px 0 36px; border-radius: var(--r-md); border: 0;
  background: var(--fill-3); color: var(--label);
  transition: background var(--d-fast) linear, box-shadow var(--d-fast) linear;
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--label-2); }
.search input:focus { outline: none; background: var(--card); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
.search input::-webkit-search-cancel-button { cursor: pointer; }

.results {
  position: absolute; left: 0; right: 0; top: calc(100% + var(--s2)); margin: 0; padding: 6px; list-style: none;
  background: var(--glass-pop);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: .5px solid var(--glass-border); border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  max-height: min(60vh, 520px); overflow-y: auto; overscroll-behavior: contain;
  animation: pop-in var(--d) var(--ease-out);
}
.res { display: flex; align-items: center; gap: var(--s2); padding: 6px 10px 6px 4px; min-height: var(--tap); border-radius: 10px; cursor: pointer; }
.res + .res { box-shadow: 0 -.5px 0 var(--sep); }
.res:hover, .res.active { background: var(--fill-3); box-shadow: none; }
.res:hover + .res, .res.active + .res { box-shadow: none; }
.res .info { flex: 1; min-width: 0; }
.res .nm { font-size: 17px; line-height: 22px; }
.res .meta { font-size: 13px; line-height: 18px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res .next { font-size: 13px; color: var(--label-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.res .next.has { color: var(--accent-ink); font-weight: 500; }
.res mark { background: none; color: var(--accent-ink); font-weight: 600; }
.res-empty { padding: var(--s4); color: var(--label-2); font-size: 15px; text-align: center; }

.star {
  border: 0; background: none; cursor: pointer; display: grid; place-items: center;
  width: var(--tap); height: var(--tap); border-radius: 50%; color: var(--label-3); font-size: 22px; flex: none;
  transition: color var(--d-fast) linear, transform var(--d) var(--spring);
}
.star:hover { color: var(--label-2); }
.star[aria-pressed="true"] { color: var(--star); }
.star:active { transform: scale(.86); }
.star.bump { animation: bump var(--d-slow) var(--spring); }

/* --------------------------------------------- segmented control */
.toolbar { display: flex; justify-content: flex-start; margin: var(--s2) 0 var(--s4); }
.segmented {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 2px; gap: 0;
  background: var(--fill-3); border-radius: 10px; min-width: 300px;
}
.segmented::before {
  content: ""; position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc(50% - 2px);
  background: var(--card); border-radius: 8px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04), 0 0 0 .5px rgba(0, 0, 0, .04);
  transition: transform var(--d) var(--ease);
}
@media (prefers-color-scheme: dark) { .segmented::before { background: #636366; } }
.segmented[data-i="1"]::before { transform: translateX(100%); }
.segmented button {
  position: relative; z-index: 1; border: 0; background: none; cursor: pointer;
  height: 36px; padding: 0 var(--s4); border-radius: 8px;
  font-size: 15px; font-weight: 500; letter-spacing: -0.016em; color: var(--label);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.segmented button[aria-selected="true"] { font-weight: 600; }
.count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--r-pill); background: var(--fill-2); color: var(--label-2);
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0;
}
[aria-selected="true"] .count { background: var(--accent); color: var(--on-accent); }

/* --------------------------------------------- bars & chips */
.bar { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; justify-content: space-between; margin-bottom: var(--s5); }
.bar-actions { display: flex; gap: var(--s2); margin-left: auto; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chips.center { justify-content: center; }
.chip {
  border: 0; background: var(--card); color: var(--label); box-shadow: var(--shadow-1), inset 0 0 0 .5px var(--sep);
  border-radius: var(--r-pill); min-height: 34px; padding: 0 var(--s3); font-size: 15px; line-height: 20px; letter-spacing: -0.016em; cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--s2);
  transition: background var(--d-fast) linear, color var(--d-fast) linear, transform var(--d-fast) var(--ease);
}
.chip:active { transform: scale(.96); }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.chip .x {
  border: 0; background: var(--fill-3); cursor: pointer; color: var(--label-2);
  width: 20px; height: 20px; margin-right: -6px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; position: relative;
}
.chip .x::after { content: ""; position: absolute; inset: -12px; }   /* 터치 타깃 확장 */
.chip .x:hover { background: var(--fill); color: var(--label); }
.chip.cat { background: var(--fill-3); box-shadow: none; color: var(--label-2); }
.chip.cat[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 500; }
.chip.cat .n { font-variant-numeric: tabular-nums; opacity: .75; font-size: 13px; }
.chip.add { color: var(--accent-ink); }
.chip.add .i { font-size: 13px; stroke-width: 2.6; }

/* buttons */
.btn {
  border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 var(--s4); border-radius: var(--r-pill);
  background: var(--fill-3); color: var(--accent-ink);
  font-size: 15px; font-weight: 600; letter-spacing: -0.016em; white-space: nowrap;
  transition: background var(--d-fast) linear, transform var(--d-fast) var(--ease), filter var(--d-fast) linear;
}
.btn:hover { background: var(--fill-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.plain { background: none; }
.btn.plain:hover { background: var(--fill-4); }
.btn.small { min-height: 32px; padding: 0 var(--s3); font-size: 15px; }
.btn.more { display: flex; margin: var(--s3) auto 0; }
.icon-btn {
  border: 0; cursor: pointer; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--fill-3); color: var(--accent-ink); font-size: 17px;
  transition: background var(--d-fast) linear, transform var(--d-fast) var(--ease);
}
.icon-btn:hover { background: var(--fill-2); }
.icon-btn:active { transform: scale(.92); }
.icon-btn .i { stroke-width: 2.4; }
@media (pointer: coarse) {
  .btn, .icon-btn { min-height: var(--tap); }
  .icon-btn { width: var(--tap); height: var(--tap); }
  .chip { min-height: 38px; }
}

/* --------------------------------------------- grouped sections */
.group { margin-bottom: var(--s8); }
.group-title {
  margin: 0 0 var(--s2) var(--s1); font-family: var(--font-display);
  font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -0.012em;   /* Title 2 */
}
.group-title.small { font-size: 13px; line-height: 18px; font-weight: 400; color: var(--label-2); letter-spacing: -0.006em; margin-left: var(--s4); text-transform: none; }
.group-foot { margin: var(--s2) var(--s4) 0; color: var(--label-2); font-size: 13px; line-height: 18px; letter-spacing: -0.006em; }
.card { background: var(--card); border-radius: var(--r-lg); padding: var(--s4); box-shadow: var(--shadow-1); }
.empty { color: var(--label-2); font-size: 15px; line-height: 20px; padding: var(--s2) 0; list-style: none; }

.empty-state { text-align: center; padding: var(--s8) var(--s6); margin-bottom: var(--s8); }
.empty-ico { width: 64px; height: 64px; margin: 0 auto var(--s3); border-radius: 18px; display: grid; place-items: center; color: var(--star); background: color-mix(in srgb, var(--star) 16%, transparent); font-size: 32px; }
.empty-state h2 { margin: 0 0 var(--s2); font-family: var(--font-display); font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -0.012em; }
.empty-state p { color: var(--label-2); margin: 0 auto var(--s5); max-width: 440px; font-size: 15px; line-height: 20px; }

/* --------------------------------------------- upcoming */
.upcoming { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s2); }
.up {
  position: relative; border-radius: var(--r-md); padding: var(--s3) var(--s3) var(--s3) 20px; background: var(--card-2);
  display: grid; grid-template-columns: 1fr auto; gap: 2px var(--s3); align-items: center; cursor: pointer; min-height: 64px;
  transition: background var(--d-fast) linear, transform var(--d-fast) var(--ease);
}
.up::before { content: ""; position: absolute; left: 8px; top: 12px; bottom: 12px; width: 4px; border-radius: 2px; background: var(--c); }
.up:hover { background: var(--fill-3); }
.up:active { transform: scale(.985); }
.up .name { font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -0.026em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up .what { font-size: 13px; line-height: 18px; color: var(--label-2); grid-column: 1; display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.up .dday {
  grid-row: 1 / span 2; grid-column: 2; text-align: right;
  font-family: var(--font-display); font-size: 22px; line-height: 26px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
}
.up .dday.soon { color: var(--exam-ink); }
.up .dday small { display: block; font-family: var(--font); font-size: 12px; line-height: 16px; font-weight: 400; color: var(--label-2); letter-spacing: 0; }
.badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; white-space: nowrap;
  font-size: 12px; font-weight: 600; letter-spacing: 0;
  color: var(--k-ink); background: color-mix(in srgb, var(--k) 15%, transparent);
}
.badge.apply, .apply { --k: var(--apply); --k-ink: var(--apply-ink); }
.badge.exam, .exam { --k: var(--exam); --k-ink: var(--exam-ink); }
.badge.result, .result { --k: var(--result); --k-ink: var(--result-ink); }
.badge.live { --k: var(--live); --k-ink: var(--live-ink); }

/* --------------------------------------------- calendar */
.cal-card { padding: var(--s4) var(--s4) var(--s3); }
.cal-head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); flex-wrap: wrap; }
.cal-head h2 { margin: 0 0 0 var(--s1); font-family: var(--font-display); font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: .013em; font-variant-numeric: tabular-nums; }
.cal-nav { display: flex; align-items: center; gap: var(--s2); margin-left: auto; }
.legend { display: flex; gap: var(--s3); font-size: 13px; color: var(--label-2); }
.lg { display: inline-flex; align-items: center; gap: 5px; }
.lg::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--k); }

.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.dow { font-size: 12px; line-height: 16px; text-align: center; padding: 0 0 var(--s2); color: var(--label-2); font-weight: 600; }
.dow.sun { color: var(--exam-ink); }
.dow.sat { color: var(--apply-ink); }
.day {
  min-height: 108px; border-top: .5px solid var(--sep); padding: 4px 3px 6px; overflow: hidden; cursor: pointer;
  transition: background var(--d-fast) linear;
}
.day:hover { background: var(--fill-4); }
.day:focus-visible { outline-offset: -3px; }
.num {
  width: 28px; height: 28px; margin: 0 auto 2px; border-radius: 50%; display: grid; place-items: center;
  font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
  transition: background var(--d-fast) linear, color var(--d-fast) linear;
}
.day.sun .num { color: var(--exam-ink); }
.day.sat .num { color: var(--apply-ink); }
.day.other .num { color: var(--label-3); }
.day.is-today .num { background: var(--exam); color: #fff; font-weight: 700; }
.day.selected .num { background: var(--label); color: var(--card); font-weight: 700; }
.day.selected.is-today .num { background: var(--exam); color: #fff; }
.day.selected { background: var(--fill-4); }
.ev {
  display: block; font-size: 11px; line-height: 15px; margin-top: 2px; padding: 1px 4px 1px 6px; border-radius: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; letter-spacing: 0;
  background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--label);
}
.ev::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); }
.ev.mid { opacity: .45; }
.ev b { font-weight: 700; color: var(--k-ink); }
.ev-more { display: block; font-size: 11px; line-height: 15px; color: var(--label-2); margin-top: 2px; padding-left: 4px; font-weight: 500; }
.cnt { display: flex; align-items: center; gap: 4px; font-size: 11px; line-height: 15px; margin-top: 3px; white-space: nowrap; padding-left: 2px; font-variant-numeric: tabular-nums; color: var(--label-2); }
.cnt i { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--k); }

.day-detail { margin-top: var(--s3); border-top: .5px solid var(--sep); padding-top: var(--s4); animation: fade-up var(--d) var(--ease-out); }
.day-detail h3 { font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -0.026em; margin: 0 0 var(--s2); }
.day-detail ul { margin: 0; padding: 0; list-style: none; }
.day-detail li { font-size: 15px; line-height: 22px; padding: 10px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.day-detail li + li { border-top: .5px solid var(--sep); }
.day-detail .names { color: var(--label-2); font-size: 13px; line-height: 20px; flex-basis: 100%; }
.linkish { border: 0; background: none; padding: 0; color: var(--accent-ink); cursor: pointer; font-size: inherit; }
.linkish:hover { text-decoration: underline; text-underline-offset: 2px; }

/* --------------------------------------------- tables */
.cert-block { margin-bottom: var(--s3); }
.cert-block h3 {
  font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -0.026em; margin: 0 0 var(--s3);
  display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap;
}
.cert-block h3 .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.org { font-size: 13px; font-weight: 400; color: var(--label-2); letter-spacing: -0.006em; }
a.ext { font-size: 13px; font-weight: 500; color: var(--accent-ink); display: inline-flex; align-items: center; gap: 2px; letter-spacing: -0.006em; }
a.ext .i { font-size: 11px; stroke-width: 2.4; }
.cert-block h3 a.ext { margin-left: auto; }
.tw { overflow-x: auto; margin: 0 calc(-1 * var(--s4)); padding: 0 var(--s4); }
table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 20px; font-variant-numeric: tabular-nums; letter-spacing: -0.016em; }
th, td { padding: 10px 12px 10px 0; text-align: left; white-space: nowrap; }
td { border-top: .5px solid var(--sep); }
th { color: var(--label-2); font-weight: 500; font-size: 13px; line-height: 18px; padding-top: 0; }
tr.past td { color: var(--label-2); }
tr.next td { background: color-mix(in srgb, var(--accent) 10%, transparent); font-weight: 500; }
tr.next td:first-child { box-shadow: inset 3px 0 0 var(--accent); padding-left: 10px; }
tr td:first-child, tr th:first-child { padding-left: 0; }

/* --------------------------------------------- sheet (dialog) */
.sheet {
  border: .5px solid var(--glass-border); border-radius: var(--r-xl); padding: var(--s6); color: var(--label);
  background: var(--card);
  width: min(760px, calc(100vw - 32px)); max-height: min(86vh, 900px); box-shadow: var(--shadow-pop);
  overscroll-behavior: contain;
}
.sheet[open] { animation: sheet-in var(--d-slow) var(--ease); }
.sheet::backdrop { background: var(--dim); animation: fade-in var(--d) linear; }
.grabber { display: none; }
.sheet .close {
  position: absolute; right: 14px; top: 14px; border: 0; cursor: pointer;
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--fill-3); color: var(--label-2); font-size: 14px;
}
.sheet .close::after { content: ""; position: absolute; inset: -7px; }
.sheet .close:hover { background: var(--fill-2); color: var(--label); }
.sheet .close .i { stroke-width: 2.8; }
.sheet .head { display: flex; align-items: center; gap: var(--s1); margin: -6px 40px var(--s1) -10px; }
.sheet h2 { font-family: var(--font-display); font-size: 28px; line-height: 34px; font-weight: 700; margin: 0; letter-spacing: .013em; }
.sheet .meta { color: var(--label-2); font-size: 15px; line-height: 20px; margin-bottom: var(--s5); display: flex; gap: var(--s2) var(--s4); flex-wrap: wrap; align-items: center; }
.sheet .meta a.ext { font-size: 15px; }
.sheet .tw { margin: 0 calc(-1 * var(--s6)); padding: 0 var(--s6); }

/* --------------------------------------------- status */
.status { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 var(--s6); font-size: 15px; }
.status li { display: flex; gap: var(--s2); align-items: center; min-height: var(--tap); border-bottom: .5px solid var(--sep); }
.status .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.status .dot.ok { background: var(--result); }
.status .dot.bad { background: var(--live); }
.status a.ext { font-size: 15px; font-weight: 400; }
.status small { color: var(--label-2); font-size: 13px; margin-left: auto; text-align: right; }
.status small.bad { color: var(--live-ink); }

/* --------------------------------------------- settings backup */
.backup { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.backup p { margin: 0; flex: 1 1 320px; color: var(--label-2); font-size: 15px; line-height: 20px; }
.backup-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.empty-foot { margin: var(--s5) 0 0 !important; font-size: 13px !important; }
.footer-group { margin-bottom: var(--s6); }

/* --------------------------------------------- tooltip & toast (glass) */
.tip {
  position: fixed; z-index: 50; max-width: 300px; color: #fff;
  background: var(--glass-dark); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  font-size: 13px; line-height: 18px; padding: 8px 12px; border-radius: 10px; pointer-events: none; white-space: pre-line;
  box-shadow: var(--shadow-pop);
}
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--s2);
  background: var(--glass-pop); color: var(--label);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: .5px solid var(--glass-border);
  padding: 12px 20px; border-radius: var(--r-pill); font-size: 15px; font-weight: 600; letter-spacing: -0.016em;
  box-shadow: var(--shadow-pop);
  animation: toast-in var(--d-slow) var(--spring);
}
.toast .i { color: var(--star); font-size: 17px; }
.toast .i.ok { color: var(--result); }
.toast .i.warn { color: var(--live); }

/* --------------------------------------------- motion */
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 16px) scale(.92); } }
@keyframes bump { 40% { transform: scale(1.3); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; scroll-behavior: auto !important; }
  .toast, .sheet[open], .results, .day-detail { animation: fade-in 160ms linear !important; }
}

/* --------------------------------------------- compact width (iPhone class) */
@media (max-width: 640px) {
  body { font-size: 17px; }
  .top h1 { font-size: 30px; line-height: 36px; }
  .toolbar { margin-top: var(--s1); }
  .segmented { width: 100%; min-width: 0; }
  .bar-actions { width: 100%; }
  .bar-actions .btn { flex: 1; min-height: var(--tap); }
  .group { margin-bottom: var(--s6); }
  .card { padding: var(--s3); }
  .cal-card { padding: var(--s3) var(--s2) var(--s2); }
  .cal-head h2 { font-size: 22px; line-height: 28px; }
  .legend { order: 5; width: 100%; padding-left: var(--s1); }
  .day { min-height: 64px; padding: 3px 1px 4px; }
  .num { width: 26px; height: 26px; font-size: 14px; }
  .ev { font-size: 0; height: 4px; padding: 0; margin: 2px 3px 0; border-radius: 2px; background: var(--c); }
  .ev::before { display: none; }
  .ev-more { font-size: 10px; text-align: center; padding: 0; }
  .cnt { font-size: 10px; gap: 2px; justify-content: center; padding: 0; }
  .cnt span { display: none; }
  .upcoming { grid-template-columns: 1fr; }
  .tw { margin: 0 calc(-1 * var(--s3)); padding: 0 var(--s3); }
  .status small { display: none; }

  /* 시트: 하단에서 올라오는 바텀 시트 */
  .sheet {
    width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding: var(--s5) var(--s4) calc(var(--s6) + env(safe-area-inset-bottom)); max-height: 90vh; border-bottom: 0;
  }
  .sheet[open] { animation: sheet-up var(--d-slow) var(--ease); }
  .grabber { display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--fill); margin: -12px auto 10px; }
  .sheet h2 { font-size: 22px; line-height: 28px; }
  .sheet .tw { margin: 0 calc(-1 * var(--s4)); padding: 0 var(--s4); }
}

/* --------------------------------------------- 캘린더로 보내기 안내 시트 */
.segmented.three { grid-template-columns: repeat(3, 1fr); width: 100%; min-width: 0; margin: var(--s4) 0 var(--s2); }
.segmented.three::before { width: calc((100% - 4px) / 3); }
.segmented[data-i="2"]::before { transform: translateX(200%); }
.segmented.three button { padding: 0 var(--s2); font-size: 14px; }
.guide { width: min(620px, calc(100vw - 32px)); }
.guide .head { margin-left: 0; }
.guide .lead { margin: var(--s2) 0 0; color: var(--label-2); font-size: 15px; line-height: 21px; }
.method { margin-top: var(--s5); padding: var(--s4); background: var(--card-2); border-radius: var(--r-lg); }
.method h3 { margin: 0 0 var(--s1); font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -0.026em; display: flex; align-items: center; gap: var(--s2); }
.method .tag { font-size: 12px; font-weight: 600; letter-spacing: 0; padding: 2px 8px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--result) 18%, transparent); color: var(--result-ink); }
.method .desc { margin: 0 0 var(--s3); color: var(--label-2); font-size: 15px; line-height: 20px; }
.steps { margin: 0 0 var(--s3); padding: 0; list-style: none; counter-reset: st; display: grid; gap: var(--s2); }
.steps li { counter-increment: st; position: relative; padding-left: 30px; font-size: 15px; line-height: 21px; }
.steps li::before {
  content: counter(st); position: absolute; left: 0; top: 0; width: 21px; height: 21px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--accent); color: var(--on-accent);
}
.steps b { font-weight: 600; }
.subs { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--r-md); }
.subs li { display: flex; align-items: center; gap: var(--s2); padding: 6px 8px 6px 12px; min-height: var(--tap); }
.subs li + li { border-top: .5px solid var(--sep); }
.subs .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.subs .nm { flex: 1; min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subs a.btn { text-decoration: none; }
.btn.wide { width: 100%; min-height: var(--tap); }
.guide .fine { margin: var(--s4) var(--s1) 0; color: var(--label-2); font-size: 13px; line-height: 18px; }
.sheet .meta button.ext { font-size: 15px; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; gap: 2px; }
@media (max-width: 640px) {
  .guide { width: 100vw; }
  .method { padding: var(--s3); }
}
