* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #0f1116 0%, #1a1f2e 100%);
  color: #f3f5f8;
  touch-action: none;
}

#wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0,0,0,0.3);
  border-bottom: 1px solid rgba(255,194,14,0.2);
}

.brand {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: #fff;
}

.brand b { color: #ffc20e; }

.scores {
  display: flex;
  gap: 16px;
}

.score {
  text-align: center;
}

.score .lbl {
  font-size: 0.7rem;
  color: #aab3c2;
  text-transform: uppercase;
  font-weight: 600;
}

.score .val {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffc20e;
  margin-top: 2px;
}

.hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  gap: 8px;
  z-index: 100;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,194,14,0.1);
  color: #ffc20e;
  border: 1px solid rgba(255,194,14,0.4);
  border-radius: 20px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 0.9rem;
  backdrop-filter: blur(8px);
}

.chip-btn {
  cursor: pointer;
  font-size: 1.1rem;
  padding: 8px 12px;
  transition: all 0.2s ease;
}

.chip-btn:hover {
  background: rgba(255,194,14,0.2);
  transform: scale(1.05);
}

.chip-btn:active {
  transform: scale(0.95);
}

.board-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(ellipse at center, rgba(255,194,14,0.05) 0%, transparent 70%);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 800px;
  max-height: 600px;
  image-rendering: crisp-edges;
}

.celebrate {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  font-size: 3rem;
  opacity: 0;
}

footer {
  padding: 12px 16px;
  text-align: center;
  color: #aab3c2;
  font-size: 0.85rem;
  background: rgba(0,0,0,0.2);
  border-top: 1px solid rgba(255,194,14,0.2);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,17,22,0.95);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.overlay.show {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.card {
  background: linear-gradient(135deg, rgba(26,31,46,0.95), rgba(31,40,60,0.95));
  border: 1px solid rgba(255,194,14,0.3);
  border-radius: 20px;
  padding: 32px;
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.card h2 {
  margin: 0 0 16px;
  font-size: 1.6rem;
  color: #fff;
}

.card h3 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  color: #ffc20e;
}

.card p {
  margin: 0 0 12px;
  color: #aab3c2;
  line-height: 1.5;
}

.logo {
  font-size: 3.2rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: -1px;
  margin-bottom: 12px;
  color: #fff;
}

.logo b { color: #ffc20e; }

.sub {
  text-align: center;
  color: #aab3c2;
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.stats {
  display: flex;
  gap: 20px;
  margin: 24px 0;
  padding: 16px;
  background: rgba(255,194,14,0.05);
  border-radius: 12px;
}

.stat {
  flex: 1;
  text-align: center;
}

.stat .lbl {
  font-size: 0.75rem;
  color: #aab3c2;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 8px;
}

.stat .val {
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffc20e;
}

.big {
  font-size: 3rem;
  font-weight: 800;
  text-align: center;
  color: #ffc20e;
  margin: 20px 0;
}

.record {
  text-align: center;
  color: #4ade80;
  font-weight: 700;
  margin: 12px 0;
  animation: bounce 0.6s ease;
}

@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.btn-primary, .btn-ghost, .btn-rewarded {
  width: 100%;
  padding: 14px 20px;
  margin: 8px 0;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: linear-gradient(135deg, #ffc20e, #ffb300);
  color: #000;
  box-shadow: 0 8px 20px rgba(255,194,14,0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(255,194,14,0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-rewarded {
  background: linear-gradient(135deg, #7c5cff, #9d84ff);
  color: #fff;
  box-shadow: 0 8px 20px rgba(124,92,255,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.btn-rewarded small {
  font-size: 0.75rem;
  opacity: 0.8;
  margin-top: 4px;
  font-weight: 500;
}

.btn-ghost {
  background: transparent;
  color: #aab3c2;
  border: 1px solid rgba(255,194,14,0.3);
}

.btn-ghost:hover {
  background: rgba(255,194,14,0.1);
  color: #ffc20e;
}

.wallet {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: #ffc20e;
  margin-bottom: 20px;
  padding: 12px;
  background: rgba(255,194,14,0.1);
  border-radius: 8px;
}

.shop-items {
  display: grid;
  gap: 12px;
  margin: 20px 0;
}

.shop-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255,194,14,0.08);
  border: 1px solid rgba(255,194,14,0.2);
  border-radius: 10px;
}

.shop-item .ic {
  font-size: 1.4rem;
  width: 32px;
  text-align: center;
}

.shop-item .t {
  flex: 1;
}

.shop-item .t b {
  display: block;
  font-weight: 700;
}

.shop-item .t span {
  color: #aab3c2;
  font-size: 0.8rem;
}

.shop-item button {
  width: auto;
  margin: 0;
  padding: 8px 14px;
  font-size: 0.8rem;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.9);
  color: #ffc20e;
  padding: 12px 20px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 2000;
  font-size: 0.9rem;
  font-weight: 600;
}

.toast.show {
  opacity: 1;
}

@media (max-width: 600px) {
  .card {
    padding: 20px;
    border-radius: 16px;
  }
  header {
    padding: 10px 12px;
  }
  .brand {
    font-size: 1.1rem;
  }
}
