:root {
  --paper: #f5f0e6;
  --card: #fffdf8;
  --ink: #20231f;
  --muted: #746b5e;
  --line: #e1d2b8;
  --gold: #b8872d;
  --red: #9b3f30;
  --green: #0d7054;
  --shadow: 0 18px 48px rgba(48, 39, 25, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(184, 135, 45, 0.14), transparent 34%),
    linear-gradient(180deg, #fbf7ee 0%, var(--paper) 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px 32px;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(135deg, #fffaf0 0%, #f1e6d1 58%, #e4d7bd 100%);
  box-shadow: var(--shadow);
}

.hero-bg-mark {
  position: absolute;
  right: -10px;
  top: -22px;
  color: rgba(32, 35, 31, 0.05);
  font-size: 160px;
  font-weight: 900;
  line-height: 1;
}

.brand-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  box-shadow: 0 10px 26px rgba(48, 39, 25, 0.13);
}

.kicker {
  margin: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

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

h1 {
  margin: 4px 0 0;
  font-size: 38px;
  line-height: 1.05;
  font-weight: 900;
}

h2 {
  margin: 26px 0 14px;
  font-size: 24px;
  line-height: 1.2;
}

h3 {
  margin: 14px 0 8px;
  font-size: 18px;
}

.hero-copy {
  position: relative;
  margin: 20px 0 0;
  color: #5d554b;
  font-size: 15px;
  line-height: 1.8;
}

.quota-panel,
.notice,
.account-line {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(184, 135, 45, 0.26);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.72);
}

.quota-panel strong {
  margin: 0 4px;
  color: var(--green);
  font-size: 30px;
}

.quota-label {
  color: var(--muted);
  font-size: 13px;
}

.tabbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 18px 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.86);
  backdrop-filter: blur(16px);
}

.tab {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.tab.active {
  background: var(--ink);
  color: #f7e7bf;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.notice {
  color: #5f574d;
  font-size: 14px;
  line-height: 1.7;
}

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

.feature-card,
.result-card,
.record-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 10px 28px rgba(48, 39, 25, 0.06);
}

.feature-card {
  min-height: 166px;
  padding: 18px;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.seal {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  color: #fff8e9;
  font-weight: 900;
}

.red { background: var(--red); }
.green { background: var(--green); }
.gold { background: var(--gold); }
.ink { background: #3b403a; }

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill-list span {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-size: 14px;
}

.section-head {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
}

.section-head h2 {
  margin: 6px 0 10px;
}

.section-head p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.field {
  display: block;
  margin-top: 16px;
}

.field span {
  display: block;
  margin-bottom: 8px;
  color: #4f493f;
  font-size: 14px;
  font-weight: 900;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  outline: 0;
}

textarea {
  min-height: 120px;
  padding: 14px;
  line-height: 1.65;
  resize: vertical;
}

select {
  height: 50px;
  padding: 0 14px;
}

input {
  height: 50px;
  padding: 0 14px;
}

.teacher-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

.record-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.ghost-btn {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-weight: 800;
}

.teacher {
  display: grid;
  gap: 5px;
  min-height: 78px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  color: var(--ink);
  text-align: left;
}

.teacher strong {
  font-size: 16px;
  line-height: 1.25;
}

.teacher small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.teacher.active {
  border-color: var(--gold);
  background: #fff5df;
}

.primary-btn {
  width: 100%;
  min-height: 52px;
  margin-top: 16px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #f7e7bf;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(32, 35, 31, 0.16);
}

.primary-btn:disabled {
  cursor: wait;
  opacity: 0.72;
}

.result-card {
  margin-top: 16px;
  padding: 20px;
  border-left: 6px solid var(--gold);
}

.result-card h3 {
  margin-top: 0;
}

.result-card p,
.result-card pre {
  color: #3f3a33;
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.line-stack {
  margin: 14px 0;
  padding: 14px;
  border-radius: 16px;
  background: #f6eddd;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.consulting-card {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 14px;
  align-items: center;
}

.consulting-card h3 {
  margin: 5px 0 6px;
}

.consulting-card p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.consulting-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff8e9 0 38%, rgba(184, 135, 45, 0.22) 40% 100%);
}

.consulting-orbit::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 2px solid transparent;
  border-top-color: var(--gold);
  border-right-color: rgba(155, 63, 48, 0.72);
  border-radius: 50%;
  animation: consult-spin 1.1s linear infinite;
}

.consulting-orbit span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red), var(--gold));
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.records {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.record-card {
  padding: 16px;
}

.record-card small {
  color: var(--muted);
}

.record-card p {
  margin-bottom: 0;
  color: #3f3a33;
  line-height: 1.65;
}

.blessing-stream {
  overflow: hidden;
  margin-top: 28px;
  padding: 20px 0 4px;
}

.stream-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 0 2px;
}

