/* ============================================================
 *  合成大肥鱼 · 样式
 *  配色：鲸鱼蓝 + 米白，圆角、软阴影。
 * ============================================================ */

:root {
  --ink: #16324f;
  --ink-soft: #5b7796;
  --blue: #2b62d9;
  --blue-deep: #1c3f92;
  --cream: #fff8ec;
  --card: #ffffff;
  --line: #dce8f6;
  --danger: #ff5f6d;
  --shadow: 0 18px 40px -18px rgba(22, 50, 79, .35);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(900px 520px at 12% -8%, #ffffff 0%, rgba(255,255,255,0) 60%),
    radial-gradient(760px 520px at 96% 8%, #cfeeff 0%, rgba(207,238,255,0) 62%),
    radial-gradient(900px 640px at 50% 112%, #ffe9c9 0%, rgba(255,233,201,0) 60%),
    linear-gradient(165deg, #eaf6ff 0%, #f3fbff 40%, #fff7ec 100%);
  background-attachment: fixed;
  overflow: hidden;
}

.app {
  height: 100dvh;
  max-height: 1080px;
  margin: 0 auto;
  padding: 14px;
  display: flex;
  gap: 16px;
  align-items: stretch;
  justify-content: center;
}

/* ---------------- 游戏区 ---------------- */

.stage {
  position: relative;
  height: 100%;
  aspect-ratio: 420 / 700;
  max-width: calc(100vw - 28px);
  border-radius: 26px;
  border: 3px solid rgba(255, 255, 255, .9);
  background: #eaf7ff;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(21, 71, 130, .10);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#game { display: block; width: 100%; height: 100%; cursor: crosshair; }

.revive-chip {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  border: 1.5px solid #ffd88a;
  box-shadow: 0 6px 16px -8px rgba(122, 84, 0, .55);
  font-size: 13px;
  font-weight: 700;
  color: #8a5a00;
  pointer-events: none;
  backdrop-filter: blur(4px);
}
.revive-chip-ico { margin-right: 2px; }

/* ---------------- 弹窗 ---------------- */

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 39, 66, .28);
  backdrop-filter: blur(3px);
  animation: overlay-in .22s ease-out;
  z-index: 5;
}
.overlay[hidden] { display: none; }

@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

.dialog {
  width: min(330px, 100%);
  padding: 22px 20px 18px;
  border-radius: 24px;
  background: var(--card);
  border: 3px solid #ffffff;
  box-shadow: 0 24px 60px -22px rgba(10, 34, 66, .6);
  text-align: center;
  animation: dialog-in .26s cubic-bezier(.2, 1.4, .5, 1);
}

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

.dialog[hidden], #revivePrompt[hidden], #overPanel[hidden] { display: none; }

.dialog-emoji { font-size: 40px; line-height: 1; margin-bottom: 6px; }

.dialog h2 {
  margin: 4px 0 10px;
  font-size: 22px;
  letter-spacing: .04em;
}

.dialog-score { margin: 4px 0; color: var(--ink-soft); font-size: 14px; }
.dialog-score strong { font-size: 26px; color: var(--blue); margin-left: 4px; }
.dialog-best { margin: 2px 0 12px; color: var(--ink-soft); font-size: 13px; }
.dialog-best span { font-weight: 700; color: var(--ink); }

.dialog-rec {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: #e08a00;
  animation: pop .5s ease;
}

@keyframes pop {
  0% { transform: scale(.7); opacity: 0; }
  60% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}

.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 6px;
}

.dialog-hint { margin: 12px 0 0; font-size: 12px; color: var(--ink-soft); }

.revive-hint { margin: 6px 0 14px; font-size: 13px; color: var(--ink-soft); }

/* ---------------- 按钮 ---------------- */

.btn {
  appearance: none;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 14px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s;
  box-shadow: 0 3px 0 rgba(21, 71, 130, .10);
}
.btn:hover { transform: translateY(-1px); border-color: #c4daf3; }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:focus-visible { outline: 3px solid rgba(43, 98, 217, .35); outline-offset: 2px; }

.btn-primary {
  background: linear-gradient(180deg, #3d7bf0, #2b62d9);
  border-color: #2b62d9;
  color: #fff;
  box-shadow: 0 4px 0 #1c47a8, 0 12px 24px -14px rgba(28, 71, 168, .9);
}
.btn-primary:hover { border-color: #2b62d9; }
.btn-primary:active { box-shadow: 0 2px 0 #1c47a8; }

.btn-revive {
  background: linear-gradient(180deg, #ffd982, #f5b93c);
  border-color: #e2a323;
  color: #583a00;
  box-shadow: 0 4px 0 #c58c17;
}
.btn-revive:active { box-shadow: 0 2px 0 #c58c17; }

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

.panel {
  width: 350px;
  flex: 0 0 auto;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px;
  border-radius: 26px;
  background: rgba(255, 255, 255, .82);
  border: 3px solid #fff;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  scrollbar-width: thin;
  scrollbar-color: #c7dcf3 transparent;
}

.panel-head { text-align: center; margin-bottom: 14px; }

.panel-head h1 {
  margin: 0;
  font-size: 25px;
  letter-spacing: .06em;
  background: linear-gradient(180deg, #2f6fe0, #17418f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-soft); letter-spacing: .04em; }

.stats { display: flex; gap: 10px; margin-bottom: 12px; }

.stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 6px 8px;
  border-radius: 16px;
  background: linear-gradient(180deg, #f4f9ff, #eaf3ff);
  border: 1.5px solid #e0ecfa;
}
.stat-label { font-size: 11.5px; color: var(--ink-soft); letter-spacing: .08em; }
.stat-value { font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-best { color: #d98b00; }
.stat-value.bump { animation: bump .28s ease; }
@keyframes bump {
  0% { transform: scale(1); }
  45% { transform: scale(1.24); }
  100% { transform: scale(1); }
}

.next-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f4f9ff, #eaf3ff);
  border: 1.5px solid #e0ecfa;
}
.box-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--ink-soft);
  writing-mode: horizontal-tb;
}
.next-preview {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
#next { width: 78px; height: 78px; }
.next-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}

.chain-box {
  padding: 10px 12px 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f4f9ff, #eaf3ff);
  border: 1.5px solid #e0ecfa;
  margin-bottom: 12px;
}

.chain {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  margin: 8px 0 6px;
  flex-wrap: nowrap;
}
.chain img {
  display: block;
  filter: drop-shadow(0 2px 2px rgba(20, 50, 90, .16));
  transition: transform .15s ease;
}
.chain img:hover { transform: translateY(-3px) scale(1.08); }

.chain-note {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  text-align: center;
}
.chain-note strong { color: #b97800; }

.actions { display: flex; gap: 10px; margin-bottom: 12px; }
.actions .btn { flex: 1; justify-content: center; }

.tips {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--ink-soft);
  text-align: center;
}
.tips strong { color: var(--ink); }

.credit {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px dashed #d9e6f5;
  font-size: 10.5px;
  line-height: 1.6;
  color: #8ba4bd;
  text-align: center;
}
.credit a { color: #5f86b3; text-decoration: none; border-bottom: 1px dotted #a9c3de; }
.credit a:hover { color: var(--blue); }

/* ---------------- 窄屏 ---------------- */

@media (max-width: 860px) {
  body { overflow: auto; }
  .app {
    height: auto;
    min-height: 100dvh;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 10px;
    gap: 12px;
  }
  .stage {
    height: auto;
    width: min(100%, 420px);
    max-width: 100%;
    flex: 0 0 auto;
  }
  .panel {
    width: min(100%, 460px);
    height: auto;
    overflow: visible;
  }
}

@media (max-width: 400px) {
  .panel { padding: 14px; }
  .panel-head h1 { font-size: 22px; }
  .stat-value { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
