:root {
  --primary: #284E5C;
  --primary-hover: #203F4A;
  --spark: #E6B85C;
  --bg: #F9F7EF;
  --surface: #FFFFFF;
  --text: #22313A;
  --muted: #6B7C85;
  --border: #E6E0D2;
  --soft-accent: #F3E5B7;
  --selected: #EEF3F1;
  --success: #6F9C7D;
  --danger: #C96A5B;
  --shadow: 0 18px 48px rgba(34, 49, 58, 0.08);
  --soft-shadow: 0 8px 24px rgba(34, 49, 58, 0.06);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(243, 229, 183, 0.24), rgba(249, 247, 239, 0) 260px),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
textarea,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  width: min(1440px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.topbar,
.auth-panel,
.guide-panel,
.workspace,
.results-panel,
.history-panel,
.auth-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--soft-shadow);
}

.auth-screen {
  min-height: calc(100vh - 36px);
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 440px);
  gap: 36px;
  align-items: center;
  position: relative;
  isolation: isolate;
}

.auth-screen::before {
  content: "";
  position: absolute;
  inset: 9% 51% 13% -2%;
  z-index: -1;
  border: 0;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(243, 229, 183, 0.24)),
    repeating-linear-gradient(0deg, rgba(40, 78, 92, 0.028) 0 1px, transparent 1px 42px);
  transform: rotate(-1deg);
}

.auth-screen::after {
  content: none;
  position: absolute;
  left: 7%;
  bottom: 10%;
  z-index: -1;
  width: min(320px, 42vw);
  height: 92px;
  border: 1px solid rgba(230, 184, 92, 0.26);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.82);
  box-shadow: var(--soft-shadow);
  transform: rotate(1.3deg);
}

.auth-hero {
  max-width: 620px;
}

.auth-hero h1 {
  margin: 0 0 12px;
  font-size: 54px;
  line-height: 1.05;
  letter-spacing: 0;
}

.hero-brand {
  margin-bottom: 14px;
}

.auth-benefits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.auth-benefits span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(40, 78, 92, 0.14);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--primary);
  background: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  box-shadow: var(--soft-shadow);
}

.hero-copy {
  max-width: 540px;
  color: #40535b;
  font-size: 17px;
}

.auth-proof {
  max-width: 520px;
  margin-top: 16px;
  padding: 8px 0 8px 14px;
  border-left: 3px solid var(--spark);
  color: #4f6068;
  background: transparent;
  box-shadow: none;
}

.auth-proof p {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
}

.auth-card {
  padding: 24px;
  box-shadow: 0 14px 38px rgba(34, 49, 58, 0.07);
  backdrop-filter: blur(14px);
}

.auth-tabs,
.app-nav {
  display: grid;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfaf6;
}

.auth-tabs {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 18px;
}

.auth-tabs button,
.app-nav button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.auth-tabs button.active,
.app-nav button.active {
  color: white;
  background: var(--primary);
  box-shadow: 0 6px 16px rgba(40, 78, 92, 0.16);
}

.auth-form {
  display: grid;
  gap: 13px;
}

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

input,
textarea,
select {
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: white;
  outline: 0;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(40, 78, 92, 0.55);
  box-shadow: 0 0 0 3px rgba(40, 78, 92, 0.08);
}

.auth-form input,
.manual-question-box input,
.manual-question-box textarea,
.question-tools input,
.question-tools select,
.result-tools input,
.result-tools select,
.history-tools input,
.history-tools select {
  min-height: 42px;
  padding: 9px 11px;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  width: 100%;
  min-height: 42px;
  padding: 9px 46px 9px 11px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--primary);
  background: rgba(40, 78, 92, 0.08);
}

.password-toggle:focus-visible {
  outline: 2px solid rgba(40, 78, 92, 0.24);
  outline-offset: 1px;
}

.password-toggle.is-visible {
  color: var(--primary);
}

.terms-row {
  grid-template-columns: 18px 1fr;
  align-items: start;
}

.terms-row input {
  min-height: auto;
  margin-top: 2px;
}

.terms-row a {
  color: var(--primary);
  text-decoration: none;
}

.terms-row a:hover {
  text-decoration: underline;
}

.code-row {
  display: grid;
  grid-template-columns: 1fr 118px;
  gap: 8px;
  align-items: end;
}

