:root {
  --bg: #eff2ff;
  --surface: #ffffff;
  --surface-soft: #f8f9ff;
  --line: #d9def5;
  --text: #1b234f;
  --text-muted: #4e5682;
  --accent: #4348c8;
  --accent-strong: #2c32ad;
  --shadow: 0 12px 30px rgba(25, 36, 92, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Lexend", sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 100% 0%, #dbe1ff 0%, #eff2ff 65%);
}

a {
  color: var(--accent-strong);
}

.page-header {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 144px;
  height: auto;
}

.page-header nav {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.page-header nav a {
  font-weight: 600;
  text-decoration: none;
}

.page-header nav a:hover {
  text-decoration: underline;
}

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 6px 20px 32px;
}

.intro,
.controls-panel,
.preview-wrapper,
.faq {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.intro {
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.8rem;
  color: var(--text-muted);
}

h1 {
  margin: 0;
  font-size: clamp(1.65rem, 4vw, 2.4rem);
  line-height: 1.1;
}

.intro p {
  margin: 12px 0 0;
  line-height: 1.6;
  max-width: 72ch;
}

.controls-panel {
  margin-bottom: 14px;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-weight: 600;
  font-size: 0.95rem;
}

.field-full {
  margin-top: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c8cff0;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface-soft);
}

textarea {
  resize: vertical;
}

.actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.helper-copy {
  margin: 10px 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  color: #ffffff;
  background: var(--accent);
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status {
  margin: 10px 0 0;
  color: var(--text-muted);
  min-height: 1.3em;
}

.status.error {
  color: #b51f3b;
}

.preview-wrapper h2,
.faq h2 {
  margin: 0;
}

.preview-wrapper > p {
  margin: 8px 0 0;
  color: var(--text-muted);
}

.sheets-container {
  margin-top: 14px;
  display: grid;
  gap: 16px;
}

.sheet {
  width: 210mm;
  min-height: 297mm;
  background: #ffffff;
  border: 1px solid #d7dbee;
  border-radius: 6px;
  margin: 0 auto;
  padding: 9mm;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  align-items: stretch;
  gap: 5mm;
}

.card {
  height: 100%;
  min-height: 0;
  border: 1px solid #bec8fa;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  background: linear-gradient(180deg, #f6f8ff 0%, #ffffff 34%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.card-brand {
  background: linear-gradient(120deg, #303aa4 0%, #545eda 100%);
  color: #ffffff;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
}

.card-brand-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.card-brand-name {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.2;
  color: #ffffff;
}

.card-brand-meta {
  margin: 1px 0 0;
  font-size: 0.62rem;
  line-height: 1.2;
  opacity: 0.94;
}

.card-body {
  padding: 8px 8px 9px;
  display: grid;
  grid-template-rows: 1fr;
  min-height: 0;
  background: #eef1ff;
}

.card-title {
  margin: 0 0 7px;
  font-size: 0.73rem;
  color: #2f3775;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.word-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 5px;
  align-content: stretch;
}

.word-list li {
  list-style: none;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 3.84px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(81, 86, 206, 0.08);
  min-height: 32px;
  display: flex;
  align-items: center;
}

.word-input {
  width: 100%;
  border: 0;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 8px;
  background: transparent;
  color: #5156ce;
  min-height: 32px;
  text-align: center;
}

.word-input:focus {
  outline: 2px solid rgba(81, 86, 206, 0.35);
  outline-offset: 0;
}

.faq {
  margin-top: 14px;
}

.faq ul {
  margin: 10px 0;
  padding-left: 20px;
  line-height: 1.7;
}

.faq p {
  margin: 0;
  line-height: 1.6;
}

@media (max-width: 900px) {
  .field-row {
    grid-template-columns: 1fr;
  }

  .sheet {
    width: 100%;
    min-height: auto;
    aspect-ratio: auto;
    padding: 10px;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
  }

  .card {
    min-height: 246px;
  }

  .card-body {
    padding: 7px 7px 8px;
  }

  .word-list {
    grid-template-rows: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }

  .card-brand {
    padding: 6px 7px;
  }

  .card-brand-logo {
    width: 18px;
    height: 18px;
  }

  .card-brand-name {
    font-size: 0.68rem;
  }

  .card-brand-meta {
    font-size: 0.57rem;
  }

  .card-title {
    font-size: 0.66rem;
  }

  .word-input {
    font-size: 0.84rem;
    padding: 6px 6px;
    min-height: 34px;
  }

  .word-list li {
    min-height: 34px;
  }
}

@media (max-width: 640px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .sheet {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 12px;
  }

  .card {
    min-height: 272px;
  }

  .actions button {
    flex: 1 1 200px;
  }
}

@page {
  size: A4 portrait;
  margin: 0;
}

@media print {
  html,
  body {
    background: #ffffff;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .page-header,
  .intro,
  .controls-panel,
  .preview-wrapper > h2,
  .preview-wrapper > p,
  .faq {
    display: none;
  }

  main {
    max-width: none;
    padding: 0;
    margin: 0;
    background: #ffffff;
  }

  .preview-wrapper {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .sheets-container {
    margin: 0;
    gap: 0;
    background: #ffffff;
  }

  .sheet {
    width: 100%;
    max-width: 210mm;
    min-height: 0;
    height: auto;
    margin: 0 auto;
    background: #ffffff;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    padding: 7mm;
    gap: 4.5mm;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(3, auto);
    page-break-after: always;
  }

  .card {
    min-height: 0;
    box-shadow: none;
    background: #ffffff;
  }

  .card-body {
    background: #ffffff;
  }

  .word-list li {
    box-shadow: none;
    background: #ffffff;
    border-color: rgba(81, 86, 206, 0.2);
  }

  .word-input {
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
    background: #ffffff;
    color: #5156ce;
    -webkit-text-fill-color: #5156ce;
  }

  .word-input:focus {
    outline: none;
  }

  .sheet:last-child {
    page-break-after: auto;
  }
}
