/* Modal dialogs, authentication, terms, and page profile. */
body.popup-open,
body.confirm-open {
  overflow: hidden;
}

.ui-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 1250;
  display: grid;
  place-items: center;
  background: var(--overlay-scrim);
  padding: var(--space-6);
}

.ui-popup-overlay[hidden] {
  display: none !important;
}

.ui-popup-dialog {
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.ui-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  border-bottom: 1px solid var(--line);
  padding: var(--space-4) var(--space-5);
}

.ui-popup-title,
.ui-popup-header > h3 {
  margin: 0;
  font-size: var(--font-size-ui-xl);
  line-height: 1.2;
}

.ui-popup-close {
  white-space: nowrap;
}

.ui-popup-content {
  overflow: auto;
  padding: var(--space-5);
  display: grid;
  gap: var(--space-4);
}


.ui-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  background: var(--overlay-scrim);
  padding: var(--space-6);
}

.ui-confirm-overlay[hidden] {
  display: none !important;
}

.ui-confirm-dialog {
  width: min(540px, calc(100vw - 32px));
  border: 1px solid var(--line-strong);
  background: var(--surface);
  padding: var(--space-5);
  display: grid;
  gap: var(--space-4);
}

.ui-confirm-message {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
}

.ui-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

.ui-confirm-actions .btn {
  min-width: 88px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-8);
}

.login-card {
  width: 460px;
  padding: var(--space-6);
}

.auth-email-pattern {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  min-width: 0;
  font-size: var(--font-size-ui-sm);
}

.auth-email-pattern code {
  overflow-wrap: anywhere;
}

.auth-email-pattern > input {
  flex: 1 1 auto;
  min-width: 0;
}

.auth-email-check-result {
  min-height: 1.4em;
  margin: 0;
  font-size: var(--font-size-ui-sm);
}

.terms-consent {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3);
  align-items: start;
  padding: var(--space-3);
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--text-secondary);
  font-size: var(--font-size-ui-sm);
  line-height: 1.45;
}

.terms-consent input {
  margin-top: 0.2em;
}

.terms-consent-copy {
  display: grid;
  gap: var(--space-1);
}

.page-profile {
  border-top: 1px solid var(--line);
  background: var(--bg-topbar);
  color: var(--text-secondary);
  padding: var(--space-3) var(--space-5);
}

.page-profile-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-ui-sm);
  text-align: center;
  width: 100%;
  max-width: var(--layout-max-width);
  margin: 0 auto;
}

.page-profile-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
}

.page-profile-row-terms {
  flex-wrap: nowrap;
  color: var(--muted);
  line-height: 1.35;
}

.ui-popup-dialog.terms-of-use-popup {
  width: min(760px, calc(100vw - 32px));
}

.terms-of-use-body {
  display: grid;
  gap: var(--space-3);
  color: var(--text-secondary);
  line-height: 1.55;
}

.terms-of-use-effective {
  margin: 0;
  color: var(--muted);
  font-size: var(--font-size-ui-sm);
}

.terms-of-use-list {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding-left: 1.25rem;
}

.terms-of-use-list li {
  padding-left: var(--space-1);
  color: var(--text-secondary);
}

.page-profile-row > span {
  min-width: 0;
}

.page-profile-title {
  font-size: var(--font-size-ui-sm);
}

.page-profile-detail {
  display: inline-block;
  max-width: 100%;
  overflow: visible;
  text-overflow: clip;
  vertical-align: bottom;
  white-space: nowrap;
}

.page-profile-judgehost {
  color: var(--text-secondary);
}

.ui-popup-dialog.judgehost-status-popup {
  width: min(980px, calc(100vw - 32px));
}

.judgehost-status-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
}

.judgehost-status-summary > div {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  border-right: 1px solid var(--line);
}

.judgehost-status-summary > div:last-child {
  border-right: 0;
}

.judgehost-status-summary span {
  color: var(--muted);
  font-size: var(--font-size-ui-sm);
}

.judgehost-status-section {
  margin-top: var(--space-6);
}

.judgehost-status-section > h3 {
  margin-bottom: var(--space-3);
}

.judgehost-status-toolchains {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-3);
}

.judgehost-status-toolchain {
  border: 1px solid var(--line);
  background: var(--surface-alt);
  padding: var(--space-4);
}

.judgehost-status-host-table {
  min-width: 680px;
}

.judgehost-status-host-table td:not(:first-child) {
  white-space: nowrap;
}

.judgehost-status-toolchain-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.judgehost-status-toolchain h4,
.judgehost-status-toolchain p {
  margin: 0;
}

.judgehost-status-toolchain p + p {
  margin-top: var(--space-1);
}

.judgehost-status-toolchain-warning {
  border-color: var(--warn-line);
  background: var(--warn-bg);
}

.judgehost-status-toolchain-warning .judgehost-status-toolchain-head > strong {
  color: var(--warn-text);
  font-size: var(--font-size-ui-sm);
}

.judgehost-status-compile-table code {
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .judgehost-status-summary {
    grid-template-columns: 1fr;
  }

  .judgehost-status-summary > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .judgehost-status-summary > div:last-child {
    border-bottom: 0;
  }
}
