:root {
  color-scheme: light;
  --paper: #f6f1e8;
  --surface: #fffdf9;
  --surface-strong: #ffffff;
  --ink: #24221f;
  --muted: #756f66;
  --line: #ded6ca;
  --line-strong: #c9bcae;
  --navy: #293f48;
  --navy-hover: #20343c;
  --red: #8f463d;
  --red-soft: #f4e7e4;
  --success: #355c4c;
  --focus: #9d493d;
  --shadow: 0 14px 38px rgba(65, 56, 45, 0.09);
  --header-height: 60px;
  --nav-height: 68px;
  --content-width: 720px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

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

h1,
h2,
h3 {
  text-wrap: balance;
}

h1,
h2 {
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-weight: 600;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(27px, 8vw, 36px);
  line-height: 1.2;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.45;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 32%, transparent);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--red);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.12em;
}

.button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
}

.button:disabled {
  cursor: wait;
  opacity: 0.6;
}

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

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

.button.secondary {
  color: var(--ink);
  background: #eee8de;
  border-color: #e1d8cb;
}

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

.button.wide {
  display: block;
  width: 100%;
  margin-top: 10px;
}

.text-button {
  min-height: 44px;
  border: 0;
  padding: 8px 10px;
  color: var(--red);
  background: transparent;
  font-weight: 700;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  padding: 32px 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin-bottom: 10px;
  font-size: 38px;
}

.login-card > p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.75;
}

.status-text {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.app {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  height: calc(var(--header-height) + env(safe-area-inset-top));
  display: grid;
  grid-template-columns: minmax(70px, 1fr) auto minmax(70px, 1fr);
  align-items: end;
  gap: 10px;
  padding: env(safe-area-inset-top) max(14px, calc((100vw - var(--content-width)) / 2)) 10px;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  backdrop-filter: blur(14px);
}

.app-header h1 {
  align-self: center;
  margin: 0;
  font-family: inherit;
  font-size: 16px;
  font-weight: 750;
  white-space: nowrap;
}

.header-home,
.header-back {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-self: start;
  border: 0;
  padding: 0 2px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  text-decoration: none;
}

.account-entry {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  justify-self: end;
  border: 1px solid #cfc5b8;
  border-radius: 50%;
  color: #fff;
  background: var(--navy);
  font-size: 14px;
  font-weight: 800;
}

.app-main {
  width: min(var(--content-width), 100%);
  min-height: calc(100vh - var(--header-height));
  margin: 0 auto;
  padding: 26px 16px calc(var(--nav-height) + env(safe-area-inset-bottom) + 52px);
}

.view {
  animation: view-in 160ms ease-out;
}

.view.subview {
  padding-bottom: 28px;
}

.view-heading,
.subview-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.creation-hub {
  display: grid;
  grid-template-columns: minmax(180px, 0.72fr) minmax(0, 1.6fr);
  align-items: center;
  gap: 18px;
  margin: 0 0 30px;
  padding: 20px;
  border-radius: 16px;
  color: #fffaf4;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.16), transparent 34%),
    linear-gradient(135deg, #7f433c, #963f35);
  box-shadow: 0 15px 34px rgba(102, 57, 49, 0.2);
}

.creation-hub-copy h2 {
  margin-bottom: 7px;
  color: #fff;
  font-size: 30px;
}

.creation-hub-copy .eyebrow {
  color: #ffe0d6;
}

.creation-hub-copy > p:last-child {
  margin: 0;
  color: #f7e6df;
  font-size: 13px;
  line-height: 1.65;
}

.creation-hub-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.book-creation-hub {
  grid-template-columns: minmax(220px, 1fr) minmax(240px, 0.82fr);
}

.book-creation-hub .creation-hub-actions {
  grid-template-columns: minmax(0, 1fr);
}

.book-choice .creation-choice-mark {
  background: var(--navy);
}

.creation-choice {
  min-width: 0;
  min-height: 96px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 12px;
  padding: 14px;
  color: var(--ink);
  background: rgba(255, 252, 247, 0.96);
  box-shadow: 0 8px 20px rgba(55, 29, 25, 0.13);
  text-align: left;
  transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.creation-choice:hover {
  transform: translateY(-2px);
  background: #fff;
  box-shadow: 0 11px 24px rgba(55, 29, 25, 0.18);
}

.creation-choice-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--red);
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 20px;
  font-weight: 700;
}

.write-choice .creation-choice-mark {
  background: var(--navy);
}

.creation-choice strong,
.creation-choice small {
  display: block;
}

.creation-choice strong {
  margin-bottom: 5px;
  font-size: 15px;
}

.creation-choice small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-overflow: ellipsis;
}

