/* ===== 元素玩具城 全局样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #12141f;
  --panel: #1c2030;
  --panel2: #252a3f;
  --accent: #ffb347;
  --accent2: #58c4ff;
  --text: #e8eaf2;
  --muted: #9aa2ba;
  --good: #6fdd8b;
}
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overflow-x: hidden;
}

/* ---- 顶栏 ---- */
#topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 12px 28px;
  background: linear-gradient(180deg, #1a1e2e, #161927);
  border-bottom: 1px solid #2c3350;
  position: sticky; top: 0; z-index: 50;
}
#topbar .logo { font-size: 20px; font-weight: 800; letter-spacing: 1px; }
#topbar nav { display: flex; gap: 10px; flex: 1; }
.nav-btn {
  background: var(--panel2); color: var(--text);
  border: 1px solid #343c5c; border-radius: 10px;
  padding: 8px 18px; font-size: 14px; cursor: pointer;
  transition: all .15s;
}
.nav-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.nav-btn.active { background: var(--accent); color: #22180a; font-weight: 700; border-color: var(--accent); }
#topbar .coins { font-size: 17px; font-weight: 700; color: var(--accent); }
#btn-add-coins {
  background: linear-gradient(90deg, #43a55c, #6fdd8b); color: #0c2a14;
  border: none; border-radius: 10px; padding: 8px 14px;
  font-size: 13.5px; font-weight: 800; cursor: pointer;
  transition: filter .15s, transform .1s;
}
#btn-add-coins:hover { filter: brightness(1.1); }
#btn-add-coins:active { transform: scale(.94); }

/* ---- 屏幕 ---- */
.screen { display: none; }
.screen.active { display: block; }
#screen-shop, #screen-showcase { padding: 28px 36px 60px; max-width: 1180px; margin: 0 auto; }
.screen-head h1 { font-size: 26px; margin-bottom: 6px; }
.screen-head h2 { font-size: 20px; margin-bottom: 6px; }
.screen-head p { color: var(--muted); font-size: 14px; margin-bottom: 22px; }

/* ---- 卡片网格 ---- */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}
.toy-card {
  background: linear-gradient(160deg, var(--panel2), var(--panel));
  border: 1px solid #333b5e; border-radius: 16px;
  padding: 18px; position: relative;
  transition: transform .15s, border-color .15s;
  overflow: hidden;
}
.toy-card:hover { transform: translateY(-3px); border-color: var(--accent2); }
.toy-card .glow {
  position: absolute; inset: -40px -40px auto auto;
  width: 130px; height: 130px; border-radius: 50%;
  filter: blur(40px); opacity: .35; pointer-events: none;
}
.toy-card .icon { font-size: 52px; line-height: 1; margin-bottom: 10px; display:block;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.4)); }
.toy-card h3 { font-size: 17px; margin-bottom: 4px; }
.toy-card .desc { color: var(--muted); font-size: 12.5px; line-height: 1.6; min-height: 40px; margin-bottom: 10px; }
.toy-card .tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.toy-card .tag {
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  background: #2e3654; color: #aeb8dc;
}
.toy-card .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.toy-card .price { font-weight: 800; color: var(--accent); font-size: 16px; }
.toy-card .price.free { color: var(--good); }
.btn {
  border: none; border-radius: 10px; padding: 8px 16px;
  font-size: 13.5px; font-weight: 700; cursor: pointer;
  transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(.96); }
