:root {
  --bg-a: #fff6d8;
  --bg-b: #d4f4f1;
  --panel: #fffefb;
  --ink: #1f1d1a;
  --muted: #5a5348;
  --line: #d8cfbf;
  --accent: #0f766e;
  --accent-2: #f59e0b;
  --changed: #117a37;
  --code-bg: #151a20;
  --code-text: #d6e4f0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background: linear-gradient(125deg, var(--bg-a), var(--bg-b));
  min-height: 100vh;
}

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 85% 75%, rgba(245, 158, 11, 0.14) 0, rgba(245, 158, 11, 0) 44%);
}

.hero {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.2rem 1rem;
  animation: rise 500ms ease-out;
}

.hero-kicker {
  margin: 0;
  display: inline-block;
  background: #1f2937;
  color: #fff;
  border-radius: 999px;
  padding: 0.15rem 0.75rem;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.hero h1 {
  margin: 0.6rem 0 0;
  font-size: clamp(1.7rem, 2.8vw, 2.7rem);
}

.hero p {
  max-width: 72ch;
  color: var(--muted);
}

.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.2rem 1.4rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: color-mix(in hsl, var(--panel) 92%, white 8%);
  box-shadow: 0 10px 30px rgba(31, 29, 26, 0.08);
  overflow: hidden;
}

.panel-title-wrap {
  padding: 1rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.38));
}

.panel-title-wrap h2 {
  margin: 0;
  font-size: 1.15rem;
}

.panel-title-wrap p {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.panel-form {
  animation: rise 560ms ease-out;
}

.panel-form form,
.playground-controls,
.status,
.dictionary {
  padding: 1rem;
}

.field {
  margin-bottom: 0.95rem;
}

.field label,
.field legend {
  display: block;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.field input,
.field select,
.field textarea,
.field button {
  width: 100%;
  border: 1px solid #b9af9d;
  border-radius: 0.65rem;
  padding: 0.6rem 0.75rem;
  font-size: 0.98rem;
  font-family: inherit;
  background: #fffdfa;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.field button:focus {
  outline: 3px solid color-mix(in hsl, var(--accent) 30%, white 70%);
  border-color: var(--accent);
}

.field small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.inline {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.inline input {
  width: auto;
  margin: 0;
}

.actions {
  display: flex;
  gap: 0.6rem;
}

button {
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  border: none;
  transition: transform 120ms ease, filter 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  filter: saturate(1.1);
}

button.ghost {
  background: #f4efe3;
  color: #201f1b;
  border: 1px solid #c9bca7;
}

.playground-controls {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
}

.playground-controls h3,
.status h3,
.dictionary h3 {
  margin: 0 0 0.7rem;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.status p {
  margin: 0.25rem 0;
}

#activeDescription {
  margin-top: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 0.65rem;
  background: #f8f5ea;
  border: 1px solid #ddd2be;
}

#eventLog {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  max-height: 130px;
  overflow: auto;
}

#eventLog li {
  background: #f6f8ff;
  border: 1px solid #d6def1;
  border-radius: 0.5rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.88rem;
}

.dictionary {
  border-top: 1px solid var(--line);
}

.dictionary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.dictionary-item {
  border: 1px solid #d9cfbe;
  border-radius: 0.7rem;
  padding: 0.55rem;
  background: #fff;
}

.dictionary-item h4 {
  margin: 0;
  font-size: 0.95rem;
}

.dictionary-item p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.panel-code {
  display: flex;
  flex-direction: column;
  animation: rise 640ms ease-out;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.status-right {
  background: rgba(255, 255, 255, 0.55);
  padding: 1rem;
}

.event-props-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 1rem;
}

.event-code-wrap {
  margin-top: 0.65rem;
}

.event-code-wrap h4 {
  margin: 0 0 0.4rem;
  font-size: 0.92rem;
}

.event-code {
  margin: 0;
  background: #0e1721;
  color: #d6e4f0;
  border-radius: 0.6rem;
  border: 1px solid #2f4256;
  padding: 0.7rem;
}

.event-code code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  white-space: pre-wrap;
}


@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .event-props-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .two-cols,
  .control-grid,
  .dictionary-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
  }
}
