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

html, body {
  height: 100%;
  background: #1d1a15;
  overflow: hidden;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  color: #4a3a22;
  user-select: none;
  touch-action: manipulation;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 0%, #2b2519 0%, #14110d 100%);
}

#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 720px;
  height: 1280px;
  flex: none;
  transform-origin: center center;
  border-radius: 28px;
  overflow: hidden;
  background: #f9e6b8;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .08);
}

#scene {
  position: absolute;
  inset: 0;
  width: 720px;
  height: 1280px;
  display: block;
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  padding: 26px 30px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hud-chip {
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: rgba(255, 255, 255, .85);
  border: 3px solid #3d2f1c;
  border-radius: 18px;
  padding: 8px 18px 10px;
  box-shadow: 0 5px 0 rgba(61, 47, 28, .85);
}

.hud-chip.small {
  padding: 6px 14px 8px;
  background: rgba(255, 255, 255, .72);
}

.hud-label {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #8a6a3c;
}

.hud-num {
  font-size: 40px;
  font-weight: 900;
  line-height: 1;
  color: #4a3a22;
  font-variant-numeric: tabular-nums;
}

.hud-num.small { font-size: 28px; }
.hud-num.bump { animation: bump .22s ease-out; }

@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  pointer-events: auto;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 3px solid #3d2f1c;
  background: #fffdf6;
  color: #4a3a22;
  font-size: 28px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(61, 47, 28, .85);
}

