* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  --bg: #fdf6f0;
  --card: #ffffff;
  --ink: #2b2320;
  --muted: #8a7a72;
  --gold: #b8925a;
  --rose: #c9748a;
  --confirmed: #7fae7a;
}
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { padding: 16px 16px 8px; text-align: center; background: linear-gradient(180deg, #fff9f3, var(--bg)); }
.topbar h1 { margin: 0 0 8px; font-size: 22px; letter-spacing: 0.2px; }
.tabs { display: flex; gap: 8px; justify-content: center; }
.tab { background: none; border: 1px solid var(--gold); color: var(--gold); border-radius: 20px; padding: 6px 14px; font-size: 13px; }
.tab.active { background: var(--gold); color: white; }
.logout-btn { display: block; margin: 10px auto 0; background: none; border: none; color: #999; font-size: 12px; text-decoration: underline; padding: 4px; }
main { flex: 1; padding: 8px 16px 32px; }
.view { display: none; }
.view.active { display: block; }
.lead { color: var(--muted); font-size: 15px; line-height: 1.4; }

.signup-hero { position: relative; border-radius: 16px; overflow: hidden; margin-top: 4px; box-shadow: 0 4px 16px rgba(184,146,90,0.18); }
.signup-banner { width: 100%; height: 150px; object-fit: cover; display: block; }
.signup-kicker { position: absolute; left: 14px; bottom: 12px; background: rgba(255,255,255,0.88); color: var(--gold); font-weight: 700; font-size: 12px; letter-spacing: 0.4px; text-transform: uppercase; padding: 6px 12px; border-radius: 20px; box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.signup-label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; margin-top: 4px; }
.signup-footnote { color: var(--muted); font-size: 12px; text-align: center; margin-top: 4px; }

#signup-form { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
input[type="text"] { padding: 12px; border-radius: 10px; border: 1px solid #ddd; font-size: 16px; }
button { padding: 12px; border-radius: 10px; border: none; background: var(--gold); color: white; font-size: 15px; font-weight: 600; transition: transform 0.08s ease; }
button:active { transform: scale(0.98); }
#signup-form button[type="submit"] { background: linear-gradient(90deg, var(--gold), var(--rose)); font-size: 16px; padding: 14px; box-shadow: 0 4px 12px rgba(201,116,138,0.3); }
.ghost-btn { background: none; border: 1px solid var(--gold); color: var(--gold); font-weight: 600; padding: 6px 12px; font-size: 13px; }
.error { color: #b23a3a; font-size: 13px; min-height: 18px; }
.card-toolbar { display: flex; justify-content: space-between; align-items: center; margin: 12px 0; }
.card-identity { display: flex; align-items: center; gap: 8px; }
#card-username { font-weight: 600; }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); }
.avatar-sm { width: 24px; height: 24px; }
.curse-btn { background: #2b2320; color: #ffcf70; border: none; border-radius: 20px; padding: 6px 12px; font-size: 13px; font-weight: 700; }
.bingo-banner { display: flex; align-items: center; justify-content: center; gap: 8px; background: linear-gradient(90deg, var(--gold), var(--rose)); color: white; text-align: center; padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-weight: 700; font-size: 16px; animation: bannerPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
.bingo-badge-img { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.cell { aspect-ratio: 1; overflow: hidden; border-radius: 8px; padding: 4px; font-size: 9.5px; line-height: 1.15; display: flex; align-items: center; justify-content: center; text-align: center; cursor: pointer; position: relative; border: 2px solid transparent; }
.cell.open { background: var(--card); border-color: #e5dcd3; }
.cell.free { background: #fff3d6; border-color: var(--gold); font-weight: 700; cursor: default; }
.cell.confirmed { background: #e3f1e1; border-color: var(--confirmed); }
.cell.confirmed::after { content: "✓"; position: absolute; top: 2px; right: 4px; color: var(--confirmed); font-weight: 900; }
.cell.bonus { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.cell.bonus::after { content: "⭐"; position: absolute; top: 1px; right: 3px; font-size: 10px; }
.cell.curse { background: #f3e3f0; border-color: #a35fa0; }
.cell.curse::before { content: "😈"; position: absolute; top: 1px; left: 3px; font-size: 10px; }
.cell.just-marked { animation: cellCelebrate 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); z-index: 2; }
.cell.just-marked::before {
  content: "🎉";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  animation: burstFade 0.6s ease forwards;
  pointer-events: none;
}
.cell img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; opacity: 0.35; position: absolute; inset: 0; }
.cell span { position: relative; z-index: 1; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }

@keyframes cellCelebrate {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(127, 174, 122, 0.6); }
  40% { transform: scale(1.25); box-shadow: 0 0 0 8px rgba(127, 174, 122, 0.25); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(127, 174, 122, 0); }
}
@keyframes burstFade {
  0% { opacity: 0; transform: scale(0.4); }
  30% { opacity: 1; transform: scale(1.3); }
  100% { opacity: 0; transform: scale(1.6) translateY(-14px); }
}
@keyframes bannerPop {
  0% { transform: scale(0.7); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.hint { color: var(--muted); font-size: 13px; margin-top: 12px; }
.choose-list { display: flex; flex-direction: column; gap: 20px; margin-top: 16px; }
.choice-card { background: var(--card); border-radius: 14px; padding: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); display: flex; flex-direction: column; gap: 10px; }
.choice-card .grid { pointer-events: none; }
.choice-card .cell.open { cursor: default; }
.choice-card button { background: linear-gradient(90deg, var(--gold), var(--rose)); }
.board-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.board-row-wrap { background: var(--card); border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); overflow: hidden; }
.board-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; cursor: pointer; }
.board-identity { display: flex; align-items: center; gap: 8px; }
.board-row .badge { font-size: 12px; color: var(--gold); font-weight: 700; }
.board-details { padding: 0 14px 14px; }
.mini-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; margin-top: 4px; }
.mini-cell { aspect-ratio: 1; border-radius: 4px; background: #f0e8e0; }
.mini-cell.confirmed { background: var(--confirmed); }
.photo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.photo-item { background: var(--card); border-radius: 12px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.photo-item img { width: 100%; height: 140px; object-fit: cover; display: block; }
.photo-caption { padding: 8px; font-size: 12px; color: var(--muted); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 10; }
.modal-inner { background: white; border-radius: 14px; padding: 20px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .ghost-btn { flex: 1; }
.modal-actions button:not(.ghost-btn) { flex: 1; }
.curse-player-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.curse-player-btn { text-align: left; }
.curse-player-btn:disabled { opacity: 0.5; cursor: default; }
#curse-back { margin-top: 10px; width: 100%; }
