:root {
  --background: #f7f7f5;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #5f6b76;
  --border: #d8dee4;
  --accent: #234f7d;
  --accent-dark: #183a5c;
  --soft-accent: #eaf1f8;
  --soft-warning: #fff8e6;
  --warning-text: #765b12;
  --shadow: 0 8px 24px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background: var(--background);
  line-height: 1.6;
}

.app-container {
  width: min(1100px, 92%);
  margin: 0 auto;
  padding: 32px 0;
}

.app-header {
  margin-bottom: 24px;
}

.site-label {
  margin: 0 0 8px;
  color: var(--accent);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.1;
}

.intro {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.instructions-card,
.input-card,
.results-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.instructions-card {
  padding: 22px;
  margin-bottom: 18px;
}

.instructions-card h2,
.input-card h2,
.results-header h2 {
  margin: 0 0 10px;
  font-size: 1.3rem;
}

.instructions-card p {
  margin: 0 0 10px;
  color: var(--muted);
}

.instructions-card p:last-child {
  margin-bottom: 0;
}

.button-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  background: #ffffff;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: #f1f4f7;
}

.primary-btn {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.primary-btn:hover {
  background: var(--accent-dark);
}

.secondary-btn {
  color: var(--muted);
}

.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 22px;
}

.input-card {
  padding: 22px;
}

.wide-card {
  grid-column: 1 / -1;
}

.section-help {
  margin: 0 0 18px;
  color: var(--muted);
}

.two-column-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

.form-row {
  margin-bottom: 14px;
}

.two-column-fields .form-row {
  margin-bottom: 0;
}

label {
  display: block;
  margin-bottom: 6px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
}

.optional-note {
  color: var(--muted);
  font-weight: 400;
}

input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  font-size: 1rem;
}

input:focus {
  outline: 2px solid var(--soft-accent);
  border-color: var(--accent);
}

.results-section {
  padding: 24px;
}

.results-header {
  margin-bottom: 18px;
}

.results-header p {
  margin: 0;
  color: var(--muted);
}

.results-container {
  display: block;
}

.empty-results {
  padding: 20px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: #fbfbfa;
  color: var(--muted);
}

.empty-results p {
  margin: 0;
}

.ratio-category {
  margin-top: 26px;
}

.ratio-category:first-child {
  margin-top: 0;
}

.ratio-category h3 {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 1.25rem;
}

.ratio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.ratio-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fcfcfb;
}

.ratio-card h4 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.ratio-value {
  display: inline-block;
  margin: 0 0 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--soft-accent);
  color: var(--accent-dark);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
}

.need-data {
  background: var(--soft-warning);
  color: var(--warning-text);
}

.formula,
.interpretation,
.student-note {
  margin: 0 0 10px;
  color: var(--muted);
}

.student-note {
  margin-bottom: 0;
}

.formula strong,
.interpretation strong,
.student-note strong {
  color: var(--text);
}

.app-footer {
  margin-top: 24px;
  color: var(--muted);
  font-size: 0.92rem;
}

.app-footer a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 800px) {
  .input-grid,
  .two-column-fields,
  .ratio-grid {
    grid-template-columns: 1fr;
  }

  .button-panel {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .input-card,
  .results-section,
  .instructions-card {
    padding: 18px;
  }
}