:root {
  color-scheme: dark;
  --bg-0: #050403;
  --bg-1: #0a0907;
  --bg-2: #1a1814;
  --panel: rgba(12, 11, 9, 0.72);
  --panel-strong: rgba(10, 9, 7, 0.82);
  --line: #1c1a17;
  --line-2: #2a2724;
  --ink: #e7e5e4;
  --muted: #a8a29e;
  --faint: #78716c;
  --ghost: #57534e;
  --accent: #fb8b7e;
  --accent-bright: #fca398;
  --accent-soft: rgba(251, 139, 126, 0.12);
  --ok: #34d399;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--mono);
  line-height: 1.5;
  background:
    linear-gradient(rgba(5, 4, 3, 0.9), rgba(5, 4, 3, 0.94)),
    url("/assets/workbench.bmp") center / cover fixed,
    radial-gradient(ellipse at top, var(--bg-2) 0%, var(--bg-1) 60%, var(--bg-0) 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence baseFrequency='0.9'/></filter><rect width='120' height='120' filter='url(%23n)'/></svg>");
}

button,
textarea {
  font: inherit;
}

.shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 20px;
}

.workspace {
  width: min(980px, 100%);
  padding: 0;
}

.mast {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 12px;
  color: rgba(251, 139, 126, 0.88);
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(251, 139, 126, 0.52);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.42;
  }
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 750;
  line-height: 1.02;
  letter-spacing: 0;
}

h1 span {
  color: var(--accent-bright);
}

.prompt-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 380px;
  padding: 16px;
  border: 1px solid var(--line-2);
  background: var(--panel);
}

.panel span,
.panel-top span {
  color: var(--faint);
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

textarea {
  width: 100%;
  flex: 1;
  margin-top: 12px;
  padding: 0;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 0.86rem;
  line-height: 1.6;
}

textarea::placeholder {
  color: var(--ghost);
}

textarea:focus {
  outline: 1px solid var(--accent);
  outline-offset: 10px;
}

.panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.result {
  display: block;
  flex: 1;
  margin-top: 12px;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.82rem;
  line-height: 1.6;
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 50px;
  margin-top: 6px;
}

.action-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status {
  margin: 0;
  color: var(--faint);
  font-size: 0.76rem;
}

.status::before {
  content: "STATUS · ";
  color: var(--ghost);
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 184px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line-2);
  background: rgba(10, 9, 7, 0.56);
}

.mode-toggle label {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  cursor: pointer;
}

.mode-toggle input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.mode-toggle span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: color 0.15s ease, background 0.15s ease;
}

.mode-toggle input:hover + span {
  color: var(--ink);
}

.mode-toggle input:checked + span {
  color: var(--bg-0);
  background: var(--accent);
  font-weight: 700;
}

.mode-toggle input:focus-visible + span {
  outline: 1px solid var(--accent-bright);
  outline-offset: -3px;
}

.primary-button,
.ghost-button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 0;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 158px;
  height: 44px;
  padding: 0 16px;
  color: var(--bg-0);
  background: var(--accent);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--accent-bright);
}

.ghost-button {
  min-height: 40px;
  padding: 0 14px;
  color: var(--muted);
  background: rgba(10, 9, 7, 0.56);
  border-color: var(--line-2);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.ghost-button:hover,
.ghost-button:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--faint);
  background: transparent;
  border-color: var(--line-2);
}

.icon-button:hover,
.icon-button:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

button:disabled {
  cursor: wait;
  color: var(--ghost);
  background: var(--line-2);
  opacity: 0.8;
}

button:active {
  transform: translateY(1px);
}

@media (max-width: 760px) {
  .shell {
    padding: 24px 14px;
    place-items: stretch;
  }

  .mast {
    align-items: start;
    margin-bottom: 22px;
    padding-bottom: 22px;
  }

  h1 {
    font-size: 2.35rem;
  }

  .prompt-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: 280px;
  }

  textarea {
    font-size: 16px;
  }

  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .action-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-toggle {
    width: 100%;
  }

  .primary-button {
    width: 100%;
  }
}