.wechat-box {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.wechat-box span,
.auth-message,
.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.auth-inline-note,
.privacy-reminder {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.privacy-reminder {
  padding: 10px 12px;
  border: 1px solid rgba(230, 184, 92, 0.34);
  border-radius: 8px;
  background: #fffaf0;
}

.privacy-reminder.compact {
  padding: 8px 0 0;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}

.trust-note {
  display: none;
}

.topbar {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
}

.brand-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
}

.topbar-line {
  max-width: 520px;
  text-align: right;
  font-size: 15px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  position: relative;
  width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 0;
  background: url("/logo.svg") center / contain no-repeat;
  box-shadow: none;
  overflow: hidden;
}

.brand-mark::before {
  content: none;
  position: absolute;
  right: -1px;
  top: 13px;
  width: 26px;
  height: 8px;
  border-radius: 999px 0 0 999px;
  background: var(--surface);
  box-shadow: 0 15px 0 var(--surface);
}

.brand-mark::after {
  content: none;
  position: absolute;
  left: 13px;
  top: 11px;
  width: 10px;
  height: 10px;
  background: var(--spark);
  clip-path: polygon(50% 0, 63% 36%, 100% 50%, 63% 64%, 50% 100%, 37% 64%, 0 50%, 37% 36%);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
}

.brand-mark span {
  display: none;
}

.brand-mark.large {
  width: 90px;
  height: 90px;
}

.brand-mark.large::before {
  top: 28px;
  width: 43px;
  height: 16px;
  box-shadow: 0 29px 0 var(--surface);
}

.brand-mark.large::after {
  left: 25px;
  top: 22px;
  width: 25px;
  height: 25px;
}

.brand-mark.large span {
  width: 22px;
  height: 22px;
  border-radius: 20px 0 0 0;
  box-shadow: -6px -6px 0 var(--surface);
}

.eyebrow,
.group-kicker {
  margin: 0 0 5px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin: 0;
  color: var(--text);
  font-size: 30px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 6px;
  font-size: 18px;
}

h3 {
  font-size: 15px;
}

.subhead,
.panel-head p,
.pdf-box p,
.guide-panel p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--selected);
}

.quota-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(230, 184, 92, 0.38);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(243, 229, 183, 0.44), rgba(255, 255, 255, 0.84)),
    rgba(243, 229, 183, 0.38);
}

.quota-panel strong {
  display: block;
  margin-bottom: 3px;
}

.quota-panel span {
  color: var(--muted);
  font-size: 13px;
}

.quota-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.auth-panel strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
}

.auth-panel span {
  color: var(--muted);
  font-size: 13px;
}

.auth-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.app-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  grid-template-columns: repeat(3, 1fr);
  width: min(520px, 100%);
  margin: 12px auto 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
}

.guide-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.3fr) 1fr;
  gap: 20px;
  margin-top: 14px;
  padding: 18px 22px;
  background: linear-gradient(135deg, #fffdf8, #ffffff);
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}

.guide-grid div {
  min-height: 74px;
  border: 0;
  border-left: 2px solid rgba(230, 184, 92, 0.55);
  border-radius: 0;
  padding: 4px 10px 4px 12px;
  background: transparent;
}

.guide-grid strong,
.guide-grid span {
  display: block;
}

.guide-grid strong {
  margin-bottom: 7px;
  font-size: 14px;
}

.guide-grid span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.42fr) minmax(520px, 0.58fr);
  gap: 0;
  margin-top: 14px;
  overflow: hidden;
}

.input-panel,
.question-panel,
.results-panel,
.history-panel {
  padding: 24px;
}

.results-panel {
  margin-top: 14px;
}

.input-panel {
  border-right: 1px solid var(--border);
  background: #fffdf8;
}

.panel-head,
.pdf-box,
.action-row,
.question-card-head,
.answer-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.materials,
.questions,
.results {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.material-card,
.question-card,
.result-group,
.answer-card,
.history-version-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.material-card {
  padding: 12px;
}

.material-card textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border: 0;
  border-radius: 8px;
  padding: 8px 0 0;
  color: var(--text);
  background: transparent;
  line-height: 1.65;
}

.material-card textarea:focus {
  box-shadow: none;
}

