:root {
  --ink: #17211a;
  --muted: #5f6b61;
  --paper: #f8f0dc;
  --card: rgba(255, 252, 241, 0.88);
  --line: rgba(23, 33, 26, 0.14);
  --accent: #b84f2b;
  --accent-dark: #74351f;
  --moss: #536b4b;
  --gold: #d2a947;
  --shadow: 0 24px 70px rgba(59, 52, 28, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "IBM Plex Sans", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at 12% 10%, rgba(210, 169, 71, 0.48), transparent 26rem),
    radial-gradient(circle at 88% 0%, rgba(83, 107, 75, 0.36), transparent 28rem),
    linear-gradient(135deg, #fbf3df 0%, #e7dcc1 52%, #d6e0c4 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(23, 33, 26, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 33, 26, 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 52px 0;
  animation: page-in 520ms ease both;
}

.hero {
  max-width: 780px;
  margin-bottom: 30px;
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  margin: 0 0 12px;
  text-transform: uppercase;
}

.language-switcher {
  display: grid;
  gap: 7px;
  min-width: 160px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.language-switcher select {
  border: 0;
  color: var(--ink);
  background: transparent;
  font: 800 0.98rem/1 "IBM Plex Sans", "Trebuchet MS", sans-serif;
  outline: none;
}

h1,
h2 {
  font-family: "Fraunces", "Georgia", serif;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(2.8rem, 8vw, 6.4rem);
  line-height: 0.9;
  margin: 0;
  text-wrap: balance;
}

h2 {
  font-size: 1.2rem;
  margin: 0 0 12px;
}

.hero-copy {
  color: var(--muted);
  font-size: 1.16rem;
  line-height: 1.7;
  max-width: 640px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 20px;
}

.composer,
.result-card,
.details article {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.composer {
  padding: 24px;
}

label {
  display: block;
  font-weight: 800;
  margin-bottom: 12px;
}

textarea {
  width: 100%;
  min-height: 250px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  color: var(--ink);
  font: 1rem/1.6 "IBM Plex Mono", "Courier New", monospace;
  background: rgba(255, 255, 255, 0.58);
  outline: none;
}

textarea::placeholder {
  color: rgba(95, 107, 97, 0.56);
}

textarea:focus::placeholder {
  color: rgba(23, 33, 26, 0.62);
}

textarea:focus {
  border-color: rgba(184, 79, 43, 0.58);
  box-shadow: 0 0 0 4px rgba(184, 79, 43, 0.12);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

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

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  color: #fffaf0;
  background: var(--accent);
  cursor: pointer;
  font: 800 0.95rem/1 "IBM Plex Sans", "Trebuchet MS", sans-serif;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

button:hover {
  background: var(--accent-dark);
  box-shadow: 0 12px 24px rgba(116, 53, 31, 0.24);
  transform: translateY(-1px);
}

button.ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid var(--line);
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  font: 800 0.95rem/1 "IBM Plex Sans", "Trebuchet MS", sans-serif;
}

.file-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-button.ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid var(--line);
}

.file-button.ghost:hover {
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 24px rgba(116, 53, 31, 0.16);
  transform: translateY(-1px);
}

.hint {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 14px 0 0;
}

.result-card {
  min-width: 0;
  overflow: hidden;
}

.result-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 20px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
  font-weight: 800;
}

pre {
  min-height: 420px;
  margin: 0;
  padding: 24px;
  overflow: auto;
  white-space: pre-wrap;
  color: #f7f0dc;
  background: linear-gradient(145deg, #19241d, #2c392b);
  font: 0.94rem/1.65 "IBM Plex Mono", "Courier New", monospace;
}

.details {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.details article {
  padding: 22px;
}

ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

li,
.example {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.46);
}

.examples {
  display: grid;
  gap: 10px;
}

.example {
  color: var(--ink);
  text-align: left;
  border-radius: 16px;
  line-height: 1.45;
  font-weight: 700;
}

.quality-pass {
  border-color: rgba(83, 107, 75, 0.34);
  background: rgba(214, 224, 196, 0.62);
}

.quality-review {
  border-color: rgba(184, 79, 43, 0.34);
  background: rgba(255, 239, 218, 0.72);
}

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

html[dir="rtl"] body {
  direction: rtl;
}

html[dir="rtl"] textarea,
html[dir="rtl"] pre {
  direction: rtl;
}

html[dir="rtl"] .result-meta {
  text-align: right;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .shell {
    padding: 34px 0;
  }

  .workspace,
  .details {
    grid-template-columns: 1fr;
  }

  .result-meta {
    flex-direction: column;
  }

  .hero-top {
    flex-direction: column;
  }

  pre {
    min-height: 300px;
  }
}
