:root {
  --paper: #f8f1df;
  --paper-deep: #efe1c2;
  --ink: #1e1b17;
  --muted: #6e665b;
  --line: rgba(70, 52, 32, 0.2);
  --surface: rgba(255, 252, 243, 0.92);
  --surface-strong: rgba(255, 249, 232, 0.97);
  --jade: #245d56;
  --jade-dark: #163e3b;
  --cinnabar: #a63d2b;
  --cinnabar-dark: #7e2c23;
  --gold: #ac8541;
  --mist: #dfe8df;
  --blue-ink: #263c47;
  --shadow: 0 18px 48px rgba(31, 24, 15, 0.16);
  color-scheme: light;
  font-family:
    "Noto Serif SC", "Songti SC", "SimSun", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 18%, rgba(166, 61, 43, 0.1), transparent 24%),
    radial-gradient(circle at 88% 78%, rgba(36, 93, 86, 0.12), transparent 28%),
    linear-gradient(120deg, rgba(24, 62, 59, 0.22), rgba(166, 61, 43, 0.12)),
    linear-gradient(rgba(248, 241, 223, 0.72), rgba(248, 241, 223, 0.9)),
    url("./assets/qimen-paper.png") center / cover fixed;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  position: relative;
  min-height: 100vh;
}

.app-shell::before,
.app-shell::after {
  position: fixed;
  z-index: 0;
  width: 1px;
  height: 62vh;
  top: 21vh;
  content: "";
  background: linear-gradient(transparent, rgba(126, 44, 35, 0.38), rgba(36, 93, 86, 0.32), transparent);
  pointer-events: none;
}

.app-shell::before {
  left: clamp(14px, 3vw, 38px);
}

.app-shell::after {
  right: clamp(14px, 3vw, 38px);
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(16px, 3vw, 36px);
  border-bottom: 1px solid rgba(52, 41, 26, 0.18);
  background: rgba(255, 249, 232, 0.8);
  backdrop-filter: blur(18px);
}