.stream-head h2 {
  margin: 6px 0 0;
}

.stream-badge {
  flex: 0 0 auto;
  margin-top: 4px;
  padding: 7px 10px;
  border: 1px solid rgba(184, 135, 45, 0.34);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.72);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.stream-copy {
  margin: 0 2px 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.stream-window {
  position: relative;
  overflow: hidden;
  margin-inline: -16px;
  padding: 6px 0 18px;
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}

.stream-window::before {
  content: "";
  position: absolute;
  inset: 18px 0 12px;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(184, 135, 45, 0.12), transparent 58%);
}

.stream-track {
  position: relative;
  z-index: 1;
  display: flex;
  width: max-content;
  gap: 12px;
  padding: 6px 16px;
  will-change: transform;
}

.stream-track-a {
  animation: blessing-scroll-left 38s linear infinite;
}

.stream-track-b {
  animation: blessing-scroll-right 46s linear infinite;
}

.stream-window:hover .stream-track {
  animation-play-state: paused;
}

.blessing-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  width: 286px;
  min-height: 104px;
  padding: 14px;
  border: 1px solid rgba(225, 210, 184, 0.9);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 253, 248, 0.96), rgba(255, 246, 228, 0.92)),
    var(--card);
  box-shadow: 0 14px 34px rgba(48, 39, 25, 0.08);
}

.blessing-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: #fff8e9;
  font-weight: 900;
  background: linear-gradient(135deg, var(--red), var(--gold));
}

.avatar-tone-0 { background: linear-gradient(135deg, #9b3f30, #b8872d); }
.avatar-tone-1 { background: linear-gradient(135deg, #0d7054, #b8872d); }
.avatar-tone-2 { background: linear-gradient(135deg, #3b403a, #9b3f30); }
.avatar-tone-3 { background: linear-gradient(135deg, #7d5430, #d2a44b); }
.avatar-tone-4 { background: linear-gradient(135deg, #315f68, #b8872d); }
.avatar-tone-5 { background: linear-gradient(135deg, #7b3e5d, #b8872d); }

.blessing-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.blessing-name {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.blessing-time {
  color: #9a9182;
  font-size: 12px;
}

.blessing-type {
  display: inline-flex;
  margin: 7px 0 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f3ead7;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.blessing-type::before {
  content: "✓";
  margin-right: 4px;
  color: var(--green);
}

.blessing-text {
  margin: 0;
  color: #4b443a;
  font-size: 13px;
  line-height: 1.55;
}

.blessing-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(13, 112, 84, 0.08);
}

@keyframes blessing-scroll-left {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@keyframes blessing-scroll-right {
  from { transform: translateX(-50%); }
  to { transform: translateX(0); }
}

@keyframes consult-spin {
  to { transform: rotate(360deg); }
}

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

.hidden {
  display: none !important;
}

.pay-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.pay-mask {
  position: absolute;
  inset: 0;
  background: rgba(18, 20, 18, 0.58);
}

.pay-panel {
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: min(calc(100% - 28px), 492px);
  max-height: calc(100vh - 40px);
  overflow: auto;
  transform: translateX(-50%);
  padding: 22px;
  border-radius: 28px;
  background: var(--card);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.pay-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.pay-head h2 {
  margin: 6px 0 0;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #f4ead7;
  color: var(--muted);
  font-size: 28px;
}

.pay-note,
.pay-tip {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.package-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.package {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.package.active {
  border-color: var(--gold);
  background: #fff6e4;
}

.package strong {
  display: block;
  margin-bottom: 4px;
}

.price {
  color: var(--red);
  font-size: 22px;
  font-weight: 900;
}

.qr-box {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f9f0df;
}

.order-box {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed var(--gold);
  border-radius: 16px;
  background: #fff8e9;
}

.order-box span {
  color: var(--muted);
  font-size: 13px;
}

.order-box strong {
  color: var(--ink);
  font-size: 14px;
  word-break: break-all;
}

.redeem-box {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fffaf0;
}

.qr-box img {
  width: 168px;
  height: 168px;
  border-radius: 16px;
  background: #fff;
  object-fit: contain;
}

.admin-shell {
  padding-bottom: 48px;
}

.admin-card {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 10px 28px rgba(48, 39, 25, 0.06);
}

.admin-copy {
  flex: 0 0 auto;
  min-width: 74px;
}

.admin-output {
  min-height: 220px;
  margin-top: 14px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0;
}

@media (max-width: 380px) {
  .app-shell {
    padding-inline: 12px;
  }

  .feature-grid,
  .form-grid,
  .teacher-row {
    grid-template-columns: 1fr;
  }

  .qr-box {
    grid-template-columns: 1fr;
  }

  .stream-window {
    margin-inline: -12px;
  }

  .blessing-card {
    width: 268px;
  }
}
