:root {
  --page-bg-start: #edf2f8;
  --page-bg-end: #dfe7f1;
  --card-bg: #ffffff;
  --panel-border: #e4e9f2;
  --shadow-lg: 0 18px 48px rgba(38, 52, 70, 0.12);
  --shadow-md: 0 5px 12px rgba(38, 52, 70, 0.08);
  --text-main: #303030;
  --text-muted: #686868;
  --field-border: #e65858;
  --field-focus: #2979ff;
  --field-bg: #fbfcff;
  --error-text: #ff4747;
  --captcha-bg: #e8effd;
  --captcha-border: #e8effd;
  --captcha-text: #0750e8;
  --button-bg: #080808;
  --button-text: #ffffff;
  --font-sans: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --radius-xl: 22px;
  --radius-lg: 22px;
  --radius-md: 10px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 6px;
  background: linear-gradient(180deg, var(--page-bg-start), var(--page-bg-end));
  color: var(--text-main);
  font-family: var(--font-sans);
}

img {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
}

.page-shell {
  min-height: calc(100vh - 12px);
  display: grid;
  place-items: center;
  padding: 24px;
  border-radius: 22px;
  background: linear-gradient(180deg, #f0f4fa 0%, #e2e9f3 100%);
}

.result-card {
  width: min(1080px, calc(100vw - 160px));
  height: min(660px, calc(100vh - 180px));
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.form-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px 38px 26px;
  background: var(--card-bg);
}

.board-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.13));
}

.title-block {
  max-width: 100%;
  margin-top: 10px;
  text-align: center;
}

.title-block h1 {
  margin: 0;
  font-size: clamp(1.38rem, 1.14rem + 0.52vw, 1.7rem);
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: 0;
}

.result-label {
  margin: 5px 0 0;
  font-size: 0.88rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: #5f5f5f;
}

.exam-label {
  display: inline-block;
  margin: 4px 0 0;
  padding: 1px 3px;
  background: #dbe7f3;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: uppercase;
}

.result-form {
  width: min(100%, 500px);
  margin-top: 28px;
}

.field {
  display: block;
  margin: 0 0 20px;
}

.field input {
  width: 100%;
  height: 52px;
  padding: 0 20px;
  border: 2px solid var(--panel-border);
  border-radius: var(--radius-md);
  background: var(--field-bg);
  color: var(--text-main);
  outline: none;
  box-shadow: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
  font-size: 1rem;
}

.field input::placeholder {
  color: #777777;
}

.field input:focus {
  border-color: var(--field-focus);
  box-shadow: 0 0 0 3px rgba(119, 145, 176, 0.14);
}

.field.is-invalid input {
  border-color: var(--field-border);
  box-shadow: 0 2px 7px rgba(255, 89, 89, 0.09);
}

.field .error-text {
  display: none;
  margin-top: 8px;
  padding-left: 2px;
  color: var(--error-text);
  font-size: 0.82rem;
  line-height: 1.2;
}

.field.is-invalid .error-text {
  display: block;
}

.captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 12px;
  margin-bottom: 20px;
  padding: 18px 20px;
  border: 2px solid var(--panel-border);
  border-radius: var(--radius-md);
  background: var(--field-bg);
}

.captcha-box {
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--captcha-border);
  border-radius: 6px;
  background: var(--captcha-bg);
  color: var(--captcha-text);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  box-shadow: none;
}

.refresh-button {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: #dedede;
  color: #333333;
  cursor: pointer;
  box-shadow: none;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.refresh-button:hover {
  background: #d8d8d8;
  transform: translateY(-1px);
}

.refresh-button:focus-visible {
  outline: 3px solid rgba(127, 178, 255, 0.25);
  outline-offset: 2px;
}

.refresh-button svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.submit-button {
  width: 100%;
  height: 56px;
  margin-top: 2px;
  border: 0;
  border-radius: 9px;
  background: var(--button-bg);
  color: var(--button-text);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
}

.submit-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(8, 8, 8, 0.22);
}

.submit-button:active {
  transform: translateY(0);
}

.admin-link {
  display: inline-flex;
  justify-content: center;
  margin-top: 16px;
  color: #1e68f0;
  font-size: 0.95rem;
  font-weight: 700;
}

.admin-link:hover {
  text-decoration: underline;
}

.status-message {
  margin: 12px 0 0;
  text-align: center;
  color: #2d7e2d;
  font-size: 0.84rem;
}

.status-message:empty {
  display: none;
}

.image-panel {
  min-height: 0;
  background: #f8fbff;
}

.image-panel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(75, 82, 90, 0.62);
}

.result-overlay.is-visible {
  display: grid;
}

.result-overlay__content {
  width: min(700px, calc(100vw - 48px));
  min-height: 414px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 24px;
  padding: 46px 40px 32px;
  border-radius: 4px;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.16);
  text-align: center;
}

.result-overlay__icon {
  position: relative;
  width: 120px;
  height: 120px;
  border: 5px solid #ee7175;
  border-radius: 50%;
}

