:root { --accent: #ffd36b; --accent2: #ff8ad0; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #0d0b2e; color: #eef;
  font-family: system-ui, "Segoe UI", Roboto, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none;
}
button { font-family: inherit; cursor: pointer; }
body { display: flex; flex-direction: column; background: linear-gradient(180deg, #0b0f33, #241654 60%, #2a0f3f); }

header {
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 10px; flex: none;
  padding-top: calc(8px + env(safe-area-inset-top));
  padding-left: calc(10px + env(safe-area-inset-left)); padding-right: calc(10px + env(safe-area-inset-right));
  background: rgba(8, 6, 30, .35); border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.stat { background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .13); border-radius: 10px; padding: 4px 10px; min-width: 64px; text-align: center; }
.stat .label { display: block; font-size: 10px; opacity: .7; text-transform: uppercase; letter-spacing: .5px; }
.stat b { font-size: 16px; color: var(--accent); font-variant-numeric: tabular-nums; }
header button { background: rgba(255, 255, 255, .08); color: #fff; border: 1px solid rgba(255, 255, 255, .15); border-radius: 10px; padding: 8px 10px; font-size: 14px; }
header button:hover { background: rgba(255, 255, 255, .15); }

#wrap {
  flex: 1; min-height: 0; position: relative;
  margin: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#board { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }

.overlay {
  position: fixed; inset: 0; background: rgba(8, 6, 30, .6); display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 10; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.panel {
  background: linear-gradient(160deg, rgba(46, 32, 108, .96), rgba(18, 14, 52, .97)); border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 18px; padding: 22px 24px; max-width: 460px; width: 100%; max-height: calc(100% - 8px); overflow: auto;
  text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.panel h1 { margin: 0 0 8px; font-size: 28px; color: var(--accent); text-shadow: 0 2px 14px rgba(255, 138, 208, .45); }
.panel p { line-height: 1.5; opacity: .92; margin: 8px 0; font-size: 15px; }
.panel kbd { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; font-size: 12px; font-family: inherit; }
.panel .sp { display: inline-block; margin: 2px 6px; white-space: nowrap; }
#ov-stats { display: flex; gap: 8px; justify-content: center; margin: 10px 0; flex-wrap: wrap; }
.primary {
  background: linear-gradient(135deg, #ff8ad0, #a66bff); color: #fff; border: none; border-radius: 12px; padding: 12px 30px;
  font-size: 17px; font-weight: 800; margin-top: 6px; box-shadow: 0 6px 20px rgba(166, 107, 255, .45); text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.primary:hover { filter: brightness(1.08); }
.primary:active { transform: translateY(1px); }
.gnx-btn {
  display: inline-block; margin-top: 10px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  background: rgba(255, 255, 255, .1); color: #fff; border: 1px solid rgba(255, 255, 255, .22); border-radius: 10px; padding: 8px 14px;
}
.gnx-btn:hover { background: rgba(255, 255, 255, .18); }
.hidden { display: none !important; }

@media (max-width: 380px) {
  .stat { min-width: 56px; padding: 4px 7px; }
  header { gap: 5px; }
  .panel { padding: 18px 16px; }
  .panel p { font-size: 14px; }
}