.topbar::after {
  position: absolute;
  right: clamp(18px, 3vw, 40px);
  bottom: -1px;
  left: clamp(18px, 3vw, 40px);
  height: 3px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(166, 61, 43, 0.55), rgba(172, 133, 65, 0.48), transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.brand-seal {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 2px solid rgba(126, 44, 35, 0.7);
  color: var(--cinnabar-dark);
  background: rgba(248, 241, 223, 0.9);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.brand p,
.section-head p,
.draw-intro p {
  margin: 0 0 3px;
  color: var(--cinnabar-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand h1,
.section-head h2,
.draw-intro h2 {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 28px;
  line-height: 1.1;
}

.section-head h2 {
  font-size: 19px;
  line-height: 1.2;
}

.draw-intro h2 {
  font-size: 23px;
  line-height: 1.1;
}

.gpt-toolbar {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  width: min(100%, 620px);
}

.gpt-link {
  display: grid;
  flex: 1;
  min-width: 210px;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.gpt-link input {
  height: 42px;
}

.draw-strip {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 210px minmax(280px, 1fr) auto;
  gap: 16px;
  align-items: stretch;
  width: min(100%, 1180px);
  margin: 18px auto 0;
  padding: 16px clamp(16px, 2vw, 22px);
  overflow: hidden;
  border: 1px solid rgba(70, 52, 32, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 252, 243, 0.82), rgba(255, 248, 232, 0.9)),
    url("./assets/qimen-paper.png") center / cover;
  box-shadow: 0 14px 40px rgba(31, 24, 15, 0.13);
}

.draw-strip::before {
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(126, 44, 35, 0.18);
  border-radius: 4px;
  content: "";
  pointer-events: none;
}

.draw-strip::after {
  position: absolute;
  right: 18px;
  bottom: 16px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 2px solid rgba(166, 61, 43, 0.38);
  color: rgba(166, 61, 43, 0.3);
  content: attr(data-seal);
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.draw-strip > * {
  position: relative;
  z-index: 1;
}

.draw-intro {
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 4px 0;
}

.draw-intro span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.draw-result {
  display: grid;
  align-content: center;
  gap: 7px;
  min-height: 106px;
  padding: 14px 18px;
  border-right: 1px solid rgba(52, 41, 26, 0.14);
  border-left: 1px solid rgba(52, 41, 26, 0.14);
  background: rgba(255, 253, 244, 0.56);
}

.draw-result span {
  color: var(--cinnabar-dark);
  font-size: 12px;
  font-weight: 800;
}

.draw-result strong {
  color: var(--blue-ink);
  font-size: 18px;
  line-height: 1.3;
}

.draw-result p {
  max-height: 4.7em;
  margin: 0;
  overflow: auto;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
}

.draw-actions {
  display: grid;
  grid-template-columns: 100px 118px;
  gap: 8px;
  align-content: center;
  min-width: 228px;
  padding-right: 36px;
}

.draw-actions .button {
  min-height: 38px;
}

.sign-admin-trigger {
  grid-column: 1 / -1;
}

.sign-status {
  grid-column: 1 / -1;
  min-height: 18px;
  color: var(--jade-dark);
  font-size: 12px;
  font-weight: 800;
}

.workspace {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(340px, 1fr));
  gap: 18px;
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 22px clamp(14px, 2.5vw, 30px) 32px;
  align-items: stretch;
}

.surface {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 252, 243, 0.9), rgba(255, 248, 231, 0.93)),
    url("./assets/qimen-paper.png") center / cover;
  box-shadow: var(--shadow);
}

.surface::before {
  position: absolute;
  inset: 14px;
  z-index: 0;
  border: 1px solid rgba(126, 44, 35, 0.2);
  border-radius: 4px;
  content: "";
  pointer-events: none;
}

.surface::after {
  position: absolute;
  right: 26px;
  bottom: 24px;
  z-index: 0;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 2px solid rgba(166, 61, 43, 0.52);
  color: rgba(166, 61, 43, 0.42);
  content: attr(data-seal);
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.inquiry-panel,
.output-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 18px;
  min-height: calc(100vh - 128px);
}

.inquiry-panel > *,
.output-panel > * {
  position: relative;
  z-index: 1;
}

.section-head {
  position: relative;
  padding: 7px 8px 14px;
  border-bottom: 1px solid rgba(52, 41, 26, 0.14);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head::before {
  position: absolute;
  bottom: -2px;
  left: 8px;
  width: 34px;
  height: 3px;
  content: "";
  background: var(--cinnabar);
}

.pill,
.status-text {
  min-height: 24px;
  color: var(--jade-dark);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 4px 9px;
  border: 1px solid rgba(36, 93, 86, 0.22);
  border-radius: 999px;
  background: rgba(223, 232, 223, 0.72);
}

.inquiry-form,
.field {
  display: grid;
  gap: 10px;
}

.inquiry-form {
  grid-template-rows: auto auto auto 1fr auto;
  gap: 15px;
  min-height: 100%;
}

.field span {
  color: var(--blue-ink);
  font-size: 14px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(52, 41, 26, 0.2);
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  background: rgba(255, 253, 244, 0.78);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

.admin-modal[hidden] {
  display: none;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(30, 27, 23, 0.46);
  backdrop-filter: blur(10px);
}

.admin-panel {
  position: relative;
  width: min(100%, 760px);
  max-height: min(720px, 92vh);
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(70, 52, 32, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 252, 243, 0.94), rgba(255, 248, 232, 0.96)),
    url("./assets/qimen-paper.png") center / cover;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.28);
}

.sign-bank-input {
  min-height: 360px;
  font-family:
    "Noto Serif SC", "Songti SC", "SimSun", "Microsoft YaHei", serif;
}

.admin-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 10px;
  margin-top: 12px;
}

.close-admin {
  min-width: 82px;
}

input {
  height: 46px;
  padding: 0 12px;
}

textarea {
  min-height: 112px;
  resize: vertical;
  padding: 12px;
  line-height: 1.65;
}

.background-input {
  min-height: 260px;
}

input:focus,
textarea:focus {
  border-color: rgba(36, 93, 86, 0.65);
  background: rgba(255, 255, 252, 0.96);
  box-shadow: 0 0 0 3px rgba(36, 93, 86, 0.14);
}

.time-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 10px;
  align-items: end;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.button:active,
.icon-button:active {
  transform: translateY(0);
}

.button-primary {
  color: #fffaf0;
  background: var(--cinnabar);
  box-shadow: 0 10px 24px rgba(166, 61, 43, 0.24);
}

.button-primary:hover {
  background: var(--cinnabar-dark);
}

.button-secondary {
  color: #fffaf0;
  background: var(--jade);
  box-shadow: 0 10px 24px rgba(36, 93, 86, 0.22);
}

.button-secondary:hover {
  background: var(--jade-dark);
}

.button-ghost {
  border: 1px solid rgba(52, 41, 26, 0.18);
  color: var(--blue-ink);
  background: rgba(255, 255, 250, 0.72);
}

.button-ghost:hover {
  background: rgba(223, 232, 223, 0.8);
}

.square-action {
  width: 72px;
}

.action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 10px;
}

.standard-output {
  width: 100%;
  min-height: 620px;
  height: 100%;
  margin-bottom: 0;
  color: #221c15;
  background:
    linear-gradient(rgba(255, 255, 250, 0.82), rgba(255, 248, 232, 0.9)),
    url("./assets/qimen-paper.png") center / cover;
  font-family:
    "Noto Serif SC", "Songti SC", "SimSun", "Microsoft YaHei", serif;
  white-space: pre-wrap;
}

@media (max-width: 1180px) {
  .workspace {
    width: min(100%, 980px);
  }

  .draw-strip {
    width: min(100%, 980px);
  }
}

@media (max-width: 780px) {
  .topbar,
  .gpt-toolbar,
  .action-row,
  .time-row,
  .draw-strip,
  .draw-actions,
  .admin-actions {
    grid-template-columns: 1fr;
  }

  .topbar,
  .gpt-toolbar {
    display: grid;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding-inline: 12px;
  }

  .draw-strip {
    margin-top: 12px;
    padding-inline: 14px;
  }

  .draw-result {
    border-right: 0;
    border-left: 0;
    border-top: 1px solid rgba(52, 41, 26, 0.14);
    border-bottom: 1px solid rgba(52, 41, 26, 0.14);
  }

  .draw-actions {
    min-width: 0;
    padding-right: 0;
  }

  .brand h1 {
    font-size: 25px;
  }

  .square-action {
    width: 100%;
  }

  .standard-output {
    min-height: 480px;
  }
}

@media (max-width: 460px) {
  .topbar {
    padding-inline: 12px;
  }

  .inquiry-panel,
  .output-panel {
    padding: 14px;
    min-height: auto;
  }

  .button {
    width: 100%;
  }
}

.hidden {
  display: none;
}
