/* Devuff Challenge — same grays, type and accent as devuff. No outlines, no glow:
   depth comes from one surface step, focus from background + caret. 4px grid. */
:root {
  color-scheme: dark;
  --bg: #0d0d0d;
  --bg-2: #080808;
  --surface: #151515;
  --surface-2: #1c1c1c;
  --surface-3: #242424;
  --ink: #ececea;
  --ink-2: #c9c9c6;
  --muted: #9a9a95;
  --muted-2: #6f6f6a;
  --hover: rgba(255, 255, 255, .05);
  --grid: rgba(255, 255, 255, .07);
  --accent: #6aa6ff;
  --action: #ffffff;
  --action-ink: #111111;
  --action-hover: #e2e2e2;
  --green: #3ddc84; --yellow: #ffcc4d; --red: #ff5c6c;
  --green-soft: rgba(61, 220, 132, .14); --red-soft: rgba(255, 92, 108, .14); --yellow-soft: rgba(255, 204, 77, .14);
  --scrim: rgba(0, 0, 0, .55);
  --shadow-menu: 0 12px 32px rgba(0, 0, 0, .45);
  --hero-from: #ffffff; --hero-to: #7fb2ff;
  --mc: #efeaff; --mc-ink: #2a2440;

  --font: "IBM Plex Sans KR", "IBM Plex Sans", Pretendard, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --r-sm: 8px; --r-md: 12px; --r-lg: 20px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.25, 1.04, .5, 1);
  --m: 300ms;
  --head: 64px;
  --gut: 16px;
}
@media (min-width: 800px) { :root { --gut: 32px; } }

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ececea; --bg-2: #e2e2df;
  --surface: #f8f8f7; --surface-2: #e4e4e1; --surface-3: #d9d9d5;
  --ink: #26251e; --ink-2: #44433c; --muted: #5a5850; --muted-2: #8b8a84;
  --hover: rgba(38, 37, 30, .05); --grid: rgba(38, 37, 30, .1);
  --accent: #2456d6;
  --action: #26251e; --action-ink: #ffffff; --action-hover: #3d3c34;
  --green: #1f9d57; --yellow: #b07c00; --red: #d93a4a;
  --green-soft: rgba(31, 157, 87, .12); --red-soft: rgba(217, 58, 74, .12); --yellow-soft: rgba(176, 124, 0, .12);
  --scrim: rgba(38, 37, 30, .35);
  --shadow-menu: 0 12px 32px rgba(38, 37, 30, .14);
  --hero-from: #26251e; --hero-to: #2f6fe0;
  --mc: #2a2440; --mc-ink: #efeaff;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { scrollbar-gutter: stable; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
