body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; overflow: hidden; color: #0f1226; background: #f7fdff; }

html[data-theme='dark'] body { background: #0f1226; color: #f7fdff; }

#wrap { height: 100vh; display: flex; flex-direction: column; background: linear-gradient(135deg, #f7fdff, #e8f4ff); }

html[data-theme='dark'] #wrap { background: linear-gradient(135deg, #1a1f3a, #0f1226); }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(15, 18, 38, 0.05);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.brand {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -1px;
}

.brand b {
  color: #52b5e8;
}

.back-hub {
  font-size: 24px;
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
  color: #0f1226;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.back-hub:active {
  opacity: 1;
}

.hchips {
  display: flex;
  gap: 12px;
}

.chip {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(8px);
}

.chip span { font-weight: 600; }

.lives-chip { background: rgba(220, 53, 69, 0.1); border-color: #dc3545; }
.coins-chip { background: rgba(255, 193, 7, 0.1); border-color: #ffc107; }
.coins-chip.earn { background: rgba(102, 51, 153, 0.1); border-color: #6633cc; }

.hud {
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  overflow-x: auto;
  justify-content: center;
  flex-wrap: wrap;
}

.board-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
  border-radius: 12px;
}

footer {
  padding: 12px 20px;
  text-align: center;
  background: rgba(15, 18, 38, 0.05);
  font-size: 13px;
  color: #666;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 100;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.card {
  background: white;
  border-radius: 16px;
  padding: 32px 24px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.card.home {
  text-align: center;
}

.logo {
  font-size: 48px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -2px;
}

.logo b {
  color: #52b5e8;
}

.sub {
  font-size: 16px;
  color: #999;
  margin-bottom: 24px;
}

.stats {
  display: flex;
  gap: 20px;
  margin-bottom: 32px;
  justify-content: center;
}

.stat {
  text-align: center;
}

.stat .lbl {
  font-size: 12px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat .val {
  font-size: 32px;
  font-weight: 600;
  color: #52b5e8;
}

.big {
  font-size: 56px;
  font-weight: 600;
  color: #0f1226;
  margin: 24px 0;
}

.card h2 {
  margin: 0 0 16px 0;
  font-size: 24px;
}

button {
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin: 8px auto;
  display: block;
  width: 100%;
  max-width: 200px;
}

.btn-primary {
  background: linear-gradient(135deg, #52b5e8, #0099cc);
  color: white;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-ghost {
  background: transparent;
  border: 2px solid #ddd;
  color: #0f1226;
}

.btn-ghost:active {
  background: rgba(0, 0, 0, 0.05);
}

.btn-share {
  background: #f0f0f0;
  color: #0f1226;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  transition: transform 0.3s;
  z-index: 200;
  max-width: 80vw;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

[dir=rtl] {
  direction: rtl;
  text-align: right;
}

[dir=rtl] .stat {
  text-align: center;
}

html[data-theme='dark'] header {
  background: rgba(247, 253, 255, 0.05);
  border-bottom-color: rgba(247, 253, 255, 0.1);
}

html[data-theme='dark'] .back-hub {
  color: #f7fdff;
}

html[data-theme='dark'] .card {
  background: #1a1f3a;
  color: #f7fdff;
}

html[data-theme='dark'] .big {
  color: #f7fdff;
}

html[data-theme='dark'] .sub {
  color: #aaa;
}

html[data-theme='dark'] button {
  color: white;
}

html[data-theme='dark'] .btn-ghost {
  border-color: #555;
  color: #f7fdff;
}

html[data-theme='dark'] footer {
  background: rgba(247, 253, 255, 0.05);
  border-top-color: rgba(247, 253, 255, 0.1);
  color: #aaa;
}

@media (max-width: 480px) {
  .card { padding: 24px 16px; }
  .logo { font-size: 36px; }
  .big { font-size: 40px; }
  header { padding: 12px 16px; }
  button { max-width: 100%; }
}
