* {
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(circle at top, #16213e, #0b1124 60%);
  color: #f5f7ff;
  margin: 0;
  padding: 32px 24px;
  min-height: 100vh;
}

.container {
  max-width: 920px;
  margin: 0 auto;
  background: rgba(13, 22, 50, 0.88);
  border: 1px solid rgba(120, 150, 255, 0.2);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 20px 40px rgba(8, 12, 30, 0.55);
}

h1 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 2rem;
  letter-spacing: 0.02em;
}

.lead {
  margin-top: 0;
  margin-bottom: 24px;
  color: rgba(240, 243, 255, 0.82);
  line-height: 1.5;
}

.api-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border-radius: 14px;
  background: rgba(23, 35, 71, 0.8);
  border: 1px solid rgba(120, 150, 255, 0.18);
  margin-bottom: 28px;
}

.api-box label {
  grid-column: 1 / -1;
  font-weight: 600;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(120, 150, 255, 0.25);
  background: rgba(12, 18, 40, 0.95);
  color: #f5f7ff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: #7c89ff;
  box-shadow: 0 0 0 3px rgba(124, 137, 255, 0.2);
}

input.error,
select.error {
  border-color: #ff7171;
  box-shadow: 0 0 0 3px rgba(255, 113, 113, 0.2);
}

button {
  padding: 12px 22px;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(135deg, #7c89ff, #6c5ce7);
  color: #fefefe;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(108, 92, 231, 0.35);
}

fieldset {
  border: 1px solid rgba(120, 150, 255, 0.18);
  border-radius: 18px;
  padding: 20px 24px 28px;
  background: rgba(18, 26, 56, 0.6);
}

legend {
  padding: 0 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-weight: 600;
}

.other-input {
  background: rgba(13, 22, 50, 0.6);
  border-radius: 12px;
  padding: 10px;
  border: 1px dashed rgba(120, 150, 255, 0.25);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.other-input input {
  background: rgba(11, 18, 42, 0.95);
}

.other-input small {
  color: rgba(242, 245, 255, 0.7);
  font-size: 0.8rem;
}

.hidden {
  display: none !important;
}

.actions {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
}

.form-message {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-left: 4px solid rgba(255, 255, 255, 0.25);
  font-weight: 500;
  line-height: 1.4;
}

.form-message.error {
  background: rgba(255, 113, 113, 0.12);
  border-left-color: #ff7171;
  color: #ffb5b5;
}

.form-message.success {
  background: rgba(88, 239, 155, 0.12);
  border-left-color: #58ef9b;
  color: #b9ffdc;
}

.result {
  margin-top: 28px;
}

.result h2 {
  margin-bottom: 16px;
}

.result-card {
  padding: 22px;
  border-radius: 18px;
  border: 1px solid rgba(120, 150, 255, 0.22);
  background: rgba(18, 25, 55, 0.75);
  box-shadow: inset 0 0 0 1px rgba(124, 137, 255, 0.08);
}

.result-card.positive {
  border-left: 6px solid #58ef9b;
}

.result-card.negative {
  border-left: 6px solid #ff7171;
}

.result-card.warning {
  border-left: 6px solid #ffd166;
}

.result-card.neutral {
  border-left: 6px solid #7c89ff;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  background: rgba(124, 137, 255, 0.2);
  color: #f5f7ff;
}

.result-card.positive .badge {
  background: rgba(88, 239, 155, 0.18);
  color: #c6ffe4;
}

.result-card.negative .badge {
  background: rgba(255, 113, 113, 0.18);
  color: #ffd3d3;
}

.result-card.warning .badge {
  background: rgba(255, 209, 102, 0.2);
  color: #fff2c4;
}

.result-card p {
  margin: 12px 0 0;
  line-height: 1.6;
  color: rgba(240, 243, 255, 0.88);
}

.result-card .probability {
  margin-top: 8px;
  font-weight: 600;
  font-size: 1rem;
}

.raw-details {
  margin-top: 16px;
  background: rgba(11, 18, 40, 0.6);
  border-radius: 14px;
  border: 1px solid rgba(120, 150, 255, 0.18);
  padding: 12px 16px;
}

.raw-details summary {
  cursor: pointer;
  font-weight: 600;
}

.raw-details pre {
  margin-top: 12px;
  padding: 12px;
  background: rgba(7, 11, 25, 0.9);
  border-radius: 12px;
  overflow-x: auto;
  color: #e4e7ff;
}

footer {
  margin-top: 32px;
  font-size: 0.9rem;
  color: rgba(210, 218, 255, 0.7);
  display: flex;
  gap: 8px;
  align-items: center;
}

footer a {
  color: rgba(200, 210, 255, 0.95);
  text-decoration: none;
  position: relative;
}

footer a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: rgba(200, 210, 255, 0.6);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

footer a:hover::after {
  transform: scaleX(1);
}

@media (max-width: 720px) {
  body {
    padding: 20px 16px;
  }

  .container {
    padding: 24px 18px;
  }

  .api-box {
    grid-template-columns: 1fr;
  }

  .actions {
    justify-content: stretch;
  }

  .actions button {
    width: 100%;
  }
}
