/* =========================================================
   数智学坊 OJ · 本地教学版
   ========================================================= */

:root {
  --bg: #f3f0e8;
  --bg-deep: #eae5d9;
  --paper: #fffdf8;
  --white: #ffffff;
  --ink: #122a30;
  --ink-2: #244249;
  --ink-3: #3b5a60;
  --muted: #687d81;
  --muted-2: #8b9b9e;
  --line: #dbe4df;
  --line-strong: #c5d3cd;
  --teal: #0e7c6b;
  --teal-dark: #075e52;
  --teal-bright: #1ba58d;
  --mint: #e1f2ea;
  --mint-2: #c6e8db;
  --amber: #d98c2b;
  --amber-soft: #fbefd9;
  --coral: #d35f4b;
  --coral-soft: #f9e4de;
  --blue: #346b9c;
  --blue-soft: #e5eef6;
  --violet: #6c5a8e;
  --violet-soft: #ece8f4;
  --slate-soft: #e8edef;
  --code: #0d2025;
  --code-2: #132b31;
  --code-line: #244047;
  --shadow-xs: 0 1px 2px rgba(18, 42, 48, .05);
  --shadow-sm: 0 8px 24px rgba(18, 42, 48, .07);
  --shadow-md: 0 20px 50px rgba(18, 42, 48, .11);
  --shadow-lg: 0 34px 80px rgba(18, 42, 48, .16);
  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "Cascadia Code", "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --topbar-h: 66px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 4%, rgba(225, 242, 234, .75), transparent 30rem),
    radial-gradient(circle at 95% 2%, rgba(251, 239, 217, .8), transparent 26rem),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding-left: 1.2em; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
svg { fill: none; }
[hidden] { display: none !important; }
::selection { background: var(--mint-2); color: var(--ink); }
:focus-visible { outline: 3px solid rgba(14, 124, 107, .3); outline-offset: 2px; border-radius: 5px; }

/* ---------- Shared ---------- */

.hidden { display: none !important; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--teal-dark);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 20px; height: 1.5px; background: currentColor; opacity: .65; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 17px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 680;
  line-height: 1.2;
  white-space: nowrap;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease, color .16s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--ink); color: #f8f5ed; box-shadow: 0 8px 18px rgba(18, 42, 48, .17); }
