:root {
  --ink: #263e35;
  --muted: #637467;
  --paper: #f3efdf;
  --panel: #faf7eb;
  --line: #c9ceb8;
  --jade: #3f6451;
  --red: #a44d37;
  --gold: #b3a169;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
  background: #dfe3d3;
  font-size: 15px;
  line-height: 1.65;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.13;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.76' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%2377856c' d='M0 0h140v140H0z' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E");
}
button,
input,
select {
  font: inherit;
}
button {
  min-height: 44px;
  min-width: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f5f1e2;
  color: var(--ink);
  padding: 8px 15px;
  cursor: pointer;
  touch-action: manipulation;
  line-height: 1.4;
}
button:hover:not(:disabled) {
  background: #e8eadb;
  border-color: var(--jade);
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}
button:focus-visible,
select:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}
.primary,
.selected {
  background: var(--jade);
  border-color: var(--jade);
  color: #fff9e8;
}
.primary:hover:not(:disabled),
.selected:hover:not(:disabled) {
  background: #294d3c;
}
.accent {
  background: var(--red);
  color: white;
  border-color: var(--red);
}
.text {
  background: transparent;
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.danger {
  color: var(--red);
  background: transparent;
  border-color: transparent;
}
.bad,
.reason {
  color: #9c4230;
}
.reason {
  font-size: 14px;
  margin: 7px 0;
}
.muted,
small {
  color: var(--muted);
}
h1,
h2,
h3,
p {
  margin: 0 0 13px;
}
h1,
h2,
h3,
.brand {
  font-family: "STKaiti", "KaiTi", "Kaiti SC", "SimSun", serif;
}
h1 {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: 4px;
  line-height: 1.3;
}
h2 {
  font-size: 23px;
  line-height: 1.4;
}
h3 {
  font-size: 19px;
}
h2 small {
  font:
    12px "Microsoft YaHei",
    sans-serif;
  word-break: break-all;
}
.app-shell {
  position: relative;
  max-width: 1120px;
  margin: 28px auto;
  min-height: calc(100dvh - 56px);
  display: grid;
  grid-template-columns: 154px minmax(0, 1fr);
  background: var(--paper);
  box-shadow: 0 14px 60px #263e3515;
  border: 1px solid #b9c2ac;
}
.sidebar {
  padding: 32px 19px;
  background: #29483b;
  color: #f5ecd6;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.brand {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 9px;
  font-size: 23px;
  white-space: nowrap;
}
.brand small {
  font-family: serif;
  color: #c4cbb1;
  font-size: 12px;
  letter-spacing: 3px;
}
.brand-seal {
  width: 45px;
  height: 48px;
  background: #a8553d;
  border: 2px solid #d69271;
  box-shadow:
    inset 0 0 0 2px #a8553d,
    inset 0 0 0 3px #d69271;
  text-align: center;
  line-height: 44px;
  color: #f7e6c6;
}
.sidebar nav {
  margin-top: 52px;
  display: grid;
  gap: 13px;
  width: 100%;
  position: sticky;
  top: 28px;
}
.sidebar nav button {
  border: none;
  background: transparent;
  color: #d1dac4;
  text-align: left;
  padding-left: 27px;
  letter-spacing: 6px;
  font-family: "KaiTi", "SimSun", serif;
  font-size: 21px;
  min-height: 54px;
}
.sidebar nav button.active {
  background: #eef0d9;
  color: #29483b;
  box-shadow: 4px 4px #1b342a;
}
.sidebar nav button:hover:not(.active) {
  background: #3b5d49;
}
.edition {
  font-size: 11px;
  line-height: 2;
  color: #c2cbb4;
  margin-top: auto;
  padding-top: 80px;
  letter-spacing: 1px;
}
.body {
  min-width: 0;
}
.topbar {
  min-height: 69px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 27px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  font-size: 13px;
}
.mode {
  font-size: 12px;
  letter-spacing: 1px;
  border: 1px solid #809279;
  padding: 3px 7px;
  color: #48604c;
  white-space: nowrap;
}
.energy-button {
  margin-left: auto;
  min-height: 44px;
  background: transparent;
}
.toplinks {
  display: flex;
  gap: 0;
}
.toplinks button {
  border: 0;
  background: transparent;
  padding: 7px 10px;
  font-size: 13px;
}
main {
  padding: 25px 30px 35px;
  min-width: 0;
}
.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.page-title p {
  max-width: 310px;
  font-size: 13px;
  text-align: right;
  color: var(--muted);
  margin: 0;
}
.eyebrow {
  font-family: Georgia, serif;
  font-size: 11px;
  letter-spacing: 2px;
  color: #829078;
  display: block;
  margin-bottom: 6px;
}
.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  flex-wrap: wrap;
  padding-bottom: 9px;
}
.tabs button {
  border-color: transparent;
  padding: 8px 24px;
}
.workbench {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.1fr);
  gap: 18px;
  margin-bottom: 23px;
  align-items: start;
}
.illustration {
  position: relative;
  align-self: center;
}
.scene-svg,
.pet-svg {
  display: block;
  width: 100%;
  height: auto;
}
.art-caption {
  text-align: center;
  letter-spacing: 2px;
  font-family: "KaiTi", "SimSun", serif;
  font-size: 16px;
  color: #657657;
  margin: 13px 0 0;
}
.seal {
  position: absolute;
  top: 30px;
  left: 12px;
  line-height: 1.3;
  border: 1px solid var(--red);
  color: var(--red);
  font-family: serif;
  padding: 3px;
  font-size: 13px;
}
.paper {
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 3px 3px 0 #cdd2bd22;
  min-width: 0;
  margin-bottom: 16px;
}
.filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
}
select,
input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  background: #f0efdf;
  border: 1px solid #bfc7b0;
  border-radius: 3px;
  padding: 7px;
  color: var(--ink);
  margin-top: 5px;
  font-size: 14px;
}
.id {
  font-family: monospace;
  display: block;
  font-size: 11px;
  margin-top: -8px;
  margin-bottom: 13px;
}
.costs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-block: 1px solid var(--line);
  margin-bottom: 15px;
}
.costs > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1px 10px;
  align-items: center;
  flex: 1;
  min-width: 100px;
}
.costs button {
  padding: 3px 0;
  grid-column: 1/-1;
  justify-self: start;
  font-size: 13px;
  min-height: 44px;
}
.costs span {
  font-size: 13px;
}
.costs b {
  font-variant-numeric: tabular-nums;
}
.guide {
  background: #e4e8d5;
  padding: 16px 20px;
  font-size: 14px;
  border: 1px dashed #adb99d;
  margin-top: 20px;
}
details {
  margin: 12px 0;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}