.result-overlay__icon::before,
.result-overlay__icon::after {
  content: "";
  position: absolute;
  top: 54px;
  left: 31px;
  width: 58px;
  height: 5px;
  border-radius: 999px;
  background: #ee7175;
}

.result-overlay__icon::before {
  transform: rotate(45deg);
}

.result-overlay__icon::after {
  transform: rotate(-45deg);
}

.result-overlay__title {
  margin: 28px 0 0;
  color: #42454a;
  font-size: 2.55rem;
  font-weight: 700;
  line-height: 1.1;
}

.result-overlay__text {
  margin: -6px 0 0;
  color: #595d63;
  font-size: 1.42rem;
  font-weight: 400;
  line-height: 1.35;
}

.result-overlay__button {
  min-width: 86px;
  height: 58px;
  margin-top: 10px;
  padding: 0 24px;
  border: 0;
  border-radius: 7px;
  background: #2f86d6;
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 0 0 5px rgba(47, 134, 214, 0.22);
}

.result-overlay__button:focus-visible {
  outline: 3px solid rgba(47, 134, 214, 0.35);
  outline-offset: 4px;
}

.result-overlay__spinner {
  display: none;
}

@media (max-width: 1080px) {
  .result-card {
    width: min(1000px, calc(100vw - 100px));
    height: min(620px, calc(100vh - 120px));
  }

  .form-panel {
    padding: 22px 24px 22px;
  }

  .board-logo {
    width: 56px;
    height: 56px;
  }

  .title-block h1 {
    font-size: clamp(1.24rem, 1.05rem + 0.42vw, 1.48rem);
  }
}

@media (max-width: 860px) {
  body {
    padding: 0;
  }

  .page-shell {
    min-height: 100vh;
    padding: 28px 22px;
    align-items: start;
    border-radius: 0;
  }

  .result-card {
    width: min(590px, 100%);
    height: auto;
    grid-template-columns: 1fr;
    border-radius: 26px;
  }

  .form-panel {
    justify-content: flex-start;
    padding: 26px 30px 24px;
  }

  .title-block h1 {
    max-width: 440px;
    font-size: 1.62rem;
    line-height: 1.18;
  }

  .title-block {
    margin-top: 10px;
  }

  .result-form {
    width: 100%;
    margin-top: 24px;
  }

  .field {
    margin-bottom: 16px;
  }

  .field input {
    height: 52px;
    padding: 0 22px;
    font-size: 1.04rem;
  }

  .captcha-row {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 16px;
    padding: 14px 20px 16px;
  }

  .captcha-box {
    width: 132px;
    height: 48px;
    justify-self: center;
    font-size: 1.36rem;
  }

  .refresh-button {
    min-height: 48px;
    width: 100%;
  }

  .submit-button {
    height: 56px;
    font-size: 1.06rem;
  }

  .image-panel {
    height: clamp(360px, 66vw, 420px);
    border-left: 0;
    border-top: 1px solid #d9dee8;
  }

  .image-panel img {
    object-position: center top;
  }

  .result-overlay__content {
    width: min(560px, calc(100vw - 44px));
    min-height: 360px;
    padding: 38px 28px 30px;
  }

  .result-overlay__icon {
    width: 98px;
    height: 98px;
  }

  .result-overlay__icon::before,
  .result-overlay__icon::after {
    top: 44px;
    left: 25px;
    width: 48px;
  }

  .result-overlay__title {
    margin-top: 18px;
    font-size: 2.1rem;
  }

  .result-overlay__text {
    font-size: 1.12rem;
  }
}

@media (max-width: 480px) {
  .page-shell {
    padding: 24px 22px;
  }

  .form-panel {
    padding: 28px 26px 22px;
  }

  .board-logo {
    width: 72px;
    height: 72px;
  }

  .title-block h1 {
    font-size: 1.42rem;
    line-height: 1.18;
  }

  .result-label {
    margin-top: 7px;
    font-size: 0.88rem;
  }

  .exam-label {
    margin-top: 3px;
    background: transparent;
    font-size: 0.8rem;
    letter-spacing: 0;
  }

  .result-form {
    margin-top: 22px;
  }

  .field {
    margin-bottom: 14px;
  }

  .field input {
    height: 48px;
    padding: 0 20px;
    font-size: 0.98rem;
  }

  .captcha-row {
    grid-template-columns: 1fr;
    gap: 9px;
    margin-bottom: 14px;
    padding: 13px 18px 15px;
  }

  .captcha-box {
    width: 124px;
    height: 44px;
    justify-self: center;
    font-size: 1.24rem;
    letter-spacing: 0.18em;
  }

  .refresh-button {
    min-height: 44px;
  }

  .submit-button {
    height: 56px;
    margin-top: 0;
    font-size: 1.04rem;
  }

  .image-panel {
    height: clamp(340px, 86vw, 420px);
  }
}
