/* ============================================================
   App 外壳：把页面收成一列应用，而不是一张官网
   ============================================================ */

html {
  background: #030b12;
}

body {
  min-height: 100dvh;
  background: #030b12;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

.site {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% -12%, rgba(64, 156, 196, 0.2), transparent 38rem),
    linear-gradient(180deg, #061824 0%, #04121e 100%);
}

.transmission {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: 0 0 calc(86px + env(safe-area-inset-bottom));
  background: transparent;
}

.transmission::after {
  display: none;
}

.transmission-wrap {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 18px 0;
  text-align: left;
}

/* ---------- 顶部栏 ---------- */

.app-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 16px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-mark {
  display: block;
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

.app-brand b {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.16em;
  line-height: 1.2;
}

.app-brand span {
  display: block;
  margin-top: 2px;
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--faint);
}

.app-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.app-status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7fd8f2;
  box-shadow: 0 0 10px rgba(127, 216, 242, 0.9);
}

/* ---------- 问候 ---------- */

.app-hero {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 2px 2px 20px;
}

.app-avatar {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  overflow: hidden;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #a8e8f9, #2a7fa3 72%);
  box-shadow:
    0 0 0 1px rgba(160, 225, 255, 0.28),
    0 8px 24px rgba(0, 20, 32, 0.5);
}

.app-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-greet {
  flex: 1;
  min-width: 0;
}

.app-greet span {
  display: block;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.app-greet strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: 0.05em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.app-edit {
  border: 1px solid rgba(150, 215, 240, 0.24);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--violet);
  background: rgba(9, 31, 47, 0.5);
}

/* ---------- 功能宫格 ---------- */

.x-link-home {
  margin-top: 0;
}

.x-edit-name {
  display: none;
}

.x-entry-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 0;
}

.x-entry-grid .message-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  padding: 16px 16px 14px;
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(28, 76, 102, 0.6), rgba(8, 28, 42, 0.7));
  box-shadow: none;
}

.x-entry-grid .message-card .x-card-mark {
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--faint);
}

.x-entry-grid .message-card h3 {
  margin: 0;
  font-size: 19px;
  letter-spacing: 0.08em;
}

.x-entry-grid .message-card .latin,
.x-entry-grid .message-card p {
  display: none;
}

.x-entry-grid .message-card .message-primary {
  width: 100%;
  margin-top: 12px;
  padding: 9px 10px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: #062634;
  border-color: transparent;
  background: linear-gradient(135deg, #a3e7f8, #5cc0e2);
  box-shadow: 0 10px 24px rgba(0, 18, 30, 0.35);
}

/* ---------- 底部导航 ---------- */

.app-tabs {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(560px, 100%);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-top: 1px solid rgba(120, 200, 235, 0.12);
  background: rgba(5, 18, 28, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* 面板内也常驻导航（层级要高于固定在 9995 的面板） */
body.x-clean-page .app-tabs {
  display: grid;
  z-index: 10000;
}

.app-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  border: 0;
  color: rgba(170, 210, 230, 0.55);
  background: none;
  font-size: 10px;
  letter-spacing: 0.1em;
  transition: color 0.25s ease;
}

.app-tab svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-tab.active,
.app-tab:active {
  color: #7fd8f2;
}

/* ---------- 面板 ---------- */

.x-panel {
  margin-top: 0;
}

.x-identity {
  margin-top: 6px;
}

/* 桌面端：整列像一块竖屏应用 */
@media (min-width: 620px) {
  .transmission-wrap {
    padding-top: 26px;
  }

  .app-tabs {
    border-right: 1px solid rgba(120, 200, 235, 0.12);
    border-left: 1px solid rgba(120, 200, 235, 0.12);
  }
}

/* ---------- 启动页 ---------- */

html.splash-lock,
html.splash-lock body {
  overflow: hidden;
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 42%, #0a2a3d, #04121e 72%);
  transition:
    opacity 0.6s ease,
    visibility 0.6s ease;
}

.splash-sea {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0.92;
  pointer-events: none;
}

.splash::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 46%, transparent 34%, rgba(2, 8, 14, 0.62) 100%);
}