.btn-primary:hover { background: var(--teal-dark); }
.btn-teal { background: var(--teal); color: #fff; box-shadow: 0 8px 18px rgba(14, 124, 107, .2); }
.btn-teal:hover { background: var(--teal-dark); }
.btn-secondary { background: var(--paper); border-color: var(--line-strong); color: var(--ink-2); }
.btn-secondary:hover { border-color: var(--teal); color: var(--teal-dark); background: var(--white); }
.btn-ghost { background: transparent; color: var(--ink-3); }
.btn-ghost:hover { background: rgba(255, 255, 255, .7); }
.btn-danger { background: var(--coral-soft); border-color: #f0c8bf; color: #a44231; }
.btn-danger:hover { background: var(--coral); color: #fff; }
.btn-sm { min-height: 34px; padding: 6px 11px; font-size: 11.5px; border-radius: 8px; }
.btn-xs { min-height: 28px; padding: 4px 8px; font-size: 10.5px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn .spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-secondary .spinner { border-color: rgba(14,124,107,.2); border-top-color: var(--teal); }

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-3);
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.icon-btn:hover { background: var(--white); border-color: var(--line); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal-dark);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; }
.badge.amber { background: var(--amber-soft); color: #8c5914; }
.badge.coral { background: var(--coral-soft); color: #a44231; }
.badge.blue { background: var(--blue-soft); color: #2b5a83; }
.badge.violet { background: var(--violet-soft); color: #584775; }
.badge.slate { background: var(--slate-soft); color: #4b6166; }
.badge.outline { background: transparent; border: 1px solid var(--line-strong); color: var(--muted); }
.badge.admin { background: var(--ink); color: #f8f5ed; }

.tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--bg);
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 560;
  line-height: 1.7;
}

.diff {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
}
.diff::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.diff-入门 { background: #e8f3ee; color: #39745e; }
.diff-基础 { background: var(--blue-soft); color: #2b5a83; }
.diff-进阶 { background: var(--amber-soft); color: #8c5914; }
.diff-挑战 { background: var(--coral-soft); color: #a44231; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .03em;
  white-space: nowrap;
}
.status-AC { background: var(--mint); color: var(--teal-dark); }
.status-WA { background: var(--coral-soft); color: #a44231; }
.status-TLE { background: var(--amber-soft); color: #8c5914; }
.status-RE { background: var(--violet-soft); color: #584775; }
.status-CE { background: var(--slate-soft); color: #4b6166; }
.status-OK { background: var(--mint); color: var(--teal-dark); }
.status-none { background: var(--bg-deep); color: var(--muted); }

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.panel-pad { padding: 24px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { color: var(--ink-2); font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.field .hint { color: var(--muted); font-size: 10.5px; line-height: 1.55; }
.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--white);
  color: var(--ink);
  font-size: 13px;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.input, .select { height: 42px; padding: 0 12px; }
.textarea { padding: 11px 12px; min-height: 105px; resize: vertical; line-height: 1.7; }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14, 124, 107, .12); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.textarea.code { font-family: var(--font-mono); font-size: 12px; line-height: 1.7; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-span-2 { grid-column: span 2; }

/* ---------- Auth ---------- */

.auth-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr);
  background: var(--bg);
}
.auth-stage {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 46px 52px;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 10%, rgba(217, 140, 43, .26), transparent 22rem),
    radial-gradient(circle at 6% 92%, rgba(27, 165, 141, .2), transparent 26rem),
    linear-gradient(145deg, #132f36 0%, #0b2025 100%);
  color: #f7f3e9;
}
.auth-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.16) .6px, transparent .6px);
  background-size: 22px 22px;
  mask-image: linear-gradient(125deg, #000 0%, transparent 62%);
  -webkit-mask-image: linear-gradient(125deg, #000 0%, transparent 62%);
  pointer-events: none;
}
.auth-stage > * { position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--teal);
  color: #f8f5ed;
  box-shadow: 0 10px 24px rgba(0,0,0,.23);
}
.logo-mark svg { width: 30px; height: 30px; }
.auth-brand strong { display: block; font-size: 18px; letter-spacing: .08em; font-weight: 780; }
.auth-brand small { display: block; margin-top: 3px; color: #9fb8b2; font-size: 10.5px; letter-spacing: .03em; }
.auth-copy { max-width: 650px; margin: 54px 0 36px; }
.auth-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  color: #cfe3dd;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
}
.auth-kicker .dot { width: 6px; height: 6px; border-radius: 50%; background: #8ad8c4; box-shadow: 0 0 0 4px rgba(138,216,196,.12); }
.auth-copy h1 { margin-top: 22px; font-size: clamp(38px, 5.1vw, 66px); line-height: 1.08; letter-spacing: -.045em; font-weight: 800; }
.auth-copy h1 em { font-style: normal; color: #f2c77e; }
.auth-copy p { margin-top: 20px; max-width: 570px; color: #b9cdc8; font-size: 14.5px; line-height: 1.9; }
.auth-features { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 25px; }
.auth-feature {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  color: #d9e8e3;
  font-size: 11.5px;
}
.auth-feature svg { width: 14px; height: 14px; stroke: #8ad8c4; stroke-width: 2; }
.auth-code {
  width: min(100%, 500px);
  margin-top: 28px;
  border-radius: 14px;
  background: rgba(6, 20, 24, .72);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 24px 55px rgba(0,0,0,.28);
  overflow: hidden;
}
.auth-code-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,.09); color: #8fa9a3; font-family: var(--font-mono); font-size: 9.5px; }
.auth-code-head .dots { display: flex; gap: 5px; }
.auth-code-head .dots i { width: 6px; height: 6px; border-radius: 50%; background: #50706a; }
.auth-code-head .dots i:first-child { background: #d35f4b; }
.auth-code-head .dots i:nth-child(2) { background: #d98c2b; }
.auth-code pre { margin: 0; padding: 16px 18px 18px; color: #d8ebe4; font-family: var(--font-mono); font-size: 12px; line-height: 1.85; overflow: auto; }
.auth-code .k { color: #f2c77e; }
.auth-code .s { color: #8ad8c4; }
.auth-code .c { color: #718e87; }
.auth-code .out { display: flex; align-items: center; gap: 8px; padding: 9px 15px; background: rgba(14,124,107,.16); border-top: 1px solid rgba(255,255,255,.07); color: #b6d9cf; font-family: var(--font-mono); font-size: 10px; }
.auth-code .out svg { width: 14px; height: 14px; flex: 0 0 auto; stroke: #8ad8c4; stroke-width: 2; }
.auth-code .out b { color: #8ad8c4; }
.auth-foot { color: #7e9891; font-size: 10.5px; letter-spacing: .01em; }
.auth-foot b { color: #b8cec8; font-weight: 500; }

.auth-form-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 38px 28px;
  background:
    radial-gradient(circle at 100% 0%, rgba(251,239,217,.8), transparent 24rem),
    var(--bg);
}
.auth-card { width: min(100%, 440px); }
.auth-card-head h2 { font-size: 30px; letter-spacing: -.035em; line-height: 1.25; }
.auth-card-head p { margin-top: 7px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.auth-tabs { display: flex; gap: 3px; padding: 4px; margin-top: 24px; border-radius: 10px; background: var(--bg-deep); border: 1px solid var(--line); }
.auth-tab { flex: 1; padding: 9px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 650; transition: all .16s ease; }
.auth-tab.active { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-xs); }
.auth-form { display: flex; flex-direction: column; gap: 15px; margin-top: 22px; }
.auth-form .field label { font-size: 11.5px; }
.auth-form .input { height: 46px; font-size: 14px; }
.auth-error { display: none; padding: 9px 11px; border-radius: 8px; background: var(--coral-soft); border: 1px solid #f0c8bf; color: #a44231; font-size: 11.5px; line-height: 1.6; }
.auth-error.show { display: block; }
.auth-submit { min-height: 47px; margin-top: 2px; }
.auth-demo {
  margin-top: 18px;
  padding: 13px 14px;
  border-radius: 11px;
  background: var(--paper);
  border: 1px dashed var(--line-strong);
}
.auth-demo-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.auth-demo-top b { font-size: 11px; color: var(--ink-2); }
.auth-demo p { margin-top: 5px; color: var(--muted); font-size: 10.5px; line-height: 1.7; }
.auth-demo code { padding: 2px 5px; border-radius: 4px; background: var(--bg); color: var(--teal-dark); font-family: var(--font-mono); font-size: 10.5px; }
.auth-legal { margin-top: 20px; color: var(--muted-2); font-size: 10px; line-height: 1.7; text-align: center; }

/* ---------- App shell ---------- */

.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 14px;
  background:
    radial-gradient(circle at 20% 0%, rgba(27,165,141,.15), transparent 18rem),
    linear-gradient(180deg, #122f36, #0c2227 60%);
  color: #dce9e5;
  overflow: hidden;
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.14) .55px, transparent .55px);
  background-size: 20px 20px;
  mask-image: linear-gradient(to bottom, #000, transparent 50%);
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 50%);
  pointer-events: none;
}
.sidebar > * { position: relative; z-index: 1; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 20px; border-bottom: 1px solid rgba(255,255,255,.09); }
.sidebar-brand .logo-mark { width: 37px; height: 37px; border-radius: 11px; box-shadow: 0 8px 18px rgba(0,0,0,.25); }
.sidebar-brand .logo-mark svg { width: 25px; height: 25px; }
.sidebar-brand strong { display: block; font-size: 15px; letter-spacing: .07em; font-weight: 760; }
.sidebar-brand small { display: block; margin-top: 2px; color: #8ea8a2; font-size: 9.5px; letter-spacing: .03em; }
.side-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 18px; }
.side-label { padding: 10px 10px 5px; color: #6f8c86; font-size: 9px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: #a9c0ba;
  font-size: 12.5px;
  font-weight: 560;
  transition: background .16s ease, color .16s ease;
}
.side-link svg { width: 16px; height: 16px; flex: 0 0 auto; stroke: currentColor; stroke-width: 1.8; }
.side-link:hover { background: rgba(255,255,255,.06); color: #f3f7f5; }
.side-link.active { background: rgba(27,165,141,.17); color: #d9f3eb; box-shadow: inset 2px 0 0 #54c9b0; }
.side-link .side-count { margin-left: auto; color: #7f9b95; font-family: var(--font-mono); font-size: 9px; }
.side-link.admin-link { color: #e8c68d; }
.side-link.admin-link.active { background: rgba(217,140,43,.14); box-shadow: inset 2px 0 0 #e8a33d; color: #ffe4b5; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.09); }
.side-meta { display: flex; align-items: center; gap: 7px; padding: 0 8px 8px; color: #6f8c86; font-size: 9.5px; }
.side-meta .dot { width: 5px; height: 5px; border-radius: 50%; background: #54c9b0; box-shadow: 0 0 0 3px rgba(84,201,176,.12); }
.user-card { display: flex; align-items: center; gap: 9px; padding: 9px; border-radius: 10px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); }
.user-avatar { width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; background: var(--amber); color: #1b2d25; font-size: 13px; font-weight: 800; }
.user-meta { min-width: 0; flex: 1; }
.user-meta b { display: block; font-size: 11.5px; color: #eef5f2; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { display: block; color: #87a29c; font-size: 9px; line-height: 1.4; }
.user-card .icon-btn { color: #8fa9a3; width: 28px; height: 28px; }
.user-card .icon-btn:hover { background: rgba(255,255,255,.1); border-color: transparent; color: #fff; }
.user-card .icon-btn svg { width: 15px; height: 15px; }

.shell-main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 35;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 30px;
  background: rgba(243, 240, 232, .84);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(197, 211, 205, .65);
}
.topbar-title { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.topbar-title span { color: var(--muted-2); font-weight: 500; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar .menu-toggle { display: none; }
.topbar-status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,253,248,.65); color: var(--muted); font-family: var(--font-mono); font-size: 9.5px; }
.topbar-status .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--teal); }
.content { width: min(100%, 1400px); margin: 0 auto; padding: 30px; flex: 1; }
.page-loading { min-height: 50vh; display: grid; place-items: center; color: var(--muted); font-size: 12px; gap: 10px; }
.page-loading .loader { width: 26px; height: 26px; border: 2px solid var(--line); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
.sidebar-backdrop { display: none; }

/* ---------- Page head / stats ---------- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin-top: 7px; font-size: clamp(30px, 3.6vw, 42px); line-height: 1.18; letter-spacing: -.04em; font-weight: 800; }
.page-head p { margin-top: 7px; max-width: 720px; color: var(--muted); font-size: 12.5px; line-height: 1.8; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.breadcrumb { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted-2); font-size: 10.5px; }
.breadcrumb a:hover { color: var(--teal-dark); }
.breadcrumb svg { width: 11px; height: 11px; stroke: currentColor; stroke-width: 2; }
.breadcrumb .current { color: var(--ink-3); font-weight: 650; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { position: relative; padding: 17px 18px; border-radius: 13px; background: var(--paper); border: 1px solid var(--line); overflow: hidden; }
.stat-card::after { content: ""; position: absolute; right: -20px; bottom: -26px; width: 80px; height: 80px; border-radius: 50%; background: var(--mint); opacity: .55; }
.stat-card .stat-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10.5px; font-weight: 650; }
.stat-card .stat-label svg { width: 14px; height: 14px; stroke: var(--teal); stroke-width: 1.8; }
.stat-card b { display: block; margin-top: 7px; font-family: var(--font-mono); font-size: 27px; line-height: 1.1; letter-spacing: -.04em; position: relative; z-index: 1; }
.stat-card small { display: block; margin-top: 3px; color: var(--muted-2); font-size: 9.5px; position: relative; z-index: 1; }
.stat-card.amber .stat-label svg { stroke: var(--amber); }
.stat-card.amber::after { background: var(--amber-soft); }
.stat-card.blue .stat-label svg { stroke: var(--blue); }
.stat-card.blue::after { background: var(--blue-soft); }
.stat-card.violet .stat-label svg { stroke: var(--violet); }
.stat-card.violet::after { background: var(--violet-soft); }

/* ---------- Problem list ---------- */

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  border-radius: 13px;
  background: var(--paper);
  border: 1px solid var(--line);
  margin-bottom: 14px;
}
.search-box { position: relative; flex: 1 1 230px; min-width: 190px; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; stroke: var(--muted); stroke-width: 1.8; }
.search-box input { width: 100%; height: 38px; padding: 0 12px 0 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); font-size: 12px; }
.search-box input:focus { outline: 0; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14,124,107,.11); }
.filter-chips { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.chip {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 620;
  transition: all .14s ease;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #f8f5ed; }
.filter-count { margin-left: auto; color: var(--muted-2); font-size: 10.5px; white-space: nowrap; }

.table-panel { background: var(--paper); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.problem-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.problem-table th { padding: 10px 14px; background: rgba(243,240,232,.72); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 9.5px; font-weight: 800; letter-spacing: .06em; text-align: left; white-space: nowrap; }
.problem-table td { padding: 13px 14px; border-bottom: 1px solid var(--line); font-size: 12px; vertical-align: middle; }
.problem-table tr:last-child td { border-bottom: 0; }
.problem-table tbody tr { cursor: pointer; transition: background .14s ease; }
.problem-table tbody tr:hover { background: rgba(225,242,234,.28); }
.problem-table .col-id { width: 64px; color: var(--muted-2); font-family: var(--font-mono); font-size: 10px; }
.problem-table .col-status { width: 54px; }
.problem-table .col-title { min-width: 250px; }
.problem-table .col-diff { width: 90px; }
.problem-table .col-chapter { width: 165px; color: var(--muted); font-size: 10.5px; }
.problem-table .col-rate { width: 135px; }
.problem-table .col-action { width: 76px; text-align: right; }
.problem-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.problem-title b { font-size: 13px; font-weight: 650; color: var(--ink); }
.problem-title .tag { font-size: 9px; }
.status-dot-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: var(--bg-deep); color: var(--muted-2); }
.status-dot-icon svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2.2; }
.status-dot-icon.solved { background: var(--mint); color: var(--teal-dark); }
.rate-cell { display: flex; align-items: center; gap: 7px; }
.rate-track { height: 5px; flex: 1; border-radius: 99px; background: var(--bg-deep); overflow: hidden; }
.rate-track i { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.rate-num { color: var(--muted); font-family: var(--font-mono); font-size: 9.5px; white-space: nowrap; }
.empty-state { padding: 52px 20px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 14px; background: rgba(255,253,248,.5); }
.empty-icon { width: 46px; height: 46px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 50%; background: var(--bg-deep); color: var(--muted); }
.empty-icon svg { width: 21px; height: 21px; stroke: currentColor; stroke-width: 1.8; }
.empty-state h3 { font-size: 14px; }
.empty-state p { margin-top: 4px; color: var(--muted); font-size: 11.5px; }

/* ---------- Problem detail ---------- */

.problem-head { margin-bottom: 20px; }
.problem-head h1 { margin-top: 8px; font-size: clamp(27px, 3.4vw, 38px); line-height: 1.23; letter-spacing: -.04em; }
.problem-head .meta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.problem-head .meta-row .sep { width: 1px; height: 14px; background: var(--line); }
.problem-head .problem-intro { margin-top: 8px; max-width: 840px; color: var(--muted); font-size: 12px; line-height: 1.8; }

.problem-layout { display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr); gap: 22px; align-items: start; }
.problem-panel { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.problem-tabs { display: flex; gap: 2px; padding: 7px; border-bottom: 1px solid var(--line); background: rgba(243,240,232,.5); }
.problem-tab { padding: 7px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 650; }
.problem-tab:hover { background: var(--white); color: var(--ink); }
.problem-tab.active { background: var(--ink); color: #f8f5ed; }
.statement-body { padding: 24px 26px 28px; }
.statement-section { margin-bottom: 24px; }
.statement-section:last-child { margin-bottom: 0; }
.statement-section h2 { display: flex; align-items: center; gap: 8px; font-size: 14px; letter-spacing: -.01em; margin-bottom: 10px; }
.statement-section h2 .sec-no { width: 21px; height: 21px; display: grid; place-items: center; border-radius: 6px; background: var(--mint); color: var(--teal-dark); font-family: var(--font-mono); font-size: 8.5px; font-weight: 700; }
.statement-text { color: var(--ink-3); font-size: 12.8px; line-height: 1.95; }
.statement-text p + p { margin-top: 8px; }
.statement-text code { padding: 1px 5px; border-radius: 4px; background: var(--bg); color: var(--teal-dark); font-family: var(--font-mono); font-size: 11px; }
.io-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.io-card { padding: 13px 14px; border-radius: 9px; background: var(--bg); border: 1px solid var(--line); }
.io-card h3 { color: var(--muted); font-size: 9.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 5px; }
.io-card p { color: var(--ink-3); font-size: 11.5px; line-height: 1.7; white-space: pre-wrap; }
.sample-list { display: flex; flex-direction: column; gap: 9px; }
.sample-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--white); }
.sample-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 11px; background: var(--bg); border-bottom: 1px solid var(--line); }
.sample-head span { color: var(--muted); font-size: 9.5px; font-weight: 750; letter-spacing: .06em; }
.copy-btn { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--white); color: var(--muted); font-size: 9px; }
.copy-btn:hover { color: var(--teal-dark); border-color: var(--teal); }
.copy-btn svg { width: 10px; height: 10px; stroke: currentColor; stroke-width: 2; }
.sample-cols { display: grid; grid-template-columns: 1fr 1fr; }
.sample-col { padding: 10px 12px; min-width: 0; }
.sample-col + .sample-col { border-left: 1px solid var(--line); }
.sample-col b { display: block; color: var(--muted-2); font-size: 8.5px; font-weight: 700; letter-spacing: .08em; margin-bottom: 4px; }
.sample-col pre { margin: 0; color: var(--ink-2); font-family: var(--font-mono); font-size: 10.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-all; }
.hint-box { padding: 12px 14px; border-radius: 9px; background: var(--amber-soft); border: 1px solid #efd9b2; color: #714c0f; font-size: 11.5px; line-height: 1.75; }
.hint-box b { display: block; margin-bottom: 3px; font-size: 10px; letter-spacing: .06em; }
.source-note { display: flex; align-items: flex-start; gap: 7px; margin-top: 12px; color: var(--muted-2); font-size: 9.5px; line-height: 1.6; }
.source-note svg { width: 12px; height: 12px; margin-top: 2px; flex: 0 0 auto; stroke: currentColor; }

/* editor */

.workspace { position: sticky; top: calc(var(--topbar-h) + 16px); display: flex; flex-direction: column; gap: 12px; }
.editor-card { background: var(--code); border: 1px solid #1f3b42; border-radius: 15px; overflow: hidden; box-shadow: var(--shadow-md); }
.editor-head { display: flex; align-items: center; gap: 9px; padding: 9px 12px; background: #132b31; border-bottom: 1px solid var(--code-line); }
.editor-dots { display: flex; gap: 4px; }
.editor-dots i { width: 6px; height: 6px; border-radius: 50%; background: #4c6a70; }
.editor-dots i:first-child { background: #d35f4b; }
.editor-dots i:nth-child(2) { background: #d98c2b; }
.editor-file { color: #9bb3ae; font-family: var(--font-mono); font-size: 9.5px; }
.editor-head .editor-lang { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; color: #8ad8c4; font-family: var(--font-mono); font-size: 9px; }
.editor-head .editor-lang .dot { width: 5px; height: 5px; border-radius: 50%; background: #8ad8c4; }
.editor-shell { display: grid; grid-template-columns: 44px minmax(0, 1fr); min-height: 340px; max-height: 58vh; background: #0b1c21; }
.line-numbers { padding: 14px 8px 14px 0; color: #466168; font-family: var(--font-mono); font-size: 12px; line-height: 1.7; text-align: right; overflow: hidden; user-select: none; border-right: 1px solid #1a333a; background: #0b1c21; }
#lineNumbers { white-space: pre; }
#codeEditor {
  width: 100%;
  min-height: 340px;
  height: 100%;
  padding: 14px 14px 18px;
  border: 0;
  background: transparent;
  color: #e0eee9;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  tab-size: 4;
  resize: vertical;
  white-space: pre;
  overflow: auto;
}
#codeEditor:focus { outline: 0; }
#codeEditor::selection { background: rgba(84,201,176,.24); }
.editor-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 9px 11px; background: #132b31; border-top: 1px solid var(--code-line); }
.editor-toolbar .toolbar-hint { margin-right: auto; color: #6f8b85; font-size: 9px; }
.editor-toolbar .btn { min-height: 29px; padding: 4px 9px; font-size: 10px; border-radius: 6px; }
.editor-toolbar .btn-secondary { background: #1c373d; border-color: #2b4a50; color: #b9cdc7; }
.editor-toolbar .btn-secondary:hover { background: #25454b; border-color: #3b6066; color: #fff; }
.editor-toolbar .btn-teal { box-shadow: none; }
.editor-toolbar .shortcut { color: #5c7872; font-family: var(--font-mono); font-size: 8.5px; margin-left: 3px; }

.run-console { border-radius: 12px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); }
.console-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 11px; background: var(--bg); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .06em; }
.console-body { min-height: 70px; max-height: 220px; overflow: auto; padding: 11px 12px; font-family: var(--font-mono); font-size: 10.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; color: var(--ink-2); }
.console-body .err { color: #b04333; }
.console-body .ok { color: var(--teal-dark); }
.console-body .muted { color: var(--muted); }
.console-meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; color: var(--muted-2); font-size: 9.5px; }
.console-meta .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--muted-2); }

.custom-input { border-radius: 12px; border: 1px solid var(--line); background: var(--paper); overflow: hidden; }
.custom-input summary { padding: 8px 11px; cursor: pointer; color: var(--muted); font-size: 10.5px; font-weight: 650; user-select: none; }
.custom-input textarea { width: 100%; min-height: 62px; border: 0; border-top: 1px solid var(--line); padding: 9px 11px; background: var(--white); font-family: var(--font-mono); font-size: 10.5px; resize: vertical; }
.custom-input textarea:focus { outline: 0; }

.verdict-card { border-radius: 14px; border: 1px solid var(--line); background: var(--paper); overflow: hidden; animation: fadeUp .3s ease both; }
.verdict-main { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.verdict-icon { width: 48px; height: 48px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 14px; background: var(--mint); color: var(--teal-dark); }
.verdict-icon svg { width: 25px; height: 25px; stroke: currentColor; stroke-width: 2; }
.verdict-icon.bad { background: var(--coral-soft); color: #a44231; }
.verdict-icon.warn { background: var(--amber-soft); color: #8c5914; }
.verdict-copy { flex: 1; min-width: 0; }
.verdict-copy .v-label { color: var(--muted); font-size: 9.5px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.verdict-copy h3 { margin-top: 1px; font-size: 20px; letter-spacing: -.03em; }
.verdict-copy p { margin-top: 2px; color: var(--muted); font-size: 11px; }
.verdict-score { text-align: right; }
.verdict-score b { display: block; font-family: var(--font-mono); font-size: 29px; line-height: 1; letter-spacing: -.04em; }
.verdict-score span { color: var(--muted); font-size: 9.5px; }
.verdict-body { padding: 0 18px 16px; }
.verdict-note { padding: 9px 11px; border-radius: 8px; background: var(--bg); color: var(--ink-3); font-size: 11px; line-height: 1.7; margin-bottom: 10px; }
.verdict-note code { font-family: var(--font-mono); font-size: 10px; color: var(--coral); }
.test-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.test-table th { padding: 6px 8px; text-align: left; color: var(--muted); font-size: 8.5px; letter-spacing: .05em; border-bottom: 1px solid var(--line); }
.test-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); color: var(--ink-3); vertical-align: top; }
.test-table tr:last-child td { border-bottom: 0; }
.test-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 4px; }
.test-detail div { padding: 6px 7px; border-radius: 5px; background: var(--bg); font-family: var(--font-mono); font-size: 9px; line-height: 1.55; white-space: pre-wrap; word-break: break-all; }
.test-detail b { display: block; color: var(--muted-2); font-family: var(--font-sans); font-size: 8px; letter-spacing: .05em; margin-bottom: 2px; }

/* submissions */

.submissions-panel { background: var(--paper); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.submission-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.submission-table th { padding: 10px 14px; background: rgba(243,240,232,.72); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 9.5px; font-weight: 800; letter-spacing: .06em; text-align: left; white-space: nowrap; }
.submission-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 11.5px; vertical-align: middle; }
.submission-table tr:last-child td { border-bottom: 0; }
.submission-table tbody tr { cursor: pointer; transition: background .14s ease; }
.submission-table tbody tr:hover { background: rgba(225,242,234,.28); }
.submission-table .col-id { font-family: var(--font-mono); font-size: 9.5px; color: var(--muted-2); width: 65px; }
.submission-table .col-problem { font-weight: 650; color: var(--ink); min-width: 170px; }
.submission-table .col-score { font-family: var(--font-mono); font-size: 11px; width: 72px; }
.submission-table .col-time { color: var(--muted); font-family: var(--font-mono); font-size: 9.5px; white-space: nowrap; }
.submission-table .col-user { color: var(--muted); }
.submission-table .col-act { text-align: right; width: 60px; }
.submission-table .mini-bar { display: inline-block; width: 42px; height: 4px; border-radius: 99px; background: var(--bg-deep); overflow: hidden; vertical-align: middle; margin-right: 6px; }
.submission-table .mini-bar i { display: block; height: 100%; background: var(--teal); }
.empty-table { padding: 46px 20px; text-align: center; color: var(--muted); font-size: 12px; }
.empty-table .empty-icon { margin-bottom: 8px; }

/* ranking */

.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; align-items: end; }
.podium-card { position: relative; padding: 20px 18px; border-radius: 15px; background: var(--paper); border: 1px solid var(--line); text-align: center; overflow: hidden; }
.podium-card.first { border-color: #e6c284; background: linear-gradient(160deg, #fffdf8, #fdf4e3); padding-top: 27px; }
.podium-card.second { background: linear-gradient(160deg, #fffdf8, #f1f6f3); }
.podium-card.third { background: linear-gradient(160deg, #fffdf8, #fbf1ea); }
.podium-rank { display: inline-flex; align-items: center; justify-content: center; width: 27px; height: 27px; border-radius: 50%; background: var(--ink); color: #fff; font-family: var(--font-mono); font-size: 10px; font-weight: 800; margin-bottom: 8px; }
.podium-card.first .podium-rank { background: var(--amber); color: #3b2a0d; }
.podium-avatar { width: 46px; height: 46px; margin: 0 auto 7px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); color: var(--teal-dark); font-size: 17px; font-weight: 800; }
.podium-card.first .podium-avatar { background: var(--amber-soft); color: #8c5914; }
.podium-card h3 { font-size: 14px; }
.podium-card p { margin-top: 2px; color: var(--muted); font-size: 10px; }
.podium-stats { display: flex; justify-content: center; gap: 16px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
.podium-stats span { color: var(--muted); font-size: 9px; }
.podium-stats b { display: block; color: var(--ink); font-family: var(--font-mono); font-size: 13px; }
.ranking-panel { background: var(--paper); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.ranking-table { width: 100%; border-collapse: collapse; min-width: 660px; }
.ranking-table th { padding: 10px 16px; background: rgba(243,240,232,.72); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 9.5px; font-weight: 800; letter-spacing: .06em; text-align: left; }
.ranking-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 11.5px; }
.ranking-table tr:last-child td { border-bottom: 0; }
.ranking-table tr.me td { background: rgba(225,242,234,.35); }
.rank-no { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.rank-no.top { color: var(--amber); font-weight: 800; }
.rank-user { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.rank-avatar { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: var(--bg-deep); color: var(--ink-3); font-size: 10px; font-weight: 800; }
.rank-solved { font-family: var(--font-mono); font-weight: 700; color: var(--teal-dark); }
.rank-score { font-family: var(--font-mono); color: var(--ink-2); }
.rank-last { color: var(--muted-2); font-family: var(--font-mono); font-size: 9.5px; }

/* ---------- Admin ---------- */

.admin-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; align-items: start; }
.admin-card { background: var(--paper); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.admin-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 17px 18px 12px; }
.admin-card-head h2 { font-size: 15px; letter-spacing: -.015em; }
.admin-card-head p { margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.admin-card-body { padding: 0 18px 18px; }
.mini-chart { display: flex; align-items: flex-end; gap: 7px; height: 118px; padding: 8px 2px 0; border-bottom: 1px solid var(--line); }
.mini-chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; height: 100%; }
.mini-chart .bar i { width: 100%; max-width: 32px; min-height: 3px; border-radius: 5px 5px 0 0; background: linear-gradient(to top, var(--teal), #62c9b4); transition: height .5s ease; }
.mini-chart .bar span { color: var(--muted-2); font-family: var(--font-mono); font-size: 8px; }
.admin-list { display: flex; flex-direction: column; }
.admin-list-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.admin-list-item:last-child { border-bottom: 0; }
.admin-list-item .ali-main { flex: 1; min-width: 0; }
.admin-list-item b { display: block; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-list-item small { display: block; color: var(--muted); font-size: 9.5px; }
.admin-problem-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.admin-problem-table th { padding: 9px 12px; background: rgba(243,240,232,.72); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .05em; text-align: left; }
.admin-problem-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 11px; vertical-align: middle; }
.admin-problem-table tr:last-child td { border-bottom: 0; }
.admin-problem-table .actions { display: flex; gap: 4px; justify-content: flex-end; }
.admin-problem-table .actions .btn { min-height: 26px; padding: 3px 7px; font-size: 9.5px; }
.admin-problem-table .actions .btn svg { width: 12px; height: 12px; }
.visibility-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 9px; font-weight: 650; color: var(--teal-dark); }
.visibility-pill.private { color: var(--muted-2); }
.visibility-pill .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* form */

.form-shell { max-width: 1080px; }
.form-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.form-head h1 { margin-top: 7px; font-size: clamp(28px, 3.4vw, 38px); letter-spacing: -.04em; }
.form-head p { margin-top: 6px; color: var(--muted); font-size: 12px; }
.form-panel { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 24px; margin-bottom: 14px; }
.form-section { margin-bottom: 26px; }
.form-section:last-child { margin-bottom: 0; }
.form-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.form-section-head h2 { display: flex; align-items: center; gap: 8px; font-size: 15px; letter-spacing: -.01em; }
.form-section-head h2 .sec-no { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; background: var(--ink); color: #fff; font-family: var(--font-mono); font-size: 9.5px; font-weight: 800; letter-spacing: -.02em; }
.form-section-head p { margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.case-editor { display: flex; flex-direction: column; gap: 8px; }
.case-row { display: grid; grid-template-columns: 28px 1fr 1fr 32px; gap: 8px; align-items: start; padding: 9px; border-radius: 9px; background: var(--bg); border: 1px solid var(--line); }
.case-index { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 6px; background: var(--white); border: 1px solid var(--line); color: var(--muted); font-family: var(--font-mono); font-size: 8.5px; font-weight: 700; margin-top: 2px; }
.case-field { display: flex; flex-direction: column; gap: 3px; }
.case-field label { color: var(--muted); font-size: 8.5px; font-weight: 700; letter-spacing: .04em; }
.case-field textarea { width: 100%; min-height: 62px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); font-family: var(--font-mono); font-size: 10px; line-height: 1.55; resize: vertical; }
.case-field textarea:focus { outline: 0; border-color: var(--teal); box-shadow: 0 0 0 2px rgba(14,124,107,.1); }
.case-remove { margin-top: 20px; width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: var(--white); color: var(--muted); }
.case-remove:hover { color: var(--coral); border-color: var(--coral); }
.case-remove svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2; }
.case-add { align-self: flex-start; }
.form-note { padding: 10px 12px; border-radius: 8px; background: var(--amber-soft); color: #74500f; font-size: 10.5px; line-height: 1.7; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.form-actions .btn-danger { margin-right: auto; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 35px; height: 20px; border-radius: 999px; background: var(--bg-deep); border: 1px solid var(--line-strong); position: relative; transition: all .18s ease; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--white); box-shadow: var(--shadow-xs); transition: transform .18s ease; }
.switch input:checked + .track { background: var(--teal); border-color: var(--teal); }
.switch input:checked + .track::after { transform: translateX(15px); }
.switch span:last-child { color: var(--ink-3); font-size: 11.5px; }

/* ---------- Modal / toast ---------- */

.modal-backdrop { position: fixed; inset: 0; z-index: 300; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 18px 4vh; background: rgba(8, 22, 26, .52); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); overflow-y: auto; animation: fadeIn .16s ease; }
.modal-panel { width: min(100%, 760px); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow-lg); overflow: hidden; animation: modalUp .22s cubic-bezier(.2,.8,.2,1); }
.modal-panel.wide { width: min(100%, 980px); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 15px; border-bottom: 1px solid var(--line); }
.modal-eyebrow { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.modal-head h2 { margin-top: 4px; font-size: 21px; letter-spacing: -.025em; line-height: 1.3; }
.modal-head p { margin-top: 3px; color: var(--muted); font-size: 11px; }
.modal-close { flex: 0 0 auto; width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--muted); }
.modal-close:hover { color: var(--ink); border-color: var(--line-strong); }
.modal-close svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; }
.modal-body { padding: 20px 22px 22px; max-height: 72vh; overflow-y: auto; }
.modal-body h3 { margin: 16px 0 7px; font-size: 13px; }
.modal-body h3:first-child { margin-top: 0; }
.modal-body p, .modal-body li { color: var(--ink-3); font-size: 11.5px; line-height: 1.8; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 22px; border-top: 1px solid var(--line); background: var(--bg); }
.modal-foot .muted { font-size: 10px; }
.modal-code { margin: 0; padding: 13px 14px; border-radius: 9px; background: var(--code); color: #d8ebe4; font-family: var(--font-mono); font-size: 11px; line-height: 1.7; overflow: auto; max-height: 330px; white-space: pre; }
.modal-verdict { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 13px; border-radius: 9px; background: var(--bg); margin-bottom: 14px; }
.modal-verdict b { font-family: var(--font-mono); font-size: 18px; }
.modal-verdict span { color: var(--muted); font-size: 10.5px; }
.modal-section-title { margin: 15px 0 7px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 400; display: flex; flex-direction: column; gap: 7px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; max-width: 340px; padding: 10px 13px; border-radius: 9px; background: var(--ink); color: #f8f5ed; box-shadow: var(--shadow-md); font-size: 11.5px; line-height: 1.5; animation: toastIn .22s ease both; }
.toast svg { width: 14px; height: 14px; flex: 0 0 auto; stroke: #8ad8c4; stroke-width: 2; }
.toast.error { background: #5a241d; }
.toast.error svg { stroke: #ffb3a4; }
.toast.out { animation: toastOut .18s ease both; }

/* ---------- Error page ---------- */

.error-page { min-height: 46vh; display: grid; place-items: center; text-align: center; }
.error-page .error-code { color: var(--line-strong); font-family: var(--font-mono); font-size: 70px; font-weight: 800; line-height: 1; letter-spacing: -.08em; }
.error-page h2 { margin-top: 8px; font-size: 20px; }
.error-page p { margin-top: 6px; color: var(--muted); font-size: 12px; }

/* ---------- Animations ---------- */

.page-enter { animation: fadeUp .35s cubic-bezier(.2,.8,.2,1) both; }
.stagger > * { animation: fadeUp .38s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalUp { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(5px); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .problem-layout { grid-template-columns: minmax(0, 1fr) minmax(0, .92fr); gap: 16px; }
  .content { padding: 24px; }
  .sidebar { width: 226px; }
  .shell { grid-template-columns: 226px minmax(0, 1fr); }
  .topbar { padding: 0 24px; }
}

@media (max-width: 980px) {
  .auth-view { grid-template-columns: 1fr; }
  .auth-stage { min-height: auto; padding: 32px 28px 34px; }
  .auth-copy { margin: 30px 0 0; }
  .auth-copy h1 { font-size: clamp(34px, 8vw, 48px); }
  .auth-code { display: none; }
  .auth-foot { display: none; }
  .auth-form-wrap { min-height: auto; padding: 32px 24px 46px; }
  .auth-card { width: min(100%, 500px); }

  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 250px; transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(8,22,26,.42); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .topbar .menu-toggle { display: inline-grid; }
  .topbar { padding: 0 18px; }
  .content { padding: 22px 18px; }
  .problem-layout { grid-template-columns: 1fr; }
  .workspace { position: static; }
  .editor-shell { max-height: 52vh; }
  .admin-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .podium { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 720px) {
  .auth-stage { padding: 26px 20px 28px; }
  .auth-copy p { font-size: 13px; }
  .auth-features { gap: 6px; }
  .auth-feature { font-size: 10.5px; padding: 5px 8px; }
  .auth-form-wrap { padding: 26px 18px 40px; }
  .auth-card-head h2 { font-size: 26px; }

  .topbar-title { font-size: 11.5px; }
  .topbar-status { display: none; }
  .content { padding: 18px 14px 30px; }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 30px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .stats-grid { gap: 8px; }
  .stat-card { padding: 14px; }
  .stat-card b { font-size: 22px; }
  .filter-bar { padding: 10px; }
  .filter-count { margin-left: 0; width: 100%; }
  .io-grid { grid-template-columns: 1fr; }
  .sample-cols { grid-template-columns: 1fr; }
  .sample-col + .sample-col { border-left: 0; border-top: 1px solid var(--line); }
  .statement-body { padding: 18px 16px 20px; }
  .problem-head h1 { font-size: 27px; }
  .editor-shell { grid-template-columns: 36px minmax(0, 1fr); min-height: 280px; }
  #codeEditor { min-height: 280px; font-size: 11.5px; padding-left: 10px; }
  .line-numbers { font-size: 11.5px; padding-right: 6px; }
  .editor-toolbar .toolbar-hint { display: none; }
  .verdict-main { align-items: flex-start; }
  .verdict-score b { font-size: 24px; }
  .verdict-body { padding: 0 14px 14px; }
  .test-detail { grid-template-columns: 1fr; }
  .podium { grid-template-columns: 1fr; }
  .podium-card.first { order: -1; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .form-span-2 { grid-column: auto; }
  .form-panel { padding: 18px 15px; }
  .case-row { grid-template-columns: 24px 1fr 1fr 28px; gap: 6px; padding: 7px; }
  .case-field textarea { min-height: 70px; }
  .form-head { align-items: flex-start; }
  .form-head .row { width: 100%; }
  .modal-backdrop { padding: 10px; }
  .modal-panel { border-radius: 13px; }
  .modal-head { padding: 16px 16px 12px; }
  .modal-body { padding: 16px; max-height: 76vh; }
  .modal-foot { padding: 10px 16px; }
  .modal-foot .row { width: 100%; }
  .modal-foot .btn { flex: 1 1 auto; }
  .toast-root { right: 12px; bottom: 12px; left: 12px; }
  .toast { max-width: none; }
  .ranking-table, .submission-table, .problem-table { min-width: 680px; }
}

@media (max-width: 440px) {
  .brand-text small { display: none; }
  .auth-brand strong { font-size: 16px; }
  .auth-copy h1 { font-size: 34px; }
  .auth-demo { padding: 11px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card b { font-size: 24px; }
  .stat-card { padding: 12px; }
  .stat-card .stat-label { font-size: 9.5px; }
  .stat-card small { font-size: 9px; }
  .sidebar { width: 86vw; }
  .editor-toolbar .btn span.label { display: none; }
  .editor-toolbar .btn { padding: 4px 7px; }
  .problem-tab { padding: 6px 9px; font-size: 10.5px; }
  .statement-body { padding: 15px 13px 18px; }
  .editor-head { padding: 8px 10px; }
  .editor-file { font-size: 8.5px; }
}

.mobile-code-jump { display: none; }
@media (max-width: 980px) {
  .mobile-code-jump { display: inline-flex; }
}
