:root {
  --page-bg-start: #d8ecfe;
  --page-bg-end: #eef6ff;
  --card-bg: #ffffff;
  --panel-border: #dbe7f4;
  --shadow-lg: 0 22px 48px rgba(65, 89, 116, 0.24);
  --shadow-md: 0 8px 18px rgba(65, 89, 116, 0.15);
  --text-main: #2b2b2b;
  --text-muted: #8e8e8e;
  --field-border: #ff5959;
  --field-focus: #7fb2ff;
  --field-bg: #ffffff;
  --error-text: #ff4747;
  --captcha-bg: #d9ebfb;
  --captcha-border: #d6e4f2;
  --captcha-text: #1e68f0;
  --button-bg: #1f1f1f;
  --button-text: #ffffff;
  --font-sans: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 10px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 20px;
  background: #fafafb;
  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 - 40px);
  display: grid;
  place-items: center;
  padding: 22px;
  border-radius: 30px;
}

.result-card {
  width: min(1310px, calc(100vw - 190px));
  height: min(742px, calc(100vh - 96px));
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.03fr);
  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: 34px 42px 30px;
  background: var(--card-bg);
}

.board-logo {
  width: 98px;
  height: 98px;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.16));
}

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

.title-block h1 {
  margin: 0;
  font-size: clamp(1.35rem, 1.05rem + 0.68vw, 1.75rem);
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: -0.02em;
}

.result-label {
  margin: 16px 0 0;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.exam-label {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

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

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

.field input {
  width: 100%;
  height: 48px;
  padding: 0 18px;
  border: 1.5px solid #d9d9d9;
  border-radius: var(--radius-md);
  background: var(--field-bg);
  color: var(--text-main);
  outline: none;
  box-shadow: 0 2px 7px rgba(60, 90, 120, 0.08);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
  font-size: 1rem;
}

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

.field input:focus {
  border-color: var(--field-focus);
  box-shadow: 0 0 0 3px rgba(127, 178, 255, 0.18);
}

.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) 68px;
  gap: 10px;
  margin-bottom: 18px;
}

.captcha-box {
  height: 50px;
  display: grid;
  place-items: center;
  border: 1px solid var(--captcha-border);
  border-radius: 6px;
  background: var(--captcha-bg);
  color: var(--captcha-text);
  font-size: clamp(1.75rem, 1.28rem + 0.72vw, 2.15rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.refresh-button {
  display: grid;
  place-items: center;
  border: 1.5px solid #9ec1ff;
  border-radius: 8px;
  background: #edf4ff;
  color: #8e8e8e;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

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

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

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

.submit-button {
  width: 100%;
  height: 50px;
  margin-top: 8px;
  border: 0;
  border-radius: 18px;
  background: var(--button-bg);
  color: var(--button-text);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  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 12px 22px rgba(31, 31, 31, 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: #ffffff;
}

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

.result-overlay__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.result-overlay__spinner {
  width: 52px;
  height: 52px;
  border: 4px solid #dfe8f3;
  border-top-color: #2a6ee8;
  border-radius: 50%;
  animation: result-spin 0.75s linear infinite;
}

.result-overlay__spinner.is-hidden {
  display: none;
}

.result-overlay__text {
  margin: 0;
  color: #2a2a2a;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

@keyframes result-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

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

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

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

  .title-block h1 {
    font-size: clamp(1.28rem, 1.08rem + 0.44vw, 1.55rem);
  }
}

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

  .page-shell {
    min-height: calc(100vh - 28px);
    padding: 12px;
    border-radius: 26px;
  }

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

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

  .title-block h1 {
    font-size: 1.16rem;
  }

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

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

  .captcha-row {
    grid-template-columns: minmax(0, 1fr) 74px;
  }

  .captcha-box {
    height: 50px;
    font-size: 1.45rem;
  }

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

  .submit-button {
    height: 50px;
    font-size: 0.98rem;
  }

  .image-panel {
    height: clamp(350px, 92vw, 430px);
    border-left: 0;
  }

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

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

  .form-panel {
    padding: 20px 18px 14px;
  }

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

  .title-block h1 {
    font-size: 0.98rem;
  }

  .result-label {
    margin-top: 12px;
    font-size: 0.9rem;
  }

  .exam-label {
    margin-top: 10px;
    font-size: 0.68rem;
    letter-spacing: 0.07em;
  }

  .field {
    margin-bottom: 16px;
  }

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

  .captcha-row {
    grid-template-columns: minmax(0, 1fr) 74px;
    gap: 10px;
    margin-bottom: 16px;
  }

  .captcha-box {
    height: 50px;
    font-size: 0.92rem;
    letter-spacing: 0.18em;
  }

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

  .submit-button {
    height: 50px;
    margin-top: 2px;
    font-size: 0.92rem;
  }

  .image-panel {
    height: clamp(300px, 84vw, 390px);
  }
}