.splash-inner {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  animation: splash-in 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.splash-mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  box-shadow: 0 22px 56px rgba(0, 10, 22, 0.6);
}

.splash-title {
  padding-left: 0.42em;
  font-family: var(--serif);
  font-size: clamp(30px, 8vw, 42px);
  font-weight: 300;
  letter-spacing: 0.42em;
  color: #eaf7ff;
  text-shadow: 0 0 40px rgba(120, 215, 255, 0.3);
}

.splash-sub {
  padding-left: 0.5em;
  font-size: 10px;
  letter-spacing: 0.5em;
  color: rgba(170, 214, 236, 0.55);
}

.splash-bar {
  position: relative;
  width: 116px;
  height: 2px;
  margin-top: 20px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(150, 215, 240, 0.14);
  transition: opacity 0.45s ease;
}

.splash-bar i {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, #7fd8f2, transparent);
  animation: splash-bar 1.25s ease-in-out infinite;
}

.splash-enter {
  margin-top: 26px;
  padding: 12px 44px;
  border: 1px solid rgba(160, 225, 255, 0.42);
  border-radius: 999px;
  color: #eaf7ff;
  background: rgba(10, 40, 58, 0.45);
  font-size: 12px;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition:
    opacity 0.55s ease,
    transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1),
    border-color 0.3s ease,
    background 0.3s ease;
}

.splash.is-ready .splash-enter {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.splash.is-ready .splash-bar {
  opacity: 0.2;
}

.splash-enter:hover {
  border-color: rgba(160, 225, 255, 0.8);
  background: rgba(20, 70, 100, 0.62);
}

.splash-enter:active {
  transform: scale(0.98);
}

.splash-enter:focus-visible {
  outline: 1px solid #7fd8f2;
  outline-offset: 4px;
}

.splash.is-done {
  opacity: 0;
  visibility: hidden;
}

@keyframes splash-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes splash-bar {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .splash-inner {
    animation: none;
  }

  .splash-bar i {
    animation: none;
    background: #7fd8f2;
    opacity: 0.55;
  }
}

/* ---------- 面板内常驻导航的布局补偿 ---------- */

body.x-clean-page .x-panel.x-clean-active {
  box-sizing: border-box;
  padding-bottom: calc(56px + env(safe-area-inset-bottom)) !important;
}

body.ix-chat-page #ixChat {
  height: 100% !important;
}

body.x-clean-page .x-companion-stage:not(#xCompanionStage) {
  min-height: calc(100svh - 56px) !important;
}

body.x-clean-page .app-tab {
  color: rgba(170, 210, 230, 0.62);
}

body.x-clean-page .app-tab.active {
  color: #7fd8f2;
}

/* ---------- 设置面板 ---------- */

.app-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-gear {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(150, 215, 240, 0.18);
  border-radius: 50%;
  background: rgba(9, 31, 47, 0.5);
  color: #7fd8f2;
}

.app-gear svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.sheet-open {
  overflow: hidden;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet[hidden] {
  display: none;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 14, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.sheet-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: 84vh;
  border: 1px solid rgba(120, 200, 235, 0.16);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, #0b2334, #061824);
  box-shadow: 0 -24px 60px rgba(0, 8, 16, 0.6);
  animation: sheet-up 0.28s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes sheet-up {
  from {
    opacity: 0.6;
    transform: translateY(26px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 8px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.sheet-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(9, 31, 47, 0.6);
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.sheet-body {
  overflow-y: auto;
  padding: 4px 20px calc(26px + env(safe-area-inset-bottom));
}

.sheet-block {
  padding: 16px 0;
  border-top: 1px solid rgba(120, 200, 235, 0.1);
}

.sheet-block:first-child {
  border-top: 0;
}

.sheet-block h3 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: #7fd8f2;
}

.sheet-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.8;
  color: rgba(214, 236, 248, 0.7);
}

.sheet-hint {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.75;
  color: rgba(170, 214, 236, 0.45);
}

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

.btn-line {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(150, 215, 240, 0.24);
  border-radius: 12px;
  background: rgba(9, 31, 47, 0.55);
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.btn-line:active {
  transform: scale(0.99);
}

.btn-danger {
  border-color: rgba(255, 120, 120, 0.32);
  color: #ff9a9a;
}
