:root {
  color-scheme: light;
  --ink: #2d2a25;
  --muted: #746c61;
  --paper: #f4efe2;
  --panel: #fffaf0;
  --line: #dfd2bd;
  --red: #b85f3f;
  --teal: #1d8f87;
  --gold: #d9a441;
  --green: #5b8a52;
  --shadow: 0 18px 50px rgba(67, 58, 49, .12);
}

html {
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(217, 164, 65, .2), transparent 30rem),
    linear-gradient(135deg, #f7f0df 0%, #eef5ef 48%, #f7e7df 100%);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .7;
}

.shell {
  display: grid;
  grid-template-columns: 21rem minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
  border-right: 1px solid rgba(67, 58, 49, .12);
  background: rgba(255, 250, 240, .74);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 3.5rem;
}

.brand strong,
.profile-panel h1,
.topbar h2,
.section-heading h3 {
  letter-spacing: 0;
}

.brand strong {
  display: block;
  font-size: 1.05rem;
}

.brand span,
.form-note,
.profile-panel p,
.log-meta,
.deity-card p {
  color: var(--muted);
}

.profile-panel,
.auth-card,
.offering-form,
.activity-panel {
  border: 1px solid rgba(67, 58, 49, .12);
  border-radius: 8px;
  background: rgba(255, 250, 240, .78);
  box-shadow: var(--shadow);
}

.profile-panel {
  padding: 1rem;
}

.logout-button {
  width: 100%;
  margin-top: .8rem;
}

.eyebrow {
  display: block;
  color: var(--red);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.profile-panel h1 {
  margin: .35rem 0 .35rem;
  font-size: 1.5rem;
}

.profile-panel p {
  margin: 0;
  line-height: 1.55;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .65rem;
}

.stats div {
  min-height: 5rem;
  padding: .9rem;
  border: 1px solid rgba(67, 58, 49, .1);
  border-radius: 8px;
  background: rgba(255, 255, 255, .45);
}

.stats strong {
  display: block;
  font-size: 1.85rem;
  line-height: 1;
}

.stats span {
  display: block;
  margin-top: .4rem;
  color: var(--muted);
  font-size: .86rem;
}

.auth-card,
.offering-form,
.activity-panel {
  padding: 1rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem;
  margin-bottom: .85rem;
  padding: .25rem;
  border-radius: 8px;
  background: #eee3cf;
}

.auth-tabs button,
.ghost {
  min-height: 2.5rem;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
}

.auth-tabs button.active {
  background: var(--panel);
  box-shadow: 0 4px 14px rgba(67, 58, 49, .12);
}

form {
  display: grid;
  gap: .8rem;
}

label {
  display: grid;
  gap: .35rem;
  color: #433a31;
  font-size: .88rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 2.8rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: rgba(255, 255, 255, .72);
  padding: .7rem .8rem;
  outline: 0;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(184, 95, 63, .14);
}

.primary,
.ghost {
  min-height: 2.8rem;
  border: 0;
  border-radius: 7px;
  font-weight: 800;
}

.primary {
  color: #fffaf0;
  background: linear-gradient(135deg, var(--red), #8f4637);
}

.ghost {
  padding: 0 1rem;
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, .6);
}

.form-note {
  min-height: 1.2rem;
  margin: 0;
  line-height: 1.45;
}

.is-loading {
  opacity: .82;
  pointer-events: none;
}

.workspace {
  min-width: 0;
  padding: 1.5rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.topbar-actions {
  display: grid;
  justify-items: end;
  gap: .45rem;
}

.network-banner {
  margin: 0;
  max-width: 23rem;
  padding: .45rem .65rem;
  border: 1px solid rgba(184, 95, 63, .3);
  border-radius: 7px;
  color: #7e412f;
  background: rgba(255, 246, 234, .92);
  font-size: .8rem;
  line-height: 1.35;
}

.topbar h2 {
  margin: .25rem 0 0;
  font-size: clamp(1.5rem, 3vw, 2.65rem);
  line-height: 1.08;
}

.deity-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(8.5rem, 1fr));
  gap: .8rem;
  margin-bottom: 1rem;
}

.deity-card {
  position: relative;
  min-height: 17rem;
  overflow: hidden;
  border: 1px solid rgba(67, 58, 49, .12);
  border-radius: 8px;
  background: rgba(255, 250, 240, .68);
  text-align: left;
  box-shadow: 0 10px 34px rgba(67, 58, 49, .09);
}

.deity-card.active {
  border-color: color-mix(in srgb, var(--deity), #433a31 12%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--deity), transparent 76%), var(--shadow);
}

.deity-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1.05;
  object-fit: cover;
  background: color-mix(in srgb, var(--deity), #fff 78%);
}

.deity-card div {
  padding: .75rem;
}

.deity-card strong {
  display: block;
  font-size: 1rem;
}

.deity-card p {
  min-height: 2.55rem;
  margin: .25rem 0 0;
  font-size: .78rem;
  line-height: 1.45;
}

.practice-layout {
  display: grid;
  grid-template-columns: minmax(18rem, 26rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.section-heading {
  margin-bottom: .9rem;
}

[data-scroll-section] {
  scroll-margin-top: 1rem;
}

.section-heading h3 {
  margin: .2rem 0 0;
  font-size: 1.15rem;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
}

.commit-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(1.5rem, 1fr));
  gap: .45rem;
}

.commit-cell {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid rgba(67, 58, 49, .1);
  border-radius: 6px;
  background: #eadfcb;
}

.commit-cell[data-level="1"] { background: #d8e6c4; }
.commit-cell[data-level="2"] { background: #a9cf94; }
.commit-cell[data-level="3"] { background: #67a96a; }
.commit-cell[data-level="4"] { background: #2f7b5f; }

.commit-cell::after {
  content: attr(aria-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + .45rem);
  z-index: 3;
  width: max-content;
  max-width: 12rem;
  transform: translateX(-50%);
  padding: .35rem .5rem;
  border-radius: 6px;
  color: #fffaf0;
  background: #433a31;
  font-size: .76rem;
  opacity: 0;
  pointer-events: none;
}

.commit-cell:hover::after {
  opacity: 1;
}

.recent-heading {
  margin-top: 1.3rem;
}

.log-list {
  display: grid;
  gap: .65rem;
  max-height: 25rem;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.log-item {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: .75rem;
  padding: .7rem;
  border: 1px solid rgba(67, 58, 49, .1);
  border-radius: 8px;
  background: rgba(255, 255, 255, .42);
}

.log-item img {
  width: 3rem;
  height: 3rem;
  border-radius: 7px;
  object-fit: cover;
  background: #eee3cf;
}

.log-item strong {
  display: block;
}

.log-item p {
  margin: .2rem 0 .35rem;
  line-height: 1.5;
}

.log-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .75rem;
  font-size: .78rem;
}

[data-register-only] {
  display: none;
}

.is-register [data-register-only] {
  display: grid;
}

.bottom-nav {
  position: fixed;
  left: .7rem;
  right: .7rem;
  bottom: .7rem;
  z-index: 45;
  display: none;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .35rem;
  padding: .35rem;
  border: 1px solid rgba(67, 58, 49, .16);
  border-radius: 12px;
  background: rgba(255, 250, 240, .9);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 28px rgba(67, 58, 49, .18);
}

.bottom-nav button {
  min-height: 2.35rem;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: .78rem;
  font-weight: 700;
}

.bottom-nav button.active {
  color: #fffaf0;
  background: linear-gradient(135deg, var(--red), #8f4637);
  box-shadow: 0 6px 14px rgba(143, 70, 55, .3);
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    align-items: start;
    border-right: 0;
    border-bottom: 1px solid rgba(67, 58, 49, .12);
  }

  .brand {
    grid-column: 1 / -1;
  }

  .deity-grid {
    grid-template-columns: repeat(3, minmax(10rem, 1fr));
  }
}

@media (max-width: 960px) {
  body {
    padding-bottom: 5.7rem;
  }

  .workspace {
    padding-bottom: 4.8rem;
  }

  .topbar-actions {
    width: 100%;
    justify-items: start;
  }

  .network-banner {
    max-width: none;
  }

  .bottom-nav {
    display: grid;
  }
}

@media (max-width: 820px) {
  .workspace,
  .rail {
    padding: 1rem;
  }

  .rail,
  .practice-layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    justify-items: stretch;
  }

  .deity-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .bottom-nav {
    left: .45rem;
    right: .45rem;
    bottom: .45rem;
    gap: .25rem;
  }

  .bottom-nav button {
    font-size: .72rem;
  }

  .deity-grid,
  .field-row {
    grid-template-columns: 1fr;
  }

  .deity-card {
    min-height: auto;
  }

  .commit-grid {
    gap: .32rem;
  }
}

/* 社交广场样式 */
.social-section {
  margin-top: 2rem;
  padding: 1.25rem;
  border: 1px solid rgba(67, 58, 49, .12);
  border-radius: 8px;
  background: rgba(255, 250, 240, .78);
  box-shadow: var(--shadow);
}

.social-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1rem;
}

.social-stat-card {
  padding: .6rem 1rem;
  border: 1px solid rgba(67, 58, 49, .1);
  border-radius: 8px;
  background: rgba(255, 255, 255, .45);
  font-size: .85rem;
}

.social-stat-card strong {
  font-size: 1.1rem;
}

.social-stat-card span {
  color: var(--muted);
  margin-left: .3rem;
}

.social-tabs {
  display: flex;
  gap: .4rem;
  margin-bottom: 1rem;
  padding: .25rem;
  border-radius: 8px;
  background: #eee3cf;
}

.social-tabs button {
  flex: 1;
  min-height: 2.2rem;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  font-weight: 600;
}

.social-tabs button.active {
  background: var(--panel);
  box-shadow: 0 4px 14px rgba(67, 58, 49, .12);
}

.social-content {
  min-height: 200px;
}

.social-loading {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
}

.social-feed {
  display: grid;
  gap: .75rem;
}

.social-feed-item {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: .75rem;
  padding: .8rem;
  border: 1px solid rgba(67, 58, 49, .1);
  border-radius: 8px;
  background: rgba(255, 255, 255, .42);
}

.social-feed-item img {
  width: 3rem;
  height: 3rem;
  border-radius: 7px;
  object-fit: cover;
  background: #eee3cf;
}

.social-feed-item strong {
  display: block;
  font-size: .9rem;
}

.social-feed-item p {
  margin: .2rem 0 .35rem;
  font-size: .88rem;
  line-height: 1.5;
}

.social-feed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .75rem;
  font-size: .78rem;
  color: var(--muted);
}

.social-deity-stat {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem;
  border: 1px solid rgba(67, 58, 49, .1);
  border-radius: 8px;
  background: rgba(255, 255, 255, .42);
  margin-bottom: .65rem;
}

.social-deity-stat img {
  width: 3rem;
  height: 3rem;
  border-radius: 7px;
  object-fit: cover;
}

.social-deity-stat-info {
  flex: 1;
}

.social-deity-stat-info strong {
  display: block;
  font-size: .95rem;
}

.social-deity-stat-info span {
  color: var(--muted);
  font-size: .82rem;
}

.social-deity-bar {
  height: 6px;
  border-radius: 3px;
  background: #eadfcb;
  margin-top: .4rem;
  overflow: hidden;
}

.social-deity-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .3s;
}

.social-user-rank {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem;
  border: 1px solid rgba(67, 58, 49, .1);
  border-radius: 8px;
  background: rgba(255, 255, 255, .42);
  margin-bottom: .65rem;
}

.social-user-rank .rank {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: #d9a441;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .85rem;
}

.social-user-rank .rank.gold { background: #d9a441; }
.social-user-rank .rank.silver { background: #9ca3af; }
.social-user-rank .rank.bronze { background: #b87333; }

.social-user-rank-info {
  flex: 1;
}

.social-user-rank-info strong {
  display: block;
  font-size: .95rem;
}

.social-user-rank-info span {
  color: var(--muted);
  font-size: .82rem;
}

.social-pagination {
  display: flex;
  justify-content: center;
  gap: .5rem;
  margin-top: 1rem;
}

.social-pagination button {
  padding: .4rem .8rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 250, 240, .6);
  font-size: .85rem;
}

.social-pagination button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.social-empty {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
}

.social-empty button {
  margin-top: .8rem;
  padding: .45rem .9rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 250, 240, .6);
}
