*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f7f7f6;
  --surface: #ffffff;
  --border: #e2e2e0;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.05);
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.logo-area {
  flex-shrink: 0;
}

.logo-text {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
}

.header-title h1 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
}

.header-title p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Main layout ── */
main {
  flex: 1;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  padding: 24px 32px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* ── Input panel ── */
.input-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

label {
  font-size: 13px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

label a {
  font-size: 12px;
  font-weight: 400;
  color: var(--accent);
  text-decoration: none;
}

label a:hover { text-decoration: underline; }

input[type="password"],
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  transition: border-color 0.15s;
  resize: vertical;
}

input[type="password"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

textarea { min-height: 180px; }

button {
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

button:hover:not(:disabled) { background: var(--accent-hover); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 13px;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg);
  border-color: #c0c0c0;
}

/* ── Status ── */
.status {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
}

.status.info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.status.error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.status.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.hidden { display: none !important; }

/* ── Output panel ── */
.output-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#drawingWrap {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 660px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

#drawing {
  width: 100%;
  height: 100%;
  min-height: 660px;
}

.output-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Footer ── */
footer {
  padding: 16px 32px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-size: 12px;
  color: var(--text-muted);
  position: relative;
}

.footer-version {
  position: absolute;
  right: 32px;
  font-size: 11px;
  color: #b0b0ae;
  letter-spacing: 0.02em;
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

footer a:hover { color: var(--text); }

/* ── Responsive ── */
@media (max-width: 768px) {
  header { padding: 12px 16px; gap: 10px; }

  .header-title h1 { font-size: 16px; }
  .header-title p  { font-size: 12px; }
  .logo-text       { font-size: 18px; }

  main {
    grid-template-columns: 1fr;
    padding: 12px 16px;
    gap: 16px;
  }

  .input-panel { gap: 14px; }

  textarea { min-height: 140px; }

  #generateBtn { width: 100%; padding: 13px; font-size: 15px; }

  #drawingWrap { min-height: 480px; }
  #drawing     { min-height: 480px; }

  .output-actions {
    justify-content: stretch;
    flex-direction: column;
  }

  .output-actions button { width: 100%; padding: 12px; }

  footer { padding: 12px 16px; }
}