code, pre, kbd { font-family: var(--mono); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
input:focus-visible, textarea:focus-visible { outline: none; }
::selection { background: rgba(106, 166, 255, .32); }
.ph-duotone { font-size: 1.15em; line-height: 1; vertical-align: -0.15em; }

/* ---- buttons ---------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: var(--r-sm);
  font-weight: 600; font-size: 14px; white-space: nowrap; background: var(--surface-2); color: var(--ink);
  transition: background var(--m) var(--ease), transform 120ms var(--ease), color var(--m) var(--ease), opacity var(--m) var(--ease); }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--action); color: var(--action-ink); }
.btn--primary:hover { background: var(--action-hover); }
.btn--ghost { background: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--hover); color: var(--ink); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn--icon { width: 36px; padding: 0; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ---- segmented control with a sliding pill ----------------------------------- */
.seg { position: relative; display: inline-flex; gap: 2px; padding: 4px; border-radius: 12px; background: var(--surface); }
.seg__pill { position: absolute; top: 4px; left: 0; height: calc(100% - 8px); border-radius: 8px; background: var(--surface-3);
  transition: transform var(--m) var(--spring), width var(--m) var(--spring), opacity 150ms; pointer-events: none; }
.seg__item { position: relative; z-index: 1; height: 32px; padding: 0 14px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px; transition: color var(--m) var(--ease); }
.seg__item:hover { color: var(--ink-2); }
.seg__item.is-active { color: var(--ink); }
.seg__count { font-size: 12px; color: var(--muted-2); font-variant-numeric: tabular-nums; }

/* ---- header ------------------------------------------------------------------ */
.site-header { position: sticky; top: 0; z-index: 20; height: var(--head); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.site-header__inner { height: 100%; display: flex; align-items: center; gap: 24px; padding: 0 var(--gut); }
.site-header__logo { display: flex; align-items: center; gap: 8px; color: var(--ink); flex: none; }
.site-header__logo svg { height: 22px; width: auto; display: block; }
.site-header__me { display: flex; align-items: center; }
.site-header__nav { background: transparent; padding: 0; }
.site-header__nav .seg__pill { top: 0; height: 100%; background: var(--surface-2); }
.site-header__nav .seg__item { height: 36px; }
.site-header__end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.me-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 6px; border-radius: 18px; background: var(--surface); font-size: 14px; font-weight: 500; transition: background var(--m) var(--ease); }
.me-chip:hover { background: var(--surface-2); }
.me-chip.is-active { background: var(--surface-2); }
@media (max-width: 799px) {
  /* backdrop-filter would make the header the containing block of the fixed tab bar */
  .site-header { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  .site-header__inner { gap: 12px; }
  .site-header__logo svg { height: 18px; }
  .site-header__nav { position: fixed; left: 0; right: 0; bottom: 0; justify-content: space-around; height: 60px; padding: 8px; border-radius: 0;
    background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
  .site-header__nav .seg__item { padding: 0 10px; font-size: 13px; }
  .me-chip__name { display: none; }
  body { padding-bottom: 60px; }
}

/* ---- level icon & grade badge -------------------------------------------------- */
.lv { --size: 36px; position: relative; width: var(--size); height: var(--size); flex: none; display: inline-grid; place-items: center; color: #0b0b0b; line-height: 1; font-variant-numeric: tabular-nums; user-select: none; }
.lv__shape { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.lv__shape path { fill: var(--c); stroke: var(--c); stroke-width: 3.5; stroke-linejoin: round; }
.lv__label { position: relative; display: grid; justify-items: center; }
.lv__fam { font-size: calc(var(--size) * .2); font-weight: 600; opacity: .7; margin-bottom: 1px; }
.lv__num { font-size: calc(var(--size) * .34); font-weight: 700; letter-spacing: -0.04em; }
.lv--J .lv__num { font-size: calc(var(--size) * .3); }
.lv--MC { color: var(--mc-ink); }
.lv--MC .lv__shape path { fill: var(--mc); stroke: var(--mc); }
.lv--MC .lv__num { font-size: calc(var(--size) * .26); }
.lv--sm { --size: 24px; }
.lv--sm .lv__fam { display: none; }
.lv--sm .lv__num { font-size: 10px; }
.lv--sm.lv--MC .lv__num { font-size: 8px; }
.lv--lg { --size: 56px; }
.lv-text { font-weight: 600; color: var(--c); }
.lv-text--MC { color: var(--ink); }

.grade { --size: 24px; width: var(--size); height: var(--size); border-radius: calc(var(--size) * .3); flex: none; display: inline-grid; place-items: center;
  background: var(--c); color: #111; font-weight: 700; font-size: calc(var(--size) * .55); line-height: 1; }
.grade--Unknown { background: var(--surface-3); color: var(--muted); }
.grade--xl { --size: 88px; border-radius: 26px; }
.grade--xl.grade--Unknown { font-size: 44px; }

/* ---- pages -------------------------------------------------------------------- */
.page { max-width: 1120px; margin: 0 auto; padding: 32px var(--gut) 96px; }
.page__head { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.page__title { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; margin: 0; margin-right: auto; }
.search { position: relative; }
.search input { width: 220px; height: 40px; padding: 0 12px 0 36px; border-radius: 12px; border: 0; background: var(--surface); caret-color: var(--accent); transition: background var(--m) var(--ease), width var(--m) var(--spring); }
.search input:focus { background: var(--surface-2); width: 260px; }
.search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.empty { padding: 64px 0; text-align: center; color: var(--muted); }

/* ---- home --------------------------------------------------------------------- */
.hero { padding: 72px 0 40px; }
.hero__title { margin: 0; font-size: clamp(34px, 5.6vw, 64px); line-height: 1.16; font-weight: 700; letter-spacing: -0.045em; word-break: keep-all;
  background: linear-gradient(180deg, var(--hero-from) 46%, var(--hero-to) 125%); -webkit-background-clip: text; background-clip: text; color: transparent; }

.chart { position: relative; padding: 24px 24px 16px 8px; border-radius: var(--r-lg); background: var(--surface); }
.chart__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 0 0 20px 16px; }
.chart__label { font-size: 15px; font-weight: 600; }
.chart__sum { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart__plot { position: relative; display: grid; grid-template-columns: 44px 1fr; height: 300px; }
.chart__y { position: relative; }
.chart__y span { position: absolute; right: 10px; transform: translateY(50%); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart__area { position: relative; }
.chart__grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--grid); }
.chart__grid--base { border-top-style: solid; border-top-color: var(--muted-2); }
.chart__bars { position: absolute; inset: 0; display: flex; align-items: flex-end; }
.chart__col { flex: 1; height: 100%; display: flex; align-items: flex-end; padding: 0 1px; cursor: pointer; }
.chart__bar { width: 100%; background: var(--c); border-radius: 3px 3px 0 0;
  transition: opacity 200ms var(--ease), filter 200ms var(--ease); }
.chart__col--MC .chart__bar { background: var(--mc); }
.chart__bars.is-hover .chart__col:not(.is-hover) .chart__bar { opacity: .38; }
.chart__x { display: grid; grid-template-columns: 44px 1fr; margin-top: 8px; }
.chart__xl { display: flex; }
.chart__xl span { flex: 1; text-align: center; font-size: 12px; color: var(--muted); font-weight: 500; transition: color 200ms; }
.chart__xl span.is-hover { color: var(--ink); }
.chart__tip { position: absolute; z-index: 3; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; pointer-events: none;
  background: color-mix(in srgb, var(--bg-2) 86%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow-menu);
  opacity: 0; filter: blur(6px); transition: opacity 180ms var(--ease), filter 180ms var(--ease), left 300ms var(--spring), top 300ms var(--spring); white-space: nowrap; }
.chart__tip.is-on { opacity: 1; filter: none; }
.chart__tip-side { display: grid; justify-items: center; gap: 6px; }
.chart__tip-lines { font-size: 14px; color: var(--ink-2); line-height: 1.6; font-variant-numeric: tabular-nums; }
.chart__tip-lines b { color: var(--ink); font-weight: 600; }
@media (max-width: 700px) {
  .chart { padding: 16px 8px 12px 0; }
  .chart__plot { height: 220px; grid-template-columns: 32px 1fr; }
  .chart__x { grid-template-columns: 32px 1fr; }
  .chart__xl span { font-size: 9px; }
  .chart__y span { font-size: 10px; right: 6px; }
  .hero { padding: 40px 0 28px; }
}

/* ---- problem list -------------------------------------------------------------- */
.plist { list-style: none; margin: 0; padding: 0; }
.plist__head, .prow { display: grid; grid-template-columns: 44px minmax(0, 1fr) 88px 104px; align-items: center; gap: 16px; padding: 0 16px; }
.plist__head { height: 36px; font-size: 12px; color: var(--muted-2); font-weight: 500; }
.plist__head span:nth-child(3), .plist__head span:nth-child(4) { text-align: right; }
.prow { min-height: 68px; border-radius: 14px; transition: background var(--m) var(--ease), transform 120ms var(--ease); }
.prow:hover { background: var(--surface); }
.prow:active { transform: scale(.995); }
.prow__main { min-width: 0; }
.prow__title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.prow__title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow__title .ph-duotone { color: var(--green); flex: none; }
.prow__title .is-tried { color: var(--yellow); }
.prow__sub { font-size: 13px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; align-items: center; }
.prow__solves, .prow__date { text-align: right; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.prow__solves i { color: var(--muted); margin-right: 4px; }
.prow__date { color: var(--muted); }
.level-group { margin: 28px 0 8px 16px; display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
@media (max-width: 640px) {
  .plist__head { display: none; }
  .prow { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; padding: 0 8px; }
  .prow__date { display: none; }
  .prow .lv { --size: 32px; }
}

/* ---- rank ------------------------------------------------------------------------- */
.rrow { display: grid; grid-template-columns: 40px 32px minmax(0, 1fr) 40px 72px 80px; align-items: center; gap: 16px; min-height: 60px; padding: 0 16px; border-radius: 14px; transition: background var(--m) var(--ease); }
.rrow:hover { background: var(--surface); }
.rrow.is-me { background: var(--surface); }
.rrow__n { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.rrow__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow__num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 14px; }
.rrow--head { min-height: 32px; font-size: 12px; color: var(--muted-2); }
.rrow--head:hover { background: none; }
.rrow--head .rrow__num { color: inherit; }
@media (max-width: 640px) { .rrow { grid-template-columns: 28px 28px minmax(0, 1fr) 32px 64px; gap: 10px; padding: 0 8px; } .rrow > :nth-child(5) { display: none; } }

/* ---- profile ------------------------------------------------------------------------ */
.prof { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; padding: 24px 0 36px; }
.prof__name { display: flex; align-items: center; gap: 8px; }
.prof__name h1 { margin: 0; font-size: 32px; letter-spacing: -0.035em; }
.prof__name input { font-size: 32px; font-weight: 700; letter-spacing: -0.035em; width: min(360px, 60vw); height: 48px; padding: 0 12px; margin-left: -12px; border: 0; border-radius: 12px; background: var(--surface-2); caret-color: var(--accent); }
.prof__grade-name { color: var(--muted); font-size: 15px; margin-top: 4px; }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 32px; }
.stat { padding: 18px 20px; border-radius: 16px; background: var(--surface); }
.stat__k { font-size: 13px; color: var(--muted); }
.stat__v { margin-top: 6px; font-size: 24px; font-weight: 700; letter-spacing: -0.03em; display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
@media (max-width: 800px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .prof { grid-template-columns: 1fr; gap: 16px; } }
.next { padding: 20px 24px; border-radius: 16px; background: var(--surface); margin-bottom: 40px; }
.next__title { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 14px; }
.next__items { display: flex; flex-wrap: wrap; gap: 8px; }
.need { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 10px; background: var(--surface-2); font-size: 14px; color: var(--ink-2); }
.need.is-ok { background: var(--green-soft); color: var(--green); }
.need small { color: var(--muted); font-variant-numeric: tabular-nums; }
.section-title { font-size: 18px; font-weight: 700; margin: 0 0 12px; letter-spacing: -0.02em; }
.crow { grid-template-columns: 44px minmax(0, 1fr) 88px 120px; }

/* ---- toast ---------------------------------------------------------------------------- */
.toasts { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 500; color: var(--ink);
  background: color-mix(in srgb, var(--surface-3) 82%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: var(--shadow-menu);
  animation: toast-in 380ms var(--spring) backwards; }
.toast.is-out { animation: toast-out 260ms var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); filter: blur(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); filter: blur(8px); } }

.loader { display: grid; place-items: center; min-height: 50vh; }
.logo-loader { width: 40px; height: 54px; overflow: visible; }
.logo-loader path { fill: none; stroke-width: 12; stroke-linejoin: round; stroke-linecap: round; }
.logo-loader__base { stroke: var(--surface-3); }
.logo-loader__run { stroke: url(#ll-grad); stroke-dasharray: 34 66; animation: ll-run 1.3s linear infinite; }
.logo-loader__run--b { animation-delay: -.65s; }
@keyframes ll-run { to { stroke-dashoffset: -100; } }
.loader--inline { min-height: 0; padding: 32px 0; }

/* ---- markdown --------------------------------------------------------------------------- */
.md { font-size: 15.5px; line-height: 1.75; color: var(--ink-2); word-break: keep-all; overflow-wrap: anywhere; }
.md p { margin: 0 0 14px; }
.md ul, .md ol { margin: 0 0 14px; padding-left: 22px; }
.md code { font-size: .88em; padding: 2px 6px; border-radius: 6px; background: var(--surface-3); color: var(--ink); }
.md pre { margin: 0 0 14px; padding: 14px 16px; border-radius: 12px; background: var(--bg-2); overflow: auto; font-size: 13px; line-height: 1.6; color: var(--ink); }
.md pre code { padding: 0; background: none; font-size: inherit; }
.md strong { color: var(--ink); }

/* ---- dialog (fades with blur, no scaling) --------------------------------------------- */
.dialog-wrap { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: var(--scrim); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade-in 220ms var(--ease) backwards; }
.dialog-wrap.is-out { animation: fade-out 200ms var(--ease) forwards; }
.dialog { width: min(400px, 100%); padding: 20px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-menu); display: grid; gap: 8px; animation: blur-in 260ms var(--ease) backwards; }
.dialog__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dialog__title { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.dialog__dev { display: flex; gap: 8px; margin-top: 8px; }
.dialog__dev input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.login-btn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 48px; border-radius: 12px; font-weight: 600; font-size: 15px; transition: filter var(--m) var(--ease), transform 120ms var(--ease); }
.login-btn:hover { filter: brightness(1.08); }
.login-btn:active { transform: scale(.98); }
.login-btn--discord { background: #5865f2; color: #fff; }
.login-btn--github { background: var(--action); color: var(--action-ink); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes blur-in { from { opacity: 0; filter: blur(8px); transform: translateY(8px); } }
.avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-3); }

/* ---- home dashboard ------------------------------------------------------------------------ */
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.card { padding: 22px 24px; border-radius: var(--r-lg); background: var(--surface); min-width: 0; }
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card__title { font-size: 15px; font-weight: 600; }
.card__more { font-size: 13px; color: var(--muted); transition: color var(--m) var(--ease); }
.card__more:hover { color: var(--ink); }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
@media (max-width: 900px) { .dash > * { grid-column: span 12; } .dash > .span-3 { grid-column: span 6; } }
.big { font-size: 40px; font-weight: 700; letter-spacing: -0.04em; line-height: 1.1; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 10px; }
.big small { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.spark { display: block; width: 100%; height: 120px; margin-top: 14px; }
.spark__area { fill: color-mix(in srgb, var(--accent) 18%, transparent); }
.spark__line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark__gap { fill: var(--surface-2); }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted-2); margin-top: 6px; font-variant-numeric: tabular-nums; }
.days { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 3px; height: 44px; margin-top: 18px; }
.days span { border-radius: 3px; background: var(--c); }
.uptime-row { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 14px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.uptime-row b { color: var(--ink); font-weight: 600; }
.mini-rank { display: grid; }
.mini-rank a { display: grid; grid-template-columns: 24px 24px minmax(0, 1fr) 28px 64px; align-items: center; gap: 12px; height: 44px; padding: 0 8px; margin: 0 -8px; border-radius: 10px; transition: background var(--m) var(--ease); font-size: 14px; }
.mini-rank a:hover { background: var(--surface-2); }
.mini-rank__n { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.mini-rank__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-rank__r { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.feed a { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 52px; padding: 6px 8px; margin: 0 -8px; border-radius: 10px; transition: background var(--m) var(--ease); }
.feed a:hover { background: var(--surface-2); }
.feed__t { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed__s { font-size: 12px; color: var(--muted); }
.feed__time { font: 500 13px var(--mono); color: var(--ink-2); }
.bars { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); align-items: end; gap: 8px; height: 140px; }
.bars__col { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.bars__col span { width: 40%; max-width: 18px; border-radius: 3px 3px 0 0; background: var(--surface-3); min-height: 2px; }
.bars__col span.is-pass { background: var(--green); }
.bars__x { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 8px; margin-top: 8px; font-size: 11px; color: var(--muted-2); text-align: center; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--c); vertical-align: 0; }
.tile__k { font-size: 13px; color: var(--muted); }
.tile__v { margin-top: 4px; font-size: 28px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* ---- footer ----------------------------------------------------------------------------------- */
.site-footer { flex: none; padding: 40px 0 48px; background: var(--bg-2); }
.site-footer__inner { max-width: 1120px; margin: 0 auto; padding: 0 var(--gut); display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.site-footer__brand svg { height: 20px; width: auto; display: block; color: var(--ink); }
.site-footer__copy { margin-top: 14px; font-size: 13px; color: var(--muted-2); }
.site-footer h3 { margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer a { font-size: 14px; color: var(--ink-2); transition: color var(--m) var(--ease); }
.site-footer a:hover { color: var(--ink); }
.site-footer__status { display: grid; gap: 8px; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.site-footer__status span { display: flex; align-items: center; gap: 8px; }
@media (max-width: 800px) { .site-footer__inner { grid-template-columns: 1fr 1fr; } .site-footer__inner > :first-child { grid-column: 1 / -1; } }

/* ---- locked problems ------------------------------------------------------------------------- */
.prow.is-locked { opacity: .45; }
.prow.is-locked:hover { opacity: .6; }
.prow__lock { color: var(--muted); }

/* ---- forms (create / review) ---------------------------------------------------------------- */
.form { display: grid; gap: 18px; max-width: 760px; }
.form__row { display: grid; gap: 8px; }
.form__row--2 { grid-template-columns: 1fr 1fr; gap: 12px; }
.form label, .form__label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input { width: 100%; height: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--surface); caret-color: var(--accent); transition: background var(--m) var(--ease); }
.input:focus { background: var(--surface-2); }
textarea.input { height: auto; min-height: 120px; padding: 12px 14px; resize: vertical; line-height: 1.6; }
.input--mono { font-family: var(--mono); font-size: 13.5px; }
.hint { font-size: 12.5px; color: var(--muted-2); }
.choice-row { display: grid; grid-template-columns: 36px 1fr; gap: 8px; align-items: center; }
.radio { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); font-weight: 700; font-size: 13px; color: var(--muted); transition: background var(--m) var(--ease), color var(--m) var(--ease); }
.radio.is-active { background: var(--action); color: var(--action-ink); }
.form__acts { display: flex; gap: 8px; flex-wrap: wrap; }
.err { padding: 12px 14px; border-radius: 12px; background: var(--red-soft); color: var(--red); font-size: 14px; }
.preview { padding: 16px; border-radius: 14px; background: var(--surface); overflow: auto; }
.preview table { border-collapse: collapse; font: 12.5px/1.6 var(--mono); }
.preview td, .preview th { padding: 3px 16px 3px 0; text-align: left; white-space: nowrap; }
.preview th { color: var(--muted); font-weight: 500; }
.status { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); }
.status--approved { background: var(--green-soft); color: var(--green); }
.status--rejected { background: var(--red-soft); color: var(--red); }
.status--pending { background: var(--yellow-soft); color: var(--yellow); }
.review { padding: 22px 24px; border-radius: 20px; background: var(--surface); margin-bottom: 12px; }
.review__head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.review__title { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.review__acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.review__acts select, .review__acts input { height: 36px; border: 0; border-radius: 10px; background: var(--surface-2); padding: 0 12px; }
.review__acts input { flex: 1; min-width: 160px; }
.flag-list { margin: 8px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--yellow); }
.pill-flag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--yellow); }
.lv-pick { display: flex; flex-wrap: wrap; gap: 4px; }
.lv-pick__b { padding: 4px; border-radius: 10px; opacity: .4; transition: opacity var(--m) var(--ease), background var(--m) var(--ease); }
.lv-pick__b:hover { opacity: .8; }
.lv-pick__b.is-active { opacity: 1; background: var(--surface-2); }
.empty p { margin: 0 0 16px; }

/* footer sits at the bottom even on short pages */
#app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
#app > main { flex: 1 0 auto; }
.site-footer[hidden] { display: none; }

/* ---- explainers --------------------------------------------------------------------------- */
.exp { margin-top: 96px; display: grid; gap: 88px; }
.exp__row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 64px; align-items: center; }
.exp__row--flip .exp__art { order: 2; }
.exp__art { min-width: 0; }
.exp__title { margin: 0 0 18px; font-size: clamp(28px, 3.4vw, 40px); line-height: 1.2; font-weight: 700; letter-spacing: -0.04em; word-break: keep-all; }
.exp__em { background: linear-gradient(180deg, var(--hero-from) 40%, var(--hero-to) 118%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.exp__text p { margin: 0 0 14px; font-size: 16px; line-height: 1.75; color: var(--ink-2); word-break: keep-all; }
@media (max-width: 800px) {
  .exp { gap: 56px; margin-top: 64px; }
  .exp__row { grid-template-columns: 1fr; gap: 20px; }
  .exp__row--flip .exp__art { order: 0; }
}

.form__row > .seg { justify-self: start; max-width: 100%; overflow-x: auto; }
.lv-pick .lv { --size: 32px; }
@media (max-width: 799px) { #app { min-height: calc(100dvh - 60px); } }

/* explainer visuals: real components, one surface step up */
.v-panel { padding: 20px; border-radius: 24px; background: var(--surface); display: grid; gap: 8px; font-size: 13.5px; }
.v-bar { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.v-case { display: grid; grid-template-columns: 20px 104px minmax(0, 1fr) auto 44px; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: 10px; background: var(--surface-2); }
.v-case code { font: 12.5px var(--mono); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-case .v-out { color: var(--ink); }
.v-case small { font: 12px var(--mono); color: var(--muted); text-align: right; }
.v-check { display: inline-flex; font-size: 16px; }
.v-check.ok { color: var(--green); } .v-check.bad { color: var(--red); }
.v-verdict { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 14px 16px; border-radius: 12px; background: var(--green-soft); color: var(--green); font-size: 16px; font-weight: 700; }
.v-verdict span { margin-left: auto; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.v-grade { grid-template-columns: auto 1fr; gap: 20px; align-items: center; }
.v-grade__list { display: grid; gap: 6px; }
.v-row { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 10px; background: var(--surface-2); }
.v-row b { font-variant-numeric: tabular-nums; }
.v-fam { display: grid; grid-template-columns: 32px 1fr; align-items: center; gap: 8px; }
.v-fam__k { font-weight: 700; color: var(--muted); font-size: 13px; }
.v-fam__lv { display: flex; gap: 6px; flex-wrap: wrap; }
.v-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.v-replay { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--bg-2); }
.v-play { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--action); color: var(--action-ink); }
.v-time { font: 500 12.5px var(--mono); color: var(--ink-2); }
.v-scrub { position: relative; height: 4px; border-radius: 2px; background: var(--surface-3); }
.v-scrub__fill { position: absolute; inset: 0 58% 0 0; border-radius: 2px; background: var(--ink); }
.v-scrub__m { position: absolute; top: -6px; width: 3px; height: 16px; margin-left: -1.5px; border-radius: 2px; background: var(--c); }
.v-clear { display: grid; grid-template-columns: 24px 1fr auto auto; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: 10px; background: var(--surface-2); font-weight: 600; }
.v-clear code { font: 12.5px var(--mono); color: var(--ink-2); font-weight: 400; }
.v-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.v-sync { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 13px; color: var(--accent); }
@media (max-width: 640px) { .v-case { grid-template-columns: 20px 1fr auto; } .v-case code:not(.v-out) { display: none; } .v-case small { display: none; } .v-grade { grid-template-columns: 1fr; } }

/* ---- error screens ---------------------------------------------------------------------------- */
.err-page { min-height: 60vh; display: grid; place-content: center; justify-items: center; text-align: center; padding: 64px var(--gut); }
.err-page__code { font-size: clamp(72px, 14vw, 140px); font-weight: 700; line-height: 1; letter-spacing: -0.06em; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, var(--hero-from) 40%, var(--hero-to) 118%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.err-page__title { margin: 20px 0 10px; font-size: 24px; font-weight: 700; letter-spacing: -0.03em; }
.err-page__text { margin: 0 0 24px; max-width: 440px; color: var(--ink-2); word-break: keep-all; line-height: 1.7; }
.err-page__acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.prof__acts { display: flex; gap: 8px; margin-top: 12px; }

/* ---- modal ------------------------------------------------------------------------------------- */
.modal { width: min(420px, 100%); padding: 28px 24px 20px; justify-items: center; text-align: center; gap: 0; }
.modal__icon { font-size: 40px; line-height: 1; margin-bottom: 14px; }
.modal__icon--accent { color: var(--accent); } .modal__icon--green { color: var(--green); } .modal__icon--yellow { color: var(--yellow); } .modal__icon--red { color: var(--red); }
.modal__title { margin: 0 0 8px; font-size: 20px; font-weight: 700; letter-spacing: -0.03em; word-break: keep-all; }
.modal__text { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.65; word-break: keep-all; }
.modal__acts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 22px; width: 100%; }
.modal__acts .btn { flex: 1; min-width: 120px; height: 44px; }
.modal__detail { margin-top: 14px; width: 100%; display: grid; gap: 6px; text-align: left; }
.modal__detail div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.modal__detail b { font-variant-numeric: tabular-nums; }
.v-play .ph-duotone, .v-link .ph-duotone, .v-check .ph-duotone, .v-sync .ph-duotone, .v-bar .ph-duotone, .v-verdict .ph-duotone { display: block; vertical-align: 0; }
.v-play { font-size: 15px; }
@media (max-width: 640px) {
  .v-panel { padding: 14px; border-radius: 20px; font-size: 13px; }
  .v-case { padding: 0 10px; gap: 8px; }
  .v-verdict span { display: none; }
  .v-grade__badge { justify-self: center; }
  .v-replay { grid-template-columns: auto 1fr; }
  .v-time { display: none; }
  .v-clear { grid-template-columns: 24px 1fr auto; }
  .v-clear .v-link { display: none; }
  .v-fam__lv .lv { --size: 30px; }
  .exp__title { font-size: 26px; }
}

/* ---- profile header: same structure and measurements as the devuff profile ---------------- */
.dvp { display: flex; flex-direction: column; }
.dvp__banner { position: relative; aspect-ratio: 6 / 1; border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); }
.dvp__banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dvp__banner-ph { position: absolute; inset: 0; background: linear-gradient(135deg, var(--surface-2), var(--surface-3)); }
.dvp__body { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 24px; padding: 0 8px 16px; border-bottom: 1px solid var(--grid); }
.dvp__avatar { position: relative; z-index: 1; width: 96px; height: 96px; margin-top: -48px; flex: none; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--ink-2); font-size: 32px; font-weight: 600; box-shadow: 0 0 0 4px var(--bg); }
.dvp__avatar img { width: 100%; height: 100%; object-fit: cover; }
.dvp__main { flex: 1; min-width: 0; padding-top: 12px; }
.dvp__name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dvp__name h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.03em; }
.dvp__handle { color: var(--muted); }
.dvp__bio { margin: 6px 0 0; max-width: 600px; color: var(--ink-2); }
.dvp__meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--muted-2); }
.dvp__meta > * { display: inline-flex; align-items: center; gap: 4px; }
.dvp__meta a { color: var(--muted); transition: color var(--m) var(--ease); }
.dvp__meta a:hover { color: var(--ink); }
.dvp__skills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.dvp__chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 500; }
.dvp__chip--green { background: var(--green-soft); color: var(--green); }
.dvp__acts { display: flex; gap: 8px; padding-top: 12px; }
.dvp-sec { margin-top: 8px; }
.dvp-sec__head { display: flex; align-items: center; justify-content: space-between; min-height: 32px; margin: 32px 0 12px; }
.dvp-sec__head h3 { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.dvp-sec__head h3 .ph-duotone { color: var(--muted); }
.ch-sum { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; margin-bottom: 24px; }
.ch-sum .stats { margin-bottom: 0; }
@media (max-width: 800px) {
  .dvp__banner { aspect-ratio: 3 / 1; }
  .dvp__body { gap: 12px; }
  .dvp__avatar { width: 80px; height: 80px; margin-top: -40px; }
  .dvp__name h1 { font-size: 24px; }
  .ch-sum { grid-template-columns: 1fr; }
}
/* a play triangle looks left-heavy when centered by its box; nudge it to its optical center */
.ph-duotone.ph-play { transform: translateX(.09em); }
.lv--D .lv__label { transform: translateY(6%); }
/* 35 levels: on phones label every other bar */
@media (max-width: 700px) { .chart__xl span:nth-child(even) { visibility: hidden; } .chart__xl span { font-size: 8px; } }
.chart__xl span { white-space: nowrap; overflow: hidden; }
.v-fam__lv .lv { --size: 30px; }

.modal--image { padding: 0 0 20px; overflow: hidden; }
.modal__image { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; margin-bottom: 20px; }
.modal--image .modal__title { padding: 0 24px; }
.modal--image .modal__acts { padding: 0 24px; margin-top: 18px; }
.svg-ic { display: block; width: 1em; height: 1em; line-height: 0; }
.svg-ic svg { display: block; }
.v-play { font-size: 14px; }
.btn--icon .svg-ic { font-size: 14px; }
