/* ============================================
   止戈垣 - 全站公共样式
   所有页面共享的基础样式、变量、背景动画
   ============================================ */

/* ---------- 设计变量（亮色） ---------- */
:root {
  color-scheme: light dark;
  --bg: #f3f7ff;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-2: rgba(248, 251, 255, 0.9);
  --text: #14213d;
  --muted: #5d6b86;
  --accent: #2563eb;
  --accent-2: #0f766e;
  --highlight: #f59e0b;
  --border: rgba(20, 33, 61, 0.1);
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.12);
  --soft: rgba(37, 99, 235, 0.1);
  --spot-a: rgba(96, 165, 250, 0.2);
  --spot-b: rgba(45, 212, 191, 0.16);
  --spot-c: rgba(251, 191, 36, 0.14);
  --spot-d: rgba(244, 114, 182, 0.12);
  --outer-card-radius: 44px;
  --panel-padding: clamp(20px, 2.6vw, 28px);
  --inner-card-radius: calc(var(--outer-card-radius) - var(--panel-padding) + 2px);
}

/* ---------- 设计变量（暗色） ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1628;
    --panel: rgba(13, 24, 42, 0.94);
    --panel-2: rgba(22, 36, 58, 0.92);
    --text: #f1f5f9;
    --muted: #94a3b8;
    --accent: #60a5fa;
    --accent-2: #34d399;
    --highlight: #fbbf24;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    --soft: rgba(96, 165, 250, 0.12);
    --spot-a: rgba(37, 99, 235, 0.25);
    --spot-b: rgba(16, 185, 129, 0.18);
    --spot-c: rgba(245, 158, 11, 0.15);
    --spot-d: rgba(236, 72, 153, 0.12);
  }
}

/* ---------- 基础重置 ---------- */
* { box-sizing: border-box; }
html { isolation: isolate; min-height: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  color: var(--text);
  min-height: 100vh;
  isolation: isolate;
  padding-top: env(safe-area-inset-top, 0);
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ---------- 动态背景 ---------- */
html::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 12% 18%, var(--spot-a), transparent 24%),
    radial-gradient(circle at 86% 22%, var(--spot-b), transparent 23%),
    radial-gradient(circle at 78% 84%, var(--spot-c), transparent 20%),
    radial-gradient(circle at 24% 78%, var(--spot-d), transparent 22%),
    linear-gradient(135deg, var(--bg), color-mix(in srgb, var(--bg) 72%, white 28%));
  background-size: 180% 180%;
  animation: bgFloat 12s ease-in-out infinite;
  animation-delay: var(--float-delay, 0s);
}

@keyframes bgFloat {
  0%   { background-position: 0% 0%; }
  25%  { background-position: 100% 0%; }
  50%  { background-position: 100% 100%; }
  75%  { background-position: 0% 100%; }
  100% { background-position: 0% 0%; }
}

/* ---------- 背景光晕层 ---------- */
html::after {
  content: "";
  position: fixed;
  inset: -18%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.72;
  filter: blur(42px) saturate(115%);
  background:
    radial-gradient(circle at 18% 24%, var(--spot-c), transparent 16%),
    radial-gradient(circle at 78% 68%, var(--spot-a), transparent 18%),
    radial-gradient(circle at 48% 92%, var(--spot-b), transparent 20%);
  transform: translate3d(0, 0, 0) scale(1);
  animation: bgGlow 28s ease-in-out infinite alternate;
  animation-delay: var(--glow-delay, 0s);
}

@keyframes bgGlow {
  0%   { transform: translate3d(-3%, -2%, 0) scale(1); }
  50%  { transform: translate3d(4%, 3%, 0) scale(1.08); }
  100% { transform: translate3d(-1%, 5%, 0) scale(1.02); }
}

@media (prefers-reduced-motion: reduce) {
  html::before, html::after { animation: none; }
}

