:root {
  --bg: #050505;
  --crimson: #dc143c;
  --crimson-deep: #7f1d1d;
  --crimson-soft: #f43f5e;
  --ink: #f5f0f2;
  --muted: #c9a7b0;
  --glass: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(244, 63, 94, 0.28);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(60rem 30rem at 85% -10%, rgba(220, 20, 60, 0.28), transparent 60%),
    radial-gradient(40rem 22rem at 10% 0%, rgba(127, 29, 29, 0.35), transparent 55%),
    linear-gradient(160deg, #0a0507 0%, var(--bg) 55%, #12040a 100%);
}

.hero {
  padding: 2.5rem 1rem 1rem;
  text-align: center;
}

.hero-inner {
  max-width: 60rem;
  margin: 0 auto;
}

.bat-mark {
  width: 5.5rem;
  color: var(--crimson-soft);
  filter: drop-shadow(0 0 12px rgba(220, 20, 60, 0.55));
}

.hero h1 {
  margin: 0.4rem 0 0.2rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, #fff1f2, var(--crimson-soft), var(--crimson));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  margin: 0;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  max-width: 78rem;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

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

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.panel {
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.panel h2 {
  margin: 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

button {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

button:hover {
  background: rgba(220, 20, 60, 0.22);
  transform: translateY(-1px);
}

button.primary {
  background: linear-gradient(135deg, var(--crimson), var(--crimson-deep));
  border-color: transparent;
  color: #fff;
}

button:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--crimson-soft);
  outline-offset: 2px;
}

textarea {
  flex: 1;
  width: 100%;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.45);
  color: var(--ink);
  padding: 1rem;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.95rem;
  line-height: 1.55;
}

.stats {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.save-state {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.preview {
  flex: 1;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.3);
  padding: 0.4rem 1.2rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

.preview h1,
.preview h2,
.preview h3 {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.25;
}

.preview h1 {
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0.35rem;
}

.preview a {
  color: var(--crimson-soft);
}

.preview code {
  font-family: ui-monospace, Consolas, monospace;
  background: rgba(220, 20, 60, 0.16);
  padding: 0.08rem 0.35rem;
  border-radius: 6px;
}

.preview pre {
  background: #0d0206;
  border: 1px solid rgba(244, 63, 94, 0.25);
  border-radius: 12px;
  padding: 1rem;
  overflow-x: auto;
}

.preview pre code {
  background: transparent;
  padding: 0;
}

.preview blockquote {
  margin-left: 0;
  padding-left: 1rem;
  border-left: 3px solid var(--crimson);
  color: var(--muted);
  font-style: italic;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 0.5rem 1rem 2rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
