:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: #111827;
  --panel-2: #151f32;
  --text: #f8fafc;
  --muted: #9aa7b7;
  --line: #263247;
  --accent: #19c37d;
  --accent-2: #38bdf8;
  --danger: #f97316;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(56, 189, 248, 0.12), transparent 280px),
    radial-gradient(circle at 15% 12%, rgba(25, 195, 125, 0.14), transparent 34%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

button,
textarea,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 clamp(16px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgba(11, 16, 32, 0.86);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background:
    linear-gradient(90deg, transparent 44%, rgba(11, 16, 32, 0.9) 44% 56%, transparent 56%),
    linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 28px rgba(56, 189, 248, 0.22);
}

.top-actions,
.prompter-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #172033;
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: #3b4d68;
  background: #1c2940;
}

.primary-button {
  background: var(--accent);
  color: #04110b;
  border-color: transparent;
  font-weight: 800;
}

.primary-button:hover {
  background: #33d391;
}

.ghost-button {
  background: transparent;
}

.icon-button {
  width: 40px;
  padding: 0;
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(420px, 1.12fr);
  gap: clamp(16px, 3vw, 28px);
  padding: clamp(16px, 4vw, 42px);
}

.editor-panel,
.prompter-panel {
  min-width: 0;
  background: rgba(17, 24, 39, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.editor-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: calc(100vh - 152px);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent-2);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 900;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.02;
  letter-spacing: 0;
}

#wordCount {
  margin: 3px 0 0;
  color: var(--muted);
  white-space: nowrap;
}

textarea {
  width: 100%;
  min-height: 540px;
  height: 100%;
  resize: none;
  border: 0;
  outline: 0;
  background: #0e1525;
  color: var(--text);
  padding: 22px;
  font-size: 18px;
  line-height: 1.62;
}

.prompter-panel {
  display: grid;
  grid-template-rows: auto minmax(420px, 1fr) auto;
  min-height: calc(100vh - 152px);
}

.prompter-toolbar {
  justify-content: flex-end;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.prompt-stage {
  position: relative;
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(11, 16, 32, 0.92), rgba(11, 16, 32, 0.6) 42%, rgba(11, 16, 32, 0.92)),
    #050816;
  scroll-behavior: auto;
}

.prompt-stage:focus {
  outline: 2px solid var(--accent-2);
  outline-offset: -2px;
}

.guide-line {
  position: sticky;
  top: 45%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--danger), transparent);
  opacity: 0.8;
  z-index: 1;
}

.prompt-text {
  min-height: 140%;
  padding: 44vh 8% 54vh;
  font-size: 54px;
  line-height: 1.36;
  font-weight: 760;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.prompt-text.mirror {
  transform: scaleX(-1);
}

.controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.toggle-row {
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.prompt-stage:fullscreen {
  background: #050816;
}

.prompt-stage:fullscreen .prompt-text {
  padding-left: 10%;
  padding-right: 10%;
}

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

  .editor-panel,
  .prompter-panel {
    min-height: 640px;
  }
}

@media (max-width: 620px) {
  .topbar {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .top-actions,
  .prompter-toolbar {
    width: 100%;
  }

  .top-actions .primary-button,
  .prompter-toolbar button {
    flex: 1;
  }

  .panel-heading {
    display: block;
  }

  #wordCount {
    margin-top: 12px;
  }

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

  .prompt-text {
    padding-left: 18px;
    padding-right: 18px;
    font-size: 42px;
  }
}
