:root {
  color-scheme: light;
  --ink: #24160f;
  --muted: #735946;
  --paper: #ead7aa;
  --paper-dark: #c89f66;
  --leather: #603821;
  --leather-hi: #9a6844;
  --bamboo: #3d6f3f;
  --bamboo-light: #8da56c;
  --tile: #1d2425;
  --wall: #f0ead8;
  --jade: #2f7a62;
  --cinnabar: #a33e2f;
  --line: rgba(61, 37, 21, 0.22);
  --tex-paper: url("./assets/texture-xuan-paper.png");
  --tex-bamboo: url("./assets/texture-bamboo-wood.png");
  --tex-jade: url("./assets/texture-jade-cinnabar.png");
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(18, 23, 20, 0.1), rgba(24, 18, 13, 0.38)),
    url("./assets/chinese-courtyard-ui-bg.png") center / cover no-repeat fixed,
    radial-gradient(circle at 58% 10%, rgba(255, 247, 213, 0.62), transparent 18rem),
    linear-gradient(180deg, rgba(240, 234, 216, 0.96) 0 25%, rgba(178, 150, 104, 0.9) 25% 26%, transparent 26%),
    linear-gradient(135deg, #263d33 0%, #1c2824 42%, #4a3325 100%);
  color: var(--ink);
  font-family: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(29, 36, 37, 0.2), transparent 14%, transparent 86%, rgba(29, 36, 37, 0.24)),
    radial-gradient(ellipse at 48% 88%, rgba(30, 21, 14, 0.32), transparent 42%);
  z-index: 0;
}

.courtyard-scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.hui-roof {
  position: absolute;
  height: 86px;
  background:
    repeating-linear-gradient(90deg, #111719 0 12px, #283032 12px 17px),
    linear-gradient(#111719, #2b3030);
  clip-path: polygon(2% 58%, 18% 24%, 47% 45%, 76% 18%, 98% 56%, 96% 72%, 4% 72%);
  opacity: 0.28;
  filter: drop-shadow(0 10px 0 rgba(255, 255, 255, 0.55));
}

.roof-left {
  left: -5vw;
  top: 36px;
  width: 42vw;
}

.roof-right {
  right: -3vw;
  top: 54px;
  width: 36vw;
  transform: scaleX(-1);
}

.moon-gate {
  position: absolute;
  left: 42%;
  top: 82px;
  width: 210px;
  height: 210px;
  border: 20px solid rgba(244, 240, 224, 0.82);
  border-radius: 50%;
  box-shadow: inset 0 -26px 0 rgba(39, 54, 48, 0.24), 0 16px 28px rgba(29, 23, 18, 0.24);
  opacity: 0.2;
}

.bamboo-grove {
  position: absolute;
  bottom: -30px;
  width: 170px;
  height: 92vh;
  opacity: 0.26;
}

.bamboo-left {
  left: -22px;
}

.bamboo-right {
  right: -24px;
  transform: scaleX(-1);
}

.bamboo-grove::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 20px, var(--bamboo) 21px 26px, transparent 27px),
    linear-gradient(90deg, transparent 58px, #264b30 59px 64px, transparent 65px),
    linear-gradient(90deg, transparent 104px, var(--bamboo) 105px 110px, transparent 111px),
    radial-gradient(ellipse at 32px 18%, rgba(141, 165, 108, 0.9) 0 24px, transparent 25px),
    radial-gradient(ellipse at 70px 34%, rgba(95, 132, 74, 0.88) 0 26px, transparent 27px),
    radial-gradient(ellipse at 116px 24%, rgba(141, 165, 108, 0.84) 0 24px, transparent 25px),
    radial-gradient(ellipse at 132px 52%, rgba(95, 132, 74, 0.78) 0 30px, transparent 31px);
  background-repeat: no-repeat;
}

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

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(620px, 2fr);
  gap: 18px;
  height: 100vh;
  padding: 18px;
}

.sidebar {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding: 10px 8px 10px 10px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(62, 37, 22, 0.4), transparent 18%, transparent 82%, rgba(62, 37, 22, 0.28)),
    repeating-linear-gradient(90deg, #9b6b3d 0 18px, #b7864b 18px 35px, #7e542f 35px 37px);
  box-shadow: inset 0 0 0 1px rgba(48, 29, 16, 0.38), 0 20px 38px rgba(0, 0, 0, 0.28);
}

.sidebar::before {
  content: "";
  position: sticky;
  top: 0;
  flex: 0 0 8px;
  margin: -10px -8px 0 -10px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(90deg, #2e1d14, #6a4428, #2e1d14);
  z-index: 2;
}

.profile-strip,
.compose-panel {
  border: 1px solid rgba(82, 55, 30, 0.34);
  background:
    radial-gradient(ellipse at 18% 18%, rgba(255, 255, 255, 0.5), transparent 28%),
    repeating-linear-gradient(0deg, rgba(88, 58, 31, 0.05) 0 1px, transparent 1px 11px),
    linear-gradient(180deg, rgba(250, 236, 201, 0.96), rgba(224, 188, 124, 0.94));
  box-shadow: inset 0 0 0 1px rgba(255, 250, 224, 0.38), 0 12px 30px rgba(0, 0, 0, 0.24);
}

.profile-strip {
  position: relative;
  display: grid;
  grid-template-columns: 40px 48px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 70px;
  padding: 10px;
  border-radius: 6px;
}

.profile-strip::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 10px;
  width: 34px;
  height: 24px;
  opacity: 0.22;
  background:
    linear-gradient(var(--ink) 0 0) 0 12px / 34px 3px,
    linear-gradient(var(--ink) 0 0) 8px 5px / 18px 3px,
    linear-gradient(var(--ink) 0 0) 15px 0 / 4px 18px;
  background-repeat: no-repeat;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #f3ddb1;
  cursor: pointer;
}

.copy-id-button {
  position: relative;
  z-index: 3;
  min-height: 30px;
  padding: 0 8px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 247, 218, 0.92), rgba(211, 164, 92, 0.9));
  color: #352217;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #fff5cf, var(--cinnabar) 72%);
  color: #fff9e8;
  font-weight: 800;
}

.desk-tools {
  display: grid;
  grid-template-columns: 1fr 64px 84px;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 6px 10px;
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(33, 24, 18, 0.18), transparent 22%, rgba(255, 236, 184, 0.28)),
    rgba(66, 42, 26, 0.44);
  box-shadow: inset 0 0 0 1px rgba(255, 232, 175, 0.12);
}

.brush {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #211511 0 10%, #d1a34f 10% 14%, #402719 14% 86%, #a33e2f 86% 100%);
  transform: rotate(-4deg);
}

.brush::after {
  content: "";
  position: absolute;
  right: -18px;
  top: -6px;
  width: 24px;
  height: 20px;
  background: linear-gradient(90deg, #20140f, #5a3927);
  clip-path: polygon(0 28%, 76% 0, 100% 50%, 76% 100%, 0 72%);
}

.inkstone {
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, #101312 0 34%, #303435 36% 58%, #0c0e0e 60%);
  box-shadow: inset 0 3px 8px rgba(255, 255, 255, 0.12), 0 4px 8px rgba(0, 0, 0, 0.26);
}

.paperweight {
  height: 20px;
  border-radius: 5px;
  background:
    linear-gradient(90deg, transparent 0 12%, rgba(255, 255, 255, 0.32) 13% 15%, transparent 16%),
    linear-gradient(180deg, #0f6456, #073b36);
  border: 1px solid rgba(9, 42, 35, 0.8);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.28), 0 4px 9px rgba(0, 0, 0, 0.22);
}

.profile-name {
  font-weight: 800;
  line-height: 1.3;
}

.profile-id,
.letter-meter,
.letter-hint,
.speed-note,
.coords,
small {
  color: var(--muted);
  font-size: 12px;
}

.sender-cylinder {
  position: relative;
  min-height: 94px;
  padding: 16px 20px 16px 72px;
  border-radius: 46px;
  border: 1px solid rgba(22, 12, 8, 0.45);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.18), transparent 24%, rgba(0, 0, 0, 0.18) 74%, rgba(255, 255, 255, 0.08)),
    repeating-linear-gradient(90deg, var(--leather), var(--leather) 11px, #4e2d1d 12px, #754528 23px);
  box-shadow: inset 0 8px 18px rgba(255, 235, 185, 0.2), inset 0 -12px 24px rgba(0, 0, 0, 0.26), 0 12px 28px rgba(0, 0, 0, 0.3);
  color: #ffe9bc;
}

.cylinder-cap {
  position: absolute;
  left: 10px;
  top: 12px;
  width: 56px;
  height: calc(100% - 24px);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, #a97750 0 34%, #5a321f 36% 64%, #2b1912 66%);
  border: 1px solid rgba(0, 0, 0, 0.42);
}

.sender-cylinder label {
  display: block;
  font-size: 13px;
  color: #ffdca0;
  margin-bottom: 6px;
}

.sender-cylinder input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(255, 230, 170, 0.6);
  background: transparent;
  color: #fff6db;
  outline: 0;
  font-weight: 800;
}

.compose-panel {
  padding: 14px;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}

.compose-panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 7px;
  background:
    linear-gradient(90deg, rgba(58, 91, 47, 0.75), rgba(141, 165, 108, 0.35)),
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(35, 71, 40, 0.5) 22px 24px);
}

.letter-panel::after,
.pigeon-panel::after,
.status-panel::after {
  content: "";
  position: absolute;
  pointer-events: none;
  opacity: 0.16;
}

.letter-panel::after {
  right: 10px;
  top: 12px;
  width: 70px;
  height: 44px;
  background:
    repeating-linear-gradient(90deg, #5f3c22 0 5px, #c39a58 5px 11px, #5f3c22 11px 12px),
    linear-gradient(#5f3c22 0 0) 0 21px / 70px 3px;
  background-repeat: no-repeat;
  border-radius: 5px;
}

.pigeon-panel::after {
  right: 14px;
  top: 12px;
  width: 72px;
  height: 44px;
  background:
    linear-gradient(var(--ink) 0 0) 20px 21px / 34px 5px,
    linear-gradient(var(--ink) 0 0) 30px 12px / 18px 5px,
    linear-gradient(var(--ink) 0 0) 48px 17px / 7px 4px,
    linear-gradient(var(--ink) 0 0) 8px 26px / 18px 4px,
    linear-gradient(var(--ink) 0 0) 3px 14px / 23px 5px;
  background-repeat: no-repeat;
  clip-path: polygon(0 12%, 100% 0, 88% 100%, 10% 90%);
}

.status-panel::after {
  left: 50%;
  bottom: 48px;
  width: 118px;
  height: 14px;
  border-radius: 4px;
  transform: translateX(-50%);
  background:
    linear-gradient(90deg, transparent 0 10%, rgba(255, 255, 255, 0.28) 11% 13%, transparent 14%),
    linear-gradient(180deg, #0f6456, #073b36);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.28), 0 4px 8px rgba(0, 0, 0, 0.18);
}

.panel-title {
  position: relative;
  margin-bottom: 10px;
  padding-left: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.panel-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 5px;
  height: 17px;
  background: var(--cinnabar);
  box-shadow: 4px 3px 0 rgba(47, 122, 98, 0.7);
}

label {
  display: block;
  margin: 10px 0 6px;
  color: #4a3323;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 248, 224, 0.76);
  color: var(--ink);
  outline: 0;
}

input,
select {
  height: 38px;
  padding: 0 10px;
}

textarea {
  min-height: 88px;
  resize: vertical;
  padding: 10px;
  line-height: 1.55;
}

.paper-preview {
  position: relative;
  display: grid;
  grid-template-columns: 68px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  margin-top: 10px;
  padding: 10px;
  overflow: hidden;
  border: 1px solid rgba(80, 48, 25, 0.24);
  border-radius: 6px;
  background: #f4dfae;
}

.paper-preview::before,
.letter-input,
.letter-card {
  background-blend-mode: multiply, normal;
}

.paper-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.55;
  pointer-events: none;
}

.paper-ornament {
  position: relative;
  width: 58px;
  height: 46px;
  border: 1px solid rgba(69, 43, 25, 0.32);
  box-shadow: inset 0 0 0 2px rgba(255, 250, 228, 0.2);
}

.paper-ornament::before,
.paper-ornament::after {
  content: "";
  position: absolute;
}

.paper-preview strong,
.paper-preview span {
  position: relative;
  display: block;
}

.paper-preview strong {
  margin-bottom: 4px;
  font-size: 15px;
}

.paper-preview span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.paper-bamboo {
  --paper-base: #c99b5f;
  --paper-edge: #6d4728;
  --paper-ink: #4e301c;
  --paper-accent: #8b6238;
}

.paper-cotton {
  --paper-base: #f2deb2;
  --paper-edge: #b94a37;
  --paper-ink: #4b3324;
  --paper-accent: #b7342c;
}

.paper-xuan {
  --paper-base: #f5ecd2;
  --paper-edge: #2f5f73;
  --paper-ink: #31404a;
  --paper-accent: #b6382f;
}

.paper-silk {
  --paper-base: #fff6d8;
  --paper-edge: #d9a834;
  --paper-ink: #3b2a16;
  --paper-accent: #0d8b74;
}

.paper-preview.paper-bamboo {
  background:
    radial-gradient(circle at 16% 24%, rgba(82, 49, 25, 0.22) 0 2px, transparent 3px),
    radial-gradient(circle at 72% 70%, rgba(82, 49, 25, 0.18) 0 3px, transparent 4px),
    repeating-linear-gradient(12deg, rgba(83, 52, 27, 0.16) 0 1px, transparent 1px 9px),
    #cfa66a;
}

.paper-bamboo .paper-ornament {
  background:
    linear-gradient(90deg, rgba(92, 58, 31, 0.4) 0 4px, transparent 4px),
    repeating-linear-gradient(0deg, rgba(81, 54, 32, 0.22) 0 2px, transparent 2px 8px),
    #d6ad70;
  clip-path: polygon(4% 8%, 96% 0, 92% 18%, 98% 39%, 91% 58%, 97% 92%, 5% 97%, 0 78%, 7% 56%, 1% 33%);
}

.paper-bamboo .paper-ornament::before {
  left: 6px;
  right: 6px;
  top: 20px;
  height: 4px;
  background: #6e4a2c;
  box-shadow: 0 -9px 0 rgba(110, 74, 44, 0.42), 0 9px 0 rgba(110, 74, 44, 0.32);
}

.paper-preview.paper-cotton {
  background:
    radial-gradient(circle at 66% 36%, rgba(183, 52, 44, 0.16) 0 10px, transparent 11px),
    linear-gradient(90deg, transparent 0 47%, rgba(160, 38, 31, 0.7) 48% 51%, transparent 52%),
    repeating-linear-gradient(30deg, rgba(100, 71, 45, 0.06) 0 1px, transparent 1px 7px),
    #f0deb9;
}

.paper-cotton .paper-ornament {
  border-color: rgba(179, 52, 44, 0.72);
  background:
    radial-gradient(circle at 70% 48%, #b7342c 0 8px, #7f251f 9px 11px, transparent 12px),
    linear-gradient(90deg, transparent 0 48%, #b7342c 49% 52%, transparent 53%),
    #f3dfb8;
}

.paper-cotton .paper-ornament::before {
  right: 5px;
  bottom: 5px;
  width: 16px;
  height: 12px;
  border-right: 2px solid #b7342c;
  border-bottom: 2px solid #b7342c;
}

.paper-preview.paper-xuan {
  background:
    radial-gradient(ellipse at 34% 58%, rgba(49, 64, 74, 0.16), transparent 38%),
    linear-gradient(90deg, rgba(47, 95, 115, 0.18), transparent 18%, transparent 82%, rgba(182, 56, 47, 0.12)),
    repeating-linear-gradient(0deg, rgba(72, 62, 49, 0.05) 0 1px, transparent 1px 10px),
    #f5ecd2;
}

.paper-xuan .paper-ornament {
  border-color: rgba(47, 95, 115, 0.56);
  background:
    radial-gradient(ellipse at 36% 56%, rgba(49, 64, 74, 0.28), transparent 34%),
    radial-gradient(circle at 78% 72%, #b6382f 0 7px, transparent 8px),
    linear-gradient(#d9a834 0 0) 4px 4px / 50px 1px,
    linear-gradient(#d9a834 0 0) 4px 41px / 50px 1px,
    #f6edd5;
  background-repeat: no-repeat;
}

.paper-xuan .paper-ornament::before {
  left: 11px;
  top: 24px;
  width: 28px;
  height: 9px;
  border-top: 2px solid rgba(49, 64, 74, 0.58);
  border-radius: 50%;
}

.paper-preview.paper-silk {
  background:
    radial-gradient(circle at 72% 44%, rgba(13, 139, 116, 0.28) 0 9px, transparent 10px),
    radial-gradient(circle at 84% 58%, rgba(217, 168, 52, 0.34) 0 5px, transparent 6px),
    linear-gradient(135deg, rgba(255, 255, 255, 0.65), transparent 28%, rgba(217, 168, 52, 0.34) 68%, transparent),
    repeating-linear-gradient(90deg, rgba(217, 168, 52, 0.12) 0 2px, transparent 2px 9px),
    #fff0c4;
  box-shadow: inset 0 0 0 1px rgba(217, 168, 52, 0.45), 0 0 18px rgba(217, 168, 52, 0.28);
}

.paper-silk .paper-ornament {
  border-color: rgba(217, 168, 52, 0.86);
  background:
    radial-gradient(circle at 72% 42%, #17a083 0 7px, #075e51 8px 10px, transparent 11px),
    linear-gradient(90deg, #d9a834 0 3px, transparent 3px 55px, #d9a834 55px),
    linear-gradient(0deg, #d9a834 0 3px, transparent 3px 43px, #d9a834 43px),
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(255, 229, 150, 0.54)),
    #fff7da;
}

.paper-silk .paper-ornament::before {
  left: 8px;
  top: 18px;
  width: 35px;
  height: 13px;
  border-top: 2px solid rgba(217, 168, 52, 0.8);
  border-bottom: 2px solid rgba(217, 168, 52, 0.6);
  border-radius: 50%;
}

.paper-silk .paper-ornament::after {
  right: 7px;
  bottom: -5px;
  width: 3px;
  height: 18px;
  background: #0d8b74;
  box-shadow: 5px 2px 0 #d9a834, 10px 0 0 #0d8b74;
}

.letter-meter {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}

.capacity-track {
  height: 8px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(92, 58, 31, 0.18);
}

#capacityFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--jade), #8da56c);
  transition: width 0.2s ease, background 0.2s ease;
}

#capacityFill.near-full {
  background: linear-gradient(90deg, #bd8b3f, var(--cinnabar));
}

.letter-hint,
.speed-note {
  margin-top: 7px;
  line-height: 1.45;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
}

.stat-grid div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 249, 230, 0.5);
}

.stat-grid span {
  display: block;
  font-size: 22px;
  font-weight: 900;
}

.route-picks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.route-search {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(78, 49, 30, 0.16);
  border-radius: 8px;
  background: rgba(255, 249, 230, 0.42);
}

.route-search label {
  margin: 0;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 8px;
}

.search-row input {
  min-width: 0;
}

.search-row button {
  min-height: 36px;
  padding-inline: 8px;
  font-weight: 800;
}

.search-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.recipient-status,
.settings-intro,
.account-state {
  padding: 8px 10px;
  border: 1px solid rgba(78, 49, 30, 0.14);
  border-radius: 6px;
  background: rgba(255, 249, 230, 0.52);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.recipient-status.ok {
  border-color: rgba(47, 122, 98, 0.34);
  background: rgba(230, 246, 224, 0.7);
  color: #2f6f55;
}

.recipient-status.error {
  border-color: rgba(132, 45, 34, 0.36);
  background: rgba(250, 226, 214, 0.72);
  color: #842d22;
}

.recipient-status.checking {
  color: #6d5736;
}

button {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid rgba(42, 27, 17, 0.28);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

button:hover {
  filter: brightness(1.04);
}

button:active {
  transform: translateY(1px);
}

.primary {
  width: 100%;
  color: #fff9e8;
  background:
    linear-gradient(90deg, rgba(255, 226, 144, 0.2), transparent 18%, transparent 82%, rgba(255, 226, 144, 0.18)),
    linear-gradient(180deg, #b34c38, #7f2d24);
  font-weight: 900;
}

.secondary {
  color: #2e2118;
  background:
    linear-gradient(90deg, rgba(47, 95, 115, 0.08), transparent 35%),
    linear-gradient(180deg, #fff1c8, #d5aa6b);
}

.compact {
  width: auto;
  min-width: 92px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(72, 43, 25, 0.14);
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.progress-head strong {
  color: var(--ink);
}

.progress-track {
  height: 12px;
  margin: 6px 0 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(92, 58, 31, 0.22);
}

#progressFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--jade), #87a96b);
  transition: width 0.25s linear;
}

.log-panel {
  min-height: 130px;
}

.inbox-panel {
  min-height: 132px;
}

.ad-panel {
  display: grid;
  gap: 8px;
  min-height: 96px;
  border-style: dashed;
}

.ad-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ad-title strong {
  padding: 2px 7px;
  border: 1px solid rgba(91, 59, 34, 0.28);
  border-radius: 999px;
  background: rgba(255, 249, 230, 0.62);
  color: var(--muted);
  font-size: 11px;
}

.ad-panel p {
  margin: 0;
  color: #5f4026;
  font-size: 13px;
  line-height: 1.55;
}

.ad-panel.minor-safe {
  border-color: rgba(47, 122, 98, 0.42);
}

.inbox-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.inbox-title strong {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 24px;
  border-radius: 999px;
  background: #7f2d24;
  color: #fff9e8;
  font-size: 13px;
}

.empty-inbox {
  padding: 14px 10px;
  border: 1px dashed rgba(77, 48, 29, 0.34);
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.inbox-list {
  display: grid;
  gap: 8px;
  max-height: 178px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.inbox-item button {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 56px;
  padding: 8px;
  border: 1px solid rgba(72, 43, 25, 0.18);
  background:
    linear-gradient(135deg, rgba(255, 248, 224, 0.92), rgba(225, 190, 124, 0.86));
  text-align: left;
}

.seal {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #c9513c, #73251d);
  color: #fff7dd;
  font-size: 12px;
  font-weight: 900;
}

.inbox-copy {
  min-width: 0;
}

.inbox-copy strong,
.inbox-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compliance-panel {
  display: grid;
  gap: 10px;
}

.switch-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid rgba(78, 49, 30, 0.16);
  border-radius: 8px;
  background: rgba(255, 249, 230, 0.44);
}

.switch-row span {
  min-width: 0;
}

.switch-row strong,
.switch-row small {
  display: block;
}

.switch-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.switch-row input {
  width: 42px;
  height: 24px;
  accent-color: var(--jade);
}

.compliance-actions,
.letter-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.map-compliance {
  padding: 9px 10px;
  border-left: 3px solid var(--jade);
  background: rgba(246, 238, 211, 0.78);
  color: #5f4026;
  font-size: 12px;
  line-height: 1.45;
}

.filing-info {
  padding: 8px 10px;
  border: 1px solid rgba(78, 49, 30, 0.14);
  border-radius: 6px;
  background: rgba(255, 249, 230, 0.5);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.filing-info a {
  color: #5f4026;
  font-weight: 800;
  text-decoration: none;
}

.filing-info a:hover {
  text-decoration: underline;
}

.danger {
  border-color: rgba(132, 45, 34, 0.42);
  color: #842d22;
}

#eventLog {
  max-height: 168px;
  overflow: auto;
  margin: 0;
  padding-left: 22px;
  line-height: 1.45;
  font-size: 13px;
}

.map-scroll {
  position: relative;
  min-width: 0;
  height: calc(100vh - 36px);
  padding: 48px 36px 42px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(29, 36, 37, 0.9) 0 18px, transparent 19px),
    linear-gradient(90deg, rgba(80, 42, 20, 0.28), transparent 5%, transparent 95%, rgba(80, 42, 20, 0.22)),
    radial-gradient(circle at 50% 22%, rgba(255, 250, 218, 0.72), transparent 32rem),
    linear-gradient(180deg, rgba(241, 223, 173, 0.95), rgba(209, 164, 103, 0.95));
  box-shadow: inset 0 0 0 1px rgba(83, 47, 24, 0.24), inset 0 0 0 10px rgba(255, 244, 202, 0.14), 0 18px 44px rgba(0, 0, 0, 0.32);
}

.map-scroll::before {
  content: "";
  position: absolute;
  left: 30px;
  right: 30px;
  top: 22px;
  height: 48px;
  z-index: 4;
  pointer-events: none;
  background:
    linear-gradient(135deg, transparent 0 18px, var(--tile) 19px 25px, transparent 26px) 0 0 / 52px 28px repeat-x,
    linear-gradient(45deg, transparent 0 18px, var(--tile) 19px 25px, transparent 26px) 26px 0 / 52px 28px repeat-x,
    linear-gradient(180deg, #101516, #303839 62%, rgba(240, 234, 216, 0.9) 63% 100%);
  clip-path: polygon(0 38%, 7% 10%, 50% 28%, 93% 10%, 100% 38%, 98% 62%, 2% 62%);
  opacity: 0.95;
}

.map-scroll::after {
  content: "";
  position: absolute;
  right: 42px;
  bottom: 72px;
  width: 156px;
  height: 180px;
  z-index: 410;
  pointer-events: none;
  opacity: 0.5;
  background:
    linear-gradient(90deg, transparent 20px, rgba(47, 111, 63, 0.9) 21px 25px, transparent 26px),
    linear-gradient(90deg, transparent 64px, rgba(47, 111, 63, 0.78) 65px 69px, transparent 70px),
    linear-gradient(90deg, transparent 112px, rgba(47, 111, 63, 0.82) 113px 117px, transparent 118px),
    radial-gradient(ellipse at 38px 24px, rgba(86, 128, 70, 0.86) 0 22px, transparent 23px),
    radial-gradient(ellipse at 72px 62px, rgba(119, 148, 79, 0.72) 0 24px, transparent 25px),
    radial-gradient(ellipse at 120px 34px, rgba(86, 128, 70, 0.8) 0 22px, transparent 23px);
  background-repeat: no-repeat;
}

.scroll-top,
.scroll-bottom {
  position: absolute;
  left: 18px;
  right: 18px;
  height: 28px;
  border-radius: 999px;
  background:
    radial-gradient(ellipse at 10% center, #714324 0 18px, transparent 19px),
    radial-gradient(ellipse at 90% center, #714324 0 18px, transparent 19px),
    repeating-linear-gradient(90deg, rgba(44, 26, 16, 0.24) 0 7px, transparent 7px 18px),
    linear-gradient(180deg, #b47843, #5c351f);
  box-shadow: inset 0 4px 8px rgba(255, 235, 175, 0.22), inset 0 -8px 14px rgba(0, 0, 0, 0.3);
  z-index: 3;
}

.scroll-top {
  top: 9px;
}

.scroll-bottom {
  bottom: 9px;
}

.map-toolbar {
  position: absolute;
  left: 52px;
  right: 52px;
  top: 62px;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.map-toolbar > * {
  pointer-events: auto;
}

.map-toolbar div {
  padding: 9px 12px;
  border: 1px solid rgba(68, 44, 25, 0.22);
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(47, 95, 115, 0.12), transparent 24%, rgba(182, 56, 47, 0.1)),
    rgba(255, 246, 214, 0.94);
  box-shadow: 0 8px 18px rgba(66, 35, 17, 0.16);
}

.map-toolbar span {
  margin-left: 12px;
  color: var(--muted);
  font-size: 13px;
}

#map {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(78, 49, 30, 0.34);
  border-radius: 6px;
  background: #d4c391;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 4px rgba(240, 234, 216, 0.58),
    inset 0 0 0 8px rgba(29, 36, 37, 0.18);
}

.leaflet-container {
  font-family: inherit;
  background: #cdbf91;
}

.leaflet-tile {
  filter: sepia(0.42) saturate(0.72) contrast(0.94);
}

.map-legend {
  position: absolute;
  right: 50px;
  bottom: 48px;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(47, 95, 115, 0.1), transparent 28%),
    rgba(255, 246, 214, 0.92);
  font-size: 12px;
  box-shadow: 0 8px 18px rgba(66, 35, 17, 0.15);
}

.map-legend i {
  display: inline-block;
  width: 28px;
  height: 0;
  margin-right: 5px;
  vertical-align: middle;
  border-top: 3px solid #2f7a62;
}

.map-legend .dash-line {
  border-top-style: dashed;
  border-top-color: #894032;
}

.map-legend .supply-dot {
  width: 10px;
  height: 10px;
  border: 2px solid #7c4f2d;
  border-radius: 50%;
  background: #f2d58f;
}

.pigeon-wrap {
  --body: #d4d5db;
  --body-dark: #747984;
  --wing: #a0a5b0;
  --wing-hi: #eef0f3;
  --accent: #9b714c;
  --spark: rgba(150, 150, 150, 0.75);
  --glow: rgba(255, 255, 255, 0);
  position: relative;
  width: 74px;
  height: 50px;
  transform: translate(-37px, -25px) rotate(var(--angle, 0deg));
  transform-origin: center;
  image-rendering: pixelated;
}

.pixel-pigeon,
.pixel-pigeon span {
  position: absolute;
  image-rendering: pixelated;
}

.pixel-pigeon {
  left: 18px;
  top: 12px;
  width: 40px;
  height: 28px;
  filter: drop-shadow(0 2px 0 rgba(22, 18, 16, 0.42));
  animation: wingbeat 0.46s steps(2, end) infinite;
}

.body {
  left: 10px;
  top: 11px;
  width: 20px;
  height: 10px;
  background:
    linear-gradient(var(--body-hi, #fff) 0 0) 3px 1px / 10px 3px,
    linear-gradient(var(--body) 0 0) 0 3px / 18px 7px,
    linear-gradient(var(--body-dark) 0 0) 14px 7px / 8px 4px;
  background-repeat: no-repeat;
}

.head {
  left: 27px;
  top: 7px;
  width: 9px;
  height: 9px;
  background:
    linear-gradient(var(--body-hi, #fff) 0 0) 1px 1px / 5px 2px,
    linear-gradient(var(--body) 0 0) 0 0 / 8px 8px,
    linear-gradient(var(--throat, #4a9d86) 0 0) 0 6px / 7px 3px;
  background-repeat: no-repeat;
}

.beak {
  left: 35px;
  top: 10px;
  width: 5px;
  height: 3px;
  background: #d97826;
}

.eye {
  left: 32px;
  top: 8px;
  width: 2px;
  height: 2px;
  background: #18120e;
}

.wing {
  background-repeat: no-repeat;
  transform-origin: right bottom;
}

.wing-top {
  left: 4px;
  top: 0;
  width: 25px;
  height: 17px;
  background:
    linear-gradient(var(--wing-dark, var(--body-dark)) 0 0) 2px 1px / 18px 4px,
    linear-gradient(var(--wing) 0 0) 0 5px / 24px 5px,
    linear-gradient(var(--wing-hi) 0 0) 4px 10px / 17px 4px,
    linear-gradient(var(--wing-dark, var(--body-dark)) 0 0) 9px 14px / 10px 3px;
  animation: wingTop 0.46s steps(2, end) infinite;
}

.wing-bottom {
  left: 17px;
  top: 18px;
  width: 19px;
  height: 9px;
  background:
    linear-gradient(var(--wing) 0 0) 0 0 / 17px 4px,
    linear-gradient(var(--wing-dark, var(--body-dark)) 0 0) 3px 4px / 13px 4px;
  animation: wingBottom 0.46s steps(2, end) infinite;
}

.tail {
  left: 1px;
  top: 15px;
  width: 14px;
  height: 9px;
  background:
    linear-gradient(var(--wing-dark, var(--body-dark)) 0 0) 0 0 / 13px 3px,
    linear-gradient(var(--wing) 0 0) 3px 3px / 11px 3px,
    linear-gradient(var(--wing-dark, var(--body-dark)) 0 0) 0 6px / 10px 3px;
}

.tube {
  left: 18px;
  top: 22px;
  width: 11px;
  height: 4px;
  background:
    linear-gradient(var(--accent) 0 0) 0 0 / 11px 4px,
    linear-gradient(#f6d16d 0 0) 1px 1px / 3px 2px,
    linear-gradient(#f6d16d 0 0) 7px 1px / 3px 2px;
  background-repeat: no-repeat;
}

.ribbon,
.crown {
  display: none;
}

.pigeon-aura {
  position: absolute;
  inset: 7px 10px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow), transparent 68%);
  animation: auraPulse 1.1s ease-in-out infinite alternate;
}

.pigeon-trail {
  position: absolute;
  left: 0;
  top: 18px;
  width: 28px;
  height: 18px;
}

.pigeon-trail i,
.pigeon-sparks i {
  position: absolute;
  display: block;
  background: var(--spark);
  image-rendering: pixelated;
}

.pigeon-trail i {
  right: 0;
  width: 18px;
  height: 3px;
  animation: trailFlicker 0.7s steps(3, end) infinite;
}

.pigeon-trail i:nth-child(1) {
  top: 1px;
}

.pigeon-trail i:nth-child(2) {
  top: 7px;
  width: 24px;
  opacity: 0.72;
  animation-delay: 0.12s;
}

.pigeon-trail i:nth-child(3) {
  top: 13px;
  width: 12px;
  opacity: 0.46;
  animation-delay: 0.24s;
}

.pigeon-sparks {
  position: absolute;
  left: 6px;
  top: 8px;
  width: 18px;
  height: 28px;
  opacity: 0;
}

.pigeon-sparks i {
  width: 3px;
  height: 3px;
  animation: sparkle 0.9s steps(3, end) infinite;
}

.pigeon-sparks i:nth-child(1) {
  left: 10px;
  top: 1px;
}

.pigeon-sparks i:nth-child(2) {
  left: 1px;
  top: 12px;
  animation-delay: 0.18s;
}

.pigeon-sparks i:nth-child(3) {
  left: 12px;
  top: 22px;
  animation-delay: 0.34s;
}

.rank-young {
  --body: #bfc2c9;
  --body-hi: #dfe1e5;
  --body-dark: #666b76;
  --wing: #8c929d;
  --wing-hi: #cfd2d8;
  --accent: #9b714c;
  --spark: rgba(102, 107, 118, 0.45);
}

.rank-young .pigeon-trail i:nth-child(2),
.rank-young .pigeon-trail i:nth-child(3) {
  display: none;
}

.rank-post {
  --body: #ece8df;
  --body-hi: #fff8ea;
  --body-dark: #6f7887;
  --wing: #aeb5c0;
  --wing-hi: #f8f6ee;
  --accent: #b3342c;
  --spark: rgba(178, 61, 45, 0.65);
  --throat: #4aa58e;
}

.rank-post .ribbon {
  display: block;
  left: 26px;
  top: 15px;
  width: 8px;
  height: 7px;
  background:
    linear-gradient(#b3342c 0 0) 0 0 / 8px 4px,
    linear-gradient(#8b211d 0 0) 2px 4px / 4px 3px;
  background-repeat: no-repeat;
}

.rank-royal {
  --body: #f3f4f2;
  --body-hi: #ffffff;
  --body-dark: #174f9b;
  --wing: #2f6fc1;
  --wing-hi: #ffffff;
  --wing-dark: #0f3771;
  --accent: #d8a12d;
  --spark: rgba(54, 122, 218, 0.78);
  --glow: rgba(57, 130, 224, 0.22);
  --throat: #2765ad;
}

.rank-royal .pixel-pigeon {
  transform: scale(1.12);
  animation-duration: 0.36s;
}

.rank-royal .ribbon {
  display: block;
  left: 12px;
  top: 13px;
  width: 14px;
  height: 9px;
  background:
    linear-gradient(#1e58a7 0 0) 0 0 / 13px 5px,
    linear-gradient(#d8a12d 0 0) 1px 1px / 11px 1px,
    linear-gradient(#d8a12d 0 0) 3px 5px / 5px 4px;
  background-repeat: no-repeat;
}

.rank-royal .pigeon-sparks {
  opacity: 0.7;
}

.rank-legend {
  --body: #fffaf0;
  --body-hi: #ffffff;
  --body-dark: #d39b24;
  --wing: #f0c24b;
  --wing-hi: #ffffff;
  --wing-dark: #c48717;
  --accent: #0d917a;
  --spark: rgba(244, 196, 72, 0.9);
  --glow: rgba(244, 196, 72, 0.36);
  --throat: #0b8f7a;
}

.rank-legend .pixel-pigeon {
  transform: scale(1.24);
  filter: drop-shadow(0 2px 0 rgba(77, 43, 12, 0.48)) drop-shadow(0 0 8px rgba(244, 196, 72, 0.62));
  animation-duration: 0.28s;
}

.rank-legend .ribbon {
  display: block;
  left: 6px;
  top: 19px;
  width: 22px;
  height: 11px;
  background:
    linear-gradient(#0d917a 0 0) 0 0 / 20px 4px,
    linear-gradient(#0a6f63 0 0) 4px 4px / 12px 3px,
    linear-gradient(#0d917a 0 0) 12px 7px / 8px 4px;
  background-repeat: no-repeat;
}

.rank-legend .crown {
  display: block;
  left: 29px;
  top: 2px;
  width: 9px;
  height: 6px;
  background:
    linear-gradient(#f5c64d 0 0) 0 3px / 9px 3px,
    linear-gradient(#f5c64d 0 0) 1px 0 / 2px 3px,
    linear-gradient(#fff0a8 0 0) 4px 0 / 2px 3px,
    linear-gradient(#f5c64d 0 0) 7px 0 / 2px 3px;
  background-repeat: no-repeat;
}

.rank-legend .pigeon-sparks {
  opacity: 1;
}

.rank-legend .pigeon-trail i {
  box-shadow: 0 0 8px rgba(244, 196, 72, 0.72);
}

.no-tile-map {
  background:
    radial-gradient(circle at 31% 39%, rgba(90, 131, 111, 0.2) 0 4%, transparent 4.5%),
    radial-gradient(circle at 62% 44%, rgba(90, 131, 111, 0.18) 0 7%, transparent 7.5%),
    radial-gradient(circle at 77% 56%, rgba(90, 131, 111, 0.16) 0 5%, transparent 5.5%),
    linear-gradient(135deg, rgba(246, 233, 191, 0.96), rgba(223, 203, 151, 0.92));
}

.no-tile-map::after {
  content: "合规地图服务待接入";
  position: absolute;
  left: 50%;
  bottom: 52px;
  z-index: 420;
  transform: translateX(-50%);
  padding: 6px 10px;
  border: 1px solid rgba(95, 61, 35, 0.28);
  border-radius: 999px;
  background: rgba(255, 248, 224, 0.86);
  color: #684327;
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
}

.pigeon-wrap {
  width: 104px;
  height: 74px;
  transform: translate(-52px, -37px) rotate(var(--angle, 0deg));
  image-rendering: auto;
}

.pigeon-sticker {
  position: absolute;
  left: 8px;
  top: 5px;
  width: 88px;
  height: 60px;
  border: 2px solid rgba(255, 247, 218, 0.92);
  border-radius: 999px;
  background-image: url("./assets/pigeon-rank-reference.png");
  background-size: 200% 200%;
  background-repeat: no-repeat;
  box-shadow:
    0 3px 0 rgba(61, 39, 26, 0.38),
    0 9px 18px rgba(45, 31, 22, 0.24);
  filter: saturate(1.04) contrast(1.06);
  animation: stickerFlight 0.56s ease-in-out infinite alternate;
  overflow: hidden;
}

.pigeon-sticker::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(125deg, rgba(255, 255, 255, 0.22), transparent 42%),
    radial-gradient(circle at 72% 28%, rgba(255, 246, 196, 0.18), transparent 34%);
  pointer-events: none;
}

.rank-young .pigeon-sticker {
  background-position: 0 0;
}

.rank-post .pigeon-sticker {
  background-position: 100% 0;
}

.rank-royal .pigeon-sticker {
  background-position: 0 100%;
  width: 96px;
  height: 66px;
  left: 4px;
  top: 3px;
  border-color: rgba(246, 218, 128, 0.95);
  filter: saturate(1.15) contrast(1.08) drop-shadow(0 0 7px rgba(49, 106, 196, 0.35));
  animation-duration: 0.42s;
}

.rank-legend .pigeon-sticker {
  background-position: 100% 100%;
  width: 104px;
  height: 72px;
  left: 0;
  top: 0;
  border-color: rgba(255, 225, 99, 0.98);
  filter: saturate(1.24) contrast(1.1) drop-shadow(0 0 10px rgba(237, 187, 54, 0.62));
  animation-duration: 0.34s;
}

.rank-young .pigeon-trail {
  left: 2px;
  top: 28px;
}

.rank-post .pigeon-trail,
.rank-royal .pigeon-trail,
.rank-legend .pigeon-trail {
  left: -2px;
  top: 30px;
}

.rank-royal .pigeon-sparks,
.rank-legend .pigeon-sparks {
  left: 2px;
  top: 18px;
}

@keyframes wingbeat {
  0% { translate: 0 0; }
  100% { translate: 0 2px; }
}

@keyframes stickerFlight {
  0% { transform: translateY(-2px) rotate(-2deg) scale(1); }
  100% { transform: translateY(3px) rotate(2deg) scale(1.025); }
}

@keyframes wingTop {
  0% { transform: rotate(-12deg) translateY(-2px); }
  100% { transform: rotate(10deg) translateY(2px); }
}

@keyframes wingBottom {
  0% { transform: rotate(6deg); }
  100% { transform: rotate(-8deg); }
}

@keyframes trailFlicker {
  0% { transform: translateX(0); opacity: 0.2; }
  50% { opacity: 0.86; }
  100% { transform: translateX(-7px); opacity: 0; }
}

@keyframes sparkle {
  0% { transform: translateX(8px); opacity: 0; }
  40% { opacity: 1; }
  100% { transform: translateX(-8px); opacity: 0; }
}

@keyframes auraPulse {
  0% { opacity: 0.45; transform: scale(0.88); }
  100% { opacity: 1; transform: scale(1.12); }
}

.supply-marker {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #654024;
  background: #f2d58f;
  color: #4b2d19;
  font-size: 12px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.24);
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(22, 15, 12, 0.58);
}

.settings-card {
  width: min(360px, calc(100vw - 32px));
  padding: 18px;
  border-radius: 8px;
  background: #f1dcae;
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
}

.letter-card {
  width: min(620px, calc(100vw - 28px));
  max-height: min(720px, calc(100vh - 28px));
  overflow: auto;
  padding: 24px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(102, 62, 31, 0.15), transparent 7%, transparent 93%, rgba(102, 62, 31, 0.14)),
    repeating-linear-gradient(0deg, rgba(101, 67, 36, 0.04), rgba(101, 67, 36, 0.04) 1px, transparent 1px, transparent 32px),
    #f3dfb4;
  box-shadow: inset 0 0 0 1px rgba(70, 42, 24, 0.2), 0 24px 70px rgba(0, 0, 0, 0.42);
}

.letter-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(79, 48, 27, 0.22);
  padding-bottom: 12px;
}

.letter-card header span {
  color: var(--cinnabar);
  font-size: 13px;
  font-weight: 900;
}

.letter-card h2 {
  margin: 5px 0 0;
  font-size: 28px;
}

.letter-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 14px 0 18px;
}

.letter-meta div {
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(78, 49, 30, 0.16);
  border-radius: 6px;
  background: rgba(255, 249, 230, 0.44);
}

.letter-meta dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.letter-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.letter-body {
  min-height: 220px;
  padding: 18px;
  border: 1px solid rgba(78, 49, 30, 0.18);
  border-radius: 6px;
  background: rgba(255, 250, 232, 0.46);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.9;
  font-size: 18px;
}

.letter-actions {
  margin-top: 14px;
}

.policy-card {
  width: min(420px, calc(100vw - 28px));
  max-height: min(720px, calc(100vh - 28px));
  overflow: auto;
  padding: 20px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(102, 62, 31, 0.12), transparent 9%, transparent 91%, rgba(102, 62, 31, 0.12)),
    #f1dcae;
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.policy-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(79, 48, 27, 0.2);
  padding-bottom: 10px;
}

.policy-card h2 {
  margin: 0;
  font-size: 24px;
}

.policy-card p {
  margin: 0 0 12px;
  line-height: 1.75;
}

.delivery-card {
  width: min(390px, calc(100vw - 28px));
  padding: 16px;
  border: 1px solid rgba(77, 49, 28, 0.34);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 244, 182, 0.52), transparent 120px),
    linear-gradient(180deg, rgba(250, 235, 199, 0.98), rgba(222, 185, 119, 0.97));
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
}

.delivery-stage {
  position: relative;
  height: 220px;
  overflow: hidden;
  border: 1px solid rgba(80, 51, 30, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(26, 36, 38, 0.18), transparent 48%),
    linear-gradient(180deg, #efe0b1, #d6ac66);
}

.delivery-moon {
  position: absolute;
  left: 28px;
  top: 22px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff7cf, #d4aa5f);
  box-shadow: 0 0 24px rgba(255, 236, 170, 0.72);
}

.delivery-courtyard {
  position: absolute;
  inset: auto 0 0;
  height: 82px;
  background:
    linear-gradient(135deg, transparent 0 20px, rgba(36, 48, 46, 0.86) 21px 28px, transparent 29px) 0 0 / 58px 36px repeat-x,
    linear-gradient(45deg, transparent 0 20px, rgba(36, 48, 46, 0.86) 21px 28px, transparent 29px) 29px 0 / 58px 36px repeat-x,
    linear-gradient(180deg, transparent 28px, rgba(92, 61, 35, 0.62) 29px 100%);
}

.delivery-pigeon {
  position: absolute;
  left: -94px;
  top: 62px;
  width: 92px;
  height: 64px;
  border: 2px solid rgba(255, 247, 218, 0.9);
  border-radius: 999px;
  background: url("./assets/pigeon-rank-reference.png") 100% 0 / 200% 200% no-repeat;
  filter: drop-shadow(0 8px 12px rgba(45, 31, 22, 0.28));
}

.delivery-scroll {
  position: absolute;
  left: 50%;
  bottom: 34px;
  width: 42px;
  height: 18px;
  transform: translateX(-50%) scaleX(0.12);
  transform-origin: center;
  border: 1px solid rgba(96, 62, 36, 0.32);
  border-radius: 999px;
  background:
    linear-gradient(90deg, #8b5632 0 8px, transparent 9px calc(100% - 9px), #8b5632 calc(100% - 8px)),
    linear-gradient(180deg, #fff4cf, #d9b76f);
  opacity: 0;
}

.delivery-scroll span {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 8px;
  border-top: 2px solid rgba(115, 75, 43, 0.42);
}

.delivery-seal {
  position: absolute;
  left: calc(50% + 44px);
  bottom: 41px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d25b42, #7f2d24);
  color: #fff5d4;
  font-weight: 900;
  opacity: 0;
  transform: scale(1.8) rotate(-16deg);
}

.delivery-copy {
  padding: 14px 2px 12px;
  text-align: center;
}

.delivery-copy span {
  color: var(--cinnabar);
  font-size: 13px;
  font-weight: 900;
}

.delivery-copy h2 {
  margin: 4px 0 8px;
  font-size: 25px;
}

.delivery-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.ritual-play .delivery-pigeon {
  animation: pigeonArrive 1.8s cubic-bezier(0.2, 0.76, 0.21, 1) both;
}

.ritual-play .delivery-scroll {
  animation: scrollDrop 1.4s 1.05s ease-out both;
}

.ritual-play .delivery-seal {
  animation: sealStamp 0.5s 2.05s cubic-bezier(0.2, 1.3, 0.3, 1) both;
}

@keyframes pigeonArrive {
  0% { transform: translate(-20px, -16px) rotate(-7deg); opacity: 0; }
  18% { opacity: 1; }
  74% { transform: translate(208px, 12px) rotate(4deg); }
  100% { transform: translate(248px, 28px) rotate(0deg); opacity: 0; }
}

@keyframes scrollDrop {
  0% { opacity: 0; transform: translate(-50%, -84px) scaleX(0.12) rotate(-10deg); }
  45% { opacity: 1; transform: translate(-50%, -18px) scaleX(0.12) rotate(3deg); }
  100% { opacity: 1; transform: translateX(-50%) scaleX(5.2) rotate(0deg); }
}

@keyframes sealStamp {
  0% { opacity: 0; transform: scale(1.8) rotate(-16deg); }
  100% { opacity: 1; transform: scale(1) rotate(-8deg); }
}

.policy-page {
  min-height: 100vh;
  overflow: auto;
  background:
    linear-gradient(rgba(34, 25, 18, 0.56), rgba(34, 25, 18, 0.56)),
    var(--bg-courtyard) center / cover fixed;
}

.policy-doc {
  width: min(760px, calc(100vw - 28px));
  margin: 18px auto 40px;
  padding: 24px;
  border: 1px solid rgba(77, 49, 28, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 248, 224, 0.92), rgba(230, 194, 126, 0.82)),
    var(--tex-paper);
  color: var(--ink);
  line-height: 1.8;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

.policy-doc h1 {
  margin: 0 0 8px;
  font-size: 30px;
}

.policy-doc h2 {
  margin: 20px 0 6px;
  font-size: 20px;
}

.policy-doc p {
  margin: 0 0 10px;
}

.admin-body {
  min-height: 100vh;
  overflow: auto;
  background:
    linear-gradient(rgba(30, 23, 18, 0.7), rgba(30, 23, 18, 0.7)),
    var(--bg-courtyard) center / cover fixed;
}

.admin-shell {
  width: min(980px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 36px;
  color: var(--ink);
}

.admin-header,
.admin-panel {
  margin-bottom: 14px;
  border: 1px solid rgba(77, 49, 28, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 248, 224, 0.88), rgba(230, 194, 126, 0.74)),
    var(--tex-paper);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
}

.admin-header {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 320px) auto;
  align-items: end;
  gap: 16px;
  padding: 18px;
}

.admin-header h1 {
  margin: 0 0 6px;
  font-size: 30px;
}

.admin-header p {
  margin: 0;
  color: var(--muted);
}

.admin-toolbar {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.admin-toolbar button {
  min-height: 38px;
  padding: 0 12px;
  background: linear-gradient(180deg, #fff1c8, #d5aa6b);
}

.admin-toolbar span {
  font-size: 12px;
  font-weight: 900;
  color: var(--muted);
}

.admin-panel {
  padding: 14px;
}

.admin-overview {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.overview-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(78, 49, 30, 0.16);
  border-radius: 6px;
  background: rgba(255, 250, 232, 0.58);
  text-align: center;
}

.overview-item strong {
  display: block;
  font-size: 22px;
}

.overview-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.admin-list {
  display: grid;
  gap: 10px;
}

.admin-item {
  padding: 12px;
  border: 1px solid rgba(78, 49, 30, 0.18);
  border-radius: 6px;
  background: rgba(255, 250, 232, 0.58);
}

.admin-item header,
.admin-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-item header span {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(127, 45, 36, 0.12);
  color: #7f2d24;
  font-size: 12px;
  font-weight: 900;
}

.admin-item p {
  margin: 10px 0;
  line-height: 1.6;
}

.admin-item small {
  color: var(--muted);
}

.admin-actions {
  justify-content: flex-start;
  margin-top: 10px;
  flex-wrap: wrap;
}

.admin-actions button {
  min-height: 32px;
  padding: 0 10px;
  background: linear-gradient(180deg, #fff1c8, #d5aa6b);
}

.friend-request-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.mini-list-title {
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.mini-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mini-item,
.mini-empty {
  min-width: 0;
  border: 1px solid rgba(78, 49, 30, 0.16);
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(47, 95, 115, 0.045), rgba(255, 249, 226, 0.68) 24%, rgba(255, 249, 226, 0.68) 76%, rgba(182, 56, 47, 0.045)),
    var(--tex-paper);
  background-size: auto, cover;
  background-position: center;
}

.mini-empty {
  padding: 9px;
  color: var(--muted);
  font-size: 13px;
}

.mini-item {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
}

.mini-avatar,
.reward-seal {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.45), transparent 20%),
    var(--tex-jade);
  background-size: auto, 240% auto;
  color: #fff8e4;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(50, 31, 18, 0.18);
}

.mini-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.mini-copy strong,
.mini-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-copy small {
  color: var(--muted);
  font-size: 12px;
}

.mini-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.mini-actions button {
  min-height: 30px;
  padding: 0 8px;
  border-radius: 5px;
  background: linear-gradient(180deg, #fff1c8, #d5aa6b);
  font-size: 12px;
}

.retention-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.retention-stats div {
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(78, 49, 30, 0.16);
  border-radius: 6px;
  background: rgba(255, 249, 230, 0.46);
  text-align: center;
}

.retention-stats strong {
  display: block;
  font-size: 20px;
}

.retention-stats small {
  color: var(--muted);
  font-size: 12px;
}

.reward-list {
  margin-top: 10px;
}

.reward-seal {
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 232, 174, 0.26), rgba(46, 27, 15, 0.24)),
    var(--tex-bamboo);
  color: #2b1a11;
}

@media (max-width: 640px) {
  .admin-header {
    grid-template-columns: 1fr;
  }

  .admin-toolbar {
    justify-items: stretch;
  }

  .admin-overview {
    grid-template-columns: repeat(2, 1fr);
  }
}

.letter-input.paper-bamboo {
  border-color: rgba(91, 57, 31, 0.46);
  background:
    radial-gradient(circle at 12% 24%, rgba(84, 51, 27, 0.18) 0 2px, transparent 3px),
    repeating-linear-gradient(12deg, rgba(86, 53, 28, 0.12) 0 1px, transparent 1px 9px),
    #d0a66c;
}

.letter-input.paper-cotton {
  border-color: rgba(183, 52, 44, 0.32);
  background:
    linear-gradient(90deg, transparent 0 92%, rgba(183, 52, 44, 0.18) 93% 94%, transparent 95%),
    repeating-linear-gradient(30deg, rgba(100, 71, 45, 0.05) 0 1px, transparent 1px 7px),
    #f4e1bd;
}

.letter-input.paper-xuan {
  border-color: rgba(47, 95, 115, 0.34);
  background:
    radial-gradient(ellipse at 18% 78%, rgba(49, 64, 74, 0.1), transparent 34%),
    linear-gradient(90deg, rgba(47, 95, 115, 0.08), transparent 22%, transparent 82%, rgba(182, 56, 47, 0.08)),
    #f7efd8;
}

.letter-input.paper-silk {
  border-color: rgba(217, 168, 52, 0.58);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.74), transparent 32%, rgba(217, 168, 52, 0.2) 68%, transparent),
    repeating-linear-gradient(90deg, rgba(217, 168, 52, 0.08) 0 2px, transparent 2px 10px),
    #fff5d2;
  box-shadow: 0 0 0 1px rgba(217, 168, 52, 0.12), 0 0 14px rgba(217, 168, 52, 0.16);
}

.letter-card.paper-bamboo {
  background:
    radial-gradient(circle at 12% 22%, rgba(74, 45, 24, 0.16) 0 3px, transparent 4px),
    repeating-linear-gradient(12deg, rgba(84, 51, 27, 0.1) 0 1px, transparent 1px 10px),
    #d4aa70;
}

.letter-card.paper-cotton {
  background:
    radial-gradient(circle at 90% 14%, rgba(183, 52, 44, 0.12) 0 26px, transparent 27px),
    linear-gradient(90deg, transparent 0 92%, rgba(183, 52, 44, 0.16) 93% 94%, transparent 95%),
    #f2dfb7;
}

.letter-card.paper-xuan {
  background:
    radial-gradient(ellipse at 22% 74%, rgba(49, 64, 74, 0.13), transparent 35%),
    linear-gradient(90deg, rgba(47, 95, 115, 0.12), transparent 15%, transparent 85%, rgba(182, 56, 47, 0.1)),
    repeating-linear-gradient(0deg, rgba(72, 62, 49, 0.04) 0 1px, transparent 1px 32px),
    #f5ecd2;
}

.letter-card.paper-silk {
  background:
    radial-gradient(circle at 86% 16%, rgba(13, 139, 116, 0.22) 0 30px, transparent 31px),
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), transparent 28%, rgba(217, 168, 52, 0.22) 66%, transparent),
    repeating-linear-gradient(90deg, rgba(217, 168, 52, 0.08) 0 2px, transparent 2px 12px),
    #fff5d0;
  box-shadow: inset 0 0 0 2px rgba(217, 168, 52, 0.28), 0 24px 70px rgba(0, 0, 0, 0.42), 0 0 28px rgba(217, 168, 52, 0.2);
}

.seal.paper-bamboo {
  background: radial-gradient(circle at 35% 28%, #9a6f43, #5b3920);
}

.seal.paper-cotton {
  background: radial-gradient(circle at 35% 28%, #cf4c39, #7a251d);
}

.seal.paper-xuan {
  background: radial-gradient(circle at 35% 28%, #c13f32, #8b2c24);
  box-shadow: 0 0 0 2px rgba(47, 95, 115, 0.18);
}

.seal.paper-silk {
  background: radial-gradient(circle at 35% 28%, #18a487, #076052);
  box-shadow: 0 0 0 2px rgba(217, 168, 52, 0.42), 0 0 16px rgba(217, 168, 52, 0.28);
}

.settings-card h2 {
  margin: 0 0 12px;
  font-size: 22px;
}

.settings-intro {
  margin: -4px 0 12px;
}

.account-state {
  margin-top: 10px;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

@media (max-width: 920px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .map-scroll {
    height: 68vh;
    min-height: 520px;
  }

  .letter-meta {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 10px;
  }

  .map-scroll {
    padding: 34px 14px;
  }

  .map-toolbar {
    left: 24px;
    right: 24px;
    align-items: stretch;
  }

  .map-toolbar div {
    max-width: 68%;
  }

  .letter-meta {
    grid-template-columns: 1fr;
  }
}

/* Integrated Chinese courtyard UI skin */
.app-shell {
  grid-template-columns: minmax(340px, 0.9fr) minmax(640px, 2.1fr);
  gap: 20px;
  padding: 20px;
}

.sidebar {
  border: 1px solid rgba(33, 20, 12, 0.68);
  background:
    linear-gradient(180deg, rgba(41, 25, 16, 0.18), transparent 80%),
    repeating-linear-gradient(90deg, #8e5d34 0 16px, #c59354 16px 31px, #6f4528 31px 34px);
}

.sidebar::after {
  content: "";
  position: sticky;
  bottom: 0;
  flex: 0 0 10px;
  margin: 0 -8px -10px -10px;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(90deg, #23160f, #80522f, #23160f);
  z-index: 2;
}

.profile-strip {
  border: 2px solid rgba(58, 33, 18, 0.42);
  background:
    linear-gradient(90deg, rgba(43, 25, 16, 0.1), transparent 18%, transparent 82%, rgba(43, 25, 16, 0.12)),
    #f4dfb0;
}

.icon-button {
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 30%, #fff1c6, #c44b35 58%, #7b251f 100%);
  color: #fff8df;
  font-weight: 900;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.26), 0 4px 10px rgba(70, 34, 18, 0.22);
}

.avatar {
  border: 2px solid rgba(255, 238, 174, 0.8);
  box-shadow: 0 0 0 3px rgba(127, 45, 36, 0.22), 0 6px 14px rgba(65, 33, 18, 0.2);
}

.desk-tools {
  grid-template-columns: 1fr 58px 74px;
  min-height: 58px;
  border: 1px solid rgba(33, 20, 12, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 232, 173, 0.2), rgba(21, 13, 9, 0.22)),
    linear-gradient(90deg, #4a2e1d, #8e6038 38%, #3a2418);
}

.sender-cylinder {
  min-height: 108px;
  border-radius: 54px;
  background:
    radial-gradient(ellipse at 7% center, #1f130d 0 17px, #96613e 18px 34px, #2c1a12 35px 40px, transparent 41px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.2), transparent 24%, rgba(0, 0, 0, 0.24) 74%, rgba(255, 255, 255, 0.08)),
    repeating-linear-gradient(90deg, #51301e 0 10px, #8c5a37 10px 21px, #3d2418 21px 24px);
}

.compose-panel {
  padding: 16px 14px 14px 18px;
  border: 1px solid rgba(76, 47, 25, 0.42);
  background:
    linear-gradient(90deg, rgba(124, 84, 40, 0.16), transparent 7%, transparent 93%, rgba(124, 84, 40, 0.12)),
    repeating-linear-gradient(0deg, rgba(80, 52, 28, 0.04) 0 1px, transparent 1px 13px),
    #f1dbad;
}

.compose-panel::before {
  width: 11px;
  background:
    linear-gradient(90deg, rgba(36, 22, 15, 0.28), transparent),
    repeating-linear-gradient(0deg, #6f4528 0 18px, #c09251 18px 36px, #442817 36px 38px);
}

.panel-title {
  padding: 7px 10px 7px 34px;
  margin: -4px 0 12px -2px;
  width: fit-content;
  min-width: 104px;
  border: 1px solid rgba(69, 42, 23, 0.32);
  border-radius: 5px;
  background:
    linear-gradient(90deg, #7c4b28 0 18px, #c79551 18px 22px, #a66d3a 22px),
    linear-gradient(180deg, #d8ae68, #a66d3a);
  color: #2b1a11;
  box-shadow: inset 0 1px 0 rgba(255, 238, 188, 0.42), 0 5px 10px rgba(67, 38, 20, 0.18);
}

.panel-title::before {
  left: 11px;
  top: 8px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f3c56b, #7f2d24 70%);
  box-shadow: none;
}

input,
select,
textarea {
  border-color: rgba(69, 42, 23, 0.34);
  background:
    linear-gradient(90deg, rgba(47, 95, 115, 0.06), transparent 20%, transparent 80%, rgba(182, 56, 47, 0.06)),
    rgba(255, 249, 226, 0.86);
  box-shadow: inset 0 1px 3px rgba(72, 43, 25, 0.08);
}

.paper-preview,
.stat-grid div,
.empty-inbox,
.inbox-item button,
.letter-meta div,
.letter-body {
  border-radius: 4px;
}

.paper-preview {
  border-color: rgba(89, 55, 30, 0.38);
  box-shadow: inset 0 0 0 2px rgba(255, 250, 226, 0.22), 0 8px 16px rgba(70, 42, 22, 0.12);
}

.pigeon-panel .stat-grid div {
  background:
    radial-gradient(circle at 82% 20%, rgba(47, 122, 98, 0.18), transparent 26px),
    linear-gradient(180deg, rgba(255, 250, 230, 0.72), rgba(221, 185, 120, 0.52));
}

.route-picks .secondary {
  min-height: 42px;
  border-color: rgba(70, 42, 23, 0.42);
  background:
    linear-gradient(90deg, #6f4528 0 8px, transparent 9px),
    linear-gradient(180deg, #d3a45d, #9c6738);
  color: #24160f;
  font-weight: 800;
}

.primary {
  min-height: 46px;
  border: 2px solid rgba(91, 27, 21, 0.55);
  border-radius: 50px;
  background:
    radial-gradient(circle at 18% 50%, rgba(255, 231, 159, 0.35), transparent 22px),
    radial-gradient(circle at 82% 50%, rgba(255, 231, 159, 0.24), transparent 22px),
    linear-gradient(180deg, #c34d39, #7f2d24);
  box-shadow: inset 0 2px 0 rgba(255, 226, 169, 0.22), 0 8px 16px rgba(90, 36, 24, 0.24);
}

.secondary.compact {
  border-radius: 5px;
  background:
    linear-gradient(90deg, #4c2d1c 0 8px, transparent 9px),
    linear-gradient(180deg, #d6b06d, #9f6c3d);
}

.status-panel {
  padding-bottom: 18px;
}

.progress-track {
  position: relative;
  height: 18px;
  border: 1px solid rgba(52, 30, 17, 0.36);
  background:
    linear-gradient(180deg, #4c2e1d, #2b1a12);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.32), 0 5px 10px rgba(77, 45, 25, 0.18);
}

#progressFill {
  background:
    linear-gradient(90deg, #0d7567, #53a982 70%, #d4b15a);
}

.progress-track::after {
  content: "";
  position: absolute;
  top: -7px;
  left: calc(var(--progress-x, 0%) - 14px);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 255, 255, 0.62), transparent 20%),
    radial-gradient(circle at center, #9bc7ad, #2f7a62 58%, #0f473f 100%);
  border: 2px solid rgba(221, 179, 87, 0.78);
  box-shadow: 0 5px 12px rgba(32, 25, 17, 0.28), inset 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.map-scroll {
  padding: 58px 44px 54px;
  border: 1px solid rgba(44, 28, 17, 0.55);
  background:
    linear-gradient(90deg, rgba(76, 45, 24, 0.2), transparent 6%, transparent 94%, rgba(76, 45, 24, 0.2)),
    linear-gradient(180deg, rgba(248, 230, 185, 0.97), rgba(219, 178, 108, 0.96));
}

.map-scroll::before {
  top: 24px;
  left: 34px;
  right: 34px;
  opacity: 1;
}

.scroll-top,
.scroll-bottom {
  height: 36px;
  left: 20px;
  right: 20px;
}

.scroll-top {
  top: 10px;
}

.scroll-bottom {
  bottom: 10px;
}

#map {
  border: 8px solid rgba(244, 228, 185, 0.9);
  outline: 1px solid rgba(53, 33, 20, 0.42);
  box-shadow:
    inset 0 0 0 2px rgba(29, 36, 37, 0.18),
    inset 0 0 0 9px rgba(255, 249, 220, 0.28),
    0 14px 28px rgba(54, 32, 18, 0.24);
}

.map-toolbar div,
.map-legend {
  border: 1px solid rgba(75, 48, 27, 0.34);
  background:
    linear-gradient(90deg, rgba(47, 95, 115, 0.12), transparent 25%, rgba(182, 56, 47, 0.09)),
    rgba(255, 247, 218, 0.95);
}

.inbox-item button {
  background:
    linear-gradient(90deg, rgba(124, 84, 40, 0.14), transparent 12%),
    linear-gradient(135deg, rgba(255, 248, 224, 0.94), rgba(225, 190, 124, 0.9));
}

/* Visual correction: calmer integrated Chinese study style */
.courtyard-scene {
  display: none;
}

body {
  background:
    linear-gradient(90deg, rgba(19, 18, 14, 0.62), rgba(19, 18, 14, 0.1) 28%, rgba(19, 18, 14, 0.1) 72%, rgba(19, 18, 14, 0.54)),
    linear-gradient(180deg, rgba(255, 247, 219, 0.2), rgba(22, 18, 13, 0.42)),
    url("./assets/chinese-courtyard-ui-bg.png") center / cover no-repeat fixed,
    #2f2a20;
}

body::before {
  background:
    linear-gradient(180deg, rgba(255, 247, 219, 0.06), rgba(22, 18, 13, 0.24)),
    radial-gradient(ellipse at 50% 95%, rgba(25, 18, 12, 0.34), transparent 45%);
}

.app-shell {
  grid-template-columns: minmax(340px, 0.82fr) minmax(660px, 2.18fr);
  gap: 20px;
  padding: 20px;
}

.sidebar {
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(34, 22, 14, 0.62);
  background:
    linear-gradient(90deg, rgba(48, 30, 18, 0.78), rgba(93, 60, 34, 0.86) 10px, rgba(250, 226, 175, 0.78) 11px, rgba(250, 226, 175, 0.78) calc(100% - 11px), rgba(93, 60, 34, 0.86) calc(100% - 10px), rgba(48, 30, 18, 0.78)),
    linear-gradient(180deg, rgba(255, 240, 199, 0.92), rgba(194, 145, 82, 0.9));
  box-shadow: inset 0 0 0 1px rgba(255, 238, 184, 0.22), 0 18px 36px rgba(0, 0, 0, 0.32);
}

.sidebar::before,
.sidebar::after {
  display: none;
}

.profile-strip,
.compose-panel {
  border: 1px solid rgba(77, 49, 28, 0.32);
  background:
    radial-gradient(ellipse at 100% 0%, rgba(255, 255, 255, 0.34), transparent 34%),
    repeating-linear-gradient(0deg, rgba(91, 62, 33, 0.035) 0 1px, transparent 1px 12px),
    linear-gradient(180deg, rgba(250, 235, 199, 0.97), rgba(232, 199, 138, 0.96));
  box-shadow: inset 0 0 0 1px rgba(255, 250, 226, 0.35), 0 8px 18px rgba(58, 34, 19, 0.16);
}

.profile-strip {
  min-height: 62px;
  padding: 8px 10px;
}

.profile-strip::after {
  opacity: 0.12;
}

.desk-tools {
  min-height: 36px;
  padding: 5px 9px;
  border-color: rgba(42, 27, 17, 0.28);
  background:
    linear-gradient(90deg, rgba(42, 27, 17, 0.22), rgba(255, 235, 185, 0.18)),
    rgba(89, 58, 34, 0.5);
}

.brush {
  height: 6px;
}

.inkstone {
  height: 24px;
}

.paperweight {
  height: 16px;
}

.sender-cylinder {
  min-height: 78px;
  padding: 13px 18px 13px 62px;
  background:
    radial-gradient(ellipse at 7% center, #25150e 0 14px, #9a6844 15px 28px, #3a2317 29px 34px, transparent 35px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.16), transparent 28%, rgba(0, 0, 0, 0.18) 74%, rgba(255, 255, 255, 0.08)),
    linear-gradient(180deg, #7b4b2d, #4e2d1d);
}

.cylinder-cap {
  width: 48px;
}

.compose-panel {
  padding: 12px 13px 12px 17px;
  overflow: hidden;
}

.compose-panel::before {
  width: 5px;
  background: linear-gradient(180deg, rgba(48, 106, 67, 0.7), rgba(141, 165, 108, 0.58));
}

.letter-panel::after,
.pigeon-panel::after {
  opacity: 0.08;
  transform: scale(0.82);
  transform-origin: top right;
}

.status-panel::after {
  display: none;
}

.panel-title {
  min-width: auto;
  margin: -2px 0 9px -2px;
  padding: 5px 9px 5px 24px;
  border-color: rgba(93, 61, 35, 0.24);
  background:
    linear-gradient(90deg, rgba(127, 45, 36, 0.82) 0 5px, transparent 6px),
    linear-gradient(180deg, rgba(237, 199, 132, 0.9), rgba(199, 151, 86, 0.82));
  box-shadow: inset 0 1px 0 rgba(255, 239, 196, 0.4);
}

.panel-title::before {
  left: 8px;
  top: 8px;
  width: 9px;
  height: 9px;
}

input,
select,
textarea {
  border-radius: 4px;
  background:
    linear-gradient(90deg, rgba(47, 95, 115, 0.04), transparent 22%, transparent 78%, rgba(182, 56, 47, 0.04)),
    rgba(255, 249, 226, 0.9);
}

.stat-grid div {
  padding: 8px;
}

.stat-grid span {
  font-size: 20px;
}

.primary {
  min-height: 42px;
  border-width: 1px;
  border-radius: 6px;
}

.route-picks .secondary,
.secondary.compact {
  min-height: 38px;
  background:
    linear-gradient(180deg, #e6c381, #b98148);
}

.progress-track {
  height: 14px;
  overflow: visible;
}

.progress-track::after {
  top: -7px;
  width: 28px;
  height: 28px;
}

.map-scroll {
  padding: 42px 34px 40px;
  border-color: rgba(48, 31, 19, 0.42);
  background:
    linear-gradient(90deg, rgba(81, 49, 25, 0.12), transparent 8%, transparent 92%, rgba(81, 49, 25, 0.12)),
    linear-gradient(180deg, rgba(246, 226, 181, 0.96), rgba(218, 176, 106, 0.94));
}

.map-scroll::before {
  height: 30px;
  top: 18px;
  opacity: 0.72;
  clip-path: polygon(0 42%, 8% 18%, 50% 30%, 92% 18%, 100% 42%, 98% 58%, 2% 58%);
}

.map-scroll::after {
  display: none;
}

.scroll-top,
.scroll-bottom {
  height: 24px;
  left: 18px;
  right: 18px;
}

#map {
  border-width: 4px;
  box-shadow:
    inset 0 0 0 2px rgba(255, 249, 220, 0.34),
    0 10px 24px rgba(54, 32, 18, 0.22);
}

.map-toolbar {
  top: 52px;
}

.map-toolbar div,
.map-legend {
  background: rgba(255, 247, 218, 0.94);
  box-shadow: 0 6px 14px rgba(66, 35, 17, 0.14);
}

.profile-strip,
.desk-tools,
.sender-cylinder,
.compose-panel {
  flex: 0 0 auto;
}

.sidebar {
  background:
    linear-gradient(90deg, rgba(48, 30, 18, 0.76), rgba(93, 60, 34, 0.6) 12px, rgba(250, 226, 175, 0.44) 13px, rgba(250, 226, 175, 0.44) calc(100% - 13px), rgba(93, 60, 34, 0.6) calc(100% - 12px), rgba(48, 30, 18, 0.76)),
    var(--tex-bamboo) center / cover,
    #b9874b;
}

.profile-strip,
.compose-panel,
.map-scroll,
.map-toolbar div,
.map-legend,
.settings-card,
.letter-card,
.policy-card {
  background-image:
    linear-gradient(180deg, rgba(255, 248, 224, 0.72), rgba(230, 194, 126, 0.58)),
    var(--tex-paper);
  background-size: auto, cover;
  background-position: center;
}

.desk-tools,
.panel-title,
.route-picks .secondary,
.secondary.compact,
.scroll-top,
.scroll-bottom {
  background-image:
    linear-gradient(180deg, rgba(255, 232, 174, 0.26), rgba(46, 27, 15, 0.24)),
    var(--tex-bamboo);
  background-size: auto, cover;
  background-position: center;
}

input,
select,
textarea,
.paper-preview,
.empty-inbox,
.inbox-item button,
.letter-body,
.letter-meta div {
  background-image:
    linear-gradient(90deg, rgba(47, 95, 115, 0.045), rgba(255, 249, 226, 0.68) 24%, rgba(255, 249, 226, 0.68) 76%, rgba(182, 56, 47, 0.045)),
    var(--tex-paper);
  background-size: auto, cover;
  background-position: center;
}

.primary,
.icon-button,
.avatar,
.seal,
.progress-track::after,
.paperweight {
  background-image:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.45), transparent 20%),
    var(--tex-jade);
  background-size: auto, 240% auto;
  background-position: center;
}

.primary {
  background-position: center, 85% 18%;
  color: #fff9e8;
}

.icon-button,
.avatar,
.seal {
  background-position: center, 88% 12%;
}

.panel-title {
  color: #2b1a11;
}

/* Portrait app layout */
body {
  overflow: auto;
}

.app-shell {
  grid-template-columns: 1fr;
  grid-template-areas:
    "map"
    "controls";
  gap: 12px;
  min-height: 100vh;
  height: auto;
  max-width: 430px;
  margin: 0 auto;
  padding: 12px;
}

.map-scroll {
  grid-area: map;
  height: min(48vh, 430px);
  min-height: 300px;
  padding: 34px 16px 32px;
  border-radius: 8px;
}

.sidebar {
  grid-area: controls;
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 10px;
  overflow: visible;
  padding: 10px;
}

.profile-strip,
.desk-tools,
.sender-cylinder,
.letter-panel,
.status-panel,
.ad-panel,
.social-panel,
.retention-panel,
.inbox-panel,
.log-panel,
.compliance-panel {
  grid-column: 1 / -1;
}

.pigeon-panel {
  grid-column: 1 / -1;
}

.profile-strip {
  grid-template-columns: 40px 48px 1fr auto;
}

.desk-tools {
  order: 1;
}

.sender-cylinder {
  order: 2;
}

.letter-panel {
  order: 3;
}

.pigeon-panel {
  order: 4;
}

.status-panel {
  order: 5;
}

.ad-panel {
  order: 6;
}

.social-panel {
  order: 7;
}

.retention-panel {
  order: 8;
}

.inbox-panel {
  order: 9;
}

.log-panel {
  order: 10;
}

.compliance-panel {
  order: 11;
}

.map-toolbar {
  left: 28px;
  right: 28px;
  top: 44px;
}

.map-toolbar div {
  min-width: 0;
}

.map-toolbar span {
  display: block;
  margin: 2px 0 0;
}

.map-legend {
  right: 26px;
  bottom: 36px;
}

.scroll-top {
  top: 8px;
}

.scroll-bottom {
  bottom: 8px;
}

@media (min-width: 680px) {
  .sidebar {
    grid-template-columns: 1fr;
  }

  .profile-strip,
  .desk-tools,
  .sender-cylinder,
  .letter-panel,
  .pigeon-panel,
  .status-panel,
  .ad-panel,
  .inbox-panel,
  .log-panel,
  .compliance-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 8px;
    gap: 8px;
  }

  .map-scroll {
    height: 46vh;
    min-height: 320px;
    padding: 30px 10px 28px;
  }

  .sidebar {
    grid-template-columns: 1fr;
    padding: 8px;
  }

  .map-toolbar {
    left: 18px;
    right: 18px;
    top: 38px;
  }

  .map-toolbar div {
    max-width: calc(100% - 94px);
    padding: 7px 9px;
  }

  .compact {
    min-width: 82px;
  }

  .map-legend {
    left: 18px;
    right: 18px;
    bottom: 30px;
  }

  .sender-cylinder {
    min-height: 70px;
  }
}