.subview-heading {
  align-items: center;
}

.save-state {
  max-width: 150px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: right;
}

.bottom-nav {
  position: fixed;
  z-index: 25;
  right: 0;
  bottom: 0;
  left: 0;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0 max(10px, calc((100vw - var(--content-width)) / 2)) env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.bottom-nav a {
  min-height: 52px;
  display: grid;
  place-items: center;
  align-self: center;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.bottom-nav a[aria-current="page"] {
  color: var(--navy);
  background: #eee8de;
}

.global-add {
  position: fixed;
  z-index: 28;
  right: max(18px, calc((100vw - var(--content-width)) / 2 + 18px));
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 10px);
  display: grid;
  justify-items: center;
  gap: 5px;
  border: 0;
  padding: 0;
  color: var(--navy);
  background: transparent;
}

.global-add-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--navy);
  box-shadow: 0 12px 26px rgba(41, 63, 72, 0.25);
  font-size: 26px;
  line-height: 1;
  transition: transform 160ms ease, background-color 160ms ease;
}

.global-add-label {
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--navy) 14%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 5px 16px rgba(41, 63, 72, 0.1);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
}

.global-add:hover .global-add-icon {
  transform: translateY(-2px);
  background: #203942;
}

.global-add:active .global-add-icon {
  transform: translateY(0) scale(0.97);
}

.paper-panel,
.paper-form,
.empty-state,
.success-panel,
.inline-notice,
.error-state {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(65, 56, 45, 0.05);
}

.paper-panel,
.paper-form,
.success-panel,
.inline-notice,
.error-state {
  padding: 20px;
}

.empty-state {
  padding: 34px 22px;
  text-align: center;
}

.empty-state h3 {
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 25px;
}

.empty-state p,
.paper-panel > p,
.success-panel p,
.inline-notice p,
.error-state p {
  color: var(--muted);
  line-height: 1.7;
}

.empty-state .button-row {
  justify-content: center;
  margin-top: 18px;
}

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

.featured-book {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(22px, 7vw, 46px);
  padding: 10px 4px 32px;
}

.featured-book-copy h3 {
  margin: 5px 0 8px;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: clamp(26px, 7vw, 36px);
  font-weight: 600;
}

.featured-book-copy .meta,
.book-card-copy .meta,
.article-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.featured-book-copy .button-row {
  margin-top: 20px;
}

.book-cover-button {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
}

.book-cover {
  position: relative;
  aspect-ratio: 130 / 184;
  container-type: inline-size;
  overflow: hidden;
  color: var(--navy);
  background-color: #f8f0e3;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  border: 1px solid rgba(35, 29, 23, 0.28);
  border-radius: 4px;
  box-shadow: 10px 14px 22px rgba(59, 48, 38, 0.2);
}

.book-cover .cover-title,
.book-cover .cover-subtitle,
.book-cover .cover-author {
  position: absolute;
  z-index: 1;
  display: block;
  overflow: hidden;
}

