/* PC workstation: left params / right PDF stage */
:root {
  --bg: #e8ebe7;
  --panel: #f7f6f1;
  --panel-raised: #ffffff;
  --ink: #1c2b33;
  --ink-soft: #5a6b74;
  --line: rgba(28, 43, 51, 0.1);
  --accent: #2f6f8f;
  --accent-press: #245a76;
  --danger: #a14b3c;
  --ok: #3d6b4f;
  --radius: 12px;
  --font-ui: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --font-display: Georgia, "Times New Roman", "Songti SC", serif;
  --font-mono: "Cascadia Code", Consolas, "Courier New", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  overflow: hidden;
}

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

/* Shell: sidebar + stage */
.shell {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: 100vh;
  min-height: 600px;
}

/* Left sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px 24px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.sidebar__brand {
  flex-shrink: 0;
}

.brand__eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.brand__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.15;
  color: var(--ink);
}

.brand__sub {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

/* Form */
.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.field__count {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-soft);
}

.field__hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 2px;
}

.field__input,
.field__textarea {
  width: 100%;
  border: 1.5px solid rgba(28, 43, 51, 0.14);
  border-radius: 10px;
  background: var(--panel-raised);
  color: var(--ink);
  font-size: 14px;
  font-family: var(--font-ui);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field__textarea {
  resize: vertical;
  min-height: 220px;
  line-height: 1.7;
  font-family: var(--font-mono);
  font-size: 13px;
}

.field__input:focus,
.field__textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 143, 0.16);
}

.field__input:disabled,
.field__textarea:disabled {
  opacity: 0.65;
  background: #efeee8;
}

/* Buttons */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn {
  appearance: none;
  border: none;
  min-height: 40px;
  border-radius: 10px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, transform 0.08s ease, opacity 0.15s ease;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 3px solid rgba(47, 111, 143, 0.35);
  outline-offset: 2px;
}

.btn--ghost {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid rgba(47, 111, 143, 0.35);
}

.btn--ghost:hover:not(:disabled) {
  background: rgba(47, 111, 143, 0.06);
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-press);
}

.btn--block {
  width: 100%;
  min-height: 44px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn__spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Status */
.status {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
}

.status--error {
  background: rgba(161, 75, 60, 0.1);
  color: var(--danger);
  border: 1px solid rgba(161, 75, 60, 0.25);
}

.status--ok {
  background: rgba(61, 107, 79, 0.1);
  color: var(--ok);
  border: 1px solid rgba(61, 107, 79, 0.25);
}

.status--info {
  background: rgba(47, 111, 143, 0.08);
  color: var(--accent);
  border: 1px solid rgba(47, 111, 143, 0.2);
}

/* Right stage */
.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.25), transparent 30%),
    var(--bg);
}

.stage__bar {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(6px);
}

.stage__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.stage__meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
}

.stage__canvas {
  flex: 1;
  position: relative;
  min-height: 0;
  padding: 20px;
  overflow: hidden;
}

.stage__empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--ink-soft);
  text-align: center;
  border: 1.5px dashed rgba(28, 43, 51, 0.15);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.35);
}

.stage__empty p {
  margin: 0;
  font-size: 14px;
}

.stage__empty-hint {
  font-size: 12px !important;
  opacity: 0.8;
}

.stage__empty-icon {
  color: var(--accent);
  opacity: 0.7;
  margin-bottom: 8px;
}

.stage__frame {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 12px 32px rgba(28, 43, 51, 0.12);
}

.stage__frame[hidden],
.stage__empty[hidden] {
  display: none !important;
}

/* Narrow fallback — still usable, not primary target */
@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(420px, 55vh);
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .stage__canvas {
    min-height: 420px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
