@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&family=Inter:wght@400;700&family=PT+Sans:wght@400;700&family=PT+Serif:wght@400;700&family=Noto+Sans:wght@400;700&display=swap&subset=cyrillic");

:root {
  --bg: #f5f2ea;
  --ink: #1c1b18;
  --muted: #6b645d;
  --accent: #2f6f6b;
  --accent-2: #d9a441;
  --panel: #ffffff;
  --border: #e4ded4;
  --shadow: 0 10px 30px rgba(15, 12, 8, 0.08);
  --panel-height: 820px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Georgia", "Times New Roman", serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fefcf7 0%, #f5f2ea 45%, #efe8dd 100%);
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.hero {
  display: grid;
  gap: 8px;
  margin-bottom: 32px;
}

.brand {
  font-family: "Trebuchet MS", "Verdana", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
}

p {
  margin: 0;
  color: var(--muted);
  max-width: 700px;
}

.content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}

.controls,
.preview,
.results {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.controls {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: var(--panel-height);
  overflow: hidden;
}

.preview {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: var(--panel-height);
}

.results {
  margin-top: 32px;
  padding: 24px;
}

.footer {
  margin-top: 24px;
  padding: 18px 6px 0;
  color: var(--muted);
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.block {
  display: grid;
  gap: 8px;
}

.text-block {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.label {
  font-family: "Trebuchet MS", "Verdana", sans-serif;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

textarea {
  width: 100%;
  min-height: 180px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 16px;
  font-family: "Times New Roman", serif;
  resize: vertical;
  background: #fffdfa;
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tool {
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 8px;
  width: 40px;
  height: 36px;
  cursor: pointer;
  font-family: "Trebuchet MS", "Verdana", sans-serif;
  font-size: 14px;
}

.tool-underline {
  text-decoration: underline;
}

.tool-strike {
  text-decoration: line-through;
}

.editor {
  min-height: 250px;
  flex: 1;
  overflow: auto;
  padding: 12px;
  border-radius: 12px;
  border: none;
  font-size: 16px;
  font-family: "Times New Roman", serif;
  background: #fffdfa;
  white-space: pre-wrap;
  outline: none;
  line-height: 1.4;
}

.editor p,
.editor div {
  margin: 0;
}

.editor:focus {
  outline: none;
  box-shadow: none;
}

.editor:empty:before {
  content: attr(data-placeholder);
  color: var(--muted);
}

select,
input[type="range"] {
  width: 100%;
}

input[type="text"] {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fffdfa;
  padding: 6px 10px;
  font-size: 14px;
}

input[type="color"] {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fffdfa;
  padding: 4px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
}

.checkbox input {
  width: 18px;
  height: 18px;
}

select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: #fffdfa;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(47, 111, 107, 0.25);
}

.ghost {
  background: transparent;
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--ink);
}

.ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.font-demo {
  font-size: 18px;
  color: var(--accent);
}

.preview-canvas-wrap {
  display: grid;
  place-items: center;
  padding: 12px;
  border-radius: 14px;
  background: #fdf9f2;
  border: 1px dashed var(--border);
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  flex: 1;
  min-height: 540px;
  overflow: hidden;
}

.preview-canvas-wrap canvas {
  width: 100%;
  height: auto;
  max-width: 100%;
  aspect-ratio: 4 / 5;
}

.nav {
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 12px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  font-size: 18px;
  color: var(--ink);
  display: grid;
  place-items: center;
}

.nav:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

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

.results-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.results-meta {
  display: grid;
  gap: 4px;
  text-align: right;
}

.progress {
  width: 100%;
  height: 10px;
  background: #f0e9dd;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.2s ease;
}

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

.card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: #fffdfa;
  display: grid;
  gap: 10px;
}

.card img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.card a {
  text-decoration: none;
  color: var(--accent);
  font-family: "Trebuchet MS", "Verdana", sans-serif;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (max-width: 980px) {
  .content {
    grid-template-columns: 1fr;
  }

  .row {
    grid-template-columns: 1fr;
  }
}