.icon-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(61, 47, 28, .85); }
.icon-btn.muted { color: #b9aa8e; }

/* ---------- tip ---------- */
.tip {
  position: absolute;
  left: 50%;
  bottom: 150px;
  transform: translateX(-50%);
  padding: 16px 36px;
  border-radius: 999px;
  background: rgba(255, 253, 246, .95);
  border: 3px solid #3d2f1c;
  box-shadow: 0 6px 0 rgba(61, 47, 28, .85);
  white-space: nowrap;
  font-size: 26px;
  font-weight: 800;
  color: #6f5730;
  letter-spacing: 3px;
  opacity: 0;
  transition: opacity .5s ease;
  pointer-events: none;
}
.tip.show { opacity: .97; }

/* ---------- overlays ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(28, 22, 14, .55);
  backdrop-filter: blur(3px);
  transition: opacity .28s ease, visibility .28s;
  z-index: 20;
}

.overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.panel {
  position: relative;
  width: 566px;
  padding: 44px 40px 38px;
  border-radius: 34px;
  background: linear-gradient(#fffdf7, #fdf1d8);
  border: 4px solid #3d2f1c;
  box-shadow: 0 14px 0 rgba(61, 47, 28, .9), 0 30px 60px rgba(0, 0, 0, .35);
  text-align: center;
}

.start-panel { padding-top: 118px; }

.logo-turtle {
  position: absolute;
  top: -84px;
  left: 50%;
  width: 172px;
  height: 172px;
  margin-left: -86px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><g fill='%233d8b28' stroke='%23333d20' stroke-width='3'><ellipse cx='22' cy='60' rx='10' ry='6' transform='rotate(-28 22 60)'/><ellipse cx='78' cy='60' rx='10' ry='6' transform='rotate(28 78 60)'/><ellipse cx='26' cy='40' rx='8' ry='5' transform='rotate(20 26 40)'/><ellipse cx='74' cy='40' rx='8' ry='5' transform='rotate(-20 74 40)'/></g><circle cx='50' cy='47' r='30' fill='%235fbf3f' stroke='%23333d20' stroke-width='4'/><circle cx='50' cy='47' r='24' fill='%237ad14f' opacity='.5'/><g fill='none' stroke='%232f7a1c' stroke-width='2.6' opacity='.75'><path d='M50 22 61 28.5v13L50 48 39 41.5v-13z'/><path d='M33 35 22 41.5v13L33 61l8-6.5v-13z'/><path d='M67 35 78 41.5v13L67 61l-8-6.5v-13z'/><path d='M50 50 61 56.5v11L50 74 39 67.5v-11z'/></g><ellipse cx='50' cy='84' rx='16' ry='12.5' fill='%23a8e07a' stroke='%23333d20' stroke-width='4'/><circle cx='44' cy='83' r='2.9' fill='%2326251a'/><circle cx='56' cy='83' r='2.9' fill='%2326251a'/><circle cx='43.2' cy='82' r='1' fill='%23fff'/><circle cx='55.2' cy='82' r='1' fill='%23fff'/><path d='M46 88.5q4 3 8 0' fill='none' stroke='%23333d20' stroke-width='2' stroke-linecap='round'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  filter: drop-shadow(0 10px 0 rgba(61, 47, 28, .22));
  animation: bob 2.8s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-10px) rotate(2deg); }
}

.title {
  font-size: 66px;
  letter-spacing: 8px;
  font-weight: 900;
  color: #3d2f1c;
  text-shadow: 0 5px 0 #f2c96b;
}

.subtitle {
  margin-top: 6px;
  font-size: 20px;
  letter-spacing: 6px;
  font-weight: 800;
  color: #a08350;
}

.rules {
  margin: 26px auto 30px;
  list-style: none;
  text-align: left;
  width: 420px;
}

.rules li {
  position: relative;
  padding: 7px 0 7px 34px;
  font-size: 23px;
  font-weight: 700;
  color: #6a5433;
  line-height: 1.35;
}

.rules li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 17px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #5fbf3f;
  border: 3px solid #343d20;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 260px;
  height: 88px;
  padding: 0 34px;
  border-radius: 22px;
  border: 4px solid #3d2f1c;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 2px;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: transform .08s ease, box-shadow .08s ease;
}

.btn.primary {
  background: linear-gradient(#8bd94f, #5fbf3f);
  color: #23300f;
  box-shadow: 0 8px 0 #3e7d24, 0 14px 24px rgba(0, 0, 0, .2);
}

.btn.ghost {
  background: #fffdf7;
  color: #6a5433;
  box-shadow: 0 8px 0 rgba(61, 47, 28, .35);
  min-width: 200px;
  font-size: 26px;
}

.btn:active { transform: translateY(5px); box-shadow: 0 2px 0 rgba(61, 47, 28, .7); }

.btns .btn { min-width: 0; flex: 0 0 auto; padding: 0 30px; }
.btns .btn.primary { padding: 0 34px; }

.credit {
  margin-top: 22px;
  font-size: 17px;
  color: #a89772;
  letter-spacing: 1px;
}

/* ---------- game over ---------- */
.ribbon {
  display: inline-block;
  margin: -78px auto 18px;
  padding: 14px 44px;
  border-radius: 18px;
  background: linear-gradient(#ffb15c, #f2705a);
  border: 4px solid #3d2f1c;
  color: #fff;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 6px;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .25);
  box-shadow: 0 7px 0 rgba(61, 47, 28, .85);
}

.score-row {
  display: flex;
  gap: 18px;
  justify-content: center;
  margin: 6px 0 16px;
}

.score-box {
  flex: 1 1 0;
  min-width: 0;
  padding: 16px 8px 14px;
  border-radius: 20px;
  background: #fffdf7;
  border: 3px solid #d9c49a;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.score-box .cap { font-size: 20px; font-weight: 800; color: #a08350; letter-spacing: 2px; }
.score-box .big { font-size: 56px; font-weight: 900; line-height: 1.05; color: #3d2f1c; font-variant-numeric: tabular-nums; }
.score-box .big.best { color: #e8892b; }

.beat {
  margin: 4px 0 26px;
  font-size: 24px;
  font-weight: 800;
  color: #6a5433;
  letter-spacing: 1px;
}

.btns { display: flex; gap: 16px; justify-content: center; }
.btns .btn { min-width: 0; }
.btn.wide { min-width: 360px; }

/* ---------- links / changelog ---------- */
.links {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 20px;
  color: #a89772;
}

.link-btn {
  border: 0;
  background: none;
  font: inherit;
  font-weight: 800;
  color: #8a6a3c;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  padding: 4px 2px;
}

.link-btn:hover { color: #5fbf3f; }
.links .dot { opacity: .6; }
.links .ver { font-weight: 800; letter-spacing: 1px; }

.log-panel { padding-top: 34px; }

.ribbon.small {
  margin: -72px auto 16px;
  padding: 10px 30px;
  font-size: 28px;
  letter-spacing: 4px;
}

.log-list {
  list-style: none;
  text-align: left;
  max-height: 620px;
  overflow-y: auto;
  margin: 6px 0 24px;
  padding-right: 6px;
}

.log-list li {
  position: relative;
  padding: 12px 0 14px 22px;
  border-left: 4px solid #e2c98f;
  margin-left: 6px;
}

.log-list b {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 12px;
  border-radius: 999px;
  background: #f2c96b;
  color: #4a3a22;
  font-size: 20px;
  letter-spacing: 1px;
}

.log-list em {
  display: block;
  font-style: normal;
  font-size: 21px;
  line-height: 1.55;
  color: #6a5433;
  margin-bottom: 4px;
}