.btn-buy { background: var(--accent); color: #241a08; }
.btn-buy:disabled { background: #3a405c; color: #7d84a3; cursor: not-allowed; }
.btn-play { background: var(--accent2); color: #06283c; }
.owned-badge {
  position: absolute; top: 14px; right: 14px;
  background: var(--good); color: #0c2a14;
  font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 20px;
}
.pick-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.pick-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* ---- 一起玩 ---- */
#play-together-bar {
  margin-top: 22px; display: flex; align-items: center; gap: 16px;
  background: var(--panel); border: 1px dashed #3c4568; border-radius: 14px;
  padding: 14px 20px;
}
#selected-hint { color: var(--muted); font-size: 14px; flex: 1; }
#btn-play-together {
  background: linear-gradient(90deg, #ff8f3c, #ffb347); color: #2a1a05;
  border: none; border-radius: 12px; padding: 12px 26px;
  font-size: 15px; font-weight: 800; cursor: pointer;
}
#btn-play-together:disabled { background: #3a405c; color: #7d84a3; cursor: not-allowed; }

/* ---- 发现图鉴 ---- */
.disc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.disc-item {
  background: var(--panel); border: 1px solid #2e3554; border-radius: 12px;
  padding: 12px 14px; display: flex; gap: 10px; align-items: center;
}
.disc-item .d-icon { font-size: 26px; }
.disc-item .d-name { font-size: 13.5px; font-weight: 700; }
.disc-item .d-desc { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.disc-item.locked { opacity: .38; filter: grayscale(.8); }

/* ---- 游戏屏 ---- */
#screen-game.active {
  display: flex; align-items: center; justify-content: center;
  height: calc(100vh - 57px); position: relative; background: #0b0d15;
}
#game-canvas {
  border-radius: 10px; box-shadow: 0 10px 50px rgba(0,0,0,.6);
  background: #000; cursor: crosshair;
}
#hud { position: absolute; inset: 0; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; }
#hud-top {
  width: 960px; display: flex; align-items: center; gap: 14px;
  padding: 12px 4px; margin-top: calc((100vh - 57px - 600px) / 2 - 50px);
}
#btn-back {
  pointer-events: auto; background: var(--panel2); color: var(--text);
  border: 1px solid #3a4162; border-radius: 10px; padding: 7px 14px;
  font-size: 13px; cursor: pointer;
}
#btn-back:hover { border-color: var(--accent); }
#hud-scenario { flex: 1; font-size: 14px; color: var(--muted); }
#hud-coins { font-weight: 800; color: var(--accent); font-size: 15px; }

#hud-toys {
  position: absolute; left: 50%; transform: translateX(-480px);
  top: calc((100vh - 57px - 600px) / 2 + 12px);
  margin-left: 12px;
  display: flex; flex-direction: column; gap: 8px; pointer-events: auto;
}
.hud-toy-slot {
  width: 52px; height: 52px; border-radius: 12px;
  background: rgba(20,24,40,.85); border: 2px solid #3a4162;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 22px; cursor: pointer; position: relative;
  backdrop-filter: blur(4px);
}
.hud-toy-slot.active { border-color: var(--accent); box-shadow: 0 0 12px rgba(255,179,71,.5); }
.hud-toy-slot .key {
  position: absolute; top: -6px; left: -6px; width: 18px; height: 18px;
  background: var(--accent); color: #241a08; font-size: 11px; font-weight: 800;
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
}

#hud-bottom {
  position: absolute; bottom: calc((100vh - 57px - 600px) / 2 + 10px);
  left: 50%; transform: translateX(-50%);
  width: 940px; display: flex; align-items: flex-end; justify-content: space-between;
}
#hud-active {
  background: rgba(18,22,38,.88); border: 1px solid #3a4162; border-radius: 14px;
  padding: 10px 16px; display: flex; align-items: center; gap: 10px;
  backdrop-filter: blur(4px);
}
#hud-toy-icon { font-size: 26px; }
#hud-toy-name { font-size: 14px; font-weight: 700; }
#hud-resource { width: 130px; height: 10px; background: #2a3050; border-radius: 6px; overflow: hidden; }
#hud-resource-fill { height: 100%; width: 100%; background: linear-gradient(90deg,#58c4ff,#6fdd8b); transition: width .1s; }
#hud-tip {
  background: rgba(18,22,38,.8); border-radius: 10px; padding: 8px 14px;
  font-size: 12.5px; color: #c3cae4; max-width: 520px; text-align: right;
}

/* ---- Toast ---- */
#toast-box {
  position: absolute; top: calc((100vh - 57px - 600px) / 2 + 20px);
  left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: rgba(24,28,48,.94); border: 1px solid #4a537e;
  border-radius: 12px; padding: 10px 20px; font-size: 14px; font-weight: 600;
  animation: toastIn .3s ease, toastOut .4s ease 3.4s forwards;
  box-shadow: 0 6px 24px rgba(0,0,0,.5);
}
.toast.discover { border-color: var(--accent); color: var(--accent);
  background: rgba(48,36,14,.95); font-size: 15px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }
