:root {
  --shell-top-h: 52px;
  --shell-bottom-h: 56px;
}

.orasage-app-shell {
  --shell-bg: #0f0e17;
  --shell-surface: rgba(21, 18, 42, 0.96);
  --shell-menu-bg: #15122a;
  --shell-border: rgba(255, 255, 255, 0.08);
  --shell-border-subtle: rgba(255, 255, 255, 0.04);
  --shell-text: #e8e4dc;
  --shell-muted: #9a9588;
  --shell-gold: #c9a05a;
  --shell-top-h: 52px;
  --shell-bottom-h: 56px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--shell-text);
  background: var(--shell-bg);
  position: relative;
}

.orasage-app-shell[data-theme='light'] {
  --shell-bg: #fafaf8;
  --shell-surface: rgba(255, 255, 255, 0.96);
  --shell-menu-bg: #ffffff;
  --shell-border: #e7e5e4;
  --shell-border-subtle: #fafaf8;
  --shell-text: #171717;
  --shell-muted: #6b7280;
  --shell-gold: #171717;
}

.orasage-app-topbar-start {
  display: flex;
  align-items: center;
  min-width: 0;
}

.orasage-app-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--shell-muted);
  text-decoration: none;
  font-size: 14px;
  font-family: var(--orasage-font-sans, 'Noto Sans SC', sans-serif);
  padding: 4px 0;
  transition: color 0.15s var(--orasage-ease-organic, ease);
}

.orasage-app-back:hover {
  color: var(--shell-gold);
}

.orasage-app-back span {
  letter-spacing: var(--orasage-letter-wide, 0.05em);
}

.orasage-app-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--shell-top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--shell-surface);
  border-bottom: 1px solid var(--shell-border);
  backdrop-filter: blur(12px);
}

.orasage-app-brand {
  font-family: var(--orasage-font-serif, Georgia, 'Times New Roman', serif);
  font-size: 1.25rem;
  letter-spacing: var(--orasage-letter-wide, 0.06em);
  color: var(--shell-gold);
  text-decoration: none;
}

.orasage-app-lang {
  position: relative;
  flex-shrink: 0;
}

/* 双类选择器：稳定压过 @orasage/ui Button 的单类工具类（与样式表加载顺序无关） */
.orasage-app-lang .orasage-app-lang-btn {
  /* 固定高度胶囊；宽度随最长文案（Português）自适应，避免与下拉符号挤占换行 */
  height: 36px;
  min-height: 36px;
  min-width: max-content;
  padding: 0 12px;
  border: 1px solid var(--shell-border);
  border-radius: 8px;
  background: transparent;
  color: var(--shell-muted);
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.orasage-app-lang .orasage-app-lang-btn span {
  white-space: nowrap;
}

.orasage-app-lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  /* 置于全站层级最顶（底栏 50 / 探索遮罩 60 / sheet 70 之上） */
  z-index: 80;
  min-width: 120px;
  max-height: 288px;
  overflow-y: auto;
  border: 1px solid var(--shell-border);
  border-radius: 8px;
  /* 不透明底色：半透明 surface 会透出下层文字，影响可读性 */
  background: var(--shell-menu-bg, #ffffff);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.orasage-app-lang .orasage-app-lang-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 10px 12px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--shell-text);
  font-size: 12px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.orasage-app-lang .orasage-app-lang-item:hover,
.orasage-app-lang .orasage-app-lang-item[aria-current='true'] {
  background: rgba(201, 160, 90, 0.12);
  color: var(--shell-gold);
}

.orasage-app-main {
  flex: 1;
  position: relative;
  z-index: 1;
  padding-bottom: calc(var(--shell-bottom-h, 56px) + env(safe-area-inset-bottom, 0px) + 16px);
}

.orasage-app-main--column {
  display: flex;
  flex-direction: column;
}

.orasage-app-main--no-bottomnav {
  padding-bottom: 12px;
}

.orasage-app-main--immersive {
  padding-bottom: 0;
  min-height: 100dvh;
}

.orasage-portal-main {
  padding-bottom: calc(var(--shell-bottom-h, 56px) + env(safe-area-inset-bottom, 0px) + 16px);
}

/* —— 旧 PC 顶栏（已下线：全站仅移动壳，保留选择器以免遗留 HTML 露出来） —— */
.orasage-site-topnav {
  display: none !important;
  position: relative;
  z-index: 10;
  background: var(--shell-bg);
  padding-top: env(safe-area-inset-top, 0px);
}

.orasage-site-topnav-inner {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: var(--shell-top-h);
  padding: 0 16px;
}

@media (min-width: 640px) {
  .orasage-site-topnav-inner {
    padding: 0 24px;
    min-height: 64px;
  }
}

.orasage-site-topnav-brand {
  flex-shrink: 0;
  font-family: var(--orasage-font-serif, Georgia, 'Times New Roman', serif);
  font-size: 1.125rem;
  letter-spacing: 0.1em;
  color: var(--shell-gold);
  text-decoration: none;
}

@media (min-width: 640px) {
  .orasage-site-topnav-brand {
    font-size: 1.25rem;
  }
}

.orasage-site-topnav-menu {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 20px;
  min-width: 0;
}

.orasage-site-topnav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 14px;
  color: var(--shell-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s var(--orasage-ease-organic, ease);
}

.orasage-site-topnav-link:hover {
  color: var(--shell-text);
}

.orasage-site-topnav-menu .orasage-auth-chip {
  margin-inline-start: 4px;
}

/* —— 顶栏（仅 Logo + 登录；宽屏同移动壳） —— */
.orasage-site-mobile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--shell-top-h);
  padding: env(safe-area-inset-top, 0px) 16px 0;
  background: var(--shell-bg);
}

.orasage-site-mobile-bar-brand {
  font-family: var(--orasage-font-serif, Georgia, 'Times New Roman', serif);
  font-size: 1.125rem;
  letter-spacing: 0.08em;
  color: var(--shell-gold);
  text-decoration: none;
}

.orasage-site-mobile-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* 页脚 — 移动壳下隐藏（底栏已承载导航；法律页可从「我的」进入） */
.orasage-portal-footer {
  display: none;
  margin-top: auto;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.orasage-portal-footer-inner {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 2rem 1.25rem;
}

@media (min-width: 640px) {
  .orasage-portal-footer-inner {
    flex-direction: row;
    justify-content: space-between;
    padding-inline: 1.5rem;
  }
}

.orasage-portal-footer-copy {
  margin: 0;
  font-size: 0.75rem;
  color: var(--shell-muted);
  text-align: center;
}

@media (min-width: 640px) {
  .orasage-portal-footer-copy {
    font-size: 0.875rem;
    text-align: start;
  }
}

.orasage-portal-footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.orasage-portal-footer-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.875rem;
  color: var(--shell-muted);
  text-decoration: none;
  transition: color 0.15s var(--orasage-ease-organic, ease);
}

.orasage-portal-footer-link:hover {
  color: var(--shell-gold);
}

.orasage-page-toolbar--subpage {
  justify-content: flex-start;
}

.orasage-page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 0;
}

.orasage-page-toolbar-spacer {
  flex: 1;
  min-width: 0;
}

.orasage-auth-chip {
  display: inline-flex;
  align-items: center;
  max-width: min(160px, 42vw);
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--shell-border);
  color: var(--shell-gold);
  font-size: 12px;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  transition: border-color 0.15s var(--orasage-ease-organic, ease), background 0.15s var(--orasage-ease-organic, ease);
}

.orasage-auth-chip:hover {
  border-color: var(--shell-gold);
  background: rgba(201, 160, 90, 0.08);
}

.orasage-auth-chip--signed-in {
  font-weight: 500;
}

.orasage-auth-chip--loading {
  width: 72px;
  min-height: 32px;
  border-color: transparent;
  background: var(--shell-border-subtle);
  animation: orasage-auth-pulse 1.2s ease-in-out infinite;
}

@keyframes orasage-auth-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.orasage-page-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--shell-muted);
  font-size: 14px;
  font-family: var(--orasage-font-sans, 'Noto Sans SC', sans-serif);
  cursor: pointer;
  padding: 4px 0;
}

/* 页面自带返回链：由 AppShell 统一提供，避免双层返回 */
.orasage-subpage-back-local {
  display: none !important;
}

.orasage-page-back:hover {
  color: var(--shell-gold);
}

.orasage-app-brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 4px;
  opacity: 0.72;
  pointer-events: none;
  user-select: none;
}

.orasage-app-brand-mark-label {
  font-family: var(--orasage-font-serif, Georgia, 'Times New Roman', serif);
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  color: var(--shell-gold);
}

.orasage-app-bottomnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: var(--shell-bg);
  border-top: none;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.orasage-app-bottomnav-inner {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  height: var(--shell-bottom-h);
}

.orasage-app-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: var(--shell-muted);
  font-size: 10px;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  padding: 4px 2px;
}

.orasage-app-nav-item[data-active='true'] {
  color: var(--shell-gold);
  font-weight: 600;
}

.orasage-app-nav-item[data-active='true']::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  border-radius: 1px;
  background: var(--shell-gold);
}

.orasage-app-nav-brand {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.orasage-app-explore-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.45);
}

.orasage-app-explore-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-radius: 16px 16px 0 0;
  background: var(--shell-surface);
  border-top: 1px solid var(--shell-border);
}

.orasage-app-explore-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--shell-gold);
}

.orasage-app-explore-list {
  display: grid;
  gap: 8px;
}

.orasage-app-explore-link {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--shell-border);
  color: var(--shell-text);
  text-decoration: none;
  font-size: 15px;
}

.orasage-app-explore-link:hover {
  border-color: var(--shell-gold);
  color: var(--shell-gold);
}
