/* Оформление приложения ученика: мобильный-first, без внешних зависимостей. */

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1b2333;
  --muted: #6b7488;
  --border: #dde3ee;
  --primary: #2f5cff;
  --primary-dark: #2447cc;
  --success-bg: #e7f7ed;
  --success-text: #17663a;
  --error-bg: #fdecec;
  --error-text: #a3252b;
  --warning-bg: #fff5e0;
  --warning-text: #8a5a00;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(23, 35, 66, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 650;
  letter-spacing: 0.01em;
}

.logout {
  margin: 0;
}

.link-button {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  padding: 6px 8px;
  border-radius: 8px;
}

.link-button:hover {
  background: rgba(47, 92, 255, 0.08);
}

.content {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.footer {
  padding: 14px 18px 26px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.card-narrow {
  max-width: 420px;
  margin: 6vh auto 0;
}

h1 {
  font-size: 22px;
  line-height: 1.25;
  margin: 0 0 8px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 14px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

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

.field-label {
  font-size: 14px;
  color: var(--muted);
}

input.answer-input {
  width: 100%;
  padding: 13px 14px;
  font-size: 18px;
  font-family: inherit;
  color: var(--text);
  background: #fbfcff;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input.answer-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 92, 255, 0.15);
  background: #fff;
}

input.code-input {
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 22px;
  text-align: center;
}

.button {
  display: inline-block;
  padding: 13px 18px;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  background: #eef1f8;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.button-primary {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.button-primary:hover {
  background: var(--primary-dark);
}

.button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin: 0 0 14px;
}

.alert-error {
  background: var(--error-bg);
  color: var(--error-text);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
}

.homework-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.badge {
  display: inline-block;
  padding: 5px 11px;
  border-radius: 999px;
  background: #eef1f8;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.question-list,
.answer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.question-label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
}

.question-number,
.answer-number {
  flex: 0 0 auto;
  min-width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #eef1f8;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.question-title {
  font-weight: 550;
}

.field-error {
  margin: 0;
  color: var(--error-text);
  font-size: 14px;
}

.field-note {
  margin: 0;
  color: var(--warning-text);
  font-size: 13px;
}

.answer-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.answer-row:last-child {
  border-bottom: none;
}

.answer-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.answer-title {
  color: var(--muted);
  font-size: 14px;
}

.answer-value {
  font-weight: 600;
  word-break: break-word;
}

.answer-empty {
  color: var(--muted);
  font-weight: 400;
  font-style: italic;
}

@media (max-width: 480px) {
  body {
    font-size: 16px;
  }

  .card {
    padding: 16px;
  }

  .content {
    padding: 16px 12px 32px;
  }
}
