/* ===== 修仙挂机 · 样式 =====
   手机竖屏优先，仙侠水墨风：墨色底、青玉色强调、金色点缀。 */

:root {
  --ink: #0d1117;
  --ink-2: #161d29;
  --jade: #7fd8c4;
  --jade-deep: #2f8f7b;
  --gold: #e8c77a;
  --text: #e9eef2;
  --muted: #8b97a6;
  --danger: #e77a7a;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;                 /* 禁止页面滚动 */
  overscroll-behavior: none;
  background: var(--ink);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* 背景：墨色渐变 + 柔和的青色雾光 */
body {
  background:
    radial-gradient(circle at 50% 28%, rgba(47, 143, 123, 0.28), transparent 55%),
    radial-gradient(circle at 80% 90%, rgba(232, 199, 122, 0.08), transparent 45%),
    linear-gradient(180deg, #0b1220 0%, #0d1117 60%, #09090d 100%);
}

.app {
  position: relative;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}

/* ===== 顶部 ===== */
.top {
  text-align: center;
  padding-top: 14px;
}

.top h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 6px;
  color: var(--gold);
  font-weight: 700;
}

.realm {
  margin: 6px 0 12px;
  font-size: 15px;
  color: var(--jade);
  text-shadow: 0 0 12px rgba(127, 216, 196, 0.4);
}

.stats {
  display: flex;
  justify-content: space-around;
  gap: 10px;
  padding: 10px 6px;
  border-radius: 16px;
  background: rgba(22, 29, 41, 0.7);
  border: 1px solid rgba(127, 216, 196, 0.15);
}

.stats > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.stats strong {
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ===== 修炼区 ===== */
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

/* 灵台：圆形玉珠，呼吸光晕 */
.orb {
  position: relative;
  width: min(62vw, 260px);
  height: min(62vw, 260px);
  max-width: 260px;
  max-height: 260px;
  border: none;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  color: #06241e;
  background: radial-gradient(circle at 35% 30%, #d9fff4, var(--jade) 45%, var(--jade-deep) 100%);
  box-shadow:
    0 0 0 10px rgba(127, 216, 196, 0.08),
    0 0 0 22px rgba(127, 216, 196, 0.04),
    0 0 60px rgba(127, 216, 196, 0.35);
  animation: breathe 3.2s ease-in-out infinite;
  transition: transform 0.08s ease-out;
  touch-action: manipulation;
}

.orb:active {
  transform: scale(0.94);
}

.orb-core {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 8px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}

@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 10px rgba(127, 216, 196, 0.08), 0 0 0 22px rgba(127, 216, 196, 0.04), 0 0 50px rgba(127, 216, 196, 0.3); }
  50% { box-shadow: 0 0 0 14px rgba(127, 216, 196, 0.1), 0 0 0 30px rgba(127, 216, 196, 0.05), 0 0 80px rgba(127, 216, 196, 0.45); }
}

.tip {
  margin: 0;
  max-width: 280px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

/* 点击飘字层 */
.float-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.float-num {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 18px;
  font-weight: 800;
  color: var(--gold);
  text-shadow: 0 0 8px rgba(232, 199, 122, 0.6);
  animation: floatUp 0.9s ease-out forwards;
  white-space: nowrap;
}

@keyframes floatUp {
  from { opacity: 1; margin-top: 0; }
  to { opacity: 0; margin-top: -60px; }
}

/* ===== 操作区 ===== */
.panel {
  padding-bottom: 10px;
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.card-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(127, 216, 196, 0.25);
  border-radius: 14px;
  background: var(--ink-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.card-btn:active:not(:disabled) {
  background: #1e2838;
}

.card-btn:disabled,
.break-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
}

.card-desc,
.card-cost {
  font-size: 12px;
  color: var(--muted);
}

.card-desc b,
.card-cost b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.break-btn {
  width: 100%;
  margin-top: 10px;
  padding: 14px;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 2px;
  cursor: pointer;
  color: #2a1d02;
  background: linear-gradient(180deg, #f5dc98, var(--gold));
  box-shadow: 0 6px 0 #a88a3f, 0 10px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.08s;
}

.break-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #a88a3f, 0 6px 12px rgba(0, 0, 0, 0.35);
}

/* ===== 修炼记录 ===== */
.log-box {
  height: 96px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(22, 29, 41, 0.6);
  border: 1px solid rgba(127, 216, 196, 0.12);
  overflow: hidden;
}

.log-box h2 {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.log-box ul {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  line-height: 1.7;
  color: #b8c3cf;
}

.log-box li.hi {
  color: var(--gold);
}

/* ===== 弹窗（突破、奇遇、离线收益） ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 8, 14, 0.7);
  backdrop-filter: blur(3px);
}

.modal-card {
  width: min(88vw, 320px);
  padding: 22px 20px 18px;
  border-radius: 18px;
  text-align: center;
  background: linear-gradient(180deg, #1c2536, #121826);
  border: 1px solid rgba(232, 199, 122, 0.35);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-card h2 {
  margin: 0 0 10px;
  font-size: 18px;
  color: var(--gold);
}

.modal-card p {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.7;
  color: #d4dce6;
}

.btn {
  padding: 10px 28px;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  color: #06241e;
  background: linear-gradient(180deg, #a7f0df, var(--jade));
}

/* 手机横屏或极矮屏幕：压缩间距，避免挤出屏幕 */
@media (max-height: 640px) {
  .orb {
    width: 180px;
    height: 180px;
  }
  .log-box {
    display: none;
  }
}
