/* Wedding games — mobile-first theme */
:root {
  --rose: #c1466b;
  --rose-dark: #8f2f4d;
  --blush: #fff1f4;
  --gold: #c9a227;
  --ink: #2a2330;
  --muted: #8a8094;
  --card: #ffffff;
  --bg: #fbeef0;
  --ok: #2e9e6b;
  --bad: #d2495b;
  --shadow: 0 6px 24px rgba(143, 47, 77, 0.12);
  --radius: 16px;
}

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

html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg), #f7e3ef 60%, #efe6f7);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 14px 16px 40px;
  min-height: 100vh;
}

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}
.topbar .title { font-weight: 700; color: var(--rose-dark); font-size: 1.05rem; }
.topbar a { text-decoration: none; color: var(--rose-dark); }
.lang-btn {
  border: 1px solid var(--rose);
  background: #fff;
  color: var(--rose-dark);
  border-radius: 999px;
  padding: 5px 12px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  min-width: 52px;
}

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.card h1, .card h2 { margin: 0 0 10px; color: var(--rose-dark); }

h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.big { font-size: 1.4rem; font-weight: 700; }

/* Buttons */
.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  background: #f0e6ee;
  color: var(--ink);
  transition: transform 0.05s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: linear-gradient(135deg, var(--rose), var(--rose-dark)); color: #fff; }
.btn.gold { background: linear-gradient(135deg, #e3c75b, var(--gold)); color: #4a3a00; }
.btn.ghost { background: #fff; border: 1px solid #e7d6df; }
.btn + .btn { margin-top: 10px; }

input.name-input, input.text-input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #e3cdd8;
  border-radius: 12px;
  font-size: 1.05rem;
  margin: 8px 0;
  background: #fff;
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(42, 35, 48, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 50;
}
.modal { width: 100%; max-width: 380px; }

/* Hub */
.hub-hero { text-align: center; padding: 8px 0 4px; }
.hub-emoji { font-size: 2.6rem; }
.game-card { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); }
.game-card .icon { font-size: 2rem; width: 48px; text-align: center; }
.game-card .meta { flex: 1; }
.game-card .meta .name { font-weight: 700; color: var(--rose-dark); }
.game-card .meta .desc { font-size: 0.85rem; color: var(--muted); }
.game-card .chev { color: var(--rose); font-size: 1.4rem; }

/* Leaderboard */
ul.leaderboard { list-style: none; margin: 0; padding: 0; }
.lb-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px; border-radius: 10px;
}
.lb-row:nth-child(odd) { background: var(--blush); }
.lb-row.me { background: #ffe6b8; outline: 2px solid var(--gold); }
.lb-rank { width: 28px; text-align: center; font-weight: 700; }
.lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-val { font-weight: 700; color: var(--rose-dark); }

/* Trivia */
.option-btn {
  text-align: left; margin-bottom: 10px; background: #fff;
  border: 2px solid #ecd9e2;
}
.option-btn .opt-letter {
  display: inline-block; width: 26px; height: 26px; line-height: 26px;
  text-align: center; border-radius: 50%; background: var(--rose); color: #fff;
  margin-right: 10px; font-weight: 700; font-size: 0.85rem;
}
.option-btn.selected { border-color: var(--rose); background: var(--blush); }
.option-btn.correct { border-color: var(--ok); background: #e6f6ee; }
.option-btn.wrong { border-color: var(--bad); background: #fdeaec; }
.option-btn .bar {
  height: 6px; border-radius: 4px; background: var(--rose); margin-top: 8px;
  transition: width 0.4s ease;
}
.timer { height: 8px; background: #eee; border-radius: 4px; overflow: hidden; margin: 6px 0 14px; }
.timer > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--rose)); transition: width 1s linear; }
.feedback { text-align: center; padding: 10px; border-radius: 12px; font-weight: 700; }
.feedback.ok { background: #e6f6ee; color: var(--ok); }
.feedback.bad { background: #fdeaec; color: var(--bad); }

/* Progress bar (puzzle) */
.progress { height: 18px; background: #f0e0e8; border-radius: 999px; overflow: hidden; }
.progress > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--rose), var(--gold));
  transition: width 0.5s ease; width: 0;
}
.frag {
  background: var(--blush); border-left: 4px solid var(--rose);
  padding: 10px 12px; border-radius: 8px; margin-bottom: 8px;
}
.frag .frag-label { font-size: 0.75rem; color: var(--muted); font-weight: 700; }
.frag.mine { border-left-color: var(--gold); }

/* Raid */
.boss-stage { text-align: center; padding: 6px 0 2px; }
.boss-emoji { font-size: 4.2rem; line-height: 1; display: inline-block; }
.boss-emoji.hit { animation: shake 0.18s; }
@keyframes shake {
  0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px) rotate(-3deg); }
  75% { transform: translateX(6px) rotate(3deg); }
}
.hpbar { height: 22px; background: #3a2330; border-radius: 999px; overflow: hidden; position: relative; }
.hpbar > span { display: block; height: 100%; background: linear-gradient(90deg, #e2496a, #ff7b54); transition: width 0.2s ease; }
.hpbar .hp-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 0.8rem; text-shadow: 0 1px 2px #000; }
.attack-btn {
  height: 130px; font-size: 1.6rem; border-radius: 24px;
  background: radial-gradient(circle at 50% 35%, #ff7b8e, var(--rose-dark));
  color: #fff; box-shadow: 0 8px 0 var(--rose-dark), var(--shadow);
}
.attack-btn:active { transform: translateY(4px); box-shadow: 0 4px 0 var(--rose-dark); }
.buff { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed #ecd9e2; }
.buff .bname { font-weight: 700; color: var(--rose-dark); }
.buff .bdesc { font-size: 0.85rem; color: var(--muted); }
.float-dmg {
  position: absolute; font-weight: 800; color: var(--rose-dark);
  pointer-events: none; animation: floatUp 0.7s ease-out forwards;
}
.float-dmg.crit { color: var(--gold); font-size: 1.6rem; }
@keyframes floatUp { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-50px); } }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px;
  font-weight: 600; box-shadow: var(--shadow); z-index: 60; max-width: 90%;
  text-align: center; animation: toastIn 0.2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; } }

.row-2 { display: flex; gap: 10px; }
.row-2 > * { flex: 1; }
.stat { text-align: center; background: var(--blush); border-radius: 12px; padding: 10px; }
.stat .v { font-size: 1.3rem; font-weight: 800; color: var(--rose-dark); }
.stat .k { font-size: 0.75rem; color: var(--muted); }
.hidden { display: none !important; }
