:root {
  --bg: #f5f3ef;
  --panel: #ffffffd9;
  --ink: #1f1a17;
  --muted: #72665d;
  --line: #dfd8d2;
  --accent: #8c3d2c;
  --accent-soft: #f0ddd7;
  --danger: #9f2f2f;
  --shadow: 0 10px 30px rgba(43, 30, 21, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Manrope", "PingFang SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at -10% -10%, #eee3db 20%, transparent 60%),
    radial-gradient(1000px 500px at 120% 120%, #e5ece9 15%, transparent 50%),
    var(--bg);
  min-height: 100vh;
}

.app-shell {
  max-width: 1080px;
  margin: 42px auto;
  padding: 0 20px 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

.version-badge {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--line);
  background: #fffaf6;
  border-radius: 999px;
  padding: 6px 10px;
  line-height: 1;
  margin-top: 4px;
  display: inline-flex;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1, h2 {
  margin: 4px 0;
  font-family: "Noto Serif SC", serif;
  font-weight: 600;
}

.prompt-panel, .market-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.prompt-panel {
  padding: 16px;
  margin-bottom: 16px;
}

label {
  display: block;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 11px;
  resize: vertical;
  font-size: 14px;
  line-height: 1.5;
  background: #fffcfa;
}

.actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

#copyStatus {
  color: var(--muted);
  font-size: 13px;
}

.market-panel {
  padding: 16px;
}

.category-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
}

.main-head {
  align-items: flex-start;
}

.title-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.refresh-inline-btn {
  padding: 5px 9px;
  white-space: nowrap;
  font-size: 12px;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.tag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn:hover { transform: translateY(-1px); }

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

.btn-danger {
  background: #fff4f4;
  border-color: #f2caca;
  color: var(--danger);
}

.btn-subtle {
  background: #f7f4f0;
}

.tab {
  position: relative;
}

.tab-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ad5a48;
  color: #fff;
  border: 1px solid #fff7f3;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  font-weight: 700;
  box-shadow: 0 3px 8px rgba(140, 61, 44, 0.2);
}

.tab.active {
  background: var(--accent-soft);
  border-color: #d4a89d;
  color: #5e2418;
}

.tag-btn {
  text-align: center;
  padding: 9px 10px;
  border: 1px solid #dfd8d2;
  border-radius: 10px;
  background: #fff;
  transition: all .15s ease;
}

.tag-btn .zh {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}

.tag-btn .en {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
  text-align: center;
  line-height: 1.25;
}

.tag-btn.active {
  border-color: #c07f71;
  background: #fff3ef;
  box-shadow: inset 0 0 0 1px #c07f71;
}

.all-shelves-section {
  margin-top: 28px;
  border-top: 1px solid #e6d8cd;
  padding-top: 18px;
}

.shelves-head {
  margin-bottom: 12px;
}

.shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 10px;
}

.shelf-card {
  border: 1px solid #e5dbd4;
  border-radius: 12px;
  background: #fffdfb;
  padding: 10px 11px;
}

.shelf-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.shelf-card h3 {
  margin: 0;
  font-size: 15px;
  font-family: "Noto Serif SC", serif;
  font-weight: 600;
}

.shelf-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shelf-tag-btn {
  border: 1px solid #dfd8d2;
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  padding: 5px 9px;
  cursor: pointer;
  text-align: center;
}

.shelf-tag-btn.active {
  border-color: #c07f71;
  background: #fff3ef;
}

.shelf-toggle {
  font-size: 12px;
  padding: 5px 8px;
  color: #7c5c4f;
}

.shelf-empty {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.recommend-zone {
  border: 1px solid #e4c8bd;
  background: linear-gradient(180deg, #fff8f5 0%, #fffdfa 100%);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 8px;
}

.tag-grid.recommend-zone {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.tag-grid.recommend-zone .tag-btn {
  padding: 11px 12px;
}

@media (max-width: 768px) {
  .topbar {
    position: relative;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding-right: 64px;
  }
  .version-badge {
    position: absolute;
    top: 2px;
    right: 0;
    margin-top: 0;
    font-size: 11px;
    padding: 5px 8px;
  }
  .section-head { flex-direction: column; }
  .title-row {
    display: flex;
    flex-wrap: wrap;
  }
  .tag-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .tag-grid.recommend-zone {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
