/* ===== 谐音梗 · 看图猜梗 · 卡通游戏风 ===== */
:root {
  --primary: #FF8A3D;
  --primary-dark: #F06A1A;
  --primary-light: #FFE4D0;
  --accent: #FFC93D;
  --bg: #FFF6EE;
  --bg-2: #FFE9D8;
  --card: #FFFFFF;
  --ink: #3A2A1E;
  --ink-2: #8C7A6B;
  --ink-3: #B9A99A;
  --line: #F0E2D4;
  --green: #4CC38A;
  --red: #FF5A5F;
  --shadow: 0 6px 18px rgba(255, 138, 61, .18);
  --shadow-sm: 0 3px 10px rgba(58, 42, 30, .08);
  --radius: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  overflow: hidden;
  user-select: none;
}
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }
.mp-icon { font-size: inherit; }

/* ===== 整体布局：竖屏铺满，从屏幕顶端开始 ===== */
.game {
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 60% at 50% -10%, #FFE0C4 0%, transparent 60%),
    linear-gradient(180deg, #FFF6EE 0%, #FFF1E4 100%);
  position: relative;
  overflow: hidden;
}

/* ===== 顶部状态栏 ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 8px;
}
.top-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.top-pill .mp-icon { font-size: 15px; }
.level-pill .mp-icon { color: var(--primary); }
.coin-pill { color: #B8741A; }
.coin-pill .mp-icon { color: var(--accent); }

/* 进度条 */
.progress-wrap {
  margin: 0 16px 6px;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-2);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  transition: width .4s cubic-bezier(.2,.8,.2,1);
}

/* ===== 主游戏区 ===== */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 6px 16px 8px;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
}

