:root {
  --paper: #f8f4ec;
  --paper-deep: #f1eadf;
  --paper-soft: #fbf8f0;
  --ink: #191816;
  --muted: #817a70;
  --faint: #a39a8b;
  --line: rgba(122, 105, 78, 0.28);
  --line-strong: rgba(122, 105, 78, 0.42);
  --accent: #9c3d32;
  --accent-deep: #7c3028;
  --amber: #b9823e;
  --green: #6c805c;
  --shadow: 0 18px 48px rgba(55, 42, 23, 0.12);
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

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

body {
  min-height: 100dvh;
  background: var(--paper-deep);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0;
}

p {
  margin: 0;
}

.app-shell {
  width: min(1568px, calc(100vw - 40px));
  min-height: calc(100dvh - 32px);
  margin: 16px auto;
  border: 1px solid rgba(151, 137, 111, 0.34);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.topbar {
  min-height: 72px;
  display: grid;
  grid-template-columns: 390px 1fr auto;
  align-items: center;
  gap: 28px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
}

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

.brand img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.brand strong {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
}

.brand small {
  color: var(--faint);
  font-size: 12px;
  white-space: nowrap;
}

.nav {
  height: 72px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 28px;
}

.nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  transition: color 120ms linear;
}

.nav a:hover,
.nav a.is-active {
  color: var(--accent);
}

.nav a.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--accent);
}

.user-zone,
.mobile-actions,
.prompt-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.user-pill,
.ghost-button,
.primary-button,
.danger-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.24);
  color: var(--ink);
  white-space: nowrap;
}

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

.primary-button:hover {
  background: var(--accent-deep);
}

.ghost-button:hover,
.danger-link:hover {
  color: var(--accent);
  border-color: rgba(156, 61, 50, 0.45);
}

.danger-link {
  color: var(--muted);
}

.avatar {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(151, 137, 111, 0.26);
  border-radius: 50%;
  background: #f0eadf;
  color: var(--muted);
}

.mobile-actions {
  display: none;
}

.mobile-menu {
  position: relative;
}

.mobile-menu summary {
  list-style: none;
}

.mobile-menu summary::-webkit-details-marker {
  display: none;
}

.mobile-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 10px);
  right: 0;
  width: min(260px, calc(100vw - 32px));
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-soft);
  box-shadow: 0 14px 32px rgba(35, 28, 18, 0.14);
}

.mobile-panel a,
.mobile-panel button {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 0 10px;
}

.mobile-panel a:hover,
.mobile-panel button:hover {
  color: var(--accent);
  background: rgba(156, 61, 50, 0.06);
}

.main {
  min-height: calc(100dvh - 104px);
  padding: 78px 40px 58px;
}

.home {
  width: min(1120px, 100%);
  display: grid;
  justify-items: center;
  margin: 0 auto;
}

.hero-label {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--accent);
  font-size: 15px;
}

.hero-label::before,
.hero-label::after {
  content: "";
  width: 34px;
  height: 1px;
  background: rgba(156, 61, 50, 0.45);
}

.hero-title {
  margin-top: 28px;
  max-width: 800px;
  text-align: center;
  font-size: 60px;
  line-height: 1.15;
}

.hero-subtitle {
  margin-top: 22px;
  max-width: 720px;
  color: var(--muted);
  text-align: center;
  font-family: var(--serif);
  font-size: 19px;
}

.identity-panel {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  margin-top: 44px;
  padding: 22px 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.identity-panel h2 {
  margin-top: 4px;
  font-size: 25px;
}

.identity-panel p {
  margin-top: 6px;
  color: var(--muted);
}

.rights-copy {
  margin-top: 10px;
  display: grid;
  gap: 3px;
}

.rights-copy p {
  margin-top: 0;
  line-height: 1.7;
}

.rights-copy strong {
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
}

.identity-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
}

.identity-stats span {
  min-width: 0;
  padding: 12px 14px;
}

.identity-stats span + span {
  border-left: 1px solid var(--line);
}

.identity-stats small,
.fine,
.pack-kicker {
  color: var(--faint);
  font-size: 13px;
}

.identity-stats strong {
  display: block;
  margin-top: 3px;
  font-family: var(--serif);
  font-size: 17px;
}

.section-block {
  width: 100%;
  margin-top: 56px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  font-size: 28px;
}

.pack-grid,
.tool-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

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

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

.pack-card,
.tool-card {
  min-height: 180px;
  display: grid;
  gap: 8px;
  align-content: start;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.16);
  transition: transform 120ms linear, border-color 120ms linear, background 120ms linear;
}

.pack-card:hover,
.tool-card:hover,
.library-row:hover,
.arsenal-row:hover {
  transform: translateY(-1px);
  border-color: rgba(156, 61, 50, 0.5);
  background: rgba(255, 255, 255, 0.28);
}

.pack-card h3,
.tool-card h3 {
  font-size: 25px;
}

.pack-card p,
.tool-card p,
.upgrade-band p {
  color: var(--muted);
}

.pack-footer {
  align-self: end;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.pack-card.is-locked,
.pack-card.is-public,
.pack-card.is-login,
.pack-card.is-coming {
  opacity: 0.75;
}

.pack-card.is-base {
  border-color: rgba(156, 61, 50, 0.42);
  background: rgba(156, 61, 50, 0.04);
}

.arrow {
  color: var(--faint);
  font-size: 30px;
}

.tool-card {
  min-height: 150px;
  position: relative;
}

.tool-card .arrow {
  position: absolute;
  right: 20px;
  bottom: 14px;
}

.upgrade-band {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 28px;
  align-items: start;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.upgrade-band h2 {
  margin-top: 4px;
  font-size: 26px;
}

.page {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  color: var(--faint);
  font-size: 13px;
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.page-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-top: 38px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.page-title-row h1 {
  font-size: 48px;
  line-height: 1.14;
}

.page-title-row p {
  max-width: 520px;
  color: var(--muted);
}

.subtask-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 28px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.subtask-tabs a {
  min-height: 72px;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  color: var(--muted);
}

.subtask-tabs a + a {
  border-left: 1px solid var(--line);
}

.subtask-tabs span {
  color: var(--faint);
  font-family: var(--serif);
  font-size: 18px;
}

.subtask-tabs strong {
  color: var(--ink);
}

.subtask-tabs a.is-active strong,
.subtask-tabs a:hover strong {
  color: var(--accent);
}

.task-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 28px;
  margin-top: 28px;
}

.lobster-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.lobster-card {
  min-height: 290px;
  display: grid;
  align-content: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.16);
}

.lobster-card h2 {
  font-size: 24px;
}

.lobster-card p {
  color: var(--muted);
}

.task-index {
  color: var(--faint);
  font-family: var(--serif);
  font-size: 18px;
}

.source-box-wide {
  margin-top: 28px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.17);
}

.panel-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  font-size: 20px;
}

.panel-body {
  padding: 20px;
}

.use-steps {
  display: grid;
  gap: 10px;
}

.use-steps p {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
  color: var(--muted);
  font-size: 13px;
}

.use-steps span {
  color: var(--accent);
  font-family: var(--serif);
}

.profile-card {
  display: grid;
  gap: 14px;
}

.profile-form {
  width: min(720px, 100%);
  margin-top: 28px;
  padding: 24px;
}

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

.profile-card input,
.profile-card select,
.profile-card textarea,
.search-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
  color: var(--ink);
  padding: 0 12px;
}

.profile-card textarea {
  min-height: 112px;
  resize: vertical;
  padding: 10px 12px;
}

.notice-line {
  margin-bottom: 16px;
}

.notice-line a {
  color: var(--accent);
}

.notice-panel {
  margin-bottom: 16px;
}

.notice-panel p {
  margin-top: 8px;
  color: var(--muted);
}

.prompt-list {
  display: grid;
  gap: 16px;
}

.prompt-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.17);
  overflow: hidden;
}

.prompt-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.prompt-head h2 {
  font-size: 27px;
}

.prompt-head p {
  margin-top: 6px;
  color: var(--muted);
}

.prompt-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.prompt-actions.is-top {
  justify-content: flex-end;
  align-content: start;
}

.page-actions {
  margin-top: 28px;
}

.prompt-meta,
.chip-row,
.library-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-meta {
  margin-top: 10px;
}

.tag,
.chip {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(122, 105, 78, 0.2);
  border-radius: 5px;
  padding: 0 9px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.18);
  font-size: 12px;
}

.chip {
  min-height: 34px;
  cursor: pointer;
}

.chip.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.tag.is-copy {
  color: var(--accent);
}

.tag.is-warning {
  color: var(--amber);
}

.prompt-body {
  padding: 22px;
}

.translator-hint {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
}

.prompt-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.9;
}