.material-top,
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.material-top {
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.pdf-box,
.manual-question-box {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.manual-question-box {
  display: grid;
  gap: 10px;
}

.manual-question-box textarea {
  min-height: 74px;
  resize: vertical;
}

.generation-action-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(40, 78, 92, 0.16);
  border-radius: 12px;
  background: #fffdf8;
}

.generation-action-panel strong {
  display: block;
  margin-bottom: 4px;
}

.generation-action-panel span {
  color: var(--muted);
  font-size: 13px;
}

.question-tools,
.result-tools,
.history-tools {
  display: grid;
  grid-template-columns: 1fr 150px 150px 150px;
  gap: 10px;
  margin-top: 16px;
}

.result-tools,
.history-tools {
  grid-template-columns: minmax(280px, 1fr) repeat(4, minmax(132px, 150px));
}

.history-tools select {
  min-width: 0;
}

.admin-shell {
  width: min(1180px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.admin-header,
.admin-login,
.admin-section,
.admin-stat {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--soft-shadow);
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
}

.admin-header h1 {
  margin: 0 0 8px;
  font-size: 34px;
  letter-spacing: 0;
}

.admin-header p {
  margin: 0;
  color: var(--muted);
}

.admin-home-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.admin-login {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
  padding: 18px;
}

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

.admin-login .hint {
  grid-column: 1 / -1;
  margin: 0;
}

.admin-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) 120px auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

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

.admin-form input {
  width: 100%;
}

.admin-abuse-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.admin-stat {
  padding: 16px;
}

.admin-stat span,
.admin-stat strong {
  display: block;
}

.admin-stat span {
  color: var(--muted);
  font-size: 13px;
}

.admin-stat strong {
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.admin-section {
  margin-top: 14px;
  padding: 20px;
}

.admin-table-wrap {
  max-height: 420px;
  margin-top: 14px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #fbfaf6;
}

.admin-table td {
  max-width: 360px;
  line-height: 1.55;
}

.admin-empty {
  color: var(--muted);
}

.search-box {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
}

.search-box input {
  width: 100%;
}

.upload-button,
.primary-button,
.secondary-button,
.icon-button,
.ghost-button,
.icon-search-button {
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.upload-button,
.secondary-button,
.ghost-button,
.icon-search-button {
  color: var(--text);
  background: white;
}

.upload-button {
  min-width: 112px;
  padding: 10px 14px;
  text-align: center;
}

.upload-button input {
  display: none;
}

.primary-button {
  min-height: 44px;
  padding: 0 18px;
  color: white;
  border-color: var(--primary);
  background: var(--primary);
  font-weight: 700;
}

.primary-button::before {
  content: "✦";
  margin-right: 7px;
  color: var(--spark);
}

.primary-button:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.secondary-button {
  min-height: 40px;
  padding: 0 14px;
}

.secondary-button:hover,
.ghost-button:hover,
.icon-search-button:hover {
  color: var(--primary);
  border-color: rgba(40, 78, 92, 0.34);
  background: var(--selected);
}

.danger-button {
  color: var(--danger);
}

.secondary-button.small,
.ghost-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.icon-button,
.icon-search-button {
  width: 42px;
  min-height: 42px;
  color: var(--primary);
  background: white;
  font-size: 19px;
  line-height: 1;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.action-row {
  z-index: 3;
  align-items: center;
  margin-top: 0;
  padding: 12px;
  border: 1px solid rgba(40, 78, 92, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--soft-shadow);
}

.material-action-row {
  position: static;
  display: block;
  margin-top: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.question-card {
  padding: 12px 14px;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.question-card:has(input[type="checkbox"]:checked) {
  border-color: rgba(40, 78, 92, 0.35);
  background: var(--selected);
}

.question-card:has(input[type="checkbox"]:checked)::before {
  content: "✦";
  display: inline-flex;
  position: absolute;
  right: 14px;
  top: 14px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.question-card {
  position: relative;
}

.question-card h3 {
  margin-bottom: 8px;
}

.question-card .prompt {
  margin: 9px 0 6px;
}

.question-card .cue {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.question-edit {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.question-edit label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.question-card input:not([type="checkbox"]),
.question-card textarea {
  width: 100%;
  padding: 8px 10px;
}

.question-card textarea {
  min-height: 70px;
  resize: vertical;
}

.tag,
.fact {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid rgba(40, 78, 92, 0.18);
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--primary);
  background: var(--selected);
  font-size: 12px;
  white-space: nowrap;
}

.tag.compact {
  min-height: 23px;
  padding: 2px 8px;
}

.season-new,
.generated-story {
  color: #7a5b13;
  background: rgba(243, 229, 183, 0.72);
  border-color: rgba(230, 184, 92, 0.55);
}

.season-old,
.season-manual,
.word-count {
  color: var(--muted);
  background: #f7f6f1;
  border-color: var(--border);
}

.type-person,
.type-place,
.type-object,
.type-experience {
  color: var(--primary);
  background: var(--selected);
  border-color: rgba(40, 78, 92, 0.18);
}

.progress-wrap {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fffdf8;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.progress-bar {
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #eee8da;
}

.progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--spark));
  transition: width 220ms ease;
}

.result-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 16px;
  margin-top: 18px;
}

.result-toc {
  position: sticky;
  top: 76px;
  align-self: start;
  max-height: calc(100vh - 96px);
  overflow: auto;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fffdf8;
}

.result-toc h3 {
  margin: 0 0 10px;
}

.toc-list {
  display: grid;
  gap: 7px;
}

.toc-list button {
  width: 100%;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 7px 9px;
  color: var(--text);
  background: white;
  text-align: left;
  cursor: pointer;
}

.toc-list button.active,
.toc-list button:hover {
  color: var(--primary);
  border-color: rgba(40, 78, 92, 0.18);
  background: var(--selected);
}

.toc-list span {
  display: inline-flex;
  margin-top: 3px;
  color: var(--spark);
  font-size: 12px;
}

.result-group {
  padding: 16px;
}

.answer-card {
  padding: 22px;
  border-radius: 12px;
}

.answer-card.standalone {
  margin-top: 0;
}

.answer-select-row {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.answer-title-row {
  align-items: flex-start;
  margin-bottom: 16px;
}

.answer-title-main {
  min-width: 0;
}

.answer-title-row h4,
.history-version-head h4 {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 19px;
  line-height: 1.35;
}

.prompt,
.history-time {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.history-time {
  margin: 6px 0 0;
}

.answer-section {
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fffdf8;
}

.answer-section h5 {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 14px;
}

.cue-notes ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.study-value ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.study-value li {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 12px;
  align-items: start;
}

.study-value strong {
  color: var(--primary);
  font-size: 13px;
  line-height: 1.55;
}

.study-value span {
  color: var(--text);
  font-size: 14px;
  line-height: 1.72;
}

.selection-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cue-note-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.34fr) 1fr;
  gap: 12px;
  align-items: start;
  padding-top: 8px;
  border-top: 1px solid rgba(230, 224, 210, 0.78);
}

.cue-note-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.cue-note-row strong {
  color: var(--text);
}

.cue-note-row span,
.link-section p,
.reuse p {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
}

.answer {
  margin: 0;
  color: var(--text);
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 17px;
  line-height: 1.86;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mini-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.copy-one {
  margin-top: 12px;
}

.history-panel {
  margin-top: 14px;
}

.history-version-card {
  padding: 20px;
  background: #fffefb;
  box-shadow: 0 10px 26px rgba(34, 49, 58, 0.05);
}

.history-date-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.history-date-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}

.history-version-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.history-select-cell {
  margin-bottom: 10px;
}

.history-version-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.history-version-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.history-version-head select {
  min-height: 34px;
  padding: 0 10px;
}

.history-version-body .answer-card {
  margin-top: 14px;
  padding: 0;
  border: 0;
  background: transparent;
}

.history-version-body .answer-title-row h4 {
  display: none;
}

.history-version-body .prompt {
  display: none;
}

.feedback-drawer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(34, 49, 58, 0.24);
  backdrop-filter: blur(8px);
}

.feedback-card {
  width: min(560px, 100%);
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

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

.feedback-card textarea {
  min-height: 140px;
  resize: vertical;
}

.settings-card {
  max-width: 520px;
}

.security-note {
  margin-top: 2px;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
}

.security-note strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 14px;
}

.security-note p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.usage-card {
  max-width: 680px;
}

.usage-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
}

.usage-steps div {
  min-height: 108px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: #fffdf8;
}

.usage-steps strong,
.usage-steps span {
  display: block;
}

.usage-steps strong {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 14px;
}

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

.feedback-card input,
.feedback-card select,
.feedback-card textarea {
  width: 100%;
  padding: 9px 11px;
}

@keyframes authPanelDrift {
  from {
    transform: translateY(0) rotate(-1.5deg);
  }

  to {
    transform: translateY(10px) rotate(-0.5deg);
  }
}

@keyframes authCardIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.empty-state {
  min-height: 124px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  background: #fffdf8;
  text-align: center;
  padding: 22px;
}

.empty-state::before {
  content: "✦";
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-bottom: 8px;
  border-radius: 8px;
  color: var(--primary);
  background: var(--soft-accent);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

.page-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.page-jump input {
  width: 52px;
  min-height: 34px;
  text-align: center;
}

@media (max-width: 1080px) {
  .auth-screen,
  .guide-panel,
  .workspace {
    display: block;
  }

  .auth-card,
  .workspace {
    margin-top: 18px;
  }

  .guide-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    margin-top: 18px;
  }

  .input-panel {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .question-tools,
  .result-layout,
  .result-tools,
  .history-tools {
    grid-template-columns: 1fr;
  }

  .result-toc {
    position: static;
    max-height: none;
  }

  .admin-grid {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }

  .admin-abuse-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 24px, 720px);
    padding-top: 12px;
  }

  .admin-shell {
    width: min(100vw - 24px, 720px);
    padding-top: 12px;
  }

  .admin-header,
  .admin-login {
    display: block;
  }

  .admin-home-link,
  .admin-login .primary-button {
    margin-top: 12px;
  }

  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-form {
    grid-template-columns: 1fr;
  }

  .auth-screen {
    min-height: calc(100vh - 24px);
    display: grid;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 12px;
    padding: 6px 0 22px;
  }

  .auth-screen::before {
    inset: 0 -8px auto -8px;
    height: 190px;
    border-radius: 0 0 18px 18px;
    transform: none;
    opacity: 0.72;
  }

  .auth-hero {
    max-width: none;
    padding: 0 2px;
  }

  .hero-brand {
    margin-bottom: 6px;
  }

  .topbar,
  .brand-block,
  .auth-panel,
  .quota-panel,
  .panel-head,
  .pdf-box,
  .answer-title-row,
  .history-version-head {
    display: block;
  }

  .brand-row {
    margin-bottom: 10px;
  }

  .hero-brand.brand-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
  }

  .brand-mark.large {
    width: 44px;
    height: 44px;
  }

  .brand-mark.large::before {
    width: 13px;
    height: 13px;
    left: 11px;
    top: 10px;
  }

  .brand-mark.large::after {
    width: 14px;
    height: 14px;
    right: 7px;
    bottom: 7px;
  }

  .auth-hero h1 {
    margin-bottom: 3px;
    font-size: 32px;
    line-height: 1;
  }

  .auth-hero .eyebrow {
    margin-bottom: 4px;
    font-size: 10px;
  }

  .hero-copy {
    max-width: none;
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.5;
  }

  .auth-benefits {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    margin-top: 10px;
  }

  .auth-benefits span {
    min-height: 26px;
    justify-content: center;
    padding: 0 5px;
    font-size: 11px;
    text-align: center;
    box-shadow: none;
  }

  .auth-proof {
    margin-top: 10px;
    padding: 6px 0 6px 9px;
  }

  .auth-proof p {
    font-size: 12px;
    line-height: 1.5;
  }

  .auth-card {
    margin-top: 0;
    padding: 14px;
    border-radius: 10px;
    box-shadow: 0 8px 22px rgba(34, 49, 58, 0.07);
  }

  .auth-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    margin-bottom: 14px;
    border-radius: 10px;
  }

  .auth-tabs button {
    min-height: 34px;
    border-radius: 7px;
    font-size: 13px;
    white-space: nowrap;
  }

  .auth-form {
    gap: 10px;
  }

  .auth-form input,
  .password-field input {
    min-height: 42px;
    border-radius: 9px;
  }

  .auth-form .primary-button {
    min-height: 44px;
    width: 100%;
  }

  .terms-row {
    align-items: start;
    font-size: 12px;
    line-height: 1.55;
  }

  .code-row {
    gap: 10px;
  }

  .code-row,
  .guide-grid,
  .usage-steps,
  .question-tools,
  .result-tools,
  .history-tools {
    grid-template-columns: 1fr;
  }

  .auth-controls,
  .quota-actions,
  .toolbar,
  .action-row,
  .history-version-actions {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .auth-controls button,
  .toolbar button,
  .action-row button,
  .upload-button {
    width: 100%;
  }

  .topbar-line {
    max-width: none;
    text-align: left;
  }

  .study-value li,
  .cue-note-row {
    grid-template-columns: 1fr;
  }

  .feedback-drawer {
    align-items: end;
    padding: 12px;
  }
}
