@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-sans-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-sans-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-mono-latin-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ikb: #002FA7;
  --wash: #8b96a8;
  --ink: #141414;
  --paper: #f6f6f4;
  --muted: color-mix(in srgb, var(--ink) 62%, var(--paper));
  --rule: color-mix(in srgb, var(--ink) 18%, var(--paper));
  --card: #fbfbf9;
  --on-ikb: #f6f6f4;
  --danger: #9c1c1c;
  --font: "IBM Plex Sans", "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "IBM Plex Mono", "Source Han Mono SC", ui-monospace, monospace;
}

html[data-theme="dark"] {
  --wash: #4a5160;
  --ink: #ecece8;
  --paper: #16171a;
  --muted: color-mix(in srgb, var(--ink) 70%, var(--paper));
  --rule: color-mix(in srgb, var(--ink) 22%, var(--paper));
  --card: #1c1d21;
  --on-ikb: #f6f6f4;
  --danger: #ff8a80;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
a { color: var(--ikb); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input {
  font: inherit;
  color: inherit;
  border-radius: 0;
}

body.hub {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: -0.01em;
}
body.hub a:hover { text-decoration: none; }

.wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 40px 40px;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 72px auto 1fr;
}

.top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  height: 72px;
  min-height: 72px;
  max-height: 72px;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 28%, var(--paper));
  padding: 0;
}

.mark {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.mark b { color: var(--ikb); font-weight: 600; }
.user { margin: 4px 0 0; font-size: 13px; color: var(--muted); }

.tools {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.tools button, .tools a.btn {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--ink) 32%, var(--paper));
  padding: 6px 12px;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}
.tools button:hover, .tools a.btn:hover {
  border-color: var(--ikb);
  color: var(--ikb);
  background: transparent;
}
.tools button:active, .submit:active { transform: translateY(1px); }

.rail {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 24px;
  align-items: end;
  padding: 22px 0 28px;
}
.rail strong {
  display: block;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.rail-meta {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
}

.studio {
  display: grid;
  grid-template-columns: 7fr 5fr;
  grid-template-rows: 1fr 1fr 1fr;
  grid-template-areas:
    "feat a"
    "feat b"
    "feat c";
  gap: 20px;
  background: transparent;
  border: 0;
  margin: 0;
  min-height: 0;
  padding-bottom: 8px;
}
.studio[aria-busy="true"] > :first-child { grid-area: feat; }
.studio[aria-busy="true"] > :nth-child(2) { grid-area: a; }
.studio[aria-busy="true"] > :nth-child(3) { grid-area: b; }
.studio[aria-busy="true"] > :nth-child(4) { grid-area: c; }

.card {
  --p: 0;
  position: relative;
  display: grid;
  grid-template-columns: 88px 1fr;
  min-height: 0;
  background: var(--card);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  border: 1px solid var(--rule);
}
.card[data-slot="0"] { grid-area: feat; }
.card[data-slot="1"] { grid-area: a; }
.card[data-slot="2"] { grid-area: b; }
.card[data-slot="3"] { grid-area: c; }

.card-media {
  position: relative;
  background: var(--wash);
  min-height: 100%;
}
.card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05);
  mix-blend-mode: multiply;
  opacity: 0.45;
  transform: scale(1.01);
}
.card-body {
  min-width: 0;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}
