:root {
  --bg: #edf3fb;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --line: #d7e0ef;
  --text: #102033;
  --muted: #60718d;
  --blue: #2156d9;
  --blue-soft: #e9f0ff;
  --green: #127a57;
  --amber: #9e6200;
  --shadow: 0 24px 60px rgba(18, 32, 51, 0.12);
  --radius: 20px;
  --radius-sm: 14px;
  --font: "Segoe UI", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: linear-gradient(180deg, #f4f7fc 0%, #eaf0f9 100%);
  color: var(--text);
  font-family: var(--font);
}

.page-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.back-link {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.back-link:hover {
  color: var(--blue);
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.language-switch-btn {
  min-width: 34px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.language-switch-btn.is-active {
  background: var(--text);
  color: #fff;
}

.hero,
.panel {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(215, 224, 239, 0.94);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.7fr);
  gap: 20px;
  margin-bottom: 20px;
}

.eyebrow {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 10px 0 12px;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 0.98;
}

.hero-text,
.helper-note,
.hero-note li,
.status-line,
.result-empty,
.cheatsheet-card li {
  color: var(--muted);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.hero-note {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 20px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
}

.hero-note-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--blue);
  margin-bottom: 10px;
}

.hero-note ul {
  margin: 0;
  padding-left: 18px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.panel {
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-header h2 {
  margin: 0;
  font-size: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-grid label span {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: white;
  color: var(--text);
}

input:focus,
select:focus {
  outline: 2px solid #cfe0ff;
  border-color: #9db8ff;
}

input:disabled,
select:disabled {
  color: #94a3b8;
  background: #eef2f7;
  cursor: not-allowed;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.18s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #2f68ef 0%, #1a49b5 100%);
  color: white;
}

.btn-secondary {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-line {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.status-line.is-error {
  background: #fff3f1;
  border-color: #ffd4cf;
  color: #9e2f1f;
}

.result-empty {
  padding: 22px 0 4px;
}

.mix-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mix-title {
  margin: 0;
  font-size: 24px;
}

.mix-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.mix-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.mix-kpi,
.mix-block {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: var(--surface);
}

.mix-kpi-label,
.mix-block-title {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.mix-kpi-value {
  font-size: 24px;
  font-weight: 800;
}

.mix-block ul {
  margin: 0;
  padding-left: 18px;
}

.mix-block li + li {
  margin-top: 8px;
}

.constraint-notes,
.source-list span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.source-list strong {
  color: var(--text);
}

.mix-markdown {
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 14px;
}

.feedback-panel {
  margin-bottom: 20px;
}

.feedback-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.feedback-grid div {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: var(--surface-soft);
  color: var(--muted);
  line-height: 1.5;
}

.cheatsheet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.cheatsheet-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 18px 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.cheatsheet-card h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.cheatsheet-card ul {
  margin: 0;
  padding-left: 18px;
}

@media (max-width: 980px) {
  .hero,
  .layout,
  .cheatsheet-grid,
  .feedback-grid,
  .mix-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
