:root {
  --bg: #f4f7f7;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: #ffffff;
  --ink: #132329;
  --muted: #60737b;
  --line: rgba(36, 80, 90, 0.18);
  --accent: #24505a;
  --accent-dark: #173941;
  --orange: #e06b38;
  --blue: #1677d2;
  --green: #1e6b50;
  --radius: 8px;
  --shadow: 0 16px 44px rgba(20, 33, 38, 0.08);
  --font-display: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-ui: "Avenir Next", "Helvetica Neue", "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--ink);
  font-family: var(--font-ui);
  background:
    linear-gradient(180deg, rgba(36, 80, 90, 0.08), transparent 240px),
    radial-gradient(circle at 12% 8%, rgba(224, 107, 56, 0.12), transparent 22rem),
    radial-gradient(circle at 88% 92%, rgba(30, 107, 80, 0.14), transparent 24rem),
    var(--bg);
}

button,
textarea,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 10px;
  width: min(1440px, 100%);
  height: 100svh;
  margin: 0 auto;
  padding: clamp(10px, 1.7vw, 18px);
}

.topbar,
.status-strip,
.workspace,
.commandbar {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 2px 0;
}

.brand span,
.kicker,
.qq-card span {
  display: block;
  color: var(--orange);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.brand h1 {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: clamp(30px, 4.5vw, 48px);
  line-height: 1;
  font-weight: 900;
}

.brand p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.topbar__right,
.inline-actions,
.commandbar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.qq-card,
.gpt-links {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
}

.qq-card {
  align-items: center;
  justify-content: space-between;
  min-width: min(100%, 360px);
  padding: 8px 10px 8px 12px;
  border-color: rgba(30, 107, 80, 0.28);
  background: #eef8f4;
}

.qq-card strong {
  display: block;
  margin-top: 2px;
  color: #123f31;
  font-size: 18px;
  line-height: 1.1;
}

.qq-card button {
  min-height: 36px;
  padding: 0 12px;
  color: #ffffff;
  border: 0;
  border-radius: 6px;
  background: var(--green);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 160ms ease, background 160ms ease;
}

.gpt-links a,
.gpt-links button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 13px;
  color: var(--ink);
  border: 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.gpt-links button:first-child {
  color: #fffaf0;
  background: linear-gradient(135deg, #132329, #24505a);
}

.gpt-links a:hover,
.gpt-links a:focus,
.gpt-links button:hover,
.gpt-links button:focus,
.button:hover,
.file-button:hover,
.qq-card button:hover,
.segmented__item:hover {
  transform: translateY(-1px);
  outline: none;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
}

.segmented__item,
.button,
.file-button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 900;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.segmented__item {
  min-height: 34px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
}

.segmented__item.is-active {
  color: #ffffff;
  background: var(--accent);
}

.button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
}

.button--solid {
  color: #ffffff;
  background: var(--accent);
}

.button--solid:hover {
  background: var(--accent-dark);
}

.button--quiet,
.file-button {
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.file-button input {
  display: none;
}

.status-strip {
  display: grid;
  grid-template-columns: 0.65fr 0.65fr 1.6fr 1.1fr;
  gap: 8px;
}

.status-strip div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
}

.status-strip span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.status-strip strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
}

.panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.panel--output {
  grid-template-rows: auto minmax(0, 1fr);
  background: rgba(255, 250, 238, 0.9);
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel h2 {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 23px;
  line-height: 1.1;
  font-weight: 900;
}

.drop-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  color: var(--muted);
  border: 1px dashed rgba(23, 19, 13, 0.36);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(238, 248, 244, 0.95), rgba(224, 107, 56, 0.08)),
    repeating-linear-gradient(90deg, rgba(36, 80, 90, 0.08) 0 1px, transparent 1px 14px);
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.drop-zone strong {
  color: var(--ink);
}

.drop-zone span {
  font-size: 13px;
}

.drop-zone:hover,
.drop-zone:focus,
.drop-zone.is-dragging {
  color: var(--accent-dark);
  border-color: var(--accent);
  outline: none;
}

textarea {
  width: 100%;
  min-width: 0;
  min-height: 0;
  margin-top: 12px;
  padding: 14px;
  resize: none;
  color: #eaf5f7;
  border: 0;
  border-radius: var(--radius);
  outline: 1px solid rgba(23, 19, 13, 0.18);
  background: #132329;
  box-shadow: inset 0 0 0 1px rgba(255, 250, 238, 0.08);
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 12.5px;
  line-height: 1.5;
}

textarea:focus {
  outline-color: var(--accent);
}

.panel--output textarea {
  min-height: 0;
}

.commandbar {
  display: flex;
  gap: 12px;
  justify-content: flex-start;
  align-items: center;
}

.commandbar__note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 19, 13, 0.56);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(10px);
  transition: opacity 160ms ease;
}

.drop-overlay.is-visible {
  opacity: 1;
}

.drop-overlay div {
  display: grid;
  gap: 10px;
  width: min(520px, 100%);
  padding: clamp(28px, 5vw, 48px);
  text-align: center;
  color: #fffaf0;
  border: 2px dashed rgba(255, 250, 238, 0.72);
  border-radius: var(--radius);
  background: rgba(23, 19, 13, 0.42);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.28);
}

.drop-overlay strong {
  font-family: var(--font-display);
  font-size: clamp(32px, 6vw, 58px);
  line-height: 1;
}

.drop-overlay span {
  color: rgba(255, 250, 238, 0.74);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(23, 19, 13, 0.5);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(10px);
  transition: opacity 160ms ease;
}

.modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.modal__panel {
  display: grid;
  gap: 18px;
  width: min(440px, 100%);
  padding: 24px;
  border: 1px solid rgba(255, 250, 238, 0.36);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
}

.modal__panel--wide {
  width: min(680px, 100%);
  max-height: min(86svh, 720px);
  overflow: auto;
}

.modal__panel h2 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1;
}

.modal__panel p {
  margin: 10px 0 0;
  color: var(--muted);
}

.modal__field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 900;
}

.modal__field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  background: #fff;
}

.modal__textarea {
  min-height: 118px;
  margin-top: 0;
  color: #fff7e7;
  word-break: break-all;
}

.modal__field input[readonly] {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

.modal__field input:focus,
.modal__textarea:focus {
  border-color: var(--accent);
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 40;
  padding: 10px 16px;
  color: #fffaf0;
  border-radius: 999px;
  background: var(--ink);
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 900px) {
  .app-shell {
    height: auto;
    min-height: 100svh;
  }

  .topbar,
  .commandbar {
    display: grid;
  }

  .workspace,
  .status-strip {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: 420px;
  }

  .qq-card {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 10px;
  }

  .topbar__right,
  .commandbar__actions {
    width: 100%;
  }

  .button,
  .file-button,
  .segmented,
  .gpt-links {
    flex: 1;
  }

  .gpt-links a,
  .gpt-links button {
    flex: 1;
    padding-inline: 9px;
    text-align: center;
  }

  .drop-zone {
    display: grid;
  }

  .modal__actions {
    display: grid;
  }
}