summary {
  cursor: pointer;
  min-height: 44px;
  color: var(--jade);
  font-size: 14px;
  padding: 5px 0;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  table-layout: fixed;
  margin: 12px 0;
}
th,
td {
  padding: 7px 4px;
  border-bottom: 1px solid #dce0ca;
  text-align: right;
  overflow-wrap: anywhere;
}
th:first-child,
td:first-child {
  text-align: left;
}
th {
  font-weight: 500;
  color: var(--muted);
}
pre {
  white-space: pre-wrap;
  word-break: break-all;
  font:
    12px/1.6 Consolas,
    monospace;
  background: #e9ecdc;
  padding: 12px;
  max-height: 350px;
  overflow: auto;
}
.qte-panel {
  max-width: 480px;
  margin: auto;
  text-align: center;
  padding: 0 15px 18px;
}
.qte-art {
  max-width: 330px;
  margin: auto;
}
.qte-panel h2 {
  margin-top: 0;
}
.scores {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 12px;
}
.scores span {
  padding: 4px 16px;
  border: 1px solid var(--line);
  font-size: 13px;
}
#qte-state {
  font-size: 14px;
}
.track {
  height: 30px;
  position: relative;
  background: #d3d9c3;
  border: 1px solid #9cad90;
  border-radius: 3px;
  margin: 20px 0 12px;
}
.track i {
  position: absolute;
  top: 0;
  height: 100%;
  display: block;
}
.hit-zone {
  background: #b4b482;
}
.perfect-zone {
  background: #53765b;
}
.track b {
  position: absolute;
  top: -8px;
  height: 44px;
  width: 4px;
  background: var(--red);
  transform: translateX(-2px);
}
.track b:before {
  content: "";
  position: absolute;
  left: -4px;
  top: -1px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid var(--red);
}
.qte-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 14px;
}
.qte-controls button {
  flex: 1;
  min-height: 54px;
}
.forge-ring {
  display: block;
  width: 150px;
  height: 150px;
  margin: 0 auto;
}
.qte-panel:has(.forge-ring) .qte-art {
  max-width: 235px;
}
.pet-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.pet-card {
  padding: 0 0 13px;
  text-align: left;
  overflow: hidden;
  background: #eef0df;
}
.pet-card b,
.pet-card span {
  display: block;
  margin: 0 14px;
}
.pet-card b {
  font-family: "KaiTi", "SimSun", serif;
  font-size: 18px;
}
.pet-card span {
  font-size: 12px;
  margin-top: 3px;
}
.pet-card.selected,
.pet-card.selected:hover:not(:disabled) {
  color: var(--ink);
  background: #e0e7d1;
  border: 2px solid var(--jade);
}
.pet-list .paper {
  padding: 12px;
  margin: 0;
}
.pet-list .paper h3 {
  font-size: 18px;
}
.pet-list .paper p {
  font-size: 13px;
}
.pet-list .paper .primary {
  font-size: 13px;
  padding: 8px;
}
.pet-detail {
  margin-top: 20px;
}
.feeding {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 80px auto;
  gap: 12px;
  align-items: end;
  margin-top: 20px;
}
.equip-slots {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 12px 0 18px;
}
.slot {
  padding: 5px;
  background: #edeedc;
  min-width: 0;
}
.slot .item-svg {
  width: 42px;
  height: 47px;
  display: block;
  margin: auto;
  opacity: 0.65;
}
.slot span {
  font-size: 13px;
  display: block;
}
.slot small {
  font-size: 10px;
  line-height: 1.4;
  display: block;
  overflow-wrap: anywhere;
  margin-top: 3px;
}
.slot.filled {
  background: #dde6d0;
  border-color: #75906c;
}
.slot.filled .item-svg {
  opacity: 1;
  color: #58774b;
}
.rune-slots {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.rune-slot {
  flex: 1;
  min-width: 80px;
  max-width: 135px;
  display: flex;
  flex-direction: column;
  text-align: center;
  background: #e9ecda;
  border: 1px solid #bac5a8;
  padding: 7px;
}
.rune-slot b {
  font-family: "KaiTi", "SimSun", serif;
  font-size: 25px;
  line-height: 1.8;
}
.rune-slot small {
  font-size: 12px;
}
.word-status {
  color: var(--jade);
  margin-top: 13px;
}
.row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 15px;
}
.row button {
  font-size: 13px;
}
.inventory {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.inventory .paper {
  margin: 0;
  padding: 15px;
}
.inventory-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.item-svg {
  width: 60px;
  height: 70px;
  flex-shrink: 0;
  color: #6a7951;
}
.inventory-item > div {
  min-width: 0;
}
.inventory-item h3 {
  font-size: 18px;
}
.inventory-item p {
  font-size: 12px;
}
.inventory-item b {
  display: block;
}
.readiness {
  display: flex;
  gap: 10px;
  padding: 14px 0;
  margin: 15px 0;
  border-block: 1px solid var(--line);
}
.readiness div {
  flex: 1;
  text-align: center;
  font-size: 12px;
}
.readiness b {
  display: block;
  font:
    23px/1.4 Georgia,
    serif;
  color: var(--jade);
  margin-top: 3px;
}
.report-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 13px 16px;
  margin-bottom: 10px;
}
.report .eyebrow {
  letter-spacing: 1px;
}
.report {
  font-size: 14px;
}
.word {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.breed-art {
  max-width: 270px;
  margin: auto;
}
progress {
  width: 100%;
  height: 8px;
  accent-color: var(--jade);
  margin: 0 0 15px;
}
#notice:empty,
#warning:empty {
  display: none;
}
#notice {
  font-size: 14px;
  padding: 10px 30px;
  color: var(--jade);
  background: #e5ead4;
}
#warning {
  background: #f1dbb1;
  color: #703921;
  padding: 12px 25px;
  font-size: 14px;
}
#warning button {
  margin-left: 8px;
  background: #fff2d1;
}
footer {
  text-align: center;
  padding: 15px;
  font-size: 10px;
  color: #79826d;
  letter-spacing: 0.3px;
}
dialog {
  color: var(--ink);
  background: var(--panel);
  border: 1px solid #a5b08f;
  max-width: calc(100vw - 24px);
  width: 560px;
  max-height: calc(100dvh - 24px);
  padding: 0;
  box-shadow: 0 24px 100px #182c3066;
  overflow: auto;
}
dialog::backdrop {
  background: #23382fb5;
}
.modal-content {
  padding: 26px;
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 20px;
}
.modal-open {
  overflow: hidden;
}
#modal-error {
  color: var(--red);
  padding-top: 10px;
}
.recovery {
  max-width: 700px;
  margin: 60px auto;
  background: var(--paper);
}
.recovery button {
  margin: 10px;
}
@media (max-width: 899px) {
  .app-shell {
    margin: 0;
    border: 0;
    display: block;
    min-height: 100dvh;
    padding-bottom: 75px;
    box-shadow: none;
  }
  .sidebar {
    padding: 0;
    display: block;
  }
  .brand,
  .edition {
    display: none;
  }
  .sidebar nav {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5;
    display: flex;
    gap: 0;
    margin: 0;
    background: #29483b;
    box-shadow: 0 -2px 14px #29483b22;
    padding: 5px 5px calc(5px + env(safe-area-inset-bottom));
    width: auto;
  }
  .sidebar nav button {
    flex: 1;
    text-align: center;
    padding: 7px 3px;
    letter-spacing: 2px;
    font-size: 19px;
    min-height: 51px;
    border-radius: 0;
  }
  .sidebar nav button.active {
    box-shadow: none;
    background: #e8edd4;
  }
  .topbar {
    padding: 10px 12px;
    gap: 8px;
    font-size: 12px;
    min-height: 60px;
  }
  .topbar .energy-button {
    padding: 6px 9px;
  }
  .toplinks button {
    padding: 6px;
    font-size: 12px;
    min-width: 44px;
  }
  .mode {
    font-size: 10px;
    padding: 3px 5px;
  }
  .page-title {
    align-items: flex-start;
    gap: 10px;
  }
  .page-title p {
    max-width: 170px;
    font-size: 12px;
  }
  h1 {
    font-size: 28px;
  }
  main {
    padding: 22px 12px 20px;
  }
  .eyebrow {
    font-size: 9px;
    letter-spacing: 1.5px;
  }
  .workbench {
    gap: 14px;
  }
  .paper {
    padding: 15px;
  }
  .qte-art {
    max-width: 260px;
  }
  .qte-panel {
    padding: 0 5px;
  }
  .qte-panel h2 {
    font-size: 20px;
  }
  .qte-panel:has(.forge-ring) .qte-art {
    max-width: 190px;
  }
  .forge-ring {
    height: 120px;
    width: 120px;
  }
  .pet-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pet-card b {
    font-size: 17px;
  }
  .pet-card b,
  .pet-card span {
    margin-inline: 10px;
  }
  .feeding {
    grid-template-columns: minmax(0, 1fr) 65px;
  }
  .feeding button {
    grid-column: 1/-1;
  }
  .inventory {
    grid-template-columns: 1fr;
  }
  .inventory-item {
    align-items: center;
  }
  .inventory-item h3 {
    font-size: 20px;
  }
  .equip-slots {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .modal-content {
    padding: 18px;
  }
  #notice {
    padding: 9px 12px;
  }
  .topbar .toplinks {
    margin-left: auto;
  }
  .guide {
    padding: 13px;
  }
  .rune-slot {
    min-width: 65px;
  }
  .rune-slots {
    gap: 6px;
  }
  .rune-slot button {
    padding: 6px;
  }
  .report {
    padding: 14px;
  }
}
@media (max-width: 600px) {
  .workbench {
    grid-template-columns: 1fr;
  }
  .workbench > .illustration {
    max-width: 350px;
    width: 100%;
    margin: auto;
  }
  .workbench .scene-svg {
    max-height: 235px;
  }
  .illustration .art-caption {
    margin: 0 0 8px;
    font-size: 14px;
  }
  .page-title {
    margin-bottom: 16px;
  }
  .tabs button {
    padding: 8px 20px;
  }
  .qte-panel .qte-art {
    max-width: 220px;
  }
  .qte-panel .qte-art .scene-svg {
    max-height: 150px;
  }
  .qte-panel:has(.forge-ring) .qte-art {
    display: none;
  }
  .scores {
    margin: 10px;
  }
  .qte-panel h2 {
    margin-bottom: 8px;
  }
  .rune-slot b {
    font-size: 22px;
  }
  .pet-detail h2 small {
    display: block;
  }
  footer {
    font-size: 9px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
