* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #0f1b33;
  color: #fff;
}
.hidden { display: none !important; }

/* ---------- login ---------- */
#login {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 50% 10%, #2a4a8f 0%, #14264d 45%, #0a1329 100%);
}
.card {
  width: min(92vw, 360px); background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.15); border-radius: 20px;
  padding: 28px 24px; backdrop-filter: blur(6px);
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.title-mark { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 6px 0 2px; }
.title-mark .ct-mark { width: 92px; height: 92px; }
.title-name { font-size: 42px; font-weight: 800; letter-spacing: .5px; text-align: center; line-height: 1.05; }
.title-name em { font-style: normal; color: #ffd166; }
.tagline { text-align: center; color: #bcd0f0; margin: -6px 0 8px; font-size: 14px; }
.card input {
  padding: 13px 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.25); color: #fff; font-size: 16px; outline: none;
}
.card input:focus { border-color: #ffd166; }
button { cursor: pointer; border: none; border-radius: 12px; font-size: 16px; font-weight: 700; }
button.primary { background: #ff5d8f; color: #fff; padding: 13px; }
button.primary:active { transform: scale(.98); }
button.ghost { background: rgba(255,255,255,.1); color: #dce8ff; padding: 12px; border: 1px solid rgba(255,255,255,.2); }
.err { color: #ff9d9d; text-align: center; min-height: 18px; font-size: 14px; margin: 0; }
.foot { text-align: center; color: #7f93bd; font-size: 12px; margin: 4px 0 0; }

/* ---------- game ---------- */
#game { position: fixed; inset: 0; display: flex; flex-direction: column; }
#topbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: rgba(10,18,40,.9); border-bottom: 1px solid rgba(255,255,255,.08);
  flex-wrap: wrap;
}
#topbar .title { font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 7px; }
#topbar .title .ct-mark { width: 24px; height: 24px; flex: none; }
.pill {
  border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 700;
  background: rgba(255,255,255,.1); color: #eaf1ff;
}
.pill.coins { background: #f7c948; color: #4a3200; }
.pill.mods { background: #2fbf71; color: #05301a; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(47,191,113,.25); } }
.btn { border: none; background: rgba(255,255,255,.12); }
.btn:active { transform: scale(.96); }
.spacer { flex: 1; }

#stage { position: relative; flex: 1; min-height: 0; }
#game { width: 100%; height: 100%; display: block; touch-action: none; }
#toasts {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none;
  width: 80%; max-width: 480px;
}
.toast {
  background: rgba(10,18,40,.85); border: 1px solid rgba(255,255,255,.15);
  border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 600;
  animation: pop .3s ease;
}
@keyframes pop { from { transform: scale(.8); opacity: 0; } }

#bottombar { background: rgba(10,18,40,.92); padding: 8px 10px; border-top: 1px solid rgba(255,255,255,.08); }
#emojiBar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; }
#emojiBar button {
  font-size: 22px; background: rgba(255,255,255,.08); border-radius: 10px;
  padding: 6px 10px; min-width: 44px;
}
#emojiBar button:active { transform: scale(.9); }
#chatrow { display: flex; gap: 8px; }
#chat {
  flex: 1; padding: 11px 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.3); color: #fff; font-size: 16px; outline: none;
}
#chatSend { background: #5b8cff; color: #fff; padding: 0 20px; }

/* ---------- modals ---------- */
.modal { position: fixed; inset: 0; background: rgba(5,10,25,.6); display: flex; align-items: center; justify-content: center; z-index: 50; }
.panel {
  width: min(94vw, 480px); max-height: 84vh; overflow-y: auto;
  background: #16233f; border: 1px solid rgba(255,255,255,.14); border-radius: 18px;
  padding: 16px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; font-size: 18px; font-weight: 800; margin-bottom: 12px; }
.x { background: rgba(255,255,255,.1); border-radius: 10px; padding: 4px 10px; font-size: 15px; color: #fff; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button { flex: 1; padding: 9px; border-radius: 10px; background: rgba(255,255,255,.08); color: #cfe0ff; font-size: 14px; }
.tabs button.on { background: #5b8cff; color: #fff; }
.shop-list { display: flex; flex-direction: column; gap: 8px; }
.shop-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: rgba(255,255,255,.06); border-radius: 12px;
}
.swatch { width: 46px; height: 46px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.shop-item .meta { flex: 1; }
.shop-item .meta .nm { font-weight: 700; }
.shop-item .meta .pr { font-size: 12px; color: #9fb4dd; }
.shop-item .act { background: #ff5d8f; color: #fff; padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.shop-item .act.owned { background: rgba(255,255,255,.12); color: #cfe0ff; }
.help-body p { line-height: 1.5; color: #dbe7ff; }
.help-body code { background: rgba(255,255,255,.1); padding: 2px 6px; border-radius: 6px; font-size: 13px; }