/* 题目插画卡片 */
.puzzle-card {
  background: linear-gradient(160deg, #FFFFFF 0%, #FFF4EA 100%);
  border: 2px solid #FFD9BC;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 16px 14px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.puzzle-card::before {
  content: "";
  position: absolute;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,201,61,.25), transparent 70%);
  top: -40px; right: -30px;
}
.puzzle-card::after {
  content: "";
  position: absolute;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,138,61,.18), transparent 70%);
  bottom: -30px; left: -20px;
}
.puzzle-badge {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 2;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .5px;
  color: #fff;
  background: linear-gradient(180deg, #FFA25E, var(--primary));
  border-radius: 999px;
  padding: 3px 10px;
  box-shadow: 0 2px 6px rgba(255,138,61,.4);
}
.puzzle-emoji {
  font-size: 56px;
  line-height: 1.15;
  letter-spacing: 4px;
  filter: drop-shadow(0 4px 6px rgba(58,42,30,.15));
  position: relative;
  z-index: 1;
  word-break: break-word;
}
.puzzle-hint {
  margin-top: 10px;
  display: inline-block;
  font-size: 13px;
  color: var(--primary-dark);
  background: var(--primary-light);
  border-radius: 999px;
  padding: 5px 14px;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

/* 答案槽 */
.answer-zone {
  display: flex;
  justify-content: center;
}
.answer-slots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  max-width: 100%;
}
.slot {
  flex: 0 0 auto;
  width: 38px;
  height: 44px;
  border-radius: 12px;
  background: var(--card);
  border: 2px dashed #E8C9AC;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  box-shadow: inset 0 2px 4px rgba(58,42,30,.05);
  transition: all .15s;
}
.slot.filled {
  border-style: solid;
  border-color: var(--primary);
  background: linear-gradient(180deg, #FFF3E8, #FFE4D0);
  box-shadow: 0 3px 8px rgba(255,138,61,.25);
  animation: pop .2s ease;
}
.slot.hint-flash {
  border-color: var(--green);
  background: #E3F8EE;
  animation: flash .6s ease;
}
.slot.wrong {
  animation: shake .4s ease;
  border-color: var(--red);
  background: #FFE8E8;
}
@keyframes pop {
  0% { transform: scale(.7); }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
@keyframes flash {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* 备选汉字 */
.options-zone {
  flex: 1;
  display: flex;
  align-items: flex-start;
  overflow-y: auto;
  padding-bottom: 2px;
}
.options-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  width: 100%;
  align-content: start;
}
.opt {
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF1E4 100%);
  border: 2px solid #FFD9BC;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  box-shadow: 0 4px 0 #E8B48A, var(--shadow-sm);
  transition: transform .1s, box-shadow .1s, opacity .2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.opt:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #E8B48A;
}
.opt.used {
  opacity: 0;
  pointer-events: none;
  transform: scale(.5);
}
.opt.eliminated {
  opacity: .25;
  pointer-events: none;
  text-decoration: line-through;
  background: #F2ECE6;
  border-color: var(--line);
  box-shadow: none;
}
.opt.hint-glow {
  border-color: var(--green);
  background: linear-gradient(180deg, #FFFFFF, #E3F8EE);
  box-shadow: 0 4px 0 #2FA871, 0 0 12px rgba(76,195,138,.5);
}

/* ===== 底部道具栏 ===== */
.toolbar {
  display: flex;
  gap: 10px;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(8px);
  border-top: 1.5px solid var(--line);
}
.tool-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px 7px;
  border-radius: 16px;
  background: linear-gradient(180deg, #FFF8F1, #FFE9D6);
  border: 2px solid #FFD2AE;
  box-shadow: 0 3px 0 #E8A874;
  transition: transform .1s, box-shadow .1s;
}
.tool-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #E8A874;
}
.tool-ico {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  box-shadow: 0 2px 6px rgba(255,138,61,.4);
}
.tool-name { font-size: 12px; font-weight: 700; color: var(--ink); }
.tool-cost {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 11px; font-weight: 700; color: #B8741A;
}
.tool-cost .mp-icon { font-size: 12px; color: var(--accent); }

/* ===== 弹层通用 ===== */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(58, 42, 30, .55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
  animation: fadeIn .25s ease;
}
.overlay.show { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.win-card {
  width: 100%;
  max-width: 320px;
  background: var(--card);
  border-radius: 24px;
  padding: 28px 24px 24px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(58,42,30,.3);
  animation: cardIn .35s cubic-bezier(.2,1.2,.3,1);
}
@keyframes cardIn {
  from { transform: scale(.8) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.win-emoji { font-size: 56px; line-height: 1; }
.win-emoji .mp-icon { font-size: 52px; color: var(--primary); line-height: 1; }
.win-emoji i[data-icon="workspace_premium"] { color: var(--accent); }
.win-emoji i[data-icon="savings"] { color: #B8741A; }
.win-title {
  margin: 12px 0 6px;
  font-size: 22px;
  font-weight: 900;
  color: var(--primary-dark);
}
.win-answer {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-2);
  letter-spacing: 2px;
}
.win-reward {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #FFF6E0;
  border: 2px solid var(--accent);
  border-radius: 999px;
  padding: 8px 20px;
  font-size: 18px;
  font-weight: 900;
  color: #B8741A;
  margin-bottom: 20px;
}
.win-reward .mp-icon { color: var(--accent); font-size: 20px; }

.btn-primary {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #FFA25E, var(--primary));
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  box-shadow: 0 5px 0 var(--primary-dark);
  transition: transform .1s, box-shadow .1s;
}
.btn-primary:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--primary-dark);
}
.btn-ghost {
  flex: 1;
  padding: 14px;
  border-radius: 14px;
  background: #F4EDE5;
  color: var(--ink-2);
  font-size: 16px;
  font-weight: 700;
  border: 2px solid var(--line);
}
.row-btns { display: flex; gap: 10px; }
.row-btns .btn-primary { flex: 1.3; }

/* 广告弹层 */
.ad-overlay { background: rgba(20,15,10,.85); }
.ad-card { text-align: center; color: #fff; }
.ad-loading {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 18px;
}
.ad-loading span {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--primary);
  animation: bounce 1s infinite ease-in-out;
}
.ad-loading span:nth-child(2) { animation-delay: .15s; background: var(--accent); }
.ad-loading span:nth-child(3) { animation-delay: .3s; background: var(--green); }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(.6); opacity: .5; }
  40% { transform: scale(1); opacity: 1; }
}
.ad-text { font-size: 18px; font-weight: 800; margin: 0 0 6px; }
.ad-sub { font-size: 13px; color: #D8C8B8; margin: 0; }

/* 长答案（俗语）适配：槽位自动缩小 */
.answer-slots.dense { gap: 4px; }
.answer-slots.dense .slot {
  width: 28px;
  height: 34px;
  font-size: 15px;
  border-radius: 9px;
}

/* 小屏适配 */
@media (max-width: 380px) {
  .slot { width: 32px; height: 38px; font-size: 17px; border-radius: 10px; }
  .answer-slots { gap: 5px; }
  .opt { font-size: 20px; }
}
@media (max-height: 640px) {
  .puzzle-emoji { font-size: 44px; }
  .puzzle-card { padding: 18px 14px 10px; }
  .opt { font-size: 19px; }
  .slot { width: 34px; height: 40px; font-size: 18px; }
  .tool-ico { width: 30px; height: 30px; font-size: 16px; }
}

/* 图标尺寸统一（内置图标默认 24px，按场景缩放） */
.top-pill .mp-icon { width: 15px; height: 15px; }
.tool-cost .mp-icon { width: 12px; height: 12px; }
.win-reward .mp-icon { width: 20px; height: 20px; }
.win-emoji .mp-icon { width: 52px; height: 52px; }
.tool-ico .mp-icon { width: 18px; height: 18px; }