/* ---------- 通用标题 ---------- */
h1 {
  margin: 0 0 12px;
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  font-weight: 800;
  line-height: 1.2;
}

.subtitle {
  margin: 0 auto 28px;
  max-width: 520px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
  font-weight: 600;
}

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
  min-height: 44px;
  min-width: 122px;
  appearance: none;
  color: var(--text);
  background: var(--panel);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

.btn:active {
  transform: none;
  box-shadow: none;
}

.btn-accent {
  background: linear-gradient(90deg, var(--accent), var(--highlight));
  color: white;
  border-color: transparent;
}

.btn-action {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ---------- 通用复制提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(18px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.2);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 999;
}

.toast.show {
  opacity: 1 !important;
  transform: translateX(-50%) translateY(0) !important;
}

/* ---------- 通用卡片 ---------- */
.section,
.panel {
  width: 100%;
  padding: var(--panel-padding);
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--outer-card-radius);
  box-shadow: var(--shadow);
}

.info-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--inner-card-radius);
  background: var(--panel-2);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.info-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
  border-color: rgba(37, 99, 235, 0.24);
}

/* ---------- 通用区块标题 ---------- */
.section-heading { margin-bottom: 20px; }

.section-kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-heading h2 {
  margin: 0 0 8px;
  font-size: clamp(1.3rem, 2.2vw, 1.8rem);
  font-weight: 800;
}

.section-heading p,
.info-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.text-link {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
}

/* ---------- 响应式圆角 ---------- */
@media (min-width: 641px) and (max-width: 1023px) {
  :root { --outer-card-radius: 36px; }
}

@media (max-width: 640px) {
  :root { --outer-card-radius: 32px; }
}

/* ============================================
   跨页面共用组件（java / bedrock / index / 404 / 50x / gay / rick）
   ============================================ */

/* ---------- 下载页共用（java / bedrock / index） ---------- */
.download-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.download-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: var(--inner-card-radius);
}
.platform-name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
}
.platform-desc {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.6;
  font-weight: 600;
  flex: 1;
}
.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  background: var(--accent);
  border-radius: 999px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-top: auto;
}
.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.28);
}
@media (max-width: 720px) {
  .download-grid { grid-template-columns: 1fr; }
}

/* ---------- 整页居中（错误页 / 单图页） ---------- */
.center-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4vw, 48px);
}

/* ---------- 错误页（404 / 50x） ---------- */
.error-card {
  width: min(520px, 100%);
  text-align: center;
  padding: clamp(32px, 5vw, 48px) clamp(24px, 4vw, 40px);
}
.status-code {
  margin: 0 0 12px;
  color: transparent;
  background: linear-gradient(135deg, var(--highlight), var(--accent));
  background-clip: text;
  -webkit-background-clip: text;
  font-size: clamp(4rem, 14vw, 6rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
}
.error-title {
  margin: 0 0 10px;
  font-size: clamp(1.3rem, 3vw, 1.6rem);
  font-weight: 800;
  color: var(--text);
}
.error-desc {
  margin: 0 auto;
  max-width: 360px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ---------- 媒体卡片（gay / rick） ---------- */
.media-wrap {
  margin: 8px auto 0;
  overflow: hidden;
  width: fit-content;
  max-width: min(100%, 480px);
  border: 1px solid var(--border);
  border-radius: var(--inner-card-radius);
  background: var(--panel-2);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.media-wrap:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
}
.media-wrap img,
.media-wrap video {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- 通用悬停卡片（统一 hover 动效） ---------- */
.card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
  border-color: rgba(37, 99, 235, 0.24);
}

/* ---------- 共用响应式微调 ---------- */
@media (max-width: 640px) {
  .media-wrap { max-width: 100%; }
}
@media (max-width: 360px) {
  .error-card { padding: 24px 18px; }
  .status-code { font-size: 3.5rem; }
  .error-title { font-size: 1.15rem; }
  .error-desc { font-size: 0.88rem; }
}
