:root {
  --bg-1: #f6f3ec;
  --bg-2: #d8e2dc;
  --ink: #1b1b1b;
  --muted: #4a4a4a;
  --accent: #c76d3a;
  --accent-dark: #8d4a25;
  --panel: rgba(255, 255, 255, 0.8);
  --border: rgba(27, 27, 27, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background: linear-gradient(145deg, var(--bg-1), var(--bg-2));
  overflow-x: hidden;
}

.background-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 10%, rgba(199, 109, 58, 0.22), transparent 40%),
    radial-gradient(circle at 84% 22%, rgba(92, 131, 116, 0.25), transparent 38%),
    radial-gradient(circle at 50% 95%, rgba(51, 73, 94, 0.17), transparent 36%);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1200px, 95vw);
  min-height: calc(100vh - 4rem);
  margin: 2rem auto;
  display: flex;
  gap: 1rem;
  animation: rise 460ms ease-out;
}

.left-panel {
  width: 320px;
  flex: 0 0 320px;
}

.editor-panel {
  width: 1px;
  flex: 1 1 auto;
  resize: horizontal;
  overflow: auto;
  min-width: 420px;
  max-width: 70vw;
}

.result-panel {
  width: 340px;
  flex: 0 0 340px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(5px);
  padding: 1rem;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
}

.left-panel h1 {
  margin: 0 0 0.3rem;
  font-size: 2rem;
  line-height: 1;
}

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

label {
  display: block;
  margin-top: 0.85rem;
  margin-bottom: 0.35rem;
  font-weight: 700;
  font-size: 0.9rem;
}

select,
input,
button {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  font: inherit;
}

select,
input,
textarea {
  padding: 0.65rem 0.7rem;
  background: rgba(255, 255, 255, 0.86);
}

#codeEditor {
  min-height: 72vh;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.45;
}

.syntax-status {
  margin-top: 0.5rem;
}

.syntax-ok {
  color: #2a6f3f;
}

.syntax-error {
  color: #8b2f2f;
}

.task-description-wrap {
  margin-top: 0.85rem;
}

.mini-title {
  margin: 0 0 0.35rem;
  font-weight: 700;
  font-size: 0.9rem;
}

.task-description {
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.7rem;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.controls-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.secondary-btn {
  background: #385f57;
}

.secondary-btn:hover {
  background: #2a4d46;
}

button {
  margin-top: 1rem;
  padding: 0.72rem 0.95rem;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease;
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.hint,
.task-meta p {
  color: var(--muted);
  margin: 0.4rem 0;
  font-size: 0.9rem;
}

.result-panel pre {
  margin: 0;
  min-height: 72vh;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9rem;
}

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

@media (max-width: 1080px) {
  .app-shell {
    display: grid;
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .left-panel,
  .editor-panel,
  .result-panel {
    width: auto;
    flex: initial;
    max-width: none;
  }

  .editor-panel {
    resize: none;
  }

  #codeEditor,
  .result-panel pre {
    min-height: 42vh;
  }
}