.book-cover .cover-title {
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: clamp(17px, 11cqw, 30px);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

.book-cover .cover-subtitle,
.book-cover .cover-author {
  font-size: clamp(8px, 4.8cqw, 12px);
  line-height: 1.5;
  letter-spacing: 0.09em;
}

.cover-template-whitespace {
  background-image: url("/static/poetry/covers/cover-whitespace.png");
}

.book-cover.cover-template-whitespace .cover-title {
  top: 16%;
  right: 27%;
  max-height: 58%;
  color: #173843;
  writing-mode: vertical-rl;
}

.book-cover.cover-template-whitespace .cover-subtitle {
  bottom: 11%;
  left: 13%;
  max-width: 58%;
  color: #9a4338;
}

.book-cover.cover-template-whitespace .cover-author {
  top: 23%;
  right: 12%;
  max-height: 48%;
  color: #5f574e;
  writing-mode: vertical-rl;
}

.cover-template-color-block {
  background-image: url("/static/poetry/covers/cover-color-block.png");
}

.book-cover.cover-template-color-block .cover-title {
  top: 17%;
  left: 18%;
  width: 56%;
  max-height: 42%;
  color: #fff7e9;
  font-size: clamp(18px, 12cqw, 33px);
}

.book-cover.cover-template-color-block .cover-subtitle {
  top: 16%;
  right: 3%;
  width: 14%;
  max-height: 28%;
  color: #173843;
  text-align: center;
  writing-mode: vertical-rl;
}

.book-cover.cover-template-color-block .cover-author {
  bottom: 9%;
  left: 20%;
  width: 66%;
  color: #fff7e9;
}

.cover-template-landscape {
  background-image: url("/static/poetry/covers/cover-landscape.png");
}

.book-cover.cover-template-landscape .cover-title {
  top: 10%;
  right: 11%;
  left: 11%;
  max-height: 27%;
  color: #173843;
  font-size: clamp(18px, 12cqw, 32px);
  text-align: center;
}

.book-cover.cover-template-landscape .cover-subtitle {
  top: 31%;
  right: 13%;
  left: 13%;
  color: #9a4338;
  text-align: center;
}

.book-cover.cover-template-landscape .cover-author {
  top: 39%;
  right: 13%;
  left: 13%;
  color: #5f574e;
  text-align: center;
}

.section-title {
  margin: 12px 0 16px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 800;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 18px;
}

.book-card {
  min-width: 0;
}

.book-card .book-cover {
  width: min(100%, 180px);
  margin: 0 auto;
  padding: 20px 15px 18px 20px;
}

.book-card .book-cover strong {
  font-size: clamp(16px, 5vw, 22px);
}

.book-card-copy {
  position: relative;
  padding: 12px 38px 0 2px;
}

.book-card-copy h3 {
  margin: 0 0 5px;
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.more-menu {
  position: absolute;
  top: 4px;
  right: 0;
}

.more-menu.inline-menu {
  position: relative;
  top: auto;
  right: auto;
}

.more-menu summary {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

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

.more-menu[open] .menu-popover {
  display: grid;
}

.menu-popover {
  position: absolute;
  z-index: 12;
  top: 42px;
  right: 0;
  width: 160px;
  display: none;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.menu-popover button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  padding: 8px 10px;
  background: transparent;
  text-align: left;
}

.menu-popover button:hover {
  background: #f3eee6;
}

.menu-popover button.danger-text {
  color: var(--red);
}

.search-field {
  display: grid;
  gap: 7px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-field input,
.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 12px 13px;
  color: var(--ink);
  background: var(--surface-strong);
  outline: 0;
}

.field input {
  height: 48px;
}

.search-field input {
  min-height: 46px;
}

.filter-tabs {
  display: flex;
  gap: 8px;
  margin: -4px 0 18px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.filter-tabs button {
  min-height: 38px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  color: var(--muted);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
}

.filter-tabs button[aria-pressed="true"] {
  border-color: var(--navy);
  color: #fff;
  background: var(--navy);
}

.field textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.75;
}

.field textarea.article-body {
  min-height: min(54vh, 540px);
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 17px;
  line-height: 1.9;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 18px;
}

.field > label,
.field > span {
  color: #5b554d;
  font-size: 13px;
  font-weight: 750;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
}

.field-grid > .field {
  align-content: start;
}

.field-meta {
  min-height: 18px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.inline-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.article-list {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border-top: 1px solid var(--line);
}

.article-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 8px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.article-card.highlight {
  animation: highlight 1.8s ease-out;
}

.article-main {
  min-width: 0;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.article-main h3 {
  margin-bottom: 6px;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 20px;
  font-weight: 600;
}

.article-excerpt {
  display: -webkit-box;
  overflow: hidden;
  margin: 8px 0;
  color: #565149;
  font-size: 14px;
  line-height: 1.75;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: pre-line;
}

.article-card .more-menu {
  position: relative;
  top: -8px;
}

.paper-form {
  padding-bottom: 0;
}

.cover-editor {
  display: grid;
  grid-template-columns: minmax(180px, 224px) minmax(0, 1fr);
  align-items: start;
  gap: 26px;
  margin-bottom: 18px;
}

.cover-preview-column {
  min-width: 0;
}

.cover-preview-label {
  margin: 0 0 9px;
  color: #5b554d;
  font-size: 13px;
  font-weight: 750;
}

.cover-live-preview {
  width: min(100%, 224px);
}

.cover-live-preview .book-cover {
  width: 100%;
  box-shadow: 7px 10px 20px rgba(59, 48, 38, 0.18);
}

.cover-preview-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.cover-editor-fields {
  min-width: 0;
}

.field-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.cover-template-picker {
  min-width: 0;
  margin: 2px 0 0;
  padding: 0;
  border: 0;
}

.cover-template-picker legend {
  margin-bottom: 9px;
  color: #5b554d;
  font-size: 13px;
  font-weight: 750;
}

.cover-template-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.cover-template-option {
  position: relative;
  min-width: 0;
  cursor: pointer;
  text-align: center;
}

.cover-template-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.cover-template-thumb {
  aspect-ratio: 130 / 184;
  display: block;
  width: 100%;
  max-width: 88px;
  margin: 0 auto 6px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  border: 2px solid transparent;
  border-radius: 4px;
  box-shadow: 0 5px 12px rgba(59, 48, 38, 0.12);
}

.cover-template-option input:checked + .cover-template-thumb {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(150, 61, 53, 0.14), 0 7px 15px rgba(59, 48, 38, 0.16);
}

.cover-template-option input:focus-visible + .cover-template-thumb {
  outline: 3px solid rgba(28, 60, 72, 0.28);
  outline-offset: 3px;
}

.cover-template-option strong {
  display: block;
  overflow: hidden;
  color: #5b554d;
  font-size: 11px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-create-next-step {
  margin-top: 6px;
}

.book-create-next-step strong {
  display: block;
  margin-bottom: 3px;
}

.book-created-guide {
  margin-bottom: 16px;
}

.book-created-guide .eyebrow {
  margin-bottom: 5px;
}

.book-created-guide h3 {
  margin-bottom: 7px;
}

.organize-book-summary,
.organize-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.organize-book-summary {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.organize-book-summary h3,
.organize-section-heading h3 {
  margin: 0 0 4px;
}

.organize-book-summary p,
.organize-section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.organize-cover-editor {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.organize-section-heading {
  margin: 22px 0 12px;
}

.book-empty-state {
  margin-bottom: 18px;
}

.editor-import-shortcut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 14px 18px;
  border: 1px solid #dfd3c5;
  border-radius: 12px;
  background: #f3ece2;
}

.editor-import-shortcut strong,
.editor-import-shortcut span {
  display: block;
}

.editor-import-shortcut strong {
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 14px;
}

.editor-import-shortcut span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.location-field-meta {
  align-items: center;
}

.location-field-meta .text-button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 3px 0 3px 8px;
}

.form-dock {
  position: sticky;
  z-index: 8;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 20px -20px 0;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.form-error {
  margin: 16px 0;
  padding: 12px 14px;
  border-radius: 9px;
  color: var(--red);
  background: var(--red-soft);
  line-height: 1.6;
}

.inline-notice,
.success-panel {
  margin-bottom: 18px;
}

.inline-notice h3 {
  margin-bottom: 6px;
}

.success-panel h3 {
  color: var(--success);
}

.import-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.file-dropzone {
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 11px;
  background: #fbf7f0;
  text-align: center;
}

.file-dropzone.dragging {
  border-color: var(--red);
  background: #f5ece5;
}

.file-dropzone.busy {
  opacity: 0.65;
}

.article-picker {
  min-width: 0;
  margin: 6px 0 18px;
  padding: 0;
  border: 0;
}

.article-picker legend {
  margin-bottom: 10px;
  color: #5b554d;
  font-size: 13px;
  font-weight: 750;
}

.picker-toolbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding: 5px 10px;
  border-radius: 9px;
  color: var(--muted);
  background: #f2ece3;
  font-size: 12px;
}

.picker-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 12px;
}

.picker-filters button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 13px;
}

.picker-filters button[aria-pressed="true"] {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
}

.picker-filter-empty {
  padding: 32px 20px;
  color: var(--muted);
  background: var(--surface-strong);
  text-align: center;
}

.picker-filter-empty strong {
  color: var(--ink);
  font-size: 16px;
}

.picker-filter-empty p {
  margin: 8px 0 0;
  font-size: 13px;
}

.picker-list,
.organize-list,
.choice-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.picker-row,
.organize-row,
.choice-row {
  min-height: 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--surface-strong);
  border-bottom: 1px solid var(--line);
}

.picker-row:last-child,
.organize-row:last-child,
.choice-row:last-child {
  border-bottom: 0;
}

.picker-row label,
.choice-row button {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.picker-row input {
  width: 20px;
  height: 20px;
}

.picker-row strong,
.organize-row strong,
.choice-row strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.lock-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 10px;
  color: var(--muted);
  background: #f4eee5;
  font-size: 12px;
  font-weight: 750;
}

.lock-button[aria-pressed="true"] {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.picker-row.is-locked {
  background: #fbf4eb;
}

.picker-row input:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.organize-controls {
  display: flex;
  gap: 2px;
}

.organize-controls button {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: #f2ece3;
}

.organize-controls button.remove {
  color: var(--red);
}

.organize-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.choice-row button {
  width: 100%;
  justify-content: space-between;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.choice-state {
  color: var(--muted);
  font-size: 12px;
}

.choice-row button:disabled {
  cursor: default;
  opacity: 0.72;
}

.more-fields {
  margin: 20px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.more-fields summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  color: var(--navy);
  cursor: pointer;
  font-weight: 750;
}

.profile-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.profile-initial {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--navy);
  font-weight: 800;
}

.author-preference-card {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.author-preference-card label {
  color: var(--ink);
  font-weight: 750;
}

.author-preference-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.preference-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
}

.preference-input-row input {
  min-width: 0;
  height: 46px;
  border: 1px solid #cbbba8;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.profile-links {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.profile-links a,
.profile-links button,
.profile-links .profile-row {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  background: transparent;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
}

.profile-links > :last-child {
  border-bottom: 0;
}

.profile-links small {
  color: var(--muted);
}

.toast {
  position: fixed;
  z-index: 70;
  right: 16px;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 78px);
  max-width: min(360px, calc(100vw - 32px));
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 15px;
  border-radius: 9px;
  color: #fff;
  background: #25231f;
  box-shadow: var(--shadow);
  font-size: 13px;
  line-height: 1.55;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@keyframes view-in {
  from {
    transform: translateY(4px);
    opacity: 0;
  }

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

@keyframes highlight {
  from {
    background: #eee4d5;
  }

  to {
    background: transparent;
  }
}

@media (max-width: 620px) {
  .app-main {
    padding: 20px 13px calc(var(--nav-height) + env(safe-area-inset-bottom) + 50px);
  }

  .app-header {
    padding-right: 13px;
    padding-left: 13px;
  }

  .creation-hub {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    margin-bottom: 18px;
    padding: 12px;
    border-radius: 12px;
  }

  .creation-hub-copy h2 {
    margin: 1px 0 0;
    font-size: 20px;
    line-height: 1.25;
  }

  .creation-hub-copy .eyebrow {
    margin-bottom: 2px;
    font-size: 9px;
  }

  .creation-hub-copy > p:last-child {
    display: none;
  }

  .creation-hub-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .book-creation-hub {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .book-creation-hub .creation-hub-copy h2 {
    font-size: 19px;
    white-space: nowrap;
  }

  .book-creation-hub .creation-hub-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .creation-choice {
    min-height: 52px;
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    padding: 9px 7px;
    text-align: center;
  }

  .creation-choice-mark,
  .creation-choice small {
    display: none;
  }

  .creation-choice strong {
    margin: 0;
    font-size: 13px;
    line-height: 1.35;
  }

  .cover-editor {
    grid-template-columns: minmax(112px, 38%) minmax(0, 1fr);
    gap: 14px;
  }

  .cover-preview-hint {
    display: none;
  }

  .cover-editor-fields .field {
    margin-bottom: 12px;
  }

  .cover-editor-fields .field input {
    height: 44px;
    padding: 10px;
  }

  .cover-template-options {
    gap: 5px;
  }

  .cover-template-option strong {
    font-size: 9px;
  }

  .organize-book-summary,
  .organize-section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .organize-book-summary .button-row,
  .organize-section-heading .button {
    width: 100%;
  }

  .editor-import-shortcut {
    align-items: stretch;
    flex-direction: column;
  }

  .editor-import-shortcut .button {
    width: 100%;
  }

  .featured-book {
    grid-template-columns: minmax(128px, 42vw) minmax(0, 1fr);
    align-items: start;
    gap: 18px;
  }

  .featured-book-copy h3 {
    font-size: 25px;
  }

  .featured-book-copy .button-row {
    display: grid;
    margin-top: 14px;
  }

  .field-grid,
  .import-grid {
    grid-template-columns: 1fr;
  }

  .file-dropzone {
    min-height: 180px;
  }

  .desktop-only {
    display: none;
  }
}

@media (max-width: 390px) {
  .picker-row.book-add-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .picker-row-actions {
    justify-content: space-between;
    padding-left: 30px;
  }

  .featured-book {
    grid-template-columns: 126px minmax(0, 1fr);
    gap: 14px;
  }

  .book-cover {
    padding: 19px 13px 17px 19px;
  }

  .book-cover strong {
    font-size: 19px;
  }

  .featured-book-copy h3 {
    font-size: 22px;
  }

  .button {
    padding-right: 12px;
    padding-left: 12px;
  }

  .books-grid {
    gap: 20px 13px;
  }

  .paper-panel,
  .paper-form,
  .success-panel,
  .inline-notice,
  .error-state {
    padding: 16px;
  }

  .form-dock {
    margin-right: -16px;
    margin-left: -16px;
    padding-right: 16px;
    padding-left: 16px;
  }
}

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