:root {
  color: #22251f;
  background: #efeee8;
  font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
  font-size: 14px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  padding: 36px 4vw;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #252920;
  padding-bottom: 24px;
  gap: 20px;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.18em;
  color: #6c7065;
  margin: 0 0 10px;
}
h1 {
  font-family: "Songti SC", SimSun, serif;
  font-weight: 600;
  font-size: 36px;
  margin: 0;
}
a {
  color: #385b3c;
  text-underline-offset: 4px;
  overflow-wrap: anywhere;
}
#connection {
  color: #62675b;
  min-height: 22px;
}
.layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 42px;
  margin-top: 28px;
}
aside {
  border-right: 1px solid #cccec3;
  padding-right: 24px;
}
label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  color: #59604f;
}
input,
select {
  width: 100%;
  border: 1px solid #bfc3b5;
  background: #f9f9f3;
  color: inherit;
  padding: 11px;
  margin-bottom: 20px;
  border-radius: 0;
  font: inherit;
}
button {
  font: inherit;
  cursor: pointer;
  border: 1px solid #9da58f;
  background: transparent;
  color: inherit;
  padding: 10px 15px;
  min-height: 42px;
}
button:hover {
  background: #e1e5d8;
}
button:disabled {
  opacity: 0.45;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #9c6329;
  outline-offset: 3px;
}
nav {
  display: grid;
  gap: 5px;
  max-height: 70vh;
  overflow: auto;
}
nav button {
  text-align: left;
  border: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
nav button[aria-current="true"] {
  background: #dce3d2;
  box-shadow: inset 3px 0 #49623b;
}
nav small {
  font-size: 11px;
  color: #65725a;
}
h2 {
  font-family: "Songti SC", SimSun, serif;
  font-size: 28px;
  margin: 0 0 10px;
}
.muted,
.empty {
  color: #747969;
}
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 26px 0;
}
figure {
  margin: 0;
  min-width: 0;
}
figcaption {
  font-size: 12px;
  color: #646b59;
  margin-bottom: 9px;
}
figure img {
  display: block;
  width: 100%;
  aspect-ratio: 1.5;
  object-fit: contain;
  background: #ddd;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0;
}
.primary {
  background: #354a2e;
  color: #fff;
  border-color: #354a2e;
}
.primary:hover {
  background: #4d653f;
}
.notice {
  border-left: 3px solid #71835d;
  padding: 12px 16px;
  background: #e5e8dc;
  white-space: pre-wrap;
}
.error {
  color: #8d3023;
  border-color: #8d3023;
  background: #f3e4dc;
}
section {
  border-top: 1px solid #c6cbbd;
  padding-top: 22px;
  margin-top: 30px;
}
h3 {
  font-size: 15px;
  margin: 0 0 16px;
}
.resource {
  display: grid;
  gap: 10px;
}
.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #d6d9ce;
}
.version {
  font-family: Consolas, monospace;
  overflow-wrap: anywhere;
}
#auth {
  padding: 18px;
  background: #e0e4d7;
  max-width: 650px;
}
#auth input {
  margin-bottom: 8px;
}
#auth span {
  display: inline-block;
  margin: 12px;
  color: #68725c;
}
@media (max-width: 700px) {
  body {
    padding: 22px 18px;
  }
  header {
    align-items: flex-start;
  }
  h1 {
    font-size: 29px;
  }
  header a {
    font-size: 12px;
  }
  .layout {
    grid-template-columns: 1fr;
    gap: 26px;
  }
  aside {
    border-right: 0;
    border-bottom: 1px solid #c6cbbd;
    padding: 0 0 18px;
  }
  nav {
    max-height: 180px;
    grid-template-columns: 1fr 1fr;
  }
  .pair {
    grid-template-columns: 1fr;
  }
  h2 {
    font-size: 24px;
  }
  .history-row {
    align-items: flex-start;
  }
  .actions button {
    flex: 1;
  }
}

.series-cover { margin: 18px 0; border: 1px solid var(--border, #d8dde4); border-radius: 10px; padding: 14px; }
.series-cover summary { cursor: pointer; font-weight: 600; }
.cover-layout { display: flex; flex-wrap: wrap; gap: 18px; padding-top: 14px; align-items: flex-start; }
.cover-layout img { width: 144px; max-width: 100%; height: auto; border-radius: 6px; }
.cover-layout > div { flex: 1 1 170px; min-width: 0; overflow-wrap: anywhere; }

.source-directory-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  overflow-wrap: anywhere;
}
.source-directory-row[hidden] {
  display: none;
}
#source-directory-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: 85vh;
  overflow: auto;
  padding: 24px;
  color: inherit;
  background: #f9f9f3;
  border: 1px solid #bfc3b5;
  border-radius: 8px;
}
#source-directory-dialog::backdrop {
  background: #22251f80;
}
.source-path-controls {
  display: flex;
  gap: 8px;
}
.source-path-controls input {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.source-path-controls button {
  white-space: nowrap;
}
.source-directory-folders {
  display: grid;
  gap: 8px;
  max-height: 35vh;
  overflow: auto;
}
.source-directory-folders button,
#source-directory-game,
#source-directory-status {
  text-align: left;
  overflow-wrap: anywhere;
}
@media (max-width: 520px) {
  #source-directory-dialog {
    padding: 16px;
  }
}