.var-chip {
  display: inline;
  border-radius: 5px;
  padding: 1px 5px;
  background: rgba(108, 128, 92, 0.14);
  color: var(--green);
}

.var-chip.is-empty {
  border-bottom: 1px dashed var(--amber);
  background: rgba(185, 130, 62, 0.17);
  color: var(--amber);
}

.prompt-extra-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.source-box {
  display: grid;
  gap: 8px;
  align-content: start;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.source-box h3,
.faq-box summary {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
}

.source-box p {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.faq-box {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.faq-box summary {
  cursor: pointer;
  color: var(--accent);
}

.faq-box article {
  margin-top: 12px;
}

.faq-box p {
  margin-top: 5px;
  color: var(--muted);
}

.recipient-line {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.recipient-line strong {
  color: var(--ink);
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 12px;
}

.source-links a {
  color: var(--accent);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.library-tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 28px;
}

.chip-row {
  margin-top: 12px;
}

.library-list,
.arsenal-list {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.library-row,
.arsenal-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px 22px;
  background: rgba(255, 255, 255, 0.16);
  transition: transform 120ms linear, border-color 120ms linear, background 120ms linear;
}

.library-row h2,
.arsenal-row h2 {
  font-size: 25px;
}

.library-row p,
.arsenal-row p {
  margin-top: 5px;
  color: var(--muted);
}

.library-meta {
  margin-top: 10px;
}

.empty-state {
  display: grid;
  gap: 18px;
  padding: 40px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  min-width: 220px;
  border-radius: 8px;
  padding: 11px 16px;
  background: rgba(25, 24, 22, 0.9);
  color: #fff;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms linear, transform 120ms linear;
}

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

.loading {
  min-height: 320px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.dev-login-grid {
  width: min(620px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 32px auto 0;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr auto;
    gap: 16px;
    padding: 16px 18px;
  }

  .brand small,
  .nav,
  .user-zone {
    display: none;
  }

  .mobile-actions {
    display: flex;
  }

  .pack-grid,
  .tool-grid,
  .lobster-grid,
  .task-layout,
  .prompt-extra-grid,
  .upgrade-band,
  .identity-panel {
    grid-template-columns: 1fr;
  }

  .identity-stats {
    width: 100%;
  }

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

  .subtask-tabs a:nth-child(odd) {
    border-left: 0;
  }

  .subtask-tabs a:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .page-title-row,
  .prompt-head,
  .library-row,
  .arsenal-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .prompt-actions.is-top {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: calc(100vw - 10px);
    min-height: calc(100dvh - 10px);
    margin: 5px auto;
    border-radius: 16px;
  }

  .topbar {
    min-height: 104px;
  }

  .brand img {
    width: 38px;
    height: 38px;
  }

  .brand strong {
    font-size: 16px;
  }

  .mobile-actions {
    align-self: center;
  }

  .main {
    min-height: calc(100dvh - 114px);
    padding: 48px 18px 38px;
  }

  .hero-label {
    width: 100%;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
  }

  .hero-label::before,
  .hero-label::after {
    width: 22px;
  }

  .hero-title {
    margin-top: 24px;
    text-align: left;
    font-size: 34px;
  }

  .hero-subtitle {
    text-align: left;
    font-size: 17px;
  }

  .identity-panel {
    margin-top: 34px;
    padding: 18px 0;
  }

  .identity-stats {
    grid-template-columns: 1fr;
  }

  .identity-stats span + span {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .section-block {
    margin-top: 42px;
  }

  .section-head {
    display: grid;
    align-items: start;
  }

  .section-head h2,
  .upgrade-band h2 {
    font-size: 24px;
  }

  .pack-card,
  .tool-card {
    min-height: 154px;
    padding: 20px 18px;
  }

  .pack-card h3,
  .tool-card h3,
  .library-row h2,
  .arsenal-row h2 {
    font-size: 23px;
  }

  .page-title-row {
    display: grid;
    margin-top: 28px;
  }

  .page-title-row h1 {
    font-size: 34px;
  }

  .subtask-tabs {
    grid-template-columns: 1fr;
  }

  .subtask-tabs a + a,
  .subtask-tabs a:nth-child(n + 3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .library-row,
  .arsenal-row {
    min-height: 152px;
    padding: 20px 16px;
  }

  .prompt-text {
    font-size: 17px;
  }

  .primary-button,
  .ghost-button,
  .danger-link,
  .user-pill {
    padding: 0 11px;
  }
}