.card h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
  text-wrap: pretty;
}
.card .extra {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
  max-width: 42ch;
}
.card-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.pct {
  font-family: var(--mono);
  font-size: 34px;
  font-weight: 500;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--ikb);
}
.pct small { font-size: 13px; margin-left: 2px; }
.go {
  flex: 0 0 auto;
  border: 1px solid currentColor;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.bar {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 2;
  height: 3px;
  width: calc(var(--p) * 1%);
  max-width: 100%;
  background: var(--ikb);
  pointer-events: none;
}

.card.featured {
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
  color: var(--ink);
  background: var(--card);
}
.card.featured .card-media {
  position: relative;
  inset: auto;
  min-height: 0;
}
.card.featured .card-body {
  position: relative;
  z-index: 1;
  min-height: 0;
  padding: 28px 32px 32px;
  justify-content: flex-start;
  gap: 20px;
  background: var(--card);
}
.card.featured h2 {
  font-size: clamp(28px, 3.4vw, 44px);
  line-height: 1.12;
  max-width: 12ch;
}
.card.featured .extra { color: var(--muted); }
.card.featured .pct { color: var(--ikb); font-size: clamp(40px, 5.5vw, 64px); }
.card.featured .pct small { font-size: 16px; }
.card.featured .bar { background: var(--ikb); }
.card.featured .go {
  background: var(--ikb);
  color: var(--on-ikb);
  border-color: var(--ikb);
}

.card:hover .card-media img { transform: scale(1.04); }
.card:hover { border-color: color-mix(in srgb, var(--ikb) 45%, var(--rule)); }
.card:not(.featured):hover {
  background: var(--card);
  color: inherit;
}
.card:not(.featured):hover .extra { color: var(--muted); }
.card:not(.featured):hover .pct { color: var(--ikb); }
.card:not(.featured):hover .bar { background: var(--ikb); }
.card:active { transform: none; }
.card:active .go { transform: translateY(1px); }

.card:focus-visible,
.tools button:focus-visible,
.submit:focus-visible,
.field input:focus-visible {
  outline: 2px solid var(--ikb);
  outline-offset: 2px;
}
.card.featured:focus-visible { outline-color: var(--ikb); }

.skeleton {
  background:
    linear-gradient(90deg, transparent 40%, color-mix(in srgb, var(--ink) 8%, transparent) 50%, transparent 60%),
    var(--card);
  background-size: 200% 100%;
  pointer-events: none;
}
.studio-error {
  grid-column: 1 / -1;
  margin: 0;
  padding: 28px;
  background: var(--card);
}

.login-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}
.login-box {
  width: min(420px, 100%);
  border: 1px solid color-mix(in srgb, var(--ink) 28%, var(--paper));
  background: var(--card);
  padding: 40px 36px;
}
.login-box h1 {
  margin: 0 0 32px;
  font-size: 32px;
  letter-spacing: -0.04em;
  font-weight: 400;
}
.login-box h1 b { color: var(--ikb); font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field span { font-size: 13px; color: var(--muted); }
.field input {
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  padding: 8px 0;
  outline: none;
}
.field input:focus { border-bottom-color: var(--ikb); }
.field input::placeholder { color: var(--muted); }
.submit {
  width: 100%;
  margin-top: 12px;
  background: var(--ikb);
  color: var(--on-ikb);
  border: 0;
  padding: 12px;
  cursor: pointer;
  font-weight: 600;
}
.submit:hover { filter: brightness(1.08); }
.submit:disabled { opacity: 0.6; cursor: wait; }
.error { color: var(--danger); font-size: 13px; min-height: 1.2em; margin: 0; }

@media (max-width: 1024px) {
  .wrap { padding: 8px 24px 32px; }
  .card.featured h2 { font-size: 32px; }
}
@media (max-width: 700px) {
  .wrap {
    padding: 8px 16px 24px;
    grid-template-rows: 72px auto auto;
  }
  .rail { gap: 12px; padding: 16px 0 20px; }
  .rail strong { font-size: 16px; }
  .studio {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      "feat"
      "a"
      "b"
      "c";
    gap: 16px;
    min-height: auto;
  }
  .card { grid-template-columns: 1fr; grid-template-rows: 96px 1fr; }
  .card.featured { grid-template-rows: 180px auto; }
  .card-media { min-height: 96px; }
  .card.featured .card-body { padding: 22px 20px 24px; }
  .card.featured h2 { font-size: 28px; }
}

@media (prefers-reduced-motion: no-preference) {
  .card-media img { transition: transform 480ms cubic-bezier(0.16, 1, 0.3, 1); }
  .card:not(.featured) { transition: background-color 180ms ease, color 180ms ease; }
  .card:not(.featured) .extra,
  .card:not(.featured) .pct,
  .card:not(.featured) .bar { transition: color 180ms ease, background-color 180ms ease; }
  .tools button, .submit { transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease; }
  .skeleton { animation: shine 1.4s ease-in-out infinite; }
}
@media (prefers-reduced-motion: reduce) {
  .card-media img { transform: none; }
}
@keyframes shine {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

@media (prefers-reduced-transparency: reduce) {
  .card-media img { mix-blend-mode: normal; opacity: 0.28; }
  .card.featured .card-body { background: var(--card); }
}

.portal-home {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #002FA7;
  text-decoration: none;
  margin-right: 12px;
  white-space: nowrap;
}
.portal-home:hover { text-decoration: underline; }
.lang-switch {
  font-size: 12px;
  font-weight: 600;
  color: inherit;
  opacity: 0.8;
  text-decoration: none;
}
.lang-switch:hover { opacity: 1; }
