* {
  box-sizing: border-box;
}
:root {
  font-family:
    Inter,
    Segoe UI,
    system-ui,
    sans-serif;
  color: #1b2841;
  background: #f5f7fc;
  font-size: 16px;
  line-height: 1.5;
  --blue: #4354d8;
  --line: #e1e6f0;
  --muted: #63718b;
}
body {
  margin: 0;
}
a {
  color: #3548c7;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a.button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: white;
  color: #273650;
  border-radius: 9px;
  padding: 9px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  text-decoration: none;
}
button:hover,
a.button:hover {
  border-color: #8894e9;
  background: #f1f3ff;
}
button:disabled {
  opacity: 0.6;
  cursor: wait;
}
.primary {
  background: var(--blue) !important;
  color: white !important;
  border-color: var(--blue) !important;
}
.quiet {
  background: transparent;
  border: 0;
}
.topbar {
  height: 80px;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  border-bottom: 1px solid var(--line);
  gap: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 750;
  color: #1a2543;
}
.brand-light {
  font-weight: 400;
}
.brand:hover {
  text-decoration: none;
}
.version {
  font-size: 12px;
  background: #eef0fc;
  color: #5863ad;
  padding: 2px 7px;
  border-radius: 6px;
}
.layout {
  display: flex;
  max-width: 1600px;
  margin: auto;
  min-height: calc(100vh - 80px);
}
nav {
  width: 215px;
  flex-shrink: 0;
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
nav a {
  display: block;
  border-radius: 9px;
  padding: 12px 16px;
  color: #56617c;
  font-weight: 550;
}
nav a.active {
  color: var(--blue);
  background: #e9edff;
}
main {
  flex: 1;
  padding: 36px 36px 60px;
  min-width: 0;
}
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}
h1 {
  font-size: 30px;
  line-height: 1.2;
  margin: 0 0 10px;
  letter-spacing: -0.7px;
}
h2 {
  font-size: 21px;
  margin: 0 0 16px;
}
h3 {
  margin: 0 0 10px;
  font-size: 18px;
}
p {
  margin: 0 0 15px;
}
.muted,
.hint {
  color: var(--muted);
}
.hint {
  font-size: 14px;
}
.eyebrow {
  font-size: 12px;
  font-weight: 750;
  color: #727fa3;
  letter-spacing: 1.6px;
  display: block;
  margin-bottom: 8px;
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 3px 12px #18244403;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 18px;
}
.task-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  min-height: 210px;
}
.task-card .button {
  margin-top: auto;
  align-self: flex-start;
}
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.task-icon {
  font-size: 24px;
  color: var(--blue);
  background: #eff1ff;
  border-radius: 10px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}
