/* style.css —— 页面和弹窗的样式。游戏画面本身在 canvas 里画，不受这里影响。
   像素风：不用圆角和柔和的阴影，边框和阴影都是硬边的方块。 */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  touch-action: none;            /* 手机上拖动不会滚动页面或缩放 */
  -webkit-user-select: none;     /* 长按不会选中文字 */
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  background: #16201e;
  color: #f2efe2;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

canvas { display: block; touch-action: none; }

/* 触屏 / 电脑各显示自己的操作说明 */
body.touch .desktop-only { display: none; }
body:not(.touch) .touch-only { display: none; }

/* 弹窗：铺满整个窗口，半透明黑底，内容居中 */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 18, 17, 0.55);
  padding: 16px;
}
.screen.hidden { display: none; }

.panel {
  width: min(420px, 100%);
  max-height: 100%;
  overflow-y: auto;              /* 手机竖屏放不下三张卡时可以上下滑 */
  touch-action: pan-y;
  padding: 28px 28px 24px;
  background: #1c2623;
  border: 4px solid #8a6f3a;
  text-align: center;
  box-shadow: 0 0 0 4px #16201e, 8px 8px 0 4px rgba(0, 0, 0, 0.45);
}
.panel.wide { width: min(760px, 100%); }

h1 { margin: 0 0 12px; font-size: 0; color: #f2c14e; }
h1 canvas { width: 100%; max-width: 248px; height: auto; margin: 0 auto; image-rendering: pixelated; }
h2 { margin: 0 0 16px; font-size: 24px; }
p { margin: 8px 0; line-height: 1.6; }
.keys { font-size: 14px; color: #c9cdbf; }
.muted { color: #9aa394; font-size: 14px; }

/* 按钮：实心方块，底下一条深色厚边像是"立"起来的，按下去往下沉 */
button {
  margin-top: 16px;
  padding: 11px 20px;
  min-height: 46px;               /* 手机上手指好点 */
  border: 2px solid #b8862b;
  background: #f2c14e;
  color: #2b1b2a;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 #6e521c;
  transition: transform 0.06s, box-shadow 0.06s, background 0.1s;
}
button:hover { background: #ffd778; }
button:active { transform: translateY(3px); box-shadow: 0 1px 0 #6e521c; }

/* 升级卡片：三张并排，窄屏时自动换行 */
.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  flex: 1 1 200px;
  max-width: 230px;
  margin: 0;
  padding: 18px 16px;
  border: 4px solid #46574f;
  background: #26332f;
  box-shadow: none;
  color: #f2efe2;
  text-align: left;
  font-weight: 400;
}
.card:hover { border-color: #f2c14e; background: #2f3f39; }
.card .key { position: absolute; top: 8px; right: 8px; padding: 2px 8px; background: #46574f; font-size: 13px; }
.card .icon { flex: none; width: 52px; height: 52px; image-rendering: pixelated; background: #1b2522; }
.card .name { display: block; font-size: 18px; font-weight: 700; color: #ffd166; margin-bottom: 6px; }
.card .desc { display: block; font-size: 14px; color: #cdd2c4; line-height: 1.5; }

.stats { display: grid; grid-template-columns: auto auto; gap: 6px 18px; justify-content: center; font-size: 16px; }
.stats .label { color: #9aa394; text-align: right; }
.stats .value { text-align: left; font-weight: 700; }
.new-best { margin-top: 12px; color: #ffd166; font-weight: 700; }

/* 每日挑战页：今天的角色头像和名字，下面是今天的成绩 */
.daily-hero { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 4px 0 12px; }
.daily-hero canvas { width: 72px; height: auto; image-rendering: pixelated; }
.daily-hero .name { font-size: 18px; font-weight: 700; color: #f2c14e; }
.daily-best { margin: 12px 0 4px; color: #ffd166; font-weight: 700; }

/* 暂停页选过的卡、音量滑块 */
.pause-cards { margin: 12px 0 4px; font-size: 14px; color: #cdd2c4; }
.volume { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; font-size: 14px; color: #c9cdbf; }
.volume input { width: 170px; accent-color: #f2c14e; touch-action: none; }

/* 右下角的声音开关 */
.sound-btn {
  position: fixed;
  right: 14px;
  bottom: 14px;
  margin: 0;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  min-height: 0;
  background: rgba(28, 38, 35, 0.85);
  color: #cdd2c4;
  border: 1px solid #46574f;
  box-shadow: none;
  z-index: 10;
}
.sound-btn:hover { background: #2f3f39; color: #fff; }

/* 进化卡：金色边框 + 微光，一眼能看出来 */
.card.evolve { border-color: #ffd166; background: #3a3424; box-shadow: 0 0 0 4px rgba(255, 209, 102, 0.3); }
.card.weapon { border-color: #5ad1ff; }

/* 事件卡：好处是绿字，代价是红字；限时挑战是金色边框 */
.card.challenge { border-color: #f2c14e; }
.card .gain { display: block; font-size: 14px; line-height: 1.5; color: #9dffb0; }
.card .cost { display: block; font-size: 14px; line-height: 1.5; color: #ff9a8a; }
.card.challenge .gain { color: #f2efe2; }
.card.challenge .cost { color: #ffd166; }

/* 触屏设备的暂停按钮 */
.pause-btn {
  position: fixed;
  top: 44px;
  right: 14px;
  margin: 0;
  padding: 8px 16px;
  font-size: 15px;
  min-height: 0;
  background: rgba(28, 38, 35, 0.85);
  color: #f2efe2;
  border: 1px solid #46574f;
  box-shadow: none;
  z-index: 10;
}
.pause-btn.hidden { display: none; }

/* 很窄的屏幕：卡片和文字缩小一点 */
@media (max-width: 480px) {
  .panel { padding: 20px 16px 18px; }
  h1 { font-size: 32px; }
  .card { flex-direction: row; align-items: center; flex-basis: 100%; max-width: none; padding: 12px 40px 12px 14px; }
  #over-stats { grid-template-columns: repeat(4, auto); gap: 4px 10px; font-size: 14px; } /* 结算页内容多，手机上数据排成两列 */
}

/* 标题页：更新提示和版本号 */
.update-note { margin: 0 0 12px; padding: 10px 14px; border: 4px solid #8a6f3a; background: #26332f; text-align: left; font-size: 14px; }
.update-note.hidden { display: none; }
.update-note h3 { margin: 0 0 6px; font-size: 15px; color: #ffd166; }
.update-note ul { margin: 0; padding-left: 18px; line-height: 1.6; color: #cdd2c4; }
.update-note button { display: block; min-height: 0; margin: 8px 0 0 auto; padding: 4px 12px; font-size: 13px; font-weight: 600; box-shadow: 0 2px 0 #0c1311; }
.version-link { display: block; min-height: 0; margin: 12px auto 0; padding: 4px 8px; border: none; background: none; box-shadow: none; color: #9aa394; font-size: 12px; font-weight: 400; }
.version-link:active { transform: none; box-shadow: none; }
.version-link:hover { background: none; color: #f2efe2; }

/* 两个按钮并排（窄屏自动换行） */
.button-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }
.button-row button { margin-top: 0; }
button.secondary { background: #26332f; color: #f2efe2; border-color: #5c6f65; box-shadow: 0 4px 0 #0c1311; }
button.secondary:hover { background: #2f3f39; border-color: #8a9a90; }
button.secondary:active { box-shadow: 0 1px 0 #0c1311; }
.button-row button:disabled { opacity: 0.45; cursor: default; transform: none; box-shadow: none; }
.button-row button:disabled:hover { background: #26332f; border-color: #5c6f65; }
/* 标题页和结算页：整齐的两列，最重要的按钮占满一行 */
.button-row.menu { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; width: min(340px, 100%); margin-left: auto; margin-right: auto; }
.button-row.menu > .wide { grid-column: 1 / -1; }
.button-row.menu button { padding-left: 8px; padding-right: 8px; }
button.secondary.accent { border-color: #c9a24a; color: #ffd166; }
.coins { color: #ffd166; }
.coins-earned { margin-top: 12px; color: #ffd166; font-weight: 700; }
.coin-parts { font-size: 13px; color: #9aa394; }

/* 结算页的伤害来源：名字、长条、百分比 */
.damage-list { margin-top: 14px; text-align: left; }
.damage-list h3 { margin: 0 0 6px; font-size: 14px; font-weight: 700; color: #9aa394; }
.damage-row { display: grid; grid-template-columns: 96px 1fr 40px; align-items: center; gap: 8px; font-size: 13px; line-height: 1.7; }
.damage-row .bar { height: 10px; background: #26332f; }
.damage-row .bar i { display: block; height: 100%; background: #f2c14e; }
.damage-row .percent { text-align: right; font-weight: 700; }

/* 强化商店的列表 */
.shop-list { display: grid; gap: 10px; margin: 14px 0 4px; text-align: left; }
.shop-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 14px;
  padding: 12px 14px;
  background: #26332f;
  border: 4px solid #46574f;
}
/* 左边一列：名字、说明、等级；右边一列：购买按钮（占满三行的高度） */
.shop-item .name, .shop-item .desc, .shop-item .pips { grid-column: 1; }
.shop-item .name { font-weight: 700; color: #ffd166; }
.shop-item .tag { margin-left: 8px; padding: 0 6px; background: #46574f; color: #8be9ff; font-size: 12px; font-weight: 400; }
.shop-item .desc { color: #cdd2c4; font-size: 14px; }
.shop-item .pips { letter-spacing: 3px; color: #5ad1ff; font-size: 13px; }
.shop-item button { grid-column: 2; grid-row: 1 / span 3; margin: 0; padding: 10px 14px; min-width: 96px; }
.shop-item button:disabled { background: #46574f; border-color: #46574f; color: #9aa394; cursor: default; box-shadow: none; transform: none; }

/* 选角色页的难度按钮 */
.tier-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 10px; }
/* 选章节和角色页：每一排上面的小标题，和选中章节下面的说明 */
.pick-label { margin: 10px 0 6px; font-size: 13px; font-weight: 700; color: #9aa394; letter-spacing: 2px; }
.pick-label .muted { font-size: 12px; font-weight: 400; letter-spacing: 0; }
.pick-note { margin: -4px 0 6px; font-size: 13px; color: #cdd2c4; }
.tier { margin: 0; min-height: 0; padding: 6px 14px; font-size: 14px; background: #26332f; color: #f2efe2; border: 2px solid #46574f; box-shadow: none; }
.tier:active, .hero:active, .card:active { transform: none; }
.tier:hover:not(:disabled) { background: #2f3f39; border-color: #f2c14e; }
.tier.selected { border-color: #f2c14e; color: #ffd166; font-weight: 700; }
.tier:disabled { color: #7c8579; cursor: default; }

/* 成就列表 */
.achievement-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0 4px; text-align: left; }
.achievement { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 12px; background: #1f2a27; border: 4px solid #33423c; color: #7c8579; }
.achievement.done { background: #26332f; border-color: #8a6f3a; color: #cdd2c4; }
.achievement .name { font-weight: 700; }
.achievement.done .name { color: #ffd166; }
.achievement .desc { grid-column: 1; font-size: 13px; }
.achievement .reward { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 13px; font-weight: 700; }
@media (max-width: 640px) {
  .achievement-list { grid-template-columns: 1fr; gap: 6px; }
  .achievement { padding: 6px 10px; border-width: 2px; }
}

/* 图鉴 */
.codex-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 10px 0 4px; text-align: left; }
.codex-title { margin: 16px 0 0; font-size: 16px; color: #ffd166; }
.codex-entry { display: flex; align-items: center; gap: 12px; padding: 8px 10px; background: #26332f; border: 2px solid #46574f; }
.codex-entry canvas { flex: none; width: 56px; height: 56px; object-fit: contain; image-rendering: pixelated; }
.codex-entry .unknown { flex: none; width: 56px; font-size: 28px; text-align: center; color: #5c6f65; }
.codex-entry .name { display: block; font-weight: 700; color: #ffd166; }
.codex-entry .desc { display: block; font-size: 13px; line-height: 1.4; color: #cdd2c4; }
@media (max-width: 640px) { .codex-list { grid-template-columns: 1fr; } }

/* 存档码：框里的字要能选中和粘贴，所以单独打开选字；16 像素的字，iPhone 点进去不会自动放大 */
.savecode {
  display: block;
  width: 100%;
  padding: 8px 10px;
  background: #26332f;
  color: #f2efe2;
  border: 2px solid #46574f;
  border-radius: 0;
  font: 16px/1.3 ui-monospace, Menlo, Consolas, monospace;
  word-break: break-all;
  resize: none;
  touch-action: auto;
  -webkit-user-select: text;
  user-select: text;
}
.savecode:focus { outline: none; border-color: #f2c14e; }
.savecode-msg { min-height: 1.6em; margin: 8px 0 0; font-size: 14px; font-weight: 700; color: #ff9a8a; }
.savecode-msg.good { color: #9dffb0; }
#btn-savecode-undo.hidden { display: none; }
.update-note .button-row button { display: inline-block; margin: 0; padding: 8px 16px; font-size: 14px; font-weight: 700; }

/* 选角色：四张卡并排，窄屏两列 */
.hero-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: 12px 10px;
  border: 4px solid #46574f;
  background: #26332f;
  box-shadow: none;
  color: #f2efe2;
  font-weight: 400;
}
.hero:hover { border-color: #f2c14e; background: #2f3f39; }
.hero.selected { border-color: #f2c14e; }
.hero .key { position: absolute; top: 8px; left: 8px; padding: 1px 7px; background: #46574f; font-size: 13px; }
.hero canvas { width: 96px; height: auto; image-rendering: pixelated; }
.hero .info { display: flex; flex-direction: column; align-items: center; }
.hero .name { font-size: 17px; font-weight: 700; color: #f2c14e; }
.hero .weapon { font-size: 13px; color: #8be9ff; margin: 2px 0 6px; }
.hero .desc { font-size: 13px; color: #cdd2c4; line-height: 1.45; }
.hero .stats-line { margin-top: 6px; font-size: 12px; color: #9aa394; }
.hero .clears { margin-top: 2px; font-size: 12px; font-weight: 700; color: #ffd166; }
@media (max-width: 640px) {
  .hero-list { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .hero { padding: 8px 8px; }
  .hero .desc { font-size: 12px; }
}