.tag {
  font-size: 13px;
  padding: 4px 9px;
  border-radius: 7px;
  background: #f0f3f9;
  color: #65708a;
}
.empty {
  padding: 60px 24px;
  text-align: center;
  background: white;
  border: 1px dashed #ccd4e5;
  border-radius: 14px;
}
.empty .symbol {
  font-size: 34px;
  color: #9aa7c9;
  margin-bottom: 15px;
}
.auth {
  max-width: 440px;
  margin: 65px auto;
  padding: 34px;
}
.auth h1 {
  font-size: 28px;
}
.auth .primary {
  width: 100%;
}
label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 17px;
  font-weight: 550;
  font-size: 15px;
}
label.check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-weight: 400;
}
label.check input {
  width: auto;
  min-height: auto;
}
input,
select,
textarea {
  border: 1px solid #cfd7e6;
  background: white;
  color: #1b2841;
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
  min-width: 0;
}
input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid #bfc7ff;
  outline-offset: 2px;
}
textarea {
  min-height: 190px;
  resize: vertical;
}
textarea.code {
  font-family: Consolas, ui-monospace, monospace;
  font-size: 14px;
  line-height: 1.65;
  min-height: 330px;
  tab-size: 4;
}
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar > * {
  width: auto;
}
.toolbar input.search {
  flex: 1;
  min-width: 180px;
  max-width: 440px;
}
.table-wrap {
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  text-align: left;
  color: #73819a;
  background: #f8faff;
  font-weight: 550;
  padding: 14px 17px;
  white-space: nowrap;
}
td {
  padding: 16px 17px;
  border-top: 1px solid #e9edf5;
  vertical-align: middle;
}
tr:hover td {
  background: #fafbff;
}
td .muted {
  font-size: 13px;
}
.mono {
  font-family: Consolas, monospace;
}
.verdict {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  border-radius: 7px;
  padding: 5px 9px;
  white-space: nowrap;
  background: #edf0fa;
  color: #4a5a83;
}
.verdict.ac {
  background: #e8f7ee;
  color: #24734a;
}
.verdict.bad {
  background: #fff2dc;
  color: #926115;
}
.verdict.live {
  background: #ecefff;
  color: #4554ca;
}
.submission-table {
  table-layout: fixed;
  min-width: 1020px;
}
.submission-table td {
  height: 76px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.submission-table .verdict {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.status-label {
  font-size: 13px;
  color: #6f7e99;
  margin-top: 5px;
}
.pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}
.error {
  color: #815411;
  background: #fff6e5;
  border: 1px solid #f1dfba;
  padding: 12px 14px;
  border-radius: 8px;
  margin-top: 14px;
}
.error:empty {
  display: none;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.avatar {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: #e9edff;
  color: var(--blue);
  display: grid;
  place-items: center;
  font-weight: 700;
}
.role {
  font-size: 12px;
  color: var(--muted);
}
dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  width: min(600px, calc(100% - 28px));
  max-height: 90vh;
  padding: 30px;
  color: #1b2841;
  box-shadow: 0 24px 80px #14234235;
}
dialog::backdrop {
  background: #18254070;
}
.close {
  float: right;
  min-height: 32px;
  padding: 0 9px;
  font-size: 24px;
  border: 0;
}
.dialog-head {
  padding-right: 35px;
}
.checklist {
  max-height: 270px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}
.checklist label {
  padding: 7px 0;
  border-bottom: 1px solid #eef1f7;
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
.statement {
  overflow-wrap: anywhere;
}
.statement img {
  max-width: 100%;
  height: auto;
}
.statement pre {
  white-space: pre-wrap;
  background: #f5f7fb;
  padding: 12px;
  border-radius: 8px;
}
.statement .section-title {
  font-weight: 700;
  margin: 20px 0 10px;
}
.statement .title {
  font-weight: 700;
  font-size: 23px;
  margin-bottom: 14px;
}
.statement .property-title {
  font-weight: 600;
}
.statement table {
  border: 1px solid var(--line);
  margin: 14px 0;
}
.statement .katex {
  font-size: 1.08em;
}
#notice {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  padding: 13px 20px;
  border: 1px solid #c5cdee;
  border-radius: 11px;
  background: #eef1ff;
  color: #293985;
  box-shadow: 0 8px 25px #13255920;
  z-index: 5;
}
.loading {
  color: var(--muted);
  padding: 40px;
  text-align: center;
}
.details-score {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -1px;
}
.source-view {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: Consolas, monospace;
  max-height: 400px;
  overflow: auto;
  background: #f5f7fc;
  padding: 18px;
  border-radius: 9px;
}
.connection {
  color: #87601f;
  font-size: 14px;
  margin: 12px 0;
}
.small-actions button {
  padding: 6px 10px;
  font-size: 13px;
  min-height: 34px;
}
[hidden] {
  display: none !important;
}
@media (max-width: 1050px) {
  .split {
    grid-template-columns: 1fr;
  }
  nav {
    width: 185px;
  }
  main {
    padding: 28px 22px;
  }
}
@media (max-width: 700px) {
  .topbar {
    padding: 0 16px;
    height: 72px;
    gap: 8px;
  }
  .brand {
    font-size: 20px;
    gap: 8px;
  }
  .brand img {
    width: 29px;
    height: 29px;
  }
  .version,
  .user .role {
    display: none;
  }
  .user {
    gap: 7px;
  }
  .user-name {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .layout {
    display: block;
  }
  nav {
    width: 100%;
    padding: 12px;
    flex-direction: row;
    overflow: auto;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    background: #fff;
  }
  nav a {
    padding: 8px 12px;
    white-space: nowrap;
    font-size: 14px;
  }
  main {
    padding: 24px 16px 40px;
  }
  .page-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  h1 {
    font-size: 26px;
  }
  .panel {
    padding: 19px;
  }
  .auth {
    margin: 30px auto;
  }
  .row {
    grid-template-columns: 1fr;
  }
  .cards {
    grid-template-columns: 1fr;
  }
  .toolbar {
    gap: 8px;
  }
  .toolbar > * {
    width: 100%;
  }
  .toolbar .button {
    width: auto;
  }
  th,
  td {
    padding: 12px 13px;
  }
  dialog {
    padding: 23px;
  }
  .user button {
    padding: 5px 10px;
    min-height: 34px;
  }
  .split {
    gap: 0;
  }
}

/* Contest pages retain the portal palette and table scroll boundary. */
.contest-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.inline-label {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
}
.inline-label select {
  width: auto;
}
#contest-body > .panel,
#cj-board,
#cj-runs > .panel {
  margin-bottom: 20px;
}
.standings th:not(:nth-child(2)),
.standings td:not(:nth-child(2)) {
  text-align: center;
}
.cell-ac {
  background: #e7f5f0;
  color: #086343;
  font-weight: 700;
}
.cell-pending {
  background: #f0edff;
  color: #5c3ea4;
}
.result-large {
  font-size: 1.5rem;
  font-weight: 700;
}
.source-preview {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 440px;
  overflow: auto;
}
#c-inspector .toolbar {
  max-height: 300px;
  overflow: auto;
}
#cj-roster {
  max-height: 300px;
  overflow: auto;
}
@media (max-width: 680px) {
  .contest-tabs .button {
    flex: 1 1 40%;
    text-align: center;
  }
  .contest-tabs .inline-label {
    flex: 1 1 40%;
  }
}

:root[data-accent="purple"] {
  --blue: #7241b7;
}
:root[data-accent="navy"] {
  --blue: #254476;
}
.brand > span {
  overflow-wrap: anywhere;
}
